Speed up pocket evaluation
authorFabian Fichter <ianfab@users.noreply.github.com>
Thu, 22 Apr 2021 20:33:39 +0000 (22:33 +0200)
committerFabian Fichter <ianfab@users.noreply.github.com>
Thu, 22 Apr 2021 20:33:39 +0000 (22:33 +0200)
crazyhouse STC
ELO: 23.77 +-6.7 (95%) LOS: 100.0%
Total: 10000 W: 5176 L: 4493 D: 331

No functional change.

src/evaluate.cpp

index f09f4ca..23804b9 100644 (file)
@@ -628,7 +628,7 @@ namespace {
 
     Score score = SCORE_ZERO;
 
-    if (pos.count_in_hand(Us, pt) > 0)
+    if (pos.count_in_hand(Us, pt) > 0 && pt != KING)
     {
         Bitboard b = pos.drop_region(Us, pt) & ~pos.pieces() & (~attackedBy2[Them] | attackedBy[Us][ALL_PIECES]);
         if ((b & kingRing[Them]) && pt != SHOGI_PAWN)
@@ -1478,7 +1478,7 @@ namespace {
 
     // Evaluate pieces in hand once attack tables are complete
     if (pos.piece_drops() || pos.seirawan_gating())
-        for (PieceType pt = PAWN; pt < KING; ++pt)
+        for (PieceType pt : pos.piece_types())
             score += hand<WHITE>(pt) - hand<BLACK>(pt);
 
     score += (mobility[WHITE] - mobility[BLACK]) * (1 + pos.captures_to_hand() + pos.must_capture() + pos.check_counting());