[Computer-go] java code for Zobrist hashing

Robert Finking robertfinkng555 at o2.co.uk
Thu Feb 9 14:28:24 PST 2012


Zobrist hashing is very simple - it requires only an array filled with 
random data and XOR - not the sort of thing you'd normally bother 
publishing I guess (although a quick google found this: 
http://burtleburtle.net/bob/hash/doobs.html). To use it in a game, the 
only other thing you need is a method of mapping from the board to the 
array. If you make the array 19x19x3 then mapping to a Go board is 
trivial (final dimension indicates black/white/liberty).

The thing that makes Zobrist so fast is that you don't need to 
recalculate the whole hash every time the game board changes, you just 
calculate the deltas - this is made easy by use of XOR. The wikipedia 
article explains this nicely (albeit from a chess point of view):
http://en.wikipedia.org/wiki/Zobrist_hashing

I noticed you say "recent" - have there been improvements to the 
original idea?

I hope this is at least vaguely useful :-)

Raffles

On 09/02/2012 20:53, Ray Tayek wrote:
> hi, does anyone have a recent example?
>
> is this what you guys are using in your game programs?
>
> thanks
>
> ---
> co-chair http://ocjug.org/
>
> _______________________________________________
> Computer-go mailing list
> Computer-go at dvandva.org
> http://dvandva.org/cgi-bin/mailman/listinfo/computer-go
>




More information about the Computer-go mailing list