Audamir

Three in a row: how not to lose

Three in a row is a solved game: with correct play every opening ends in a draw. What the complete game tree means for a player.

A game of Three in a row on a 3 × 3 board: the red stones have two lines that each lack a single stone, and both missing cells are still free
Two lines that each lack a single stone: the red stones have two free cells in which they would complete a line.

Three in a row is a preset of the game Lines on a 3 × 3 board. It is so small that all of it can be searched: of 255,168 possible games, 131,184 are won by the first player, 77,904 by the second and 46,080 end in a draw.[1] With random play the first player therefore has the edge, but with correct play nobody wins.

What holds with correct play

  • Every opening leads to a draw if the second player answers correctly.
  • After an opening in the centre, only one of the four corners saves the draw.
  • After an opening in a corner, the only answer is the centre; seven of the eight answers lose.
  • After an opening on an edge, the centre, two adjacent corners or the opposite edge hold the draw.
  • Every losing answer loses on the seventh move.

The fork

A fork is a move that makes two threats at once, and the opponent can block only one. The best-known trap: the first player plays a corner, the second the centre, the first the opposite corner. The second player must then play an edge, and an answer in a corner loses.

The order of eight rules: win, block the opponent, make a fork, stop the opponent's fork, centre, opposite corner, empty corner, empty edge. In a check of 762 positions it did not worsen the result in any of them.

Against the AI

All the numbers come from games of AI opponents; people were not measured.

Way of playing against the Weak AIWon as the first playerWon as the second player
random moves14.3%1.3%
blocking only68.4%29.6%
centre and corners74.9%41.0%
plus the fork81.1%41.0%
the eight rules86.1%41.0%
perfect play88.5%41.0%
best play against the Weak AI95.5%41.0%
  • As the second player the ceiling is 41.0%, because the Weak AI does not err often enough in the centre.
  • Against the Weak AI the best opening is a corner: the Weak AI errs in 86.0% of the games and with the correct continuation 94.0% are won.
  • The Normal and the Strong AI have not lost a single game (1,386 games against the complete tree); centre, corners and blocking always end in a draw against them.
  • The Weak AI never misses a win in one move, plays at random in 8% of its moves and misses the opponent's threat in 40% of the rest.

The other presets of Lines (Five in a row, Gravity four) are larger and have no such clear trees; what was measured about them is on the page Lines.

Notes

  1. See (forthcoming article no. 25). ↩︎