From: ianfab Date: Sun, 12 Aug 2018 09:49:53 +0000 (+0200) Subject: Fix #5: Set attack bitboards for all piece types X-Git-Url: http://winboard.nl/cgi-bin?a=commitdiff_plain;h=d1ebfd0efb368fbb80aaf5bf4f6f878f2fa3c136;p=fairystockfish.git Fix #5: Set attack bitboards for all piece types This fixes issues with uninitialized attack tables. Bench results are deterministic now also for variants that are missing some of the standard chess piece types. No functional change for standard chess. --- diff --git a/src/evaluate.cpp b/src/evaluate.cpp index e009ba5..4333e24 100644 --- a/src/evaluate.cpp +++ b/src/evaluate.cpp @@ -944,10 +944,10 @@ namespace { initialize(); initialize(); - // Pieces should be evaluated first (populate attack tables) - for (PieceType pt : pos.piece_types()) - if (pt != PAWN && pt != KING) - score += pieces(pt) - pieces(pt); + // Pieces should be evaluated first (populate attack tables). + // For unused piece types, we still need to set attack bitboard to zero. + for (PieceType pt = KNIGHT; pt < KING; ++pt) + score += pieces(pt) - pieces(pt); score += mobility[WHITE] - mobility[BLACK];