X-Git-Url: http://winboard.nl/cgi-bin?a=blobdiff_plain;f=book.c;h=8872d16987d3a26a148b3a70725f4deaa537549d;hb=7b721be1faca2a8524f56ab9e414d0bb97215765;hp=bb9d1703307249c4b2b654ddf6a689e46e545111;hpb=f1549d478be5058606811dac414d79492d1ebe5c;p=xboard.git diff --git a/book.c b/book.c index bb9d170..8872d16 100644 --- a/book.c +++ b/book.c @@ -28,6 +28,8 @@ * ------------------------------------------------------------------------ */ +#include "config.h" + #include #include #include @@ -326,7 +328,8 @@ hash (int moveNr) pieceGroup = p_enc / 12; p_enc = p_enc % 12; Zobrist = RandomPiece[64*p_enc + (squareNr & 63)]; - switch(pieceGroup) { + if(pieceGroup & 4) Zobrist *= 987654321; + switch(pieceGroup & 3) { case 1: // pieces 5-10 (FEACWM) Zobrist = (Zobrist << 16) ^ (Zobrist >> 48); break; @@ -337,7 +340,8 @@ hash (int moveNr) Zobrist = (Zobrist << 48) ^ (Zobrist >> 16); break; } - if(squareNr >= 64) Zobrist = (Zobrist << 8) ^ (Zobrist >> 56); + if(squareNr & 64) Zobrist = (Zobrist << 8) ^ (Zobrist >> 56); + if(squareNr & 128) Zobrist = (Zobrist << 4) ^ (Zobrist >> 60); // holdings have separate (additive) key, to encode presence of multiple pieces on same square if(f == BOARD_LEFT-2) holdingsKey += Zobrist * boards[moveNr][r][f+1]; else if(f == BOARD_RGHT+1) holdingsKey += Zobrist * boards[moveNr][r][f-1]; else @@ -792,6 +796,7 @@ DisplayBook (int moveNr) p = MovesToText(count, entries); EditTagsPopUp(p, NULL); free(p); + addToBookFlag = FALSE; return TRUE; }