Fischer random chess numbering scheme

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

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
0NN---
1N-N--
2N--N-
3N---N
4-NN--
5-N-N-
6-N--N
7--NN-
8--N-N
9---NN

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

King's table

Scharnagl's NQ-skeleton Table
0QNNRKR192 QNRKNR 384 QRNNKR 576 QRNKRN 768 QRKNRN
16NQNRKR208 NQRKNR 400 RQNNKR 592 RQNKRN 784 RQKNRN
32NNQRKR224 NRQKNR 416 RNQNKR 608 RNQKRN 800 RKQNRN
48NNRQKR240 NRKQNR 432 RNNQKR 624 RNKQRN 816 RKNQRN
64NNRKQR256 NRKNQR 448 RNNKQR 640 RNKRQN 832 RKNRQN
80NNRKRQ272 NRKNRQ 464 RNNKRQ 656 RNKRNQ 848 RKNRNQ
96QNRNKR288 QNRKRN 480 QRNKNR 672 QRKNNR 864 QRKRNN
112NQRNKR304 NQRKRN 496 RQNKNR 688 RQKNNR 880 RQKRNN
128NRQNKR320 NRQKRN 512 RNQKNR 704 RKQNNR 896 RKQRNN
144NRNQKR336 NRKQRN 528 RNKQNR 720 RKNQNR 912 RKRQNN
160NRNKQR352 NRKRQN 544 RNKNQR 736 RKNNQR 928 RKRNQN
176NRNKRQ368 NRKRNQ 560 RNKNRQ 752 RKNNRQ 944 RKRNNQ

Bishop's table

Remainder Bishop positioning
abcdefgh
0BB------
1B--B----
2B----B--
3B------B
4-BB-----
5--BB----
6--B--B--
7--B----B
8-B--B---
9---BB---
10----BB--
11----B--B
12-B----B-
13---B--B-
14-----BB-
15------BB
abcdefgh
8
a8 black rook
b8 black knight
c8 black bishop
d8 black queen
e8 black king
f8 black bishop
g8 black knight
h8 black rook
a7 black pawn
b7 black pawn
c7 black pawn
d7 black pawn
e7 black pawn
f7 black pawn
g7 black pawn
h7 black pawn
a2 white pawn
b2 white pawn
c2 white pawn
d2 white pawn
e2 white pawn
f2 white pawn
g2 white pawn
h2 white pawn
a1 white rook
b1 white knight
c1 white bishop
d1 white queen
e1 white king
f1 white bishop
g1 white knight
h1 white rook
8
77
66
55
44
33
22
11
abcdefgh
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

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

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

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
0NN----
1N-N---
2N--N--
3N---N-
4N----N
5-NN---
6-N-N--
7-N--N-
8-N---N
9--NN--
10--N-N-
11--N--N
12---NN-
13---N-N
14----NN

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

1NNQRKR241NNRQKR481NNRKQR721NNRKRQ
17NQNRKR257NRNQKR497NRNKQR737NRNKRQ
33NQRNKR273NRQNKR513NRKNQR753NRKNRQ
49NQRKNR289NRQKNR529NRKQNR769NRKRNQ
65NQRKRN305NRQKRN545NRKQRN785NRKRQN
81QNNRKR321RNNQKR561RNNKQR801RNNKRQ
97QNRNKR337RNQNKR577RNKNQR817RNKNRQ
113QNRKNR353RNQKNR593RNKQNR833RNKRNQ
129QNRKRN369RNQKRN609RNKQRN849RNKRQN
145QRNNKR385RQNNKR625RKNNQR865RKNNRQ
161QRNKNR401RQNKNR641RKNQNR881RKNRNQ
177QRNKRN417RQNKRN657RKNQRN897RKNRQN
193QRKNNR433RQKNNR673RKQNNR913RKRNNQ
209QRKNRN449RQKNRN689RKQNRN929RKRNQN
225QRKRNN465RQKRNN705RKQRNN945RKRQNN

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

This article is issued from Wikipedia. The text is licensed under Creative Commons - Attribution - Sharealike. Additional terms may apply for the media files.