Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: Fast hash key method - Revisited!

Author: Bruce Moreland

Date: 10:54:59 01/14/98

Go up one level in this thread



On January 14, 1998 at 13:20:48, John Scalo wrote:

>So is this by design or am I missing something? If it's by design, does
>it make sense that hashing the entire board every time is actually
>faster because the # of nodes is so much lower?

You missed something.

When you move a piece from a1 to a2, you have to XOR out the value for
the square a1, then XOR in the value for the square a2.  So:

    hashNew = hashOld ^ hashFrom ^ hashTo;

You also have to hash out a piece that you capture.

This can get a little complicated if you promote, capture en-passant, or
castle, so make sure you get these cases right.

This whole thing is a pure performance optimization.  You should search
*exactly* the same tree that you did before.  You can verify this if you
take the time to do it, and I strongly recommend doing this.

bruce



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.