# What is the longest single-branch chess sequence?

A chess position's n-score is defined as:

• NaN if it's impossible for the position to be played for another n half-moves (assume that the game ends in a draw as soon as the same position is repeated 3 times);
• Otherwise, the number of possible positions it can have evolved into at the end of n half-moves, not counting possible futures where the game ends before the n half-moves are complete.

What is the maximum n for which there exists a legally-reachable position whose n-score is 2?

(I don't know the answer to this.)

• Two? Doesn't that imply at least two branches? Also, this definition of n-score counts positions instead of games reaching those positions, so it doesn't account for transpositions, that is, several branches merging back into one. This means it may not be the best measure for branching.
– Bass
Dec 23, 2023 at 2:03

This position has a 15-score of 2: [but is slightly illegal, see below for a related position with a 13-score of 2]

No piece can legally move, except for the bottom three white pawns and the top three black pawns. The a- and h-pawns can move up to four times, and the c- and f-pawns can move at most twice, before the position becomes deadlocked and neither player can move. Moving a pawn two squares terminates the game early, so these lines are discarded. For a given player-to-move (WLOG White), there are two positions possible after fifteen plies (one ply before deadlock) - either the a- or rear c-pawn has one move remaining.

Is this position legal?

One can check that seven captures per side are required to arrange the pawns this way, and each side is missing seven pieces. (two pawns, two knights, a rook, a bishop, and a queen)
[EDIT] Unfortunately, if one is to arrange the pawns in seven captures each, none of those captures can be Black's b-pawn or White's g-pawn, so this position is illegal. The pawns on c3 and g6 can be removed to produce a position with a 13-score of 2, which is still better than I can do by other setups.

Please do double check my moves, (keeping track of the repetitions is super tedious with the tools I have available), but it looks like this position has a 125-score of 2:

(click to enlarge)

The basic idea is an unavoidable draw by repetition. The things that are necessary for this to work are:

• unless both players co-operate to make the game as long as possible, the variation ends in a repetition before the 125th move, and doesn't count.
• When co-operating for the longest game, it will always be white that will eventually have to push the pawn to avoid the draw
• at the very end of the game, both king positions are fixed by parity, in particular so that the white king ends up on one of the two white squares available to it.

Therefore, any game that has lasted 125 half-moves has just ended in a three-fold repetition in one of these two positions:

Unless I have made a mistake in my reasoning, this example should show that the n-score is not a very good way to measure branching; there are several (thousands of) possible games that last 125 half-moves, but every single one of them will inevitably end up in one of the two given positions after (half-)move 125.

If anyone has a tool that can find all the longest possible games under the "3-fold repetition automatically draws" stipulation, a sanity check for this answer would be much appreciated.

• ..cannot be bothered to edit it in because it would need new images, but looks like "black to move" would increase the n to 126.
– Bass
Dec 25, 2023 at 0:33
• A cycle has only 16 move not 20, due to white king having only 2 white fields, so your total is to high ?! Dec 25, 2023 at 12:16
• Ah, cool, so the idea is that many branches are eliminated due to the inability to reach 125 half moves, so the only available moves left are those that are part of the longest sequence. Nice loophole! Dec 25, 2023 at 13:12
• @Retudin how do you figure? 6 pawn pushes (each followed by a black king move) plus 7x16 "cycle moves", plus the final move = 125.
– Bass
Dec 25, 2023 at 17:26
• My bad (my similar answer does have a cycle of 16; but yours of 18 (including pawn-king pair) due to 3+2 instead of. 2+2 possible white king positions. and of course, a cycle after the last pawn move, which my solution does not have. I should have looked better at the differences. Dec 25, 2023 at 19:46

(third attempt:) Correction regarding my previous solution:

- I failed to see that moving the g2g3 pair to h allowed an extra cycle (g4->g3)
- I failed to see that since the king cannot move from h to e, the cycle is not 32 but 28 moves.
- I failed to see that because of that cycles end in e (or h depending on parity, and thus there is only 1 end position for the longest games!!
- I failed to see that no black pawn is needed to pin the black King, freeing a black pawn.
- Note that this extra pawn can solve the 1 end position issue; on b it extends the end with one move allowing the king to reach 2 positions.
- Note that adding a bishop on g8 or h7 does not work, it allows the king to end on all 4 positions, since the last move can be with king or bishop and cycles need not end on e/h anymore since the king can 'pause' on h and e by moving the bishop. (Sad since that would increase cycle length.)

All this leads to a position with a much longer sequence!

286 half moves! Notes:
Playing Bd2, g7 or later e7 will immediately end the game. Only playing Bd2 when all delays have been played will result in the longest game.
White needs 4 captures to get the pawns in position -- OK
Black needs 5 captures to get the pawns n position + a promotion -- OK
There are 2 possible end positions -- OK

White moves of cycle/subsequence S. The rooks just move clockwise each time between those moves (starting in a different configuration each cycle):
Kf1,Ke1,Kf1,Kg1,
Kh1,Kg1,Kh1,Kg1,
Kh1,Kg1,Kf1,Ke1,
Kf1,Ke1
All moves of a longest game :
S,c6;
S,c5;
S,c4;
S,c3;
S,b6;
S,b5;
S,b4;
S,Rab1; e5,Ra21;
S,Ra21; e6,Rba2;
S,b2; Kf1,b3; Ke1/Kg1,Bd2+
27*10+16 half moves

(second outdated/incorrect) Answer taking draw by repetition into account.

Both sides have 2 positions at each parity, as long as no pawns are moved.
This gives a cycle of 32 half-moves (at the end of which a pawn needs to move to avoid a draw).
Still only two end positions are in the longest possible game, since the last pawn move (b2) restricts the rooks to 1 position.
There are 6 pawn moves (I do not see room for more, note that black has to promote to rook. thus cannot have 8 pawns) After b2; Kf1/Kh1, Bd2+ will end the game at the 192th half-move.

• In the new position, B can promote at b1. (Boom goes the variation tree.)
– Bass
Dec 25, 2023 at 22:40
• @Bass : Corrected. Dec 26, 2023 at 9:52
• Love the rook merry-go-around! Could you post an actual move sequence, the king being restricted to a single rank makes a 32-half-move sequence between pawn pushes sound like an amazing feat.
– Bass
Dec 26, 2023 at 21:05
• @Bass thx for the suggestion to actually work out the moves. There were issues, and my adapted solution is much better. I can only hope that I made no errors this time; this problem is much trickier than I thought. (I especially like the use of the new knight) Dec 27, 2023 at 10:49