Jump to content
  • Advertisement
Sign in to follow this  
MatNew

alpha beta - Zobrist key

This topic is 4509 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
Advertisement
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
thanks
see this page yes...
i don't understand how to compute the zobrist key.....
see method probeHash -> ZobristKey()

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
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!