Chess960 III

by zenquaker

In a blog post on my Chess960 Almanac, Mark Weeks comments that he’s not sure how I came up with the list of swaps. I thought I would explain that and why I came up with yet another system for numbering Chess960 start positions.

First the swaps. The swaps are numbered 1-S. That is, the first nine are numbered 1-9, then the rest are given a letter in alphabetic order up to S. The order of the swaps is to start with all of the swaps involving the a file in order left to right, then the swaps involving the b file in order left to right, then the c file and so on. For each file you ignore swaps that have already been given a number. That gives you a list like this:

  • 1: Swap a file with b file.
  • 2: Swap a file with c file.
  • 3: Swap a file with d file.
  • 4: Swap a file with e file.
  • 5: Swap a file with f file.
  • 6: Swap a file with g file.
  • 7: Swap a file with h file.
  • 8: Swap b file with c file. (Note that swap b file with a file is skipped, since that is swap #1)
  • 9: Swap b file with d file.
  • A: Swap b file with e file.
  • B: Swap b file with f file.
  • C: Swap b file with g file.
  • D: Swap b file with h file.
  • E: Swap c file with d file. (Skipping already covered swaps #2 and #8)
  • and so on.

Once those swaps are defined, I start with the standard Chess position (RNBQKBNR). That is the root of a tree. From that root I create on branch for each swap in order, with the end of the branch being the resulting start position. So swap 1 gives a branch with position NRBQKBNR, swap 2 gives a branch with BNRQKBNR, and so on. Each resulting position is checked, and a branch is only made if the position is a legal Chess960 position. Therefore swap #6 (swap a file with g file) is not done, because the resulting position (NNBQKBRR) violates the rule that the king must be between the rooks. Each of these new positions (along with the starting standard position) is saved in a master list.

Once the first set (or level) of branches are done, I start on the second level of branches. That is done by taking each first level branch (in order) and doing all of the swaps on it’s position. Now two checks are done on each result. A branch is only made if it is a legal Chess960 position that has not already been seen. There are some Chess960 positions that could be reached by more than one order of swaps. The most obvious is NRKQBBNR. You can reach it doing swap #1 and then swap #F, which would be swap path 1F. But since those swaps don’t interact with each other, you could also reach that position through the swap path F1. I only record 1F.

Once you have the second level of branches, you create a third level by doing all the swaps on the second level branches that result in new, legal positions.

Obviously I didn’t do all this by hand. I wrote a Python program to do it for me. As it turns out, any legal Chess960 position can be derived by swapping two pieces in another legal Chess960 position. This is demonstrated by the fact that my program to iteratively step through all of the swaps generates all of the legal positions. As it turns out, and legal Chess960 position can be reached with no more than six swaps from the standard Chess starting position. It would be nice if there was only one position that could be reached with six swaps, which we could call the furthest from the standard position. However, there are 68 Chess960 starting positions that require six swaps from the standard starting position. The last Chess960 starting position found by my program is QNRKRNBB (swap path RQFOE2).

Why the hell would I do this? It is just more of my examination of the concept of absurd positions in Chess960, which has no clear definition. Certain critics of Chess960 say that some of the starting positions are absurd, but give no definition of what those are. I’m exploring possible definitions to see what sort of sets of positions are returned. I’m working on the assumption that in the most general terms an absurd starting position is one that is radically different from the standard starting position, or in other words is “not similar” to the standard starting position. Again, “not similar” is an undefined concept. There are lots of ways to define similarity. One is distance. Distance may not be the right one. You can be completely different from your father and yet still be the closest person to him genealogically. But it’s a starting point, even if distance is also undefined. One way to define it is the number of swaps required to get to a starting position from the standard starting position.

So, why come up with a new way of numbering Chess960 positions? There are already three out there: Scharnagl’s, Milener’s, and Fritz’s. One thing I noticed is that none of these are easy to convert from a position to a number. Say I’m looking at a Chess960 game where the start position was created with some random method, like dice or numbered pawns. I don’t know the number of the position, but I want to remember the position. I could remember all eight pieces in order, but it’s much easier (and more reliable) to remember the one three digit number. With a little memorization and a little math in your head you can get that number (in my system):

  1. Look at the dark square bishop. It can be on one of four files: a, c, e, or g. Number those 0-3 in order, and the location of the dark square bishop is the number you start with.
  2. Look at the light square bishop, on file b, d, f, or h. Again number the files 0-3. Multiply the location of the light square bishop by four, and add it to the number from step 1.
  3. Look at the queen. Number the files that don’t have a bishop 0-5. Multiply the location of the queen by 16, and add it to the number from step 2.
  4. Look at the left hand knight. Not counting the squares with the bishops and the queen, there are four squares it could be in. Number those squares in order -1, 3, 6, 8. Add to that the number of non-bishop, non-queen squares from the left hand knight to the right hand knight. Multiply that number by 96 and add it to the number from step 3.
  5. Add to the number from step 4. Now you have a number from 1-960 that you can remember until you get home and can compare it to my numbering system to get the position.

For example, take the last position generated by my swap program: QNRKRNBB.

  1. The dark square bishop is on the g file, which is 3.
  2. The light square bishop is on the h file, which is also 3. 3 x 4 = 12. 12 + 3 = 15.
  3. The queen is on the a file, which is 0. 0 x 16 = 0. 0 + 15 = 15.
  4. The left hand night is on the b file, which is -1 (because the queen is on the a file, so the a file isn’t counted). The right hand knight is on the f file, 4 squares away. -1 + 4 = 3. 3 x 96 = 288. 288+ 15 = 303.
  5. 1 + 303 = 304. Which is the i_num listed for that position in the Chess960 Almanac.

Proving once again that a programmer will move everything he owns all the way across the country in a rickshaw if it will make it easier for him to get a Coke in the morning.

Finally, Mark has an insightful point in his blog post: “How does this study of start positions improve your chess960 play? Quite frankly, I’m not sure that it does. It does, however, make you more aware of subtle differences across the 960 positions, all of which tend to look very similar to the unpracticed eye. It might indeed be the first step in some uber-theory of chess960 openings.” I cannot disagree that it has little immediate use for Chess960 play. My eventual plan is to a statistical analysis of the CCRL 404 FRC database. I’m thinking that if I can find clusters of initial moves, pawn structures, piece placement or whatever, and then find matching clusters of features in the Chess960 Almanac, that could provide some general guidelines for opening play in Chess960.