From: Fabian Fichter Date: Fri, 23 Apr 2021 09:29:46 +0000 (+0200) Subject: Speed up piece evaluation X-Git-Url: http://winboard.nl/cgi-bin?a=commitdiff_plain;h=30b76a3bc5374ad29ce3afa13548873c23ce5ad5;p=fairystockfish.git Speed up piece evaluation standard STC ELO: 16.27 +-4.6 (95%) LOS: 100.0% Total: 10000 W: 2492 L: 2024 D: 5484 No functional change. --- diff --git a/src/evaluate.cpp b/src/evaluate.cpp index 23804b9..2975d6f 100644 --- a/src/evaluate.cpp +++ b/src/evaluate.cpp @@ -1467,13 +1467,14 @@ namespace { goto make_v; // Main evaluation begins here + std::memset(attackedBy, 0, sizeof(attackedBy)); initialize(); initialize(); // Pieces evaluated first (also populates attackedBy, attackedBy2). // For unused piece types, we still need to set attack bitboard to zero. - for (PieceType pt = KNIGHT; pt < KING; ++pt) - if (pt != SHOGI_PAWN) + for (PieceType pt : pos.piece_types()) + if (pt != SHOGI_PAWN && pt != PAWN && pt != KING) score += pieces(pt) - pieces(pt); // Evaluate pieces in hand once attack tables are complete