]> git.sesse.net Git - stockfish/commitdiff
Tweak backward pawns definition
authorStéphane Nicolet <cassio@free.fr>
Tue, 2 Jun 2015 19:06:46 +0000 (12:06 -0700)
committerGary Linscott <glinscott@gmail.com>
Tue, 2 Jun 2015 19:07:02 +0000 (12:07 -0700)
Advanced pawns cannot be backward. Also lower the backward penalty in
endgame.

Passed STC:
LLR: 2.96 (-2.94,2.94) [-1.50,4.50]
Total: 18534 W: 3588 L: 3433 D: 11513

and LTC:
LLR: 2.96 (-2.94,2.94) [0.00,6.00]
Total: 21319 W: 3415 L: 3217 D: 14687

Bench: 7271152

Resolves #359

src/pawns.cpp

index 8e3e7815ec60bdf8193979a015fc57abfb645db1..ee46279d8957a757f0877421c003c6df2b2020e5 100644 (file)
@@ -44,7 +44,7 @@ namespace {
     S(40, 35), S(40, 35), S(36, 35), S(25, 30) } };
 
   // Backward pawn penalty by opposed flag
     S(40, 35), S(40, 35), S(36, 35), S(25, 30) } };
 
   // Backward pawn penalty by opposed flag
-  const Score Backward[2] = { S(67, 56), S(49, 40) };
+  const Score Backward[2] = { S(67, 42), S(49, 24) };
 
   // Connected pawn bonus by opposed, phalanx, twice supported and rank
   Score Connected[2][2][2][RANK_NB];
 
   // Connected pawn bonus by opposed, phalanx, twice supported and rank
   Score Connected[2][2][2][RANK_NB];
@@ -147,9 +147,10 @@ namespace {
         // Test for backward pawn.
         // If the pawn is passed, isolated, lever or connected it cannot be
         // backward. If there are friendly pawns behind on adjacent files
         // Test for backward pawn.
         // If the pawn is passed, isolated, lever or connected it cannot be
         // backward. If there are friendly pawns behind on adjacent files
-        // it cannot be backward either.
+        // or if it is sufficiently advanced, it cannot be backward either.
         if (   (passed | isolated | lever | connected)
         if (   (passed | isolated | lever | connected)
-            || (ourPawns & pawn_attack_span(Them, s)))
+            || (ourPawns & pawn_attack_span(Them, s))
+            || (relative_rank(Us, s) >= RANK_5))
             backward = false;
         else
         {
             backward = false;
         else
         {