Play tic-tac-toe against an unbeatable computer

Minimax plays perfectly — the best you can do is draw. Or pick casual mode, or pass the device to a friend.

Tools used in this guide

The job

Three in a row on a 3×3 board — the game everyone learns in a minute, which is exactly why it's the classic 'solved game' demo: perfect play always ends in a draw.

Pick a mode

Two players pass the same device, or play the computer. Computer mode has two difficulties: casual plays random legal moves (you can win), unbeatable runs the full minimax tree (you can only draw). Session score counts wins, losses, and draws.

  • Going first matters: take a corner — the unbeatable engine punishes an edge opening.
  • In unbeatable mode a draw means you played perfectly too; the game is that small.

Worked example

Open unbeatable mode with center X. The engine takes a corner; you block its forks for nine moves — draw. Switch to casual and the same opening usually wins within a few games.

Where it stops

The classic ruleset only: 3×3, X always starts, no misère or larger boards. Score is per-session and doesn't persist between visits. The minimax tree is the full game tree — unbeatable really means unbeatable.