1
0
Fork 0
mirror of https://github.com/sockspls/badfish synced 2025-07-11 19:49:14 +00:00

Simplify passed pawns logic

Remove the bonus for no *friendly* pieces in the pawn's path and
reduce a bit the bonus based on kings proximity.

This patch is part of to the ongoing effort to remove form evaluation
all the terms that do not add value.

After 16284 games:

Mod vs Orig 2728 - 2651 - 10911 ELO +1 (+- 3.1)

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
This commit is contained in:
Marco Costalba 2011-11-12 09:03:18 +01:00
parent 44c78fdb7a
commit a40ded2884

View file

@ -813,8 +813,8 @@ namespace {
Square blockSq = s + pawn_push(Us); Square blockSq = s + pawn_push(Us);
// Adjust bonus based on kings proximity // Adjust bonus based on kings proximity
ebonus += Value(square_distance(pos.king_square(Them), blockSq) * 6 * rr); ebonus += Value(square_distance(pos.king_square(Them), blockSq) * 5 * rr);
ebonus -= Value(square_distance(pos.king_square(Us), blockSq) * 3 * rr); ebonus -= Value(square_distance(pos.king_square(Us), blockSq) * 2 * rr);
// If blockSq is not the queening square then consider also a second push // If blockSq is not the queening square then consider also a second push
if (rank_of(blockSq) != (Us == WHITE ? RANK_8 : RANK_1)) if (rank_of(blockSq) != (Us == WHITE ? RANK_8 : RANK_1))
@ -845,11 +845,6 @@ namespace {
// If yes, big bonus (but smaller than when there are no enemy attacks), // If yes, big bonus (but smaller than when there are no enemy attacks),
// if no, somewhat smaller bonus. // if no, somewhat smaller bonus.
ebonus += Value(rr * ((unsafeSquares & defendedSquares) == unsafeSquares ? 13 : 8)); ebonus += Value(rr * ((unsafeSquares & defendedSquares) == unsafeSquares ? 13 : 8));
// At last, add a small bonus when there are no *friendly* pieces
// in the pawn's path.
if (!(squaresToQueen & pos.pieces(Us)))
ebonus += Value(rr);
} }
} // rr != 0 } // rr != 0
@ -858,6 +853,7 @@ namespace {
supportingPawns = pos.pieces(PAWN, Us) & neighboring_files_bb(s); supportingPawns = pos.pieces(PAWN, Us) & neighboring_files_bb(s);
if (supportingPawns & rank_bb(s)) if (supportingPawns & rank_bb(s))
ebonus += Value(r * 20); ebonus += Value(r * 20);
else if (supportingPawns & rank_bb(s - pawn_push(Us))) else if (supportingPawns & rank_bb(s - pawn_push(Us)))
ebonus += Value(r * 12); ebonus += Value(r * 12);