Author: Dieter Buerssner
Date: 13:18:29 04/06/03
Go up one level in this thread
Let's start even easier - with only 2 kings. In your scheme, it will be 64*64 positions. But we can try to enumerate all legal king king positions. It turns out, that there are only 3612 such positions (instead of 4096 = 64*64). It is easy to store a table for this. Something like kingindex[64][64]. kingindex[a1][a1] could be -1. kingindex[a1][b1] = -1; kingindex[a1][c1] = 0; kingindex[a1][d1] = 1; and so on. Now an additional piece comes into play - say your rook. Imagine you start to first calculate the king-king number with the above table. Now the rook will at most have 62 places. Your index might be kingindex[white_king_sq][black_king_sq]*62 + rook_index. rook_index will simply be rook_square (say enumerated from a1 to h8) minus number of kings, that have a lower square number. So you will only need 3612*62 instead of 64*64*64. Taking account of symmetry will reduce this much more. Without a pawn on the board, you can restrict one king to a triangle - say a1 d1 d4. If it is not inside that triangle, you can use some symmetry operation, to transfer it there. You can even go a little bit further. When the K is on the a1 h8 diagonal, you can mirror the other king to a bigger triangle a1-h1-h8. Now again you can take the enumuration trick for KK positions. Calcualting all this out, will leave you with 463 legal KK positions, and then with 462*62 positions in KRK. This already comes close to the actual scheme used by Eugene Nalimov. Regards, Dieter
This page took 0 seconds to execute
Last modified: Thu, 15 Apr 21 08:11:13 -0700
Current Computer Chess Club Forums at Talkchess. This site by Sean Mintz.