What is the maximum number of legal moves in a legal position, given that the player is in check?

It's easy to see that 43 is an upper bound. Let's suppose the white K is in check along a diagonal by a Q or B (other cases are similar or easier). Then White has at most 7 legal K moves; a white Q has at most 3 moves (interposition or capture); a white B of the right color has at most one move; and a white R, N, or P has at most 2 moves. Even if White has lost no pieces and has promoted all his pawns to queens, he has no more than 1*7 + 9*3 + 1*1 + 4*2 = 43 legal moves.

In fact it's easy to see that 43 cannot be attained. If White has 7 legal K moves, then one of them must be to capture the checking piece. But in that case no interposition is possible, the only legal non-K moves are captures, so White has at most 21 moves total.

  • A king checked by a lone pawn has 8 legal moves. – justhalf Jun 19 at 17:51
  • @justhalfRight. That's why I specfied "by a Q or B". (Of course on a pawn check there are no interpositions, so the number of legal moves is much smaller.) – bof Jun 19 at 18:41
  • Right, I missed that, my apologies. – justhalf Jun 19 at 22:46
  • 1
    I don't know about the upper bound, but I once played a game where I got into a wierd position. I was in check and had the lowest possible number of ways to get out of it. I was so impressed by my opponent achieving such brilliancy, that I gave him the win straight away – David Jun 20 at 10:50
  • I thought it is common to get only one way to get out of check in endgame? – justhalf Jun 24 at 20:51

Of course we can do better. We can always do better. 42 legal responses with a little trick.

[FEN "3rB2k/2P1P3/1NQ1QN2/2Q1QN2/2Q1Q3/1R3R2/3K1B2/8 w - - 0 1"]

My previous attempt, 40 legal responses:

[FEN "8/4N2R/3QQQQ1/1K5r/3QQQQ1/BB1NN2R/8/1k6 w - - 0 1"]

And 39 legal responses with a bishop check (and the position is legal, black's last move was ...h2-h1=B+):

[FEN "7k/1K6/4RN2/5QN1/B1R3QN/3Q3Q/3NQ3/4NQ1b w - - 0 1"]
  • Nice job Remellion! It seems that the check all the way down the board is a great mechanism. And I have a legal position that covers a knight check. The Queen can be used in both the rook and bishop cases of course. Here's a 21 that centers around a pawn check: 3R3Q/B7/2N1N3/1N3N2/Q2p3Q/1N2K3/2N5/Q2R4 w - - 0 1 – Rewan Demontay Jun 18 at 14:08
  • Nice to trick. That one depenss on whether or not you count different promotions as different moves kf course. But it is nice nonetheless! – Rewan Demontay Jun 22 at 11:06
  • Different promotions are always counted as different moves. – Remellion Jun 23 at 6:30

Since several lower bounds have already been posted, I would like to elaborate a bit more on the possible upper bounds, since the estimate in the question is a bit oversimplified in my opinion (although the conclusion is still correct).

First, let us have a look at naive upper bounds, not considering interference between piece types, for each possible checking piece. The number of moves per piece type in the respective scenario (with the optimal number of pieces given in brackets) are given below:

    R       B       N       P   
K   7 (1)   7 (1)   8 (1)   8 (1)
Q   3 (7)   3 (8)   1 (1)   1 (3)
R   1 (2)   2 (2)   1 (2)   1 (2)
B   2 (2)   1 (1)   1 (1)   1 (1)
N   2 (2)   2 (2)   1 (8)   1 (8)
P   4 (2)   4 (1)   4 (2)   1 (0)
    46      44      28      22  

It is quite obvious that checks of non-sliding piece (N/P) do not need to be considered, since they can not be blocked. The case of a bishop is only slightly worse than a rook, but it is relatively obvious that it can not be better (because of opposite colored bishops, and pawns can not be effectively used against bishops), so we can focus on the scenario of a rook check.

The naive/conservative upper bound is 46 as given above. However, there are several interferences that make it impossible to achieve this:

  • The slider blocking moves only work if the king is not next to the piece giving check, therefore, the king effectively can only have 6 moves, i.e., one less than the maximum.
  • The 8x8 board is too small to fit all possible interposing pieces into their optimal positions:
    • When the king is not at the edge of the board, we only have 8 squares available for the 2 pawns, 7 queens, and 2 bishops. Therefore, 3 of these pieces need to be put on suboptimal squares or need to be replaced by a different piece, which will lose at least 3x1 move.
    • When the king is at the edge of the board, we still have only 10 squares for the 11 P/Q/B, so we lose one move. Furthermore, the king of course has two moves less compared to when it is not at the edge of the board.

For those reasons, the theoretical maximum needs to be lowered by 4, arriving at 42. Since we already know the lower bound 42 from Remellion's answer, we can conclude that 42 is both the lower and the upper bound, so it has to be the optimum.

The number of 42 can be achieved with different scenarios, just using different ways to concede the 4 moves that we have to lose compared to the naive upper bound, but all of them are similar to the position from Remellion's answer:

  • King at the edge, one queen replaced by a knight
3r3k/2P1P3/1NQ1QN2/2Q1QN2/2Q1B3/2Q1B3/1R3R2/3K4 w - - 0 1
  • King at the edge, one bishop at a suboptimal square
3rB2k/2P1P3/1NQ1QN2/2Q1Q3/2Q1Q3/2Q1B3/1R3R2/3K4 w - - 0 1
  • Three queens replaced by knights.
3r3k/2P1P3/1NQ1QN2/1NQ1BN2/2Q1BN2/1R3R2/3K4/8 w - - 0 1
  • etc.
  • 1
    This answer is very good, attacking the problem from the other angle. One thing I would like to clarify: A case is missing. The construction with a rook checking on the 8th rank and white having a ton of promotion possibilities gives rise to a completely different legal setup; however, I was only able to optimise that case to 40 moves, which is still surprisingly close. Might be a fun exercise to try that one yourself. – Remellion Jul 2 at 5:14
  • Thanks, I indeed missed that case, I will try to update my answer when I find the time. From a quick look 40 (6x4+4x2+2+1+1) also to me seems to me the upper (and lower) bound for this case. – Fabian Fichter Jul 2 at 8:28
  • Hm, I got something with 7x4. But yes, 6x4 also yields 40 oddly enough. – Remellion Jul 2 at 8:45
  • 6x4 actually was a typo, I meant 7x4, but yes, removing one pawn still works. – Fabian Fichter Jul 2 at 12:27

UPDATE 3: Once more building off of @Remellion's newest matrix for 42 in a legal position, here's 68 in an illegal position.

[FEN "1NQrQN2/1NP1PN2/1NQ1QN2/1NQ1QN2/1NQ1QN2/1NQ1QN2/1NQ1QN2/1N1K1N2 w - - 0 1"]

Is this optimal for an illegal position?

UPDATE 2: Building off of @Remellion's impressive position for 40 in a legal position, here's a new bar for an illegal position of 66. Credit goes to @Remellion of course for making the original position that I have modified. (Although I did show the basic mechanism of it first....)


Is it possible to do any more than this? Due to how crowded the position is, I think not. Could anybody provided mathematical proof that 66 is optimal? Feel free to edit it into my answer if you want to.

UPDATE: Actually, in a legal position, I have gone far past 21! I have reached 37 through capture, blocking, or moving the king. All 8 pawns have been promoted. This uses the same mechanism as my illegal position, which I made first.

[FEN "8/2NNN2B/1RQQQ3/1q4K1/1BRQQ3/2NNN3/8/k7 w - - 0 1"]

My personal best for an illegal position is 55, through capture, blocking, or moving the king. I managed to create this wild setting.


Most of the count for both positions come from the blocking moves.

OUTDATED; Indeed, 21 is more than likely the most possible if you want a legal position. I'm not sure if you want it to be a legal position, so I made it so. All 8 pawns have been promoted.

[FEN "8/Q2R2Q1/2N1N3/1N3K2/Q2n3Q/1N6/2N1N3/BkbR2Q1 w KQkq - 0 1"]

If you don't mind it being an illegal position, you can add in one more knight for a total of 22. This is iIlegal because the Black knight has no square that it could have come from, and White has one more promoted piece of than legally possible.

[FEN "3R4/Q5Q1/2N1N3/1N3K2/Q2n3Q/1N3N2/2N1N3/BknR2Q1 w KQkq - 0 1"]
  • The second position still has only 21 legal moves, doesn't it? – TonyK Jun 18 at 12:25
  • I got that fixed. I forget to input a queen. – Rewan Demontay Jun 18 at 12:27
  • But now the mix of pieces is impossible: White can have at most 13 non-Bishop pieces. – TonyK Jun 18 at 12:28
  • Precisely. I stated that it is an Ilegal position. – Rewan Demontay Jun 18 at 12:29
  • Still only 21 moves -- the Queen on g4 blocks one of the King's moves. – TonyK Jun 18 at 12:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.