Chapter 2 · GameMinimax Tic-Tac-Toe? ← Chapter 2 CloseHow to playYou play X and the AI plays O. Click a square to place your mark (or focus it with Tab and press Enter).The first player to fill three squares in a row, column, or diagonal wins; if the board fills up, the game is a draw.The First move option decides who starts.Minimax searchFor every empty square the AI tries all continuations to the end of the game. Wins score +10, losses −10, draws 0; depth is subtracted from the magnitude so that faster wins and later losses are preferred (10 − depth for a win, −10 + depth for a loss). On its own turn it picks the highest value, on the opponent's turn the lowest.Alpha-beta pruningAs soon as a branch is known to be no better than an option already found, the rest of that branch is skipped. The result does not change; only fewer nodes are searched. The counter on the right shows how many nodes were examined for each move.Colors on the boardOrange square: the search is trying this move right now.Green square and its number: the minimax value of this move (from the AI's point of view).If Animate the search is off, the AI moves immediately.Link to game theoryTic-tac-toe is a small, zero-sum game of perfect information. If both sides play perfectly the result is a draw: an opponent who plays minimax cannot be beaten, and the best you can hope for against it is a draw.