added minimax algorithm, system is now slow as f***, must fix