Fischer random chess numbering scheme

Naming a Fischer Random board using numbers

This article needs additional citations for verification. Please help improve this article by adding citations to reliable sources. Unsourced material may be challenged and removed.
Find sources: "Fischer random chess numbering scheme" – news · newspapers · books · scholar · JSTOR (August 2012) (Learn how and when to remove this message)

|

The game Fischer random chess, played with conventional chess pieces and rules, starts with a random selection of one of 960 positions for the pieces. Arrangements of the pieces are restricted so that the king is between the rooks and the bishops are on different colored squares. In order to both select a valid arrangement and to then concisely discuss which randomly selected arrangement a particular game used, the Fischer random chess numbering scheme is used: a number between 0 and 959 indicates a valid arrangement and given an arrangement the number can be determined.

The Fischer random chess numbering scheme can be shown in the form of a simple two-tables representation. Also a direct derivation of starting arrays exists for any given number from 0 to 959. This mapping of starting arrays and numbers stems from Reinhard Scharnagl and is now used worldwide for Fischer random chess. The enumeration has been published first in the internet and then 2004 in his (German language) book "Fischer-Random-Schach (FRC / Chess960) - Die revolutionäre Zukunft des Schachspiels (inkl. Computerschach)", ISBN 3-8334-1322-0.

## Direct derivation

[edit]

White's starting array can be derived from its number N (0 ... 959) as follows:

a) Divide N by 4, yielding quotient N2 and remainder B1. Place a Bishop upon the bright square corresponding to B1 (0=b, 1=d, 2=f, 3=h).

b) Divide N2 by 4 again, yielding quotient N3 and remainder B2. Place a second Bishop upon the dark square corresponding to B2 (0=a, 1=c, 2=e, 3=g).

c) Divide N3 by 6, yielding quotient N4 and remainder Q. Place the Queen according to Q, where 0 is the first free square starting from a, 1 is the second, etc.

d) N4 will be a single digit, 0 ... 9. Ignoring Bishops and Queen, find the positions of two Knights within the remaining five spaces. Place the Knights according to its value by consulting the following N5N table:

Digit  | Knight positioning

|

0 | N | N | - | - | \-
1 | N | - | N | - | \-
2 | N | - | - | N | \-
3 | N | - | - | - | N
4 | - | N | N | - | \-
5 | - | N | - | N | \-
6 | - | N | - | - | N
7 | - | - | N | N | \-
8 | - | - | N | - | N
9 | - | - | - | N | N

e) There are three blank squares remaining; place a Rook in each of the outer two and the King in the middle one.

## Two-tables representation

[edit]

### King's table

[edit]

Scharnagl's NQ-skeleton Table  0 | `QNNRKR` | 192 | ` QNRKNR ` | 384 | ` QRNNKR ` | 576 | ` QRNKRN ` | 768 | ` QRKNRN `

|
|
|
|
|
|
|
|
|

16 | `NQNRKR` | 208 | ` NQRKNR ` | 400 | ` RQNNKR ` | 592 | ` RQNKRN ` | 784 | ` RQKNRN `
32 | `NNQRKR` | 224 | ` NRQKNR ` | 416 | ` RNQNKR ` | 608 | ` RNQKRN ` | 800 | ` RKQNRN `
48 | `NNRQKR` | 240 | ` NRKQNR ` | 432 | ` RNNQKR ` | 624 | ` RNKQRN ` | 816 | ` RKNQRN `
64 | `NNRKQR` | 256 | ` NRKNQR ` | 448 | ` RNNKQR ` | 640 | ` RNKRQN ` | 832 | ` RKNRQN `
80 | `NNRKRQ` | 272 | ` NRKNRQ ` | 464 | ` RNNKRQ ` | 656 | ` RNKRNQ ` | 848 | ` RKNRNQ `
96 | `QNRNKR` | 288 | ` QNRKRN ` | 480 | ` QRNKNR ` | 672 | ` QRKNNR ` | 864 | ` QRKRNN `
112 | `NQRNKR` | 304 | ` NQRKRN ` | 496 | ` RQNKNR ` | 688 | ` RQKNNR ` | 880 | ` RQKRNN `
128 | `NRQNKR` | 320 | ` NRQKRN ` | 512 | ` RNQKNR ` | 704 | ` RKQNNR ` | 896 | ` RKQRNN `
144 | `NRNQKR` | 336 | ` NRKQRN ` | 528 | ` RNKQNR ` | 720 | ` RKNQNR ` | 912 | ` RKRQNN `
160 | `NRNKQR` | 352 | ` NRKRQN ` | 544 | ` RNKNQR ` | 736 | ` RKNNQR ` | 928 | ` RKRNQN `
176 | `NRNKRQ` | 368 | ` NRKRNQ ` | 560 | ` RNKNRQ ` | 752 | ` RKNNRQ ` | 944 | ` RKRNNQ `

### Bishop's table

[edit]

Remainder  | Bishop positioning

|

a | b | c | d | e | f | g | h
0 | B | B | - | - | - | - | - | \-
1 | B | - | - | B | - | - | - | \-
2 | B | - | - | - | - | B | - | \-
3 | B | - | - | - | - | - | - | B
4 | - | B | B | - | - | - | - | \-
5 | - | - | B | B | - | - | - | \-
6 | - | - | B | - | - | B | - | \-
7 | - | - | B | - | - | - | - | B
8 | - | B | - | - | B | - | - | \-
9 | - | - | - | B | B | - | - | \-
10 | - | - | - | - | B | B | - | \-
11 | - | - | - | - | B | - | - | B
12 | - | B | - | - | - | - | B | \-
13 | - | - | - | B | - | - | B | \-
14 | - | - | - | - | - | B | B | \-
15 | - | - | - | - | - | - | B | B

| a| b| c| d| e| f| g| h|

|
|
|
|
|
|
|
|
|

| 8
7| 7
6| 6
5| 5
4| 4
3| 3
2| 2
1| 1
| a| b| c| d| e| f| g| h|

The standard starting position for chess is denoted by SP-518.

These two tables will serve for a quick mapping of an arbitrary Fischer random chess starting position (short: SP) at White's base row to a number between 0 and 959. First search for the same or the nearest smaller number from the King's Table. Then determine the difference (0 to 15) to the drawn number and select that matching bishops' positioning from the Bishop's Table. According to this first place both bishops at the first base row, then the six pieces in the sequence of the found row of the King's Table upon the six free places left over. Finally the black pieces will be placed symmetrically to White's base row.

Consider the SP-518 arrangement. The largest multiple of 16 less than 518 is 512, so we search for 512 in the King's table and the remainder, 6, in the Bishop's table. In the King's table, number 512 is "RNQKNR". In the Bishop's table, "--B--B--" is at number 6. We insert the pieces from the King's table into these gaps to get the starting array "RNBQKBNR", which is the starting order in traditional chess.

### Scharnagl's methods

[edit]

For years, Reinhard Scharnagl has championed the desirability of giving each of the starting positions (SP) a unique identification number (idn) in the range 0-959 or, perhaps, 1-960. He has presented his methods on the internet and in books. See the external references. As an application, a random number generator could make one probe into the range at hand for a random number, and produce a random SP. Late in 2005, the program Fritz9 became available. It has a Fischer random chess option, but, for some unexplained reason, it assigns idns to SPs in a different way. Rather than requiring a giant table with 960 entries, both methods can use some smaller tables and some arithmetic.

The methods described below are appropriate for the idn range 0-959. For the idn range 1-960, he recommends conversion by dividing by 960 and working with the remainder. This has the effect of assigning to idn 0 the SP that was at idn 960, and leaving the other idn SP matchups unchanged. If this calculation is applied in the idn range 0-959, nothing is changed.

For any SP, after skipping over the bishop's, the queen may occupy any one of six possible squares, and they are numbered from left to right (from White's perspective) 0,1,2,3,4,5. The two knights, then, can appear in any of the remaining five squares (skipping over bishops and queen) in 10 ways. These are shown and numbered in the N5N table.

For any SP, both the queens position and the N5N configuration are immediately available from the NQ-skeleton. The queen's position is the number of characters to the left of the "Q", giving 2 for the standard SP. The N5N configuration is obtained by omitting the "Q", giving -N-N- for the standard SP, so its N5N code is 5. In general

idn = (bishop's code) + 16* (queen's position) + 96* (N5N code)

For the standard SP, idn = 6 + 16*2 + 96*5 = 518

Going the other way, starting with an idn, divide it by 16 and get

idn = q1*16 + r1. r1 gives the bishop's code, so put the bishops on the board. Then divide q1 by 6.

q1 = q2*6 + r2. r2 gives the queen's position, so put it on the board.

q2 gives the N5N code, so put the knights on the board (of course skipping over the bishops and queen).

Starting with idn = 518, we get 518 = 32*16 + 6, and 32 = 5*6 + 2 so the bishop's code is 6, the queen's position is 2 and the N5N code is 5 with configuration -N-N-. If asterisks denote blank squares, the first rank fills up as: **B**B** **BQ*B** *NBQ*BN*

All of the multiplication and division can be eliminated by using the NQ-skeleton table below. It contains all of the 60 possible NQ-skeletons, and directly refers to all of the SPs with bishop's code 0, i.e. with bishops on a1 and b1.

Given an SP, extract the bishop's code, the NQ-skeleton and its N5N configuration. The six skeletons in each of the 10 blocks in the table all have the same N5N configuration, and the blocks are arranged according to the N5N table above. It is easy, then, to find the appropriate block, and look inside for the entry with the "Q" in the desired place, say at No. M. Then idn = (bishop's code) + M. For the standard SP, we extract 6 -NQ-N- and -N-N-. The desired block is the middle one in the second row, and the desired skeleton is at No. 512. We get idn = 6 + 512 = 518.

Going the other way, given an idn, locate, in the table, the largest number, say M, that is less than or equal to idn. Then idn - M gives the bishop's code, and the skeleton at M shows how to fill in the rest of the pieces. Given idn = 518 we locate 512, with NQ-skeleton -NQ-N-, in the table, and get bishops code = 518 - 512 = 6.

### Preliminaries

[edit]

Both methods take account of the positions of the bishops first, and ignore the distinction between the king and rooks. Once the positions of the bishops, knights and queen are known, there is only one possibility for the remaining three squares. In the places where division of whole numbers is done, it is always done giving a quotient (designated q1,q2,..) and a remainder (designated r1,r2 ..).

There are 16 ways to put two bishops on opposite colored squares. These are shown and numbered in the table above. The entries actually can be calculated using simple arithmetic, but the table method seems less error prone. For the standard SP the bishop's code is 6.

In any SP, when looking at the arrangement of the other pieces around the bishops, it is helpful to write down the NQ-skeleton for that SP. This is done by ignoring the bishops and replacing the "K" and "R" by a common symbol, say "-". The NQ-skeleton for the standard SP is -NQ-N-. The sections below showing Scharnagl's Methods and the Fritz9 Methods are independent, and may be read in any order.

### Fritz9 methods

[edit]

Upon entry to Fischer random chess, Fritz9 prompts the user to enter a position idn or to "draw lots". If the user wishes to choose the first rank configuration of pieces, he/she must know how to get at the idn, but, unfortunately, Fritz9 does not use the standard method described above. The table below shows a quick way to get the Fritz9 idn for any SP.

For any SP, after ignoring the bishops, attention is given first to the knights (rather than to the queen). After taking account of the arrangement of the two knights in six squares (skipping over bishops), the queen is left with four possibilities: 0,1,2,3 (counting from the a-side of the board and skipping over bishops and knights). The queen's position is the number of hyphens to the left of the "Q" in the NQ-skeleton for the SP.

Digit  | Knight positioning

|

0 | N | N | - | - | - | \-
1 | N | - | N | - | - | \-
2 | N | - | - | N | - | \-
3 | N | - | - | - | N | \-
4 | N | - | - | - | - | N
5 | - | N | N | - | - | \-
6 | - | N | - | N | - | \-
7 | - | N | - | - | N | \-
8 | - | N | - | - | - | N
9 | - | - | N | N | - | \-
10 | - | - | N | - | N | \-
11 | - | - | N | - | - | N
12 | - | - | - | N | N | \-
13 | - | - | - | N | - | N
14 | - | - | - | - | N | N

Given an SP, extract the bishop's code, the NQ-skeleton and its queen's position. Then, locate, in the appropriate column, the NQ-skeleton at hand, say at No. M. The Fritz9 idn = (bishop's code) + M. For the standard SP, we extract 6 RNQKNR and 1 and get Fritz9 idn = 6 + 353 = 359.

Fritz9 NQ-skeleton Table

1 | NNQRKR | 241 | NNRQKR | 481 | NNRKQR | 721 | NNRKRQ

|
|
|
|
|
|
|

17 | NQNRKR | 257 | NRNQKR | 497 | NRNKQR | 737 | NRNKRQ
33 | NQRNKR | 273 | NRQNKR | 513 | NRKNQR | 753 | NRKNRQ
49 | NQRKNR | 289 | NRQKNR | 529 | NRKQNR | 769 | NRKRNQ
65 | NQRKRN | 305 | NRQKRN | 545 | NRKQRN | 785 | NRKRQN
81 | QNNRKR | 321 | RNNQKR | 561 | RNNKQR | 801 | RNNKRQ
97 | QNRNKR | 337 | RNQNKR | 577 | RNKNQR | 817 | RNKNRQ
113 | QNRKNR | 353 | RNQKNR | 593 | RNKQNR | 833 | RNKRNQ
129 | QNRKRN | 369 | RNQKRN | 609 | RNKQRN | 849 | RNKRQN
145 | QRNNKR | 385 | RQNNKR | 625 | RKNNQR | 865 | RKNNRQ
161 | QRNKNR | 401 | RQNKNR | 641 | RKNQNR | 881 | RKNRNQ
177 | QRNKRN | 417 | RQNKRN | 657 | RKNQRN | 897 | RKNRQN
193 | QRKNNR | 433 | RQKNNR | 673 | RKQNNR | 913 | RKRNNQ
209 | QRKNRN | 449 | RQKNRN | 689 | RKQNRN | 929 | RKRNQN
225 | QRKRNN | 465 | RQKRNN | 705 | RKQRNN | 945 | RKRQNN

Anyone with Fritz9 can verify this table by entering in the idns. It directly refers to just those SPs with bishop's code 0 i.e. with the bishops on a1 and b1.

## See also

[edit]

* Fischer random chess starting position

## External links

[edit]

* Image of all starting positions
* Chess960 start positions