About this version
This Tic Tac Toe implementation uses the minimax algorithm, a classic decision-making technique from game theory. Minimax recursively explores every possible future state of the board, assuming both players make their best possible move, and picks the branch that guarantees the best outcome for the AI.
Because Tic Tac Toe has only 255,168 possible games, the AI can evaluate the entire tree instantly and play perfectly every time. Perfect play always ends in either a draw or a win for the AI. Your goal is to force a draw.
Best opening moves
- Corner: the strongest opening. Creates two diagonal threats.
- Center: second best. Fewer forks for the AI.
- Edge: weakest. You will almost always lose if you open here.