optimize tictactoe