Chess960 · Castling Skeletons
Castling in Fischer-random chess depends only on where the king and its two rooks sit, and the king always stands between the rooks — so across all 960 setups there are exactly C(8,3)=56 king–rook skeletons. Each card holds one skeleton and every Scharnagl ID built on it. Ordered by file, from R K R on a–b–c through f–g–h. All generated live.
White's eight back-rank pieces — king, queen, two rooks, two bishops, two knights — are shuffled along the first rank under two rules: the bishops stand on squares of opposite colour, and the king stands between the two rooks, so that castling stays possible on both sides. The pawns stay where they are and Black copies White file for file, so every count below is a count of White's first rank, and so of positions.
The two knights are not “knight 1” and “knight 2”. Knights on b1 and g1 make one position, not two: swapping them changes nothing on the board. The same holds for the rooks and for the bishops. So a pair is placed by choosing a set of squares, never an ordered pair, and that is exactly what C(n,k) counts. With neither rule, eight labelled pieces could be lined up in 8! = 40,320 orders, but every board would then be counted 2!·2!·2! = 8 times (swap the knights, swap the bishops, swap the rooks): 40,320 / 8 = 5,040 different first ranks.
| Light-squared bishop | one of b, d, f, h | 4 |
| Dark-squared bishop | one of a, c, e, g | 4 |
| Queen | any of the 6 empty squares | 6 |
| Knights | 2 of the 5 empty squares, as a pair | C(5,2) = 10 |
| Rook · king · rook | the last 3 squares, king in the middle | 1 |
| 4 × 4 × 6 × 10 × 1 = 960 | ||
The bishops are alike too, yet they are not divided by 2: the colour rule already tells them apart — one is the light bishop, the other the dark one — so 4 × 4 counts every pair of squares exactly once. Placing the first bishop anywhere (8) and the second on the other colour (4) would count each pair twice, once from each end: 8 × 4 / 2 = 16, the same. The knights carry no such label: 5 × 4 = 20 ordered placements count each pair twice, 20 / 2 = 10 = C(5,2). The last three squares leave no choice at all: the king must take the middle one, and the rooks are alike, so swapping them is not a new position.
The order of the steps does not change the total; this order is the one the Scharnagl numbering follows. An ID is the five choices read as one number in mixed bases, ID = light bishop + 4 × dark bishop + 16 × queen + 96 × knight pair, each choice counted from 0 along the free squares from a to h, and the ten knight pairs in a fixed order. That runs from 0 to 4 × 4 × 6 × 10 − 1 = 959. The orthodox start is 518 = 2 + 4 × 1 + 16 × 2 + 96 × 5: light bishop on the third light square (f), dark bishop on the second dark square (c), queen on the third free square (d), knights on pair 5 — the second and fourth of the five squares left (b and g) — and R K R on a, e, h: RNBQKBNR.
The same count, starting from the king and the rooks — the view this page is built on. Choose the three files they will hold: C(8,3) = 56. Each set of three files gives exactly one skeleton, again because the king must stand in the middle and the rooks are alike. Five files are left for B, B, Q, N, N.
The rank has four light squares and four dark ones. The skeleton takes three, so the five free squares split by colour either 3–2 or 4–1 — never 5–0, since that would need the skeleton to take four squares of one colour. A 4–1 split happens only when all three skeleton squares share a colour: C(4,3) = 4 ways on the light squares and 4 on the dark, 8 skeletons. The other 56 − 8 = 48 split 3–2.
| 3–2 split | bishops 3 × 2, queen on one of the 3 left, knights on the last 2 | 6 × 3 × 1 = 18 |
| 4–1 split | bishops 4 × 1, queen on one of the 3 left, knights on the last 2 | 4 × 3 × 1 = 12 |
| 48 × 18 + 8 × 12 = 864 + 96 = 960 | ||
Each rule cuts the 5,040 unrestricted ranks by a fixed fraction. The bishops can take C(8,2) = 28 pairs of squares, and 4 × 4 = 16 of those pairs are of opposite colour: 5,040 × 16 / 28 = 2,880. Wherever the king and the rooks end up, their three squares can be filled in three ways — king on the left, in the middle or on the right — and only the middle one is allowed: 2,880 / 3 = 960.
No setup is its own mirror image: the king would have to stand on the middle file, and eight files have none. Mirroring keeps both rules — the bishops swap colours but stay opposite, and the king stays between the rooks — so the 960 fall into 480 mirror pairs. The orthodox start #518 pairs with #534, RNBKQBNR.
Skeleton written R K R with dashes for empty files (e.g. -R--K-R-). #518 (RNBQKBNR, the orthodox start) is highlighted where it appears. Numbering after Reinhard Scharnagl (FRC/Chess960, 2004) — the same IDs FIDE uses.
Why 18 or 12: the five files a skeleton leaves free split either 3–2 or 4–1 by square colour. A 3–2 split allows 3×2 bishop placements and 3 squares for the queen — 18 positions. In the eight 4–1 skeletons one bishop is pinned to the lone minority file: 1×4×3 = 12.