Ben Lambrechts wrote:

Now I got the following problem: how to rotate/mirror the board for a unique representation.

Both are the same board, but has anyone made an algorithm that rotates the board or an area of the board in a unique way?
I don't need the move order, just the "snapshot" of the board.

Compute the the min(8 Zobrist hashes for all mirror/rot combinations)

(x, y), (inv Y, x), (inv X, inv Y), (y, inv X), (inv X, y), (inv Y, inv X), (x, inv Y), (y, x).

Call the smallest of the 8 hashes the "canonical hash".

Make a database of "canonical hashes". Since Zobrist hashes can be updated
incrementally, checking over the legal moves is just xoring the 8 hashes of the each legal move (with a given mirror/rot) to the hashes of the current position in that same mirror/rot. You store 8 hashes for the current position (=without the move) and compute the 8 hashes of the next position. The smallest of these is the canonical of the next position. This is repeated for each legal move. Its simple, but perhaps my explanation makes it sound more complicated than it is ;-)


Jacques.

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

Reply via email to