Gravity four: what was worked out
With perfect play the first player wins by starting in the middle. What follows for the first move, threats and the AI levels.
Game: Lines
Gravity four is a preset of the game Lines: a 7 × 6 board, a stone falls to the lowest free cell of its column, four in a row win. It has 42 cells, so the game's solver solved it exactly: with perfect play the first player wins by starting in the middle.[1] The default budget of 300 million nodes is not enough (“not solved”); a question mark in the game's documentation is therefore a budget, not a result.[2]
What holds with perfect play
- A first move in the middle column 4 wins, in column 3 or 5 it leads to a draw, and in column 1, 2, 6 or 7 to a loss.[3]
- After the middle every answer of the second player loses; after column 3 the second player loses with an answer 1 or 2 and draws with an answer 3 to 6, and the other answers were not solved.
- On smaller boards with gravity and a line of 4 the second player wins on 6 × 4 and 6 × 6, elsewhere from 4 × 4 to 7 × 5 it is a draw; from 7 × 6 the first player wins.
Threats and the fork
A threat is an empty cell where a stone of the player would complete four in a row; only the lowest free cell of a column can be played at once, a higher threat is a future one: it cannot be blocked, and whoever plays under it gives the opponent the win.
- Two threats in the same column right above each other cannot be stopped: if the opponent had no threat, the first player with them won 39 of 39 sample positions, the second player 21 of 27.[4]
- A fork is a move after which the opponent cannot win at once and after every answer the player has a win in one move.
- An explanation, not a measurement: when the columns are filled one stone at a time, the first player gets the odd rows and the second player the even ones. An odd threat of the first player without an even threat of the opponent won 94% of the sample positions, an even threat of the second player without an odd one of the first 61%; it is a tendency, not a law.
- A trap is a position in which exactly one move keeps the result. A block is always such a move; a quiet trap (the single move is not a block) is in 18 to 30% of the not lost positions with no threat to play at once.
Against the AI
All the numbers come from games of AI opponents; people were not measured.[5]
| AI | Opens in the middle | Uses a fork | Worsened moves |
|---|---|---|---|
| Weak | 31% | 52 of 130 | 29% |
| Normal | 100% | 277 of 277 | 4.8% |
| Strong | 100% | 322 of 322 | 8.4% |
- A worsened move is a move from a position that was not lost, after which the result with perfect play is worse. The Weak AI almost always turns a win into a loss, the Normal AI too, but from the 21st move on it errs in only 0.4% of its moves; the Strong AI turns a win into a draw and a draw into a loss.
- The Strong AI against the Strong AI draws 73% of the games, although the first player wins with perfect play: no level plays perfectly.
Notes
- See (forthcoming article no. 67). ↩︎
lines.js --solved --board square:7x6/4g --nodes 4000000000(thenchains.js): 2,439,497,410 nodes, 27 minutes on one core; the default--nodes 300000000did not solve it; smaller boards--board LIST --nodes 300000000; game 0.124.1. ↩︎- The first moves and the answers: a copy of the game's solver with a starting position, 0.3 to 2.4 billion nodes per move; game 0.124.1. ↩︎
- Samples of positions after 10 to 26 stones (threats: 2,493, traps: 400 for each count of stones), a copy of the solver; game 0.124.1. ↩︎
- 200 games for each of the six pairs of levels; mistakes against the solver in 21,648 positions (a budget of 2 million nodes); game 0.124.1. ↩︎