Skip to content

Commit

Permalink
More bonus for free passed pawn
Browse files Browse the repository at this point in the history
Give even more bonus to passed pawn if adjacent squares to its path
are not attacked.

passed STC
http://tests.stockfishchess.org/tests/view/5d08c9b10ebc5925cf0a6630
LLR: 2.95 (-2.94,2.94) [0.50,4.50]
Total: 175197 W: 39859 L: 38816 D: 96522

passed LTC
http://tests.stockfishchess.org/tests/view/5d0ab8240ebc5925cf0a8fe4
LLR: 2.95 (-2.94,2.94) [0.00,3.50]
Total: 92928 W: 16124 L: 15682 D: 61122

Bench: 3398333
  • Loading branch information
Vizvezdenec authored and snicolet committed Jun 20, 2019
1 parent 8bf21a7 commit 37ffacf
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/evaluate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -605,6 +605,7 @@ namespace {
};

Bitboard b, bb, squaresToQueen, defendedSquares, unsafeSquares;
Bitboard wideUnsafeSquares;
Score score = SCORE_ZERO;

b = pe->passed_pawns(Us);
Expand Down Expand Up @@ -639,6 +640,7 @@ namespace {
// consider all the squaresToQueen. Otherwise consider only the squares
// in the pawn's path attacked or occupied by the enemy.
defendedSquares = unsafeSquares = squaresToQueen = forward_file_bb(Us, s);
wideUnsafeSquares = AllSquares;

bb = forward_file_bb(Them, s) & pos.pieces(ROOK, QUEEN);

Expand All @@ -647,10 +649,14 @@ namespace {

if (!(pos.pieces(Them) & bb))
unsafeSquares &= attackedBy[Them][ALL_PIECES] | pos.pieces(Them);

if (!unsafeSquares)
wideUnsafeSquares = (attackedBy[Them][ALL_PIECES] | pos.pieces(Them))
& (shift<WEST>(squaresToQueen) | shift<EAST>(squaresToQueen));

// If there aren't any enemy attacks, assign a big bonus. Otherwise
// assign a smaller bonus if the block square isn't attacked.
int k = !unsafeSquares ? 20 : !(unsafeSquares & blockSq) ? 9 : 0;
int k = !wideUnsafeSquares ? 35 : !unsafeSquares ? 20 : !(unsafeSquares & blockSq) ? 9 : 0;

// Assign a larger bonus if the block square is defended.
if (defendedSquares & blockSq)
Expand Down

0 comments on commit 37ffacf

Please sign in to comment.