Tic Tac Toe 1v1
The definitive browser-based Tic Tac Toe engine. Features 3x3 to 5x5 dynamic grids, Minimax AI integration, game state rollback, and comprehensive match analytics.
About
Tic Tac Toe (also known as Noughts and Crosses) is a classic instance of a zero-sum game with perfect information. In the standard n×n grid where n = 3, the game space contains 255,168 possible unique game iterations. However, due to board symmetry (rotational and reflectional), the distinct complexity reduces significantly.
Ideally played, the game will always result in a draw. This tool implements a rigorous Minimax Algorithm for the Single Player mode, ensuring the AI agent makes the mathematically optimal move at every depth layer. For larger grids (n ≥ 4), the engine switches to a depth-limited heuristic search to maintain performance while preserving strategic dominance.
Formulas
The AI evaluates the board state S using a utility function U(S). For the terminal states:
The Minimax value of a state is calculated recursively:
Reference Data
| Grid Size (n) | Win Condition | Complexity Class | Optimal Outcome | First Move Advantage |
|---|---|---|---|---|
| 3×3 | 3 in a row | Low | DRAW | Corner / Center |
| 4×4 | 4 in a row | Medium | DRAW | Center |
| 5×5 | 5 in a row | High | DRAW | Center |
| 15×15 (Gomoku) | 5 in a row | Extreme | Player 1 Wins | Must be restricted |