Consider blocked pawns in CTF bonus
authorFabian Fichter <ianfab@users.noreply.github.com>
Sun, 10 May 2020 08:48:47 +0000 (10:48 +0200)
committerFabian Fichter <ianfab@users.noreply.github.com>
Sun, 10 May 2020 08:48:47 +0000 (10:48 +0200)
kingofthehill STC
LLR: 2.97 (-2.94,2.94) [0.00,10.00]
Total: 1552 W: 729 L: 616 D: 207
http://www.variantfishtest.org:6543/tests/view/5eb66c286e23db36d55f2af6

kingofthehill LTC
LLR: 2.95 (-2.94,2.94) [0.00,10.00]
Total: 1165 W: 530 L: 427 D: 208
http://www.variantfishtest.org:6543/tests/view/5eb6d1a46e23db36d55f2b24

src/evaluate.cpp

index 1f9a485..d2209fd 100644 (file)
@@ -902,7 +902,8 @@ namespace {
   template<Tracing T> template<Color Us>
   Score Evaluation<T>::variant() const {
 
-    constexpr Color Them = (Us == WHITE ? BLACK : WHITE);
+    constexpr Color Them = ~Us;
+    constexpr Direction Down = pawn_push(Them);
 
     Score score = SCORE_ZERO;
 
@@ -933,7 +934,7 @@ namespace {
                 Bitboard attacks = (  (PseudoAttacks[Us][ptCtf][s] & pos.pieces())
                                     | (PseudoMoves[Us][ptCtf][s] & ~pos.pieces())) & ~processed & pos.board_bb();
                 ctfPieces |= attacks & ~(pos.pieces(Us, PAWN) | attackedBy[Them][ALL_PIECES]);
-                onHold |= attacks & ~((pos.pieces(Us, PAWN) & attackedBy[Them][ALL_PIECES]) | attackedBy2[Them]);
+                onHold |= attacks & ~((pos.pieces(Us, PAWN) & (shift<Down>(pos.pieces()) | attackedBy[Them][ALL_PIECES])) | attackedBy2[Them]);
                 onHold2 |= attacks;
             }
         }