Chess960 numbering scheme

From Wikipedia, the free encyclopedia
Jump to: navigation, search

The game Chess960, 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 Chess960 numbering scheme is used: a number between 0 and 959 indicates a valid arrangement and given an arrangement the number can be determined.

The Chess960 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 Chess960. 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.

Two tables representation[edit]

These two tables will serve for a quick mapping of an arbitrary Chess960 starting position (short: SP) at White's base row to a random 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.

Example[edit]

This is the SP-518 arrangement. In the King's Table we will find No. 512 "RNQKNR". For the remainder 6 we will find "--B--B--" in the Bishop's Table at No. 6. Altogether by that for the SP-518 = 512+6 this will result in the well known white starting array "RNBQKBNR" from traditional Chess.

King's table[edit]

Max. Positioning Sequence of the other Pieces
0 Q N N R K R   336 N R K Q R N   672 Q R K N N R
16 N Q N R K R 352 N R K R Q N 688 R Q K N N R
32 N N Q R K R 368 N R K R N Q 704 R K Q N N R
48 N N R Q K R 384 Q R N N K R 720 R K N Q N R
64 N N R K Q R 400 R Q N N K R 736 R K N N Q R
80 N N R K R Q 416 R N Q N K R 752 R K N N R Q
96 Q N R N K R 432 R N N Q K R 768 Q R K N R N
112 N Q R N K R 448 R N N K Q R 784 R Q K N R N
128 N R Q N K R 464 R N N K R Q 800 R K Q N R N
144 N R N Q K R 480 Q R N K N R 816 R K N Q R N
160 N R N K Q R 496 R Q N K N R 832 R K N R Q N
176 N R N K R Q 512 R N Q K N R 848 R K N R N Q
192 Q N R K N R 528 R N K Q N R 864 Q R K R N N
208 N Q R K N R 544 R N K N Q R 880 R Q K R N N
224 N R Q K N R 560 R N K N R Q 896 R K Q R N N
240 N R K Q N R 576 Q R N K R N 912 R K R Q N N
256 N R K N Q R 592 R Q N K R N 928 R K R N Q N
272 N R K N R Q 608 R N Q K R N 944 R K R N N Q
288 Q N R K R N 624 R N K Q R N 960 Q N N R K R
304 N Q R K R N 640 R N K R Q N R. Scharnagl
320 N R Q K R N 656 R N K R N Q

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

Direct derivation[edit]

White's Chess960 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. Place the Knights according to its value by consulting the following 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.

Starting position IDs in Chess960[edit]

For years, Reinhard Scharnagl has championed the desirability of giving each of the Chess960 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 Chess960 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.

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 small table below. 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.

               Scharnagl's Bishop's Table
-
  0  BB------   4 -BB-----   8 -B--B---  12 -B----B-
  1  B--B----   5 --BB----   9 ---BB---  13 ---B--B-
  2  B----B--   6 --B--B--  10 ----BB--  14 -----BB-
  3  B------B   7 --B----B  11 ----B--B  15 ------BB

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.

Scharnagl's methods[edit]

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 below.

Scharnagl's N5N Table
0 NN--- 5 -N-N-
1 N-N-- 6 -N--N
2 N--N- 7 --NN-
3 N---N 8 --N-N
4 -NN-- 9 ---NN
Scharnagl's NQ-skeleton Table
0 QNN--- 192 QN—N- 384 Q-NN-- 576 Q-N--N 768 Q--N-N
16 NQN--- 208 NQ—N- 400 -QNN-- 592 -QN—N 784 -Q-N-N
32 NNQ--- 224 N-Q-N- 416 -NQN-- 608 -NQ—N 800 --QN-N
48 NN-Q-- 240 N--QN- 432 -NNQ-- 624 -N-Q-N 816 --NQ-N
64 NN—Q- 256 N--NQ- 448 -NN-Q- 640 -N--QN 832 --N-QN
80 NN---Q 272 N--N-Q 464 -NN—Q 656 -N--NQ 848 --N-NQ
96 QN-N-- 286 QN---N 480 Q-N-N- 672 Q--NN- 864 Q---NN
112 NQ-N-- 304 NQ---N 496 -QN-N- 688 -Q-NN- 880 -Q--NN
128 N-QN-- 320 N-Q--N 512 -NQ-N- 704 --QNN- 896 --Q-NN
144 N-NQ-- 336 N--Q-N 528 -N-QN- 720 --NQN- 912 ---QNN
160 N-N-Q- 352 N---QN 544 -N-NQ- 736 --NNQ- 928 ---NQN
176 N-N--Q 368 N---NQ 560 -N-N-Q 752 --NN-Q 944 ---NNQ

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.

Fritz9 methods[edit]

Upon entry to Chess960, 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.

In the table below, the columns correspond to the queen's position, and, in each column, the ordering is alphabetic with "-" last.

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 -NQ-N- and 1 and get Fritz9 idn = 6 + 353 = 359.

          Fritz9 NQ-skeleton Table
-
  1 NNQ---  241 NN-Q--  481 NN—Q-  721 NN---Q
 17 NQN---  257 N-NQ—497 N-N-Q-  737 N-N--Q
 33 NQ-N--  273 N-QN—513 N--NQ-  753 N--N-Q
 49 NQ—N-  289 N-Q-N-  529 N--QN-  769 N---NQ
 65 NQ---N  305 N-Q--N  545 N--Q-N  785 N---QN
 81 QNN---  321 -NNQ—561 -NN-Q-  801 -NN—Q
 97 QN-N--  337 -NQN—577 -N-NQ-  817 -N-N-Q
113 QN—N-  353 -NQ-N-  593 -N-QN-  833 -N--NQ
129 QN---N  369 -NQ—N  609 -N-Q-N  849 -N--QN
145 Q-NN—385 -QNN—625—NNQ-  865—NN-Q
161 Q-N-N-  401 -QN-N-  641—NQN-  881—N-NQ
177 Q-N--N  417 -QN—N  657—NQ-N  897—N-QN
193 Q--NN-  433 -Q-NN-  673—QNN-  913 ---NNQ
209 Q--N-N  449 -Q-N-N  689—QN-N  929 ---NQN
225 Q---NN  465 -Q--NN  705—Q-NN  945 ---QNN

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.

External links[edit]