mirror of
https://github.com/sockspls/badfish
synced 2025-04-30 08:43:09 +00:00
Add penalty for doubled pawns in agile structure
Give an additional penalty of S(20, 10) for any doubled pawn if none of the opponent's pawns is facing any of our - pawns or - pawn attacks; that means, each of their pawns can push at least one square without being captured. This ignores their non-pawns pieces and attacks. One possible justification: Their pawns' ability to push freely provides options to react to our threats by changing their pawn structure. Our doubled pawns however will likely lead to an exploitable weakness, even if the pawn structure is not yet fixed. Note that the notion of "their pawns not being fixed" is symmetric for both players: If all of their pawns can push freely so can ours. All pawns being freely pushable might just be an early-game-indicator. However, it can trigger during endgame pawns races, where doubled pawns are especially hindering, too. LTC LLR: 2.94 (-2.94,2.94) {0.25,1.25} Total: 134976 W: 17964 L: 17415 D: 99597 Ptnml(0-2): 998, 12702, 39619, 13091, 1078 https://tests.stockfishchess.org/tests/view/5ffdd5316019e097de3ef281 STC LLR: 2.94 (-2.94,2.94) {-0.25,1.25} Total: 35640 W: 7219 L: 6904 D: 21517 Ptnml(0-2): 645, 4096, 8084, 4289, 706 https://tests.stockfishchess.org/tests/view/5ffda4a16019e097de3ef265 closes https://github.com/official-stockfish/Stockfish/pull/3302 Bench: 4363873
This commit is contained in:
parent
6dddcecb09
commit
77eeea407c
1 changed files with 9 additions and 0 deletions
|
@ -32,6 +32,7 @@ namespace {
|
||||||
// Pawn penalties
|
// Pawn penalties
|
||||||
constexpr Score Backward = S( 6, 23);
|
constexpr Score Backward = S( 6, 23);
|
||||||
constexpr Score Doubled = S(13, 53);
|
constexpr Score Doubled = S(13, 53);
|
||||||
|
constexpr Score DoubledEarly = S(20, 10);
|
||||||
constexpr Score Isolated = S( 2, 15);
|
constexpr Score Isolated = S( 2, 15);
|
||||||
constexpr Score WeakLever = S( 5, 57);
|
constexpr Score WeakLever = S( 5, 57);
|
||||||
constexpr Score WeakUnopposed = S(16, 22);
|
constexpr Score WeakUnopposed = S(16, 22);
|
||||||
|
@ -86,6 +87,7 @@ namespace {
|
||||||
|
|
||||||
constexpr Color Them = ~Us;
|
constexpr Color Them = ~Us;
|
||||||
constexpr Direction Up = pawn_push(Us);
|
constexpr Direction Up = pawn_push(Us);
|
||||||
|
constexpr Direction Down = -Up;
|
||||||
|
|
||||||
Bitboard neighbours, stoppers, support, phalanx, opposed;
|
Bitboard neighbours, stoppers, support, phalanx, opposed;
|
||||||
Bitboard lever, leverPush, blocked;
|
Bitboard lever, leverPush, blocked;
|
||||||
|
@ -123,6 +125,13 @@ namespace {
|
||||||
phalanx = neighbours & rank_bb(s);
|
phalanx = neighbours & rank_bb(s);
|
||||||
support = neighbours & rank_bb(s - Up);
|
support = neighbours & rank_bb(s - Up);
|
||||||
|
|
||||||
|
if (doubled)
|
||||||
|
{
|
||||||
|
// Additional doubled penalty if none of their pawns is fixed
|
||||||
|
if (!(ourPawns & shift<Down>(theirPawns | pawn_attacks_bb<Them>(theirPawns))))
|
||||||
|
score -= DoubledEarly;
|
||||||
|
}
|
||||||
|
|
||||||
// A pawn is backward when it is behind all pawns of the same color on
|
// A pawn is backward when it is behind all pawns of the same color on
|
||||||
// the adjacent files and cannot safely advance.
|
// the adjacent files and cannot safely advance.
|
||||||
backward = !(neighbours & forward_ranks_bb(Them, s + Up))
|
backward = !(neighbours & forward_ranks_bb(Them, s + Up))
|
||||||
|
|
Loading…
Add table
Reference in a new issue