09 December 2008

A Database of Chess960 Start Positions

Now that I'm comfortable with chess960 concepts, I thought it would be useful to have a small database of the 960 valid start positions. This would let me answer some simple questions like 'how many positions are there with such-and-such characteristics'. I set out on a web search to find the base data relating the 960 start positions (SP) to their corresponding setup string, for example, relating position 518 (SP518) to the traditional chess setup RNBQKBNR. I looked at 20-odd sites, came up empty handed, and decided it would be faster to generate the data myself. Since the basic algorithms are explained on Wikipedia pages, I studied them for the details, and 30 minutes later had my database.

Wikipedia entries often suffer from an excess of detail, and the chess960 pages are no exception. Constructing a random chess960 start position is easy. Confining yourself to White's first rank, first you place a Bishop at random on one of the four light squares and the other Bishop at random on one of the four dark squares. Then you place the Queen at random on one of the six remaining empty squares, followed by the two Knights on the five remaining squares. That leaves three empty squares where you must place the King and Rooks so that the King has one Rook somewhere to its left and the other Rook to its right. When you are done with the White pieces, you place the Black pieces on Black's first rank so that they mirror the White pieces. Then you place all of the Pawns on their respective second ranks.

You can use almost any simple game of chance to choose random squares; dice and cards work well if you repeat a step returning an invalid number, e.g. larger than the number four when placing a Bishop. Coin tosses work if you're comfortable with binary numbers (aren't we all?) and you could even use yarrow stalks or a ouija board if you're comfortable with divination.

The standard accepted numbering of the 960 start positions uses a clever scheme that cycles through the 16 possible setups for the Bishops (4 x 4) and the 60 possible setups for the Queen and Knights (6 x 5 x 4, divided by 2, to factor out the duplication of the Knights). After generating the 960 positions and mapping them to their standard numbers, I loaded the data into my database and created an external page with the most important info...

Chess960 Start Positions
http://www.mark-weeks.com/cfaa/chess960/c960strt.htm

...Armed with the table, I realized I could use it to refine my initial web search and locate other web pages to check my work. First I found 37 chess960 positions on Opening experience : Fischer Random Chess (Chess960). One of its positions didn't match my numbering (SP246), but I quickly determined that it was an error on that page. Then I found another copy of all 960 positions on Fischer random chess setups. This matched my results perfectly and gave me confidence that my work had been correct. I then used my database to answer simple questions like

With the King and Queen on the central files (the d-/e-files), which positions are symmetric? By symmetric, I mean that one type of piece (R, B, or N) is on the a-/h-files, another is on the b-/g-files, and the remaining piece is on the c-/f-files.

Logic says there should be 12 such positions, but how are they numbered? My database says they are numbered like this...

SP323 • BNRQKRNB
SP326 • NRBQKBRN
SP332 • NBRQKRBN
SP339 • BNRKQRNB
SP342 • NRBKQBRN
SP348 • NBRKQRBN
SP515 • BRNQKNRB
SP518 • RNBQKBNR
SP524 • RBNQKNBR
SP531 • BRNKQNRB
SP534 • RNBKQBNR
SP540 • RBNKQNBR

Of course, SP518 is one of those positions, but it's also worth noting that SP534 is similar to SP518, with only the King and Queen switched on the central files. Here's a diagram of SP534.


Start Position 534
The Queen is NOT on her color!

This is a good time to clarify a point that sometimes confuses newcomers to chess960. SP534 is not a simple mirror image of SP518, the traditional start position. When castling O-O or O-O-O in SP534, the King and Rook end up on exactly the same squares as they do when castling in SP518: e.g. after castling O-O, the Rook ends on f1 and the King ends on g1.

Along with identifying the 12 symmetric start positions my database taught me a few other things about the family of valid chess960 start positions. I'll leave that discussion for another post.

***

Note: Listed under 'STRATEGIC CONCEPTS' on Chess Blog Carnival 1/09, where I'm described as 'a support beam of the chess bloggers'. Call me 'Mr. Beam'?

2 comments:

JHVN said...
This comment has been removed by the author.
Fischer Random Chess said...
This comment has been removed by the author.