# alpha beta - Zobrist key

This topic is 4599 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

Hello, i can't implement the alpha beta algorithm with zobrist hashing. Yes, i googled very lot and used the search function within this forum too but nothin could help me to understand the zobrist hashing. It would be very kind if anybody could explain it to me.... Thanks a lot

##### Share on other sites
Here is a link I found on google that appears to explain the concept very clearly: http://www.seanet.com/~brucemo/topics/zobrist.htm

##### Share on other sites
thanks
i don't understand how to compute the zobrist key.....
see method probeHash -> ZobristKey()

##### Share on other sites
You look up values in a table for the current positions of each piece, and xor the values together.

I do not see anything that looks like "probeHash -> ZobristKey()"

##### Share on other sites
Thanks,
but i still have several problems:
1)
In the following code:

int probe_hash(int depth, int alpha, int beta, int bestMoveTmp)
{
HASH * h = ...
if(h->key == Zobrist_key())
{
if(h->depth >= depth)
{
if(h->flags == hashExact) return h->val;
if((h->flags == hashAlpha) && (h->val flags == hashBeta) && (h->val >= beta)) return beta;
}
bestMove = bestMoveTmp;
}
return NULL;
}

which i reprogrammed of the following link:
http://www.seanet.com/~brucemo/topics/hashing.htm
i don't know ho to implement the line:
if(h->key == Zobrist_key())

how do i calculate the zobrist keys ?
Or how do i look within the TT ?

##### Share on other sites
For each square.. for each piece.. create a random table of values used to form the zobrist key. This is an initialization step.

The zobrist key is then formed by Xor'ing all the values from this table that correspond to real pieces on real squares (ie, an actual board position)

Until you understand that.. dont bother with anything else. Seriously.

1. 1
2. 2
3. 3
Rutin
22
4. 4
5. 5

• 13
• 19
• 14
• 9
• 9
• ### Forum Statistics

• Total Topics
632934
• Total Posts
3009301
• ### Who's Online (See full list)

There are no registered users currently online

×