]> git.sesse.net Git - stockfish/commitdiff
Bonus for pawn scrifice which create passed pawn
authorStefan Geschwentner <stgeschwentner@gmail.com>
Mon, 8 May 2017 03:38:03 +0000 (20:38 -0700)
committerJoona Kiiski <joona@zoox.com>
Mon, 8 May 2017 03:51:52 +0000 (20:51 -0700)
STC:
LLR: 2.95 (-2.94,2.94) [0.00,5.00]
Total: 16752 W: 3141 L: 2944 D: 10667

LTC:
LLR: 3.34 (-2.94,2.94) [0.00,5.00]
Total: 33928 W: 4544 L: 4300 D: 25084

Bench: 5639223

Closes #1092

src/evaluate.cpp
src/pawns.cpp

index e381d6f8e503d432f3f837fcd40611f0b600a5e8..92ad6e9a28ceee7ba7cd11bde5ed46164ed45a8b 100644 (file)
@@ -618,7 +618,7 @@ namespace {
     {
         Square s = pop_lsb(&b);
 
     {
         Square s = pop_lsb(&b);
 
-        assert(!(pos.pieces(PAWN) & forward_bb(Us, s)));
+        assert(!(pos.pieces(Them, PAWN) & forward_bb(Us, s + pawn_push(Us))));
 
         bb = forward_bb(Us, s) & (ei.attackedBy[Them][ALL_PIECES] | pos.pieces(Them));
         score -= HinderPassedPawn * popcount(bb);
 
         bb = forward_bb(Us, s) & (ei.attackedBy[Them][ALL_PIECES] | pos.pieces(Them));
         score -= HinderPassedPawn * popcount(bb);
@@ -675,8 +675,8 @@ namespace {
         } // rr != 0
 
         // Scale down bonus for candidate passers which need more than one
         } // rr != 0
 
         // Scale down bonus for candidate passers which need more than one
-        // pawn push to become passed.
-        if (!pos.pawn_passed(Us, s + pawn_push(Us)))
+        // pawn push to become passed or have a pawn in front of them.
+        if (!pos.pawn_passed(Us, s + pawn_push(Us)) || (pos.pieces(PAWN) & forward_bb(Us, s)))
             mbonus /= 2, ebonus /= 2;
 
         score += make_score(mbonus, ebonus) + PassedFile[file_of(s)];
             mbonus /= 2, ebonus /= 2;
 
         score += make_score(mbonus, ebonus) + PassedFile[file_of(s)];
index 17a96670911dc414b351ca7f2197dada32a510a7..95d5fb4cfeb5af4da52552430224b3622470d3cc 100644 (file)
@@ -163,6 +163,13 @@ namespace {
             && popcount(phalanx)   >= popcount(leverPush))
             e->passedPawns[Us] |= s;
 
             && popcount(phalanx)   >= popcount(leverPush))
             e->passedPawns[Us] |= s;
 
+        else if (    stoppers == SquareBB[s + Up]
+                 &&  relative_rank(Us, s) >= RANK_5
+                 && (b = (shift<Up>(supported) & ~theirPawns)))
+            while(b)
+                if(!more_than_one(theirPawns & PawnAttacks[Us][pop_lsb(&b)]))
+                    e->passedPawns[Us] |= s;
+
         // Score this pawn
         if (!neighbours)
             score -= Isolated[opposed];
         // Score this pawn
         if (!neighbours)
             score -= Isolated[opposed];