Say you represent the content of each point with 0 for empty, 1 for black
and 2 for white. Start by creating a table of 19x19x3 random 64-bit numbers.

unsigned long long zobrist_table[19][19][3];

...
unsigned long long zobrist_key=0;

for(int row=0;row<19;++row){
  for(int col=0;col<19;++col){
    int point_content = board[row][col];
    zobrist_key ^= zobrist_table[row][col][point_content];
  }
}

The result is the zobrist key. In practice, you would make the zobrist key
part of your representation of the board, and when you modify the board, you
just incrementally update the zobrist key. Just remember that when you
change the content of a point,
new_zobrist_key = old_zobrist_key ^
zobrist_table[row][col][old_point_content] ^
zobrist_table[row][col][new_point_content];

Get that working first and then reread Jacques's post.

Álvaro.
_______________________________________________
computer-go mailing list
computer-go@computer-go.org
http://www.computer-go.org/mailman/listinfo/computer-go/

Reply via email to