Minimax to play an optimal game of tic tac toe