Ben Lambrechts wrote:
> I am planning a fuseki database.
> Now I got the following problem: how to rotate/mirror the board for a
> unique representation.

Other people have already explained the theory so let me give a
practical solution. With GNU Go from CVS (3.7.11 is too old) you can
do like this (small board example):

kebnekaise 860% ./gnugo --mode gtp --boardsize 7
play black C3
=

play white E3
=

play black C5
=

play white E5
=

showboard
=
   A B C D E F G
 7 . . . . . . . 7
 6 . . . . . . . 6
 5 . . X . O . . 5
 4 . . . + . . . 4
 3 . . X . O . . 3
 2 . . . . . . . 2     WHITE (O) has captured 0 stones
 1 . . . . . . . 1     BLACK (X) has captured 0 stones
   A B C D E F G

invariant_hash
= 260eb1ddc749acde

The invariant hash is the minimum of 8 Zobrist hashes for the
different rotations/translations, like other people have proposed.
Notice that you don't need to transform the board to a canonical
orientation. Just let the first position you encounter for a specific
invariant hash be the canonical position for that hash. Or forget the
board entirely and just work with hashes.

For convenience there's also:

invariant_hash_for_moves black
= A7 318e964ed7069379
B7 0373fdd44fdafe00
C7 26f758754b488c86
D7 05b6443c9d60e37d
E7 12f40e9983a36311
F7 325059d1da0d1dc6
G7 2e25b88c7212e237
A6 1a23fde0d4c2013a
B6 392298324b51f7b0
C6 4e2e21d52cd43b8f
D6 15eebcd82563e84e
E6 03819ba2084b34c8
F6 2689b6f0ee4586fe
G6 255c9056f34a98a2
A5 0d5f205b26b7125f
B5 0ed199b674d50654
D5 0ee34df698dac1de
F5 11b25345cd62e0c7
G5 20878af3e6c718f4
A4 a460c09fab970d82
B4 0a45921a80779900
C4 114863343dceb090
D4 27be3651d6b14106
E4 597651a0d52c681c
F4 5fabee9c42e474a8
G4 12c61843f864fb16
A3 0d5f205b26b7125f
B3 0ed199b674d50654
D3 0ee34df698dac1de
F3 11b25345cd62e0c7
G3 20878af3e6c718f4
A2 1a23fde0d4c2013a
B2 392298324b51f7b0
C2 4e2e21d52cd43b8f
D2 15eebcd82563e84e
E2 03819ba2084b34c8
F2 2689b6f0ee4586fe
G2 255c9056f34a98a2
A1 318e964ed7069379
B1 0373fdd44fdafe00
C1 26f758754b488c86
D1 05b6443c9d60e37d
E1 12f40e9983a36311
F1 325059d1da0d1dc6
G1 2e25b88c7212e237

Notice how e.g. D3 and D5 lead to positions with the same invariant
hash, as they should.

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

Reply via email to