4
$\begingroup$

(This is a combinatorics question, and therefore more appropriate here than at the Chess Stack Exchange.)

Background: in chess, board positions are recorded using a system called Forsyth-Edwards Notation (FEN for short). The rows (called "ranks" in chess) are written from left to right, starting at the top of the board and continuing to the bottom. The pieces are listed with letters: K for king, Q for queen, R for rook, B for bishop, N for knight, and P for pawn. Uppercase letters are used for white pieces and lowercase for the black pieces. Empty spaces are denoted by numbers; ranks are separated by slashes. See the Wikipedia article for a full explanation and examples.

My question is, how many ranks are possible? No positions illegal due to rules of pawn promotion or castling may occur given only one rank, so the sole restrictions from chess rules are:

  • There cannot be more than two kings on the same rank, and if that is the case they must be opposite colours.
  • The kings cannot be next to each other (kK and Kk are invalid)
  • A king cannot have a queen or rook on both sides of it surrounded by empty space
  • Both kings cannot be in check at the same time. This translates into: if both kings are on the same rank, it is invalid to have only empty space between each king and an opposing Qq or Rr.

I cannot decide whether it is relevant that empty spaces are condensed into a single number (four consecutive empty spaces are written as 4 rather than 1111).

The initial count of the possible ranks without kings is very high: with $11$ square types (the six piece types, minus the king, times two colours, plus an empty square), and eight available squares, the total number is $11^8 = 214358881$.

Continuing, we can explore the case where there is one king. There are $8$ squares to place it and $2$ colours, so there are $16$ initial ways to place the king. There are $7$ remaining squares and $11$ remaining square types, so the total number of piece arrangements is $16 \times 11^7 = 311794736$. But many of these are illegal, because they have the king in check from two pieces at once. We must also consider that if there is a non-horizontal piece between a king and checking piece, then the position will become legal. If the checking pieces are one square away from each other (only the king between them), then there are $11^5 = 161051$ ways to populate the rest of the rank. Multiply this by $6$ available squares for the king to get $966306$. If the checking pieces are two squares apart, the three pieces have $10$ different placements and the rest of the rank can be populated in $11^4 = 14641$ ways (total $146410$). If they are three squares apart, there are $12$ arrangements and $11^3$ ways to populate the rest of the rank ($15972$). Continuing on, four squares apart yield $1452$ illegal arrangements, five squares yield $110$, and six yield $6$. The total number of illegal arrangements is thus $966306 + 146410 + 15972 + 1452 + 110 + 6 = 1130256$. The pieces can also be $2$ different colours, and there are $2$ possible checking pieces, so the total number of illegal ranks with one king is $1130256 \times 2 \times 2 = 4521024$. The number of legal ranks is $311794736 - 4521024 = 307273712$.

$\endgroup$

Your Answer

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

Browse other questions tagged or ask your own question.