From: H.G.Muller Date: Mon, 2 Mar 2015 18:16:09 +0000 (+0100) Subject: Extend book to 48 piece types and 256 squares X-Git-Url: http://winboard.nl/cgi-bin?a=commitdiff_plain;h=9249912d43d4c814c953f51146a65fc33250e385;p=xboard.git Extend book to 48 piece types and 256 squares Before the Zobrist key could only handle 24 piece types and 128 squares. --- diff --git a/book.c b/book.c index dc81458..8872d16 100644 --- a/book.c +++ b/book.c @@ -328,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; @@ -339,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