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 '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 '19 at 18:41
  • Right, I missed that, my apologies. – justhalf Jun 19 '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 '19 at 10:50
  • I thought it is common to get only one way to get out of check in endgame? – justhalf Jun 24 '19 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"]
| improve this answer | |
  • Different promotions are always counted as different moves. – Remellion Jun 23 '19 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.
| improve this answer | |
  • 2
    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 '19 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 '19 at 8:28
  • Hm, I got something with 7x4. But yes, 6x4 also yields 40 oddly enough. – Remellion Jul 2 '19 at 8:45
  • 6x4 actually was a typo, I meant 7x4, but yes, removing one pawn still works. – Fabian Fichter Jul 2 '19 at 12:27
  • Irrelevant to the result, but how can the king have 8 moves when checked by a knight? Knights always check pairs of diagonally adjacent squares. – wimi Jun 20 at 20:50

Building on @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"]
| improve this answer | |
  • The second position still has only 21 legal moves, doesn't it? – TonyK Jun 18 '19 at 12:25
  • But now the mix of pieces is impossible: White can have at most 13 non-Bishop pieces. – TonyK Jun 18 '19 at 12:28
  • Still only 21 moves -- the Queen on g4 blocks one of the King's moves. – TonyK Jun 18 '19 at 12:32
  • Make an effort, Rewan! You lost a Knight in the last edit. – TonyK Jun 18 '19 at 12:35
  • Also in the first position the Queen at h1 should be on g1. – TonyK Jun 18 '19 at 12:37

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.