www.delorie.com/gnu/docs/gnugo/gnugo_170.html   search  
 
Buy GNU books!


GNU Go Documentation

[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

14.2.1 Calculation of the hash value

The hash algorithm is called Zobrist hashing, and is a standard technique for go and chess programming. The algorithm as used by us works as follows:

  1. First we define a go position. This positions consists of

    It is not necessary to specify the color to move (white or black) as part of the position. The reason for this is that read results are stored separately for the various reading functions such as attack3, and it is implicit in the calling function which player is to move.

  2. For each location on the board we generate random numbers:

    These random numbers are generated once at initialization time and then used throughout the life time of the hash table.

  3. The hash key for a position is the XOR of all the random numbers which are applicable for the position (white stones, black stones, and ko position).


  webmaster     delorie software   privacy  
  Copyright 2003   by The Free Software Foundation     Updated Jun 2003