Author: Dieter Buerssner
Date: 04:29:59 09/14/00
Go up one level in this thread
On September 13, 2000 at 17:12:07, Andreas Herrmann wrote: >i want to include pawn hash tables in my chess program holmes, but i don't know >how i have to calculate the hash index and the hash key. >I think the hash index of the position will only calculated with the pawns on >the board like the following, > >for (pos=A1;pos<=h8;pos=pos+1) { > if (figure[pos]=pawn) { > PawnHashIndex = PawnHashIndex ^ RandomIndex[pos].index; > } >} > >is this right?? There is at least missing some color information. With your scheme, you will get the same pawn hash for two positions with the same pawn structure, and on pawn changes color. Also, it might be useful, to hash the king positions, when much of your pawn evaluation depends on king positions. Without king positions in pseudo-C hash_t RandomIndex[64][2]; /* Initialize by Pseudo random numbers */ PawnHashIndex = 0; for (pos = A1; pos <= H8; pos++) if (figure[pos] == pawn) PawnHashIndex ^= RandomIndex[pos][color[pos]]; I guess, that it is obvious, that you don't want to do this after every move. If you move a pawn , you can update the PawnHashIndex by /* Update the pawn hash for "normal" pawn move */ PawnHashIndex ^= RandomIndex[from][side]; /* clear the old pawn position */ PawnHashIndex ^= RandomIndex[to][side]; /* put in the new pawn position */ Similar code is needed for captures of a pawn and pawn promotions. 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.