Skip to content

Commit 69ec09b

Browse files
locutus2zamar
authored andcommitted
Bonus for pawn scrifice which create passed pawn
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
1 parent 2529654 commit 69ec09b

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed

src/evaluate.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -618,7 +618,7 @@ namespace {
618618
{
619619
Square s = pop_lsb(&b);
620620

621-
assert(!(pos.pieces(PAWN) & forward_bb(Us, s)));
621+
assert(!(pos.pieces(Them, PAWN) & forward_bb(Us, s + pawn_push(Us))));
622622

623623
bb = forward_bb(Us, s) & (ei.attackedBy[Them][ALL_PIECES] | pos.pieces(Them));
624624
score -= HinderPassedPawn * popcount(bb);
@@ -675,8 +675,8 @@ namespace {
675675
} // rr != 0
676676

677677
// Scale down bonus for candidate passers which need more than one
678-
// pawn push to become passed.
679-
if (!pos.pawn_passed(Us, s + pawn_push(Us)))
678+
// pawn push to become passed or have a pawn in front of them.
679+
if (!pos.pawn_passed(Us, s + pawn_push(Us)) || (pos.pieces(PAWN) & forward_bb(Us, s)))
680680
mbonus /= 2, ebonus /= 2;
681681

682682
score += make_score(mbonus, ebonus) + PassedFile[file_of(s)];

src/pawns.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,13 @@ namespace {
163163
&& popcount(phalanx) >= popcount(leverPush))
164164
e->passedPawns[Us] |= s;
165165

166+
else if ( stoppers == SquareBB[s + Up]
167+
&& relative_rank(Us, s) >= RANK_5
168+
&& (b = (shift<Up>(supported) & ~theirPawns)))
169+
while(b)
170+
if(!more_than_one(theirPawns & PawnAttacks[Us][pop_lsb(&b)]))
171+
e->passedPawns[Us] |= s;
172+
166173
// Score this pawn
167174
if (!neighbours)
168175
score -= Isolated[opposed];

0 commit comments

Comments
 (0)