Index: > A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
Business Industries Finance Tax

Home > Fischer Random Chess


First Prev [ 1 2 3 4 5 ] Next Last

5 Starting position IDs

Some people have wanted each possible starting position to have a unique standard numeric identifier (id). R. Scharnagl recommends the following method for defining each position id, where each position has a different id ranging from 0 to 959.


To create a starting position given an id:

The KRN code values are as follows, showing the order from white's perspective from left to right (where K is king, R is rook, and N is knight):

KRN codePosition
0N N R K R
1N R N K R
2N R K N R
3N R K R N
4R N N K R
5R N K N R
6R N K R N
7R K N N R
8R K N R N
9R K R N N

Conversely, given a board position, its id can be computed as follows:

id = (light square Bishop location, where file b is 0) + 4 × (dark square Bishop location, file a is 0) + 16 × (Queen location, counting leftmost as 0 and skipping Bishops) + 96 × (KRN code)

The standard chess position is position id 518. This can be shown by computing it:

id = (2 because the light square Bishop is on file f) + 4 × (1 because the dark square Bishop is on file c) + 16 × (2 because the Queen is on file d, skipping bishop on c) + 96 × (5, the KRN code) = 518

Computer software can use this algorithm to quickly create any of the standard positions, by simply selecting a random number from 0 to 959 and using that as the position id. Note that some random number generators are poor (e.g., they are predictable and/or do not have an equal distribution of possible values), so implementors should make sure they use a good random number generator.

6 Other ways to create initial positions

There are several other methods that can create initial positions.

6.1 Coin-tossing method

Edward Northam has developed the following approach for creating initial positions using only two distinguishable coins.

First, two coins (small and large) are used to randomly generate numbers with equal probability. He suggests doing this by declaring that tails on the smaller coin counts as 0, tails on the larger coin counts as 1, and heads on either coin counts as 2. To create numbers in the range 1 through 4, toss both coins and add their values together. To create numbers in the range 1 through 3, do the same but retoss whenever 4 is the result. To create numbers in the range 1 through 2, just toss the larger coin (tails is 1, heads is 2).

Any other technique that randomly generates numbers from 1 to 4 (or at least 1-2) will work as well, such as as the selection of a closed hand that may hold a white or black Pawn.

As with a die, the coin tosses can build a starting position one piece at a time. Before each toss there will be at most 4 vacant squares available to the piece at hand, and they can be numbered counting from the a-side (as with the die procedure described above). Place the white pieces on white's back rank as follows:

  1. Place a Bishop on one of the 4 light squares.
  2. Place a Bishop on one of the 4 dark squares.
  3. Place the King. There 6 vacant squares, but only the middle 4 are available to the King, since there must be room for a Rook on each side of the King.
  4. Place a Rook on the a-side of the King.
  5. Place a Rook on the h-side of the King.
  6. Place the Queen on one of the 3 vacant squares that remain.
  7. Place Knights on the two squares that are left.

The average number of tosses needed to complete the process is 6. If a die and coins are at hand, no tosses need be repeated. The coins are used unless a number 1,2,3 is needed. Then the die is rolled, and 4,5,6 is counted as 1,2,3.

Both the die and coins methods can be speeded up by introducing parallelism. Several dice of different colors can be rolled, so long as there is a prior agreement about the ordering of the colors (which color is counted as the first roll, the second etc.). Using US coins, if each player tosses a penny, nickel, dime, and quarter (penny goes with nickel, dime goes with quarter), this single action gives four outcomes. Again, there must be a prior agreement about the order of these outcomes. Two such actions will place all of the pieces more than 97% of the time.

The ultimate parallelism of this type would have each player toss four different coins and a die. If a die is used only when 1,2,3 is needed, this single action will place all eight pieces. Again, there must be a prior agreement about the ordering of these outcomes.





Non User