]> git.sesse.net Git - stockfish/commitdiff
Rank threats on pinned pawns
authorStefan Geschwentner <locutus2@users.noreply.github.com>
Wed, 25 Jul 2018 23:28:37 +0000 (01:28 +0200)
committerStéphane Nicolet <cassio@free.fr>
Wed, 25 Jul 2018 23:29:12 +0000 (01:29 +0200)
Add for pinned pawns half of the standard rank based threat bonus.

STC:
LLR: 2.97 (-2.94,2.94) [0.00,5.00]
Total: 44010 W: 9987 L: 9635 D: 24388
http://tests.stockfishchess.org/tests/view/5b58aa780ebc5902bdb88c7a

LTC:
LLR: 2.95 (-2.94,2.94) [0.00,5.00]
Total: 29475 W: 5089 L: 4847 D: 19539
http://tests.stockfishchess.org/tests/view/5b58b56c0ebc5902bdb88f37

Closes https://github.com/official-stockfish/Stockfish/pull/1701

Bench: 4503866

src/evaluate.cpp

index 7309f9f31a6c5e7c7de25bdaac4e75394f9f9f57..ac9cf90bdcb314aad1198af283f0ab8d9662eb6c 100644 (file)
@@ -540,6 +540,9 @@ namespace {
             score += ThreatByMinor[type_of(pos.piece_on(s))];
             if (type_of(pos.piece_on(s)) != PAWN)
                 score += ThreatByRank * (int)relative_rank(Them, s);
+
+            else if (pos.blockers_for_king(Them) & s)
+                score += ThreatByRank * (int)relative_rank(Them, s) / 2;
         }
 
         b = weak & attackedBy[Us][ROOK];
@@ -549,6 +552,9 @@ namespace {
             score += ThreatByRook[type_of(pos.piece_on(s))];
             if (type_of(pos.piece_on(s)) != PAWN)
                 score += ThreatByRank * (int)relative_rank(Them, s);
+
+            else if (pos.blockers_for_king(Them) & s)
+                score += ThreatByRank * (int)relative_rank(Them, s) / 2;
         }
 
         if (weak & attackedBy[Us][KING])