[computer-go] Zobrist hashing with easy transformation comparison
Nick Apperson
apperson at gmail.com
Fri Feb 9 14:21:47 PST 2007
Hey all,
I was thinking about our conversation and i decided to design a zobrist
class that allows for easy comparison to check and see if 2 different
zobrist values are equivalent after a rotation etc... It updates the
zobrist in such a way that it can transform them and after trying 8
possiblilities, it can determine if they are equal. There are actually
quite a few optimizations that could be performed on it, but I just wanted
to post the basic idea. See the following source code for the basic idea:
http://www.nicholasapperson.com/computergo/zobrist.h
Essentially it works so that it hashes the played stone as each of the
rotated forms and stores that in each of the 8 bytes used. The bytes are
arranged in an order such that flipping the 2 DWORDs results in the zobrist
value for if there was a rotation in the x axis, flipping WORDs results in a
reflection across the y axis and swapping bytes results in a reflection
across the y=x line. Order obviously matters in the case of xy so the
transformation is assumed to take place after the other reflections. For
example:
if we have 0x1234567890ABCDEF as a zobrist value,
0x90ABCDEF12345678 would be the zobrist of the position with a reflection
across the x-axis
Anyway, I'm sure there is a bug or two, but I wanted to get your alls
thoughts.
- Nick
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://computer-go.org/pipermail/computer-go/attachments/20070209/02635a2f/attachment.htm
More information about the computer-go
mailing list