Author: Dieter Buerssner
Date: 10:04:45 11/16/04
Go up one level in this thread
Hi Gerd,
I made a similar experience. Some while ago, I programmed the "pawn game" (it
was discussed here, chess board, only pawns, no kings). When implementing
hashing, I remembered your idea of some simple arithmetics on the pawn bitboards
to get a hash key. I cannot remember all details, but I remember that it was
significantly worse than others schemes I tried. Best really seems to be
Zorbrist like hashing. I used a variant that is almost equivilant. Have a look
up table of zob_key[12][156]. 12 for the 12 bytes in the two bitboards, and then
I added (instead of xor) the values together. I doubt, that incremental hashkeys
would be much faster. But certainly more work and more possibilities for errors.
Still better than simple arithmetics was the following idea. I considered the 2
bitboards as the state of a PRNG (a multiply with carry generator), and
calculated a "random number" out of this state.
INLINE HASH_ENTRY *calc_idx(int side, POSITION *pos)
{
unsigned long idx, l1, l2;
/* The const slows down this code by a factor of 10 on some K6 */
static /* const */unsigned long mul=2051013963UL; /* 999996864UL */
unsigned long *lp = (unsigned long *)pos->pawns;
l2 = lp[0];
l1 = lp[1];
idx = l2+l1*mul;
l2 = lp[2];
l1 = lp[3];
idx += l2+l1*mul;
idx = (idx%hentries)*3; /* cluster 3 entries per pos together *(
// idx = ((unsigned long)((hentries * (unsigned long long)idx)>>32))*3;
return htable[side]+idx;
}
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.