# The Longest Chess Game

In honour of Stockfish and Leela Chess Zero just finishing the longest game in TCEC history at the Superfinal of the Top Chess Engines Championship Season 14, here's a simple problem related to chess rules:

Assuming the players co-operate, how many moves does the longest theoretically possible chess game have?

For the purpose of this puzzle, we'll want to make the usual draw rules non-optional, so that the game automatically ends in a draw, if

• There's a threefold repetition of a situation,
• There have been no captures and no pawn moves in the previous 50 moves by both sides, or
• There is insufficient material to checkmate on the board:
• Just the two kings
• The kings with one knight
• The kings with one bishop
• A king and bishop against a king and a bishop on a same coloured square

Other usual chess rules obviously also apply.

It's not necessary to post an actual game record of the longest possible game, it's enough to give just the move count along with a detailed explanation of how it is achievable.

5899 moves for white, 5898 moves for black.

Explanation:

As I understand it, the 50 move rule means that if the players do 50 moves each without a capture/pawn-move, the game is drawn. In chess it is apparently customary to only count the number of moves by one player (e.g. a 32-move game means white played 32 moves, black 31 or 32 moves), but in the rest of this answer I will count moves of both players added together.

The threefold repetition rule can be ignored, because the players are cooperating and there are always enough pieces and enough room to avoid repetition for 50 moves each. The basic idea for creating the longest game is to do as many pawn moves as possible, interspersing those pawn moves and any capturing moves with 99 non-pawn non-capturing moves whenever possible.

Each pawn can move at most 6 times before it reaches the back row. With 16 pawns, that makes (at most) 6*16=96 pawn moves. For a pair of opposing pawns to both reach the back row, at least one of them must make a capture, so at least 8 of the 96 pawn moves are also captures. It is fairly easy to check that it can be done with only 8 captures by pawns.

Including the pawns, there are 30 pieces that can be captured before there are only the two kings left. The pawns capture 8 of those, leaving 22 more captures by other pieces.

So we have a total of 96+22=118 moves that are pawn moves and/or captures.

The 99 moves before the first capture/pawn-move can be moves by the knights. So you may think that the game could last 100*118=11800 moves, where every 100th move is a pawn move or capture, and where the last move is the capture that leaves only the two kings on the board. However, in such a game all pawn moves and captures would be performed by one colour, and we need both players to make captures and pawn moves. It is not possible for one player to do all the pawn moves and capture before the other player, so we must switch colour at least twice.

Unfortunately (as Bass points out in the comments), two switches is also not sufficient. Black is the first to do captures/pawn-moves, but he should not do captures using his pawns because the white pawns are still in their starting positions. The 8 available capture-by-pawn moves must be used for getting pawns to pass each other. When it is white's turn for captures/pawn-moves, he can promote his pawns, but he cannot yet capture blacks pawns because they still have more moves to do. When it is black's turn, he can get his pawns promoted, but finally white must be allowed to capture black's former pawns again. So this means three switches of colour are necessary, and very probably sufficient.

So three times in the game, there is one fewer move between successive captures/pawn-moves. This leads to a game of 11797 moves, or 5899 moves for white, 5898 moves for black.

• See chess.stackexchange.com/a/4118/13975 for an answer on a different Stack Exchange site with a reference to an actual published article. Their number agrees with yours; the answer also points out that most of the drawing rules merely entitle a player to claim a draw; two players can conspire to make the game go on indefinitely long, if neither of them bothers to claim a draw. Commented Feb 21, 2019 at 10:55
• @GarethMcCaughan Yep, that's why I cleverly made the 50-rule mandatory for the puzzle.:-) However, I think the paper must be counting white's last half-move as a whole move (this seems to be a common practise in chess), since I'm fairly certain that Jaap's postulated two-colour-switch method cannot exist: B "goes first", but cannot promote on the first go because W's pawns are in the way, and after B promotes on his second go, the promoted pieces must still be captured later. Otherwise, I fully agree with this reasoning, and the number is what I expected, so +1, and a tick to follow later.
– Bass
Commented Feb 21, 2019 at 11:21
• @Bass Oh yes, so you did :-). Commented Feb 21, 2019 at 12:10
• @Bass You are right. I updated my answer to show that three switches are necessary. Commented Feb 21, 2019 at 12:27
• @Bass There's a 50-move optional rule, and a 75-move mandatory rule; if an arbiter notices that a game has gone on for 75-moves without a pawn move or capture, they can declare the game a draw regardless of whether the player want a draw. Commented Feb 21, 2019 at 16:30

My guess would be

5900

Because

Even with the no threefold repetition rule we can go on forever, because there exists infinite sequences without repeats, like the Thue–Morse sequence.

Each pawn can move 6 times before it reaches the end and transforms to another piece, and there are 16 pawns in total. There are also 30 non-king pieces which can be captured. Therefore we have $$6*16+30=126$$ total pawn moves/captures. But we can't do this in 126 individual moves, since the pawns can only pass each other by capturing another piece. For each pair of pawns we must combine a pawn move and a capture, which leaves us $$126-8=118$$ pawn moves/captures.

We can make at most 50 other moves before one of these, which gives a total of $$118*50=5900$$ moves. At this point there are only the kings left, and the game will end.

• You can't have exactly 50 moves distance between all the captures/pawn moves, because then only one colour will be doing all the captures or pawn moves. Other than that, I think you are right. Minor addition: Each pawn can only move 6 times, but then also then needs to be captured, which makes up the 7 moves that you are counting. Note also that for each pawn to make its 6 moves to the back row it must go past the opposing pawn, so there must be at least 8 captures by a pawn of a non-pawn piece, but there are enough pieces to do this. Commented Feb 21, 2019 at 9:17
• There aren't an infinite number of sequences without repeats, because you have finitely many states (threefold repetition doesn't care about whether the intermediate sequence of steps is repeated, only whether the actual position is repeated). Commented Feb 21, 2019 at 9:49
• @JaapScherphuis Thanks for the input. I'm not sure how to include the fact that both colors have to move pawns/capture. I'm not even sure how exactly moves are counted. Is a move a single player moving a piece or both players moving a piece each? Commented Feb 21, 2019 at 9:53
• @boboquack Seems like I misunderstood that. But the number of board states in chess is so big, that I don't think this rule is going to limit us or change the answer. Commented Feb 21, 2019 at 9:57
• Yes, the term "move" in chess is always confusing to me too. I've written up my own answer to try to work this out. Commented Feb 21, 2019 at 10:23