I actually have a routine in Lazarus that rotates a full board. It's called transformBoard() and it takes 2 arguments - a board to rotate and a transformation (0 through 7) and returns a new rotated board.
I don't use it much except for debugging or stuff done at the root, because there are faster ways to do things. I also have a routine called canHash() which returns a canonical hash of the board by trying all 8 transformations and returning the lowest valued one. It is more efficient (but not efficient) because it doesn't actually produce a new board - it just builds 8 hashes of the board from scratch without touching anything. This routine is only used at the root for storing opening book moves. You can use zobrist hashing for maintaining all 8 keys incrementally, but you probably need a fairly good reason to do so. Incrementally updating of 1 key is almost free, but 8 might be noticeable if you are doing it inside a tree search or play-outs. It depends on how "fat" or "lean" your program is. Even 8 keys may not be noticeable if your program does a lot of work at each move (or an end nodes.) If you are not, then it doesn't really matter how you do it. I typically have 2 routines for everything - I have a slow_make() and a fast_make() and the fast_make() doesn't care about superko (although it checks for simple-ko) or anything that fast play-outs doesn't care about. So the fast make doesn't even try to update zobrist keys. - Don Ben Lambrechts wrote: > Hi all, > > I am planning a fuseki database. > Now I got the following problem: how to rotate/mirror the board for a > unique representation. > > $$c > $$ +---------------------------------------+ > $$ | . . . . . . . . . . . . . . . . . . . | > $$ | . . . . . . . . . . . . . . . . . . . | > $$ | . . . . . . . . . . . . . . . . . . . | > $$ | . . . O . . . . . , . . . . . X . . . | > $$ | . . . . . . . . . . . . . . . . . . . | > $$ | . . . . . . . . . . . . . . . . . . . | > $$ | . . . . . . . . . . . . . . . . . . . | > $$ | . . . . . . . . . . . . . . . . . . . | > $$ | . . . . . . . . . . . . . . . . . . . | > $$ | . . . , . . . . . , . . . . . , . . . | > $$ | . . . . . . . . . . . . . . . . 5 . . | > $$ | . . . . . . . . . . . . . . . . . . . | > $$ | . . . . . . . . . . . . . . . . . . . | > $$ | . . . . . . . . . . . . . . . . . . . | > $$ | . . . . . . . . . . . . . . . . . . . | > $$ | . . . O . . . . . , . . . . . , . . . | > $$ | . . . . . . . . . . . . . . . X . . . | > $$ | . . . . . . . . . . . . . . . . . . . | > $$ | . . . . . . . . . . . . . . . . . . . | > $$ +---------------------------------------+ > > $$c > $$ +---------------------------------------+ > $$ | . . . . . . . . . . . . . . . . . . . | > $$ | . . . . . . . . . . . . . . . . . . . | > $$ | . . . . . . . . 5 . . . . . . . . . . | > $$ | . . X , . . . . . , . . . . . X . . . | > $$ | . . . . . . . . . . . . . . . . . . . | > $$ | . . . . . . . . . . . . . . . . . . . | > $$ | . . . . . . . . . . . . . . . . . . . | > $$ | . . . . . . . . . . . . . . . . . . . | > $$ | . . . . . . . . . . . . . . . . . . . | > $$ | . . . , . . . . . , . . . . . , . . . | > $$ | . . . . . . . . . . . . . . . . . . . | > $$ | . . . . . . . . . . . . . . . . . . . | > $$ | . . . . . . . . . . . . . . . . . . . | > $$ | . . . . . . . . . . . . . . . . . . . | > $$ | . . . . . . . . . . . . . . . . . . . | > $$ | . . . O . . . . . , . . . . . O . . . | > $$ | . . . . . . . . . . . . . . . . . . . | > $$ | . . . . . . . . . . . . . . . . . . . | > $$ | . . . . . . . . . . . . . . . . . . . | > $$ +---------------------------------------+ > > 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. > > Ben > _______________________________________________ > computer-go mailing list > computer-go@computer-go.org > http://www.computer-go.org/mailman/listinfo/computer-go/ > _______________________________________________ computer-go mailing list computer-go@computer-go.org http://www.computer-go.org/mailman/listinfo/computer-go/