]> git.sesse.net Git - stockfish/commitdiff
Add penalty for doubled pawns in agile structure
authorLolligerhans <lolligerhans@gmx.de>
Tue, 12 Jan 2021 13:30:25 +0000 (14:30 +0100)
committerJoost VandeVondele <Joost.VandeVondele@gmail.com>
Sun, 17 Jan 2021 08:35:59 +0000 (09:35 +0100)
Give an additional penalty of S(20, 10) for any doubled pawn if none of
the opponent's pawns is facing any of our
 - pawns or
 - pawn attacks;
that means, each of their pawns can push at least one square without
being captured.
This ignores their non-pawns pieces and attacks.

One possible justification: Their pawns' ability to push freely provides
options to react to our threats by changing their pawn structure. Our
doubled pawns however will likely lead to an exploitable weakness, even
if the pawn structure is not yet fixed.

Note that the notion of "their pawns not being fixed" is symmetric for
both players: If all of their pawns can push freely so can ours. All
pawns being freely pushable might just be an early-game-indicator.
However, it can trigger during endgame pawns races, where doubled pawns
are especially hindering, too.

LTC
LLR: 2.94 (-2.94,2.94) {0.25,1.25}
Total: 134976 W: 17964 L: 17415 D: 99597
Ptnml(0-2): 998, 12702, 39619, 13091, 1078
https://tests.stockfishchess.org/tests/view/5ffdd5316019e097de3ef281

STC
LLR: 2.94 (-2.94,2.94) {-0.25,1.25}
Total: 35640 W: 7219 L: 6904 D: 21517
Ptnml(0-2): 645, 4096, 8084, 4289, 706
https://tests.stockfishchess.org/tests/view/5ffda4a16019e097de3ef265

closes https://github.com/official-stockfish/Stockfish/pull/3302

Bench: 4363873

src/pawns.cpp

index de47570efaf4a5620783403e3977c90651e29815..5d6770ed76eafb88bcd871a790f45c289a0b1e0a 100644 (file)
@@ -32,6 +32,7 @@ namespace {
   // Pawn penalties
   constexpr Score Backward      = S( 6, 23);
   constexpr Score Doubled       = S(13, 53);
+  constexpr Score DoubledEarly  = S(20, 10);
   constexpr Score Isolated      = S( 2, 15);
   constexpr Score WeakLever     = S( 5, 57);
   constexpr Score WeakUnopposed = S(16, 22);
@@ -86,6 +87,7 @@ namespace {
 
     constexpr Color     Them = ~Us;
     constexpr Direction Up   = pawn_push(Us);
+    constexpr Direction Down = -Up;
 
     Bitboard neighbours, stoppers, support, phalanx, opposed;
     Bitboard lever, leverPush, blocked;
@@ -123,6 +125,13 @@ namespace {
         phalanx    = neighbours & rank_bb(s);
         support    = neighbours & rank_bb(s - Up);
 
+        if (doubled)
+        {
+            // Additional doubled penalty if none of their pawns is fixed
+            if (!(ourPawns & shift<Down>(theirPawns | pawn_attacks_bb<Them>(theirPawns))))
+                score -= DoubledEarly;
+        }
+
         // A pawn is backward when it is behind all pawns of the same color on
         // the adjacent files and cannot safely advance.
         backward =  !(neighbours & forward_ranks_bb(Them, s + Up))