Sign in to follow this  

alpha beta - Zobrist key

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

If you intended to correct an error in the post then please contact us.

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 this post


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

If this page can't help you understand it, there is nothing anyone here will be able to do for you without more information.

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
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 this post


Link to post
Share on other sites
Guest Anonymous Poster
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 this post


Link to post
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.

Share this post


Link to post
Share on other sites

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

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this