# Minichess: 8 files and 4 to 8 ranks

Part of [`research/chess-proof`](../README.md). Scripts are in the parent folder, results in `../data/`, figures in `../figures/`.

## Chess with the middle removed: 8 files, 4 ranks

`minichess.py` plays chess on a board of 8 files and 4 ranks with both armies in place:

```
4  r n b q k b n r
3  p p p p p p p p
2  P P P P P P P P
1  R N B Q K B N R
   a b c d e f g h
```

The rules are chess rules on that board. A pawn promotes on the far rank. A two-square move may not land on the
promotion rank, which on 4 ranks rules it out. Castling works as usual. `minichess_ref.py` is a second rules engine,
written another way: every piece is tried against every square, and each pair is judged by the rules directly. The two
agree on perft (18, 237, 3 952), on every position of random games, and on castling test positions.

**The answer: White mates in one.** `solve_minichess.py 4` finds 1.exf3# at once, and 1.gxf3# mates too. Both kings start
walled in by their own pieces. The pawn on f3 checks the king on e4 diagonally, and nothing can take it: the bishop on
f4 is on the same file, the queen on d4 does not reach f3, and g2 and the knight on g1 defend it. On the other wing,
1.exd3+ is not mate, because the queen, bishop and knight all cover d3. Had Black moved first, 1...exf2# would win the
same way. With the middle removed, the game is decided by the first move. So chess's depth lives in the empty middle,
the space that keeps the armies apart for the first moves.

## Adding the rows back: is there a pattern?

`minichess.py` takes any number of ranks H from 4 to 8, with the armies on ranks 1–2 and H−1..H. The two-square pawn
move returns, and with it en passant. At H = 8 it is chess: perft (20, 400, 8 902) and every position of 150 random games
match python-chess exactly. `minichess_ref.py` agrees with it for every H, on perft to depth 3 and on more than 50 000
positions of random games. Fairy-Stockfish 11.1, a variant engine installed from apt, agrees on perft to depth 4 for
5–7 ranks: 28 681, 169 383 and 184 450. On 4 ranks it lets a pawn jump two squares onto the promotion rank without
promoting, which chess never allows, so it is not used there.

Three measurements per board:

- the exhaustive forced-mate search (`solve_minichess.py`, a budget of 3 million prover calls);
- Fairy-Stockfish's evaluation of the start at depth 12–24 (`rows_pattern.py`);
- 20 self-play games per board at 200 000 nodes a move, the first two plies drawn at random among moves within 50
  centipawns of the best. `minichess.py` judges every game: mate, stalemate, dead material, threefold repetition,
  the 50-move rule, or 200 plies.

| ranks | empty ranks between the pawns | first moves | perft depth 4 | forced White mate | White's score | W / D / L | first capture (mean ply) | mean length (plies) |
|---|---|---|---|---|---|---|---|---|
| 4 | 0 | 18 | 65 145 | **mate in 1** | n/a (solved) | n/a | 1 | 1 |
| 5 | 1 | 12 | 28 681 | none within 11 plies | 90% | 16 / 4 / 0 | 4.0 | 64 |
| 6 | 2 | 20 | 169 383 | none within 11 plies | 100% | 20 / 0 / 0 | 2.0 | 67 |
| 7 | 3 | 20 | 184 450 | none within 11 plies | 57% | 7 / 9 / 4 | 9.4 | 127 |
| 8 (chess) | 4 | 20 | 197 281 | none within 13 plies | 60% | 5 / 14 / 1 | 9.2 | 138 |

**The pattern is a threshold, not a slope.**

- **0 empty ranks:** the first move decides. White mates in one, and that is proved.
- **1–2 empty ranks:** the forced mate is gone (none within 11 plies, proved), but contact comes within the first few
  plies. The first capture comes at ply 2–4 on average, and White's extra tempo decides almost every engine game: 90%
  and 100%. Fairy-Stockfish's evaluation of the start swings between +0.5 and +2.6 with depth, the mark of positions
  that are sharp, not settled.
- **3–4 empty ranks:** both sides have about nine plies to develop before the first capture. Games run around 130 plies
  and are mostly drawn, and White's score falls to 58–60%, close to chess. The evaluation settles below one pawn.

Chess sits on the drawish side of the threshold, consistent with the belief that it is a draw. The proof cost behaves
the same on every board: each extra White move multiplies the search by roughly 11–18. So the threshold changes who is
better, not how hard a proof is.

Limits: 20 games per board, one old engine (Fairy-Stockfish 11.1 with its classical evaluation), and evaluations whose
absolute scale is off. It rates chess's start at +0.7, where modern Stockfish says about +0.3. Engine games are evidence,
not proofs: only the 4-rank result and the no-mate bounds are proved.
