
"Rating assuming that the computer always chooses the best move while the human player chooses every possible move with equal probability" given a board situation and whose turn it is is recursively done as follows: maximum if it's 's turn and minimum if it's 's turn)

Else, internally carry out all possible moves, rate the resulting situations recursively using this algorithm and return the best of the ratings (seen from whose turn it is, i.e.If in the rated situation has won, return 1."Rating assuming that both players always choose the best move" given a board situation and whose turn it is is recursively done as follows: If still several best moves remain, the computer chooses one at random.If the best rating is taken by several moves, these moves are rated assuming that the computer always chooses the best move while the human player chooses every possible move with equal probability.The computer internally carries out all possible moves and rates the resulting situations assuming that both players always choose the best move.The computer's playing algorithm works as follows:

Tic is a Java Applet that plays the game Tic Tac Toe: Two players alternately place es and s on a 3x3 board, the one who first gets three of his symbols in a line (horizontal, vertical or diagonal) wins. Tic Tac Toe Java Applet Tic Tac Toe Java Applet
