Starting position IDs in Chess960 Chess960 numbering scheme




1 starting position ids in chess960

1.1 preliminaries
1.2 scharnagl s methods
1.3 fritz9 methods





starting position ids in chess960

for years, reinhard scharnagl has championed desirability of giving each of chess960 starting positions (sp) unique identification number (idn) in range 0-959 or, perhaps, 1-960. has presented methods on internet , in books. see external references. application, random number generator make 1 probe range @ hand random number, , produce random sp. late in 2005, program fritz9 became available. has chess960 option, but, unexplained reason, assigns idns sps in different way. rather requiring giant table 960 entries, both methods can use smaller tables , arithmetic.


preliminaries

both methods take account of positions of bishops first, , ignore distinction between king , rooks. once positions of bishops, knights , queen known, there 1 possibility remaining 3 squares. in places division of whole numbers done, done giving quotient (designated q1,q2,..) , remainder (designated r1,r2 ..).


there 16 ways put 2 bishops on opposite colored squares. these shown , numbered in small table below. entries can calculated using simple arithmetic, table method seems less error prone. standard sp bishop s code 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 sp, when looking @ arrangement of other pieces around bishops, helpful write down nq-skeleton sp. done ignoring bishops , replacing k , r common symbol, - . nq-skeleton standard sp -nq-n-. sections below showing scharnagl s methods , fritz9 methods independent, , may read in order.


scharnagl s methods

the methods described below appropriate idn range 0-959. idn range 1-960, recommends conversion dividing 960 , working remainder. has effect of assigning idn 0 sp @ idn 960, , leaving other idn sp matchups unchanged. if calculation applied in idn range 0-959, nothing changed.


for sp, after skipping on bishop s, queen may occupy 1 of 6 possible squares, , numbered left right (from white s perspective) 0,1,2,3,4,5. 2 knights, then, can appear in of remaining 5 squares (skipping on bishops , queen) in 10 ways. these shown , numbered in n5n table below.




for sp, both queens position , n5n configuration available nq-skeleton. queen s position number of characters left of q , giving 2 standard sp. n5n configuration obtained omitting q , giving -n-n- standard sp, n5n code 5. in general


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


for standard sp, idn = 6 + 16*2 + 96*5 = 518


going other way, starting idn, divide 16 , get


idn = q1*16 + r1. r1 gives bishop s code, put bishops on board. divide q1 6.


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


q2 gives n5n code, put knights on board (of course skipping on bishops , queen).


starting idn = 518, 518 = 32*16 + 6, , 32 = 5*6 + 2 bishop s code 6, queen s position 2 , n5n code 5 configuration -n-n-. if asterisks denote blank squares, first rank fills as: **b**b** **bq*b** *nbq*bn*


all of multiplication , division can eliminated using nq-skeleton table below. contains of 60 possible nq-skeletons, , directly refers of sps bishop s code 0, i.e. bishops on a1 , b1.


given sp, extract bishop s code, nq-skeleton , n5n configuration. 6 skeletons in each of 10 blocks in table have same n5n configuration, , blocks arranged according n5n table above. easy, then, find appropriate block, , inside entry q in desired place, @ no. m. idn = (bishop s code) + m. standard sp, extract 6 -nq-n- , -n-n-. desired block middle 1 in second row, , desired skeleton @ no. 512. idn = 6 + 512 = 518.


going other way, given idn, locate, in table, largest number, m, less or equal idn. idn - m gives bishop s code, , skeleton @ m shows how fill in rest of pieces. given idn = 518 locate 512, nq-skeleton -nq-n-, in table, , bishops code = 518 - 512 = 6.


fritz9 methods

upon entry chess960, fritz9 prompts user enter position idn or draw lots . if user wishes choose first rank configuration of pieces, he/she must know how @ idn, but, unfortunately, fritz9 not use standard method described above. table below shows quick way fritz9 idn sp.


for sp, after ignoring bishops, attention given first knights (rather queen). after taking account of arrangement of 2 knights in 6 squares (skipping on bishops), queen left 4 possibilities: 0,1,2,3 (counting a-side of board , skipping on bishops , knights). queen s position number of hyphens left of q in nq-skeleton sp.


in table below, columns correspond queen s position, and, in each column, ordering alphabetic - last.


given sp, extract bishop s code, nq-skeleton , queen s position. then, locate, in appropriate column, nq-skeleton @ hand, @ no. m. fritz9 idn = (bishop s code) + m. standard sp, extract 6 -nq-n- , 1 , 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 fritz9 can verify table entering in idns. directly refers sps bishop s code 0 i.e. bishops on a1 , b1.







Comments

Popular posts from this blog

Independence United Arab Emirates

History Alexandra College

Management School of Computer Science, University of Manchester