Evaluate ungatable pieces in Seirawan
authoralwey <alwey@free.software>
Sat, 5 Sep 2020 07:23:12 +0000 (09:23 +0200)
committerFabian Fichter <ianfab@users.noreply.github.com>
Sun, 6 Sep 2020 20:19:28 +0000 (22:19 +0200)
src/evaluate.cpp

index 5056b79..0f1f0c5 100644 (file)
@@ -467,6 +467,10 @@ namespace {
                                 std::max(PieceValue[EG][pos.promoted_piece_type(pt)] - PieceValue[EG][pt], VALUE_ZERO)) / 4 * pos.count_in_hand(Us, pt);
         if (pos.enclosing_drop())
             mobility[Us] += make_score(500, 500) * popcount(b);
+
+        // Reduce score if there is a deficit of gates
+        if (pos.seirawan_gating() && !pos.piece_drops() && pos.count_in_hand(Us, ALL_PIECES) > popcount(pos.gates(Us)))
+            score -= make_score(200, 900) / pos.count_in_hand(Us, ALL_PIECES) * (pos.count_in_hand(Us, ALL_PIECES) - popcount(pos.gates(Us)));
     }
 
     return score;