From: protonspring Date: Thu, 27 Jun 2019 07:45:53 +0000 (+0200) Subject: Bonus for double attacks on unsupported pawns X-Git-Url: https://git.sesse.net/?p=stockfish;a=commitdiff_plain;h=d889bb47185e33012b45cab63359952247bc86e2 Bonus for double attacks on unsupported pawns This is a functional change that rewards double attacks on an unsupported pawns. STC (non-functional difference) LLR: 2.96 (-2.94,2.94) [0.50,4.50] Total: 83276 W: 18981 L: 18398 D: 45897 http://tests.stockfishchess.org/tests/view/5d0970500ebc5925cf0a77d4 LTC (incomplete looping version) LLR: 0.50 (-2.94,2.94) [0.00,3.50] Total: 82999 W: 14244 L: 13978 D: 54777 http://tests.stockfishchess.org/tests/view/5d0a8d480ebc5925cf0a8d58 LTC (completed non-looping version). LLR: 2.96 (-2.94,2.94) [0.00,3.50] Total: 223381 W: 38323 L: 37512 D: 147546 http://tests.stockfishchess.org/tests/view/5d0e80510ebc5925cf0ad320 Closes https://github.com/official-stockfish/Stockfish/pull/2205 Bench 3633546 ---------------------------------- Comments by Alain SAVARD: interesting result ! I would have expected that search would resolve such positions correctly on the very next move. This is not a very common pattern, and when it happens, it will quickly disappear. So I'm quite surprised that it passed LTC. I would be even more surprised if this would resist a simplification. Anyway, let's try to imagine a few cases. a) If you have White d5 f5 against Black e6, and White to move last move by Black was probably a capture on e6 and White is about to recapture on e6 b) If you have White d5 f5 against e6, and Black to move last move by White was possibly a capture on d5 or f5 or the pawn on e6 was pinned or could not move for some reason. and white wants to blast open the position and just pushed d4-d5 or f4-f5 Some possible follow-ups a) Motif is so rare that the popcount() can be safely replaced with a bool() But this would not pass a SPRT[0,4], So try a simplification with bool() and also without the & ~theirAttacks b) If it works, we probably can simply have this in the loop if (lever) score += S(0, 20); c) remove all this and tweak something in search for pawn captures (priority, SEE, extension,..) --- diff --git a/src/movepick.cpp b/src/movepick.cpp index 52ac5b4c..b7f66178 100644 --- a/src/movepick.cpp +++ b/src/movepick.cpp @@ -208,7 +208,7 @@ top: score(); partial_insertion_sort(cur, endMoves, -4000 * depth / ONE_PLY); } - + ++stage; /* fallthrough */ diff --git a/src/pawns.cpp b/src/pawns.cpp index bbcadceb..54748504 100644 --- a/src/pawns.cpp +++ b/src/pawns.cpp @@ -36,6 +36,7 @@ namespace { constexpr Score Doubled = S(11, 56); constexpr Score Isolated = S( 5, 15); constexpr Score WeakUnopposed = S( 13, 27); + constexpr Score Attacked2Unsupported = S( 0, 20); // Connected pawn bonus constexpr int Connected[RANK_NB] = { 0, 7, 8, 12, 29, 48, 86 }; @@ -79,8 +80,13 @@ namespace { Bitboard theirPawns = pos.pieces(Them, PAWN); e->passedPawns[Us] = e->pawnAttacksSpan[Us] = 0; - e->kingSquares[Us] = SQ_NONE; - e->pawnAttacks[Us] = pawn_attacks_bb(ourPawns); + e->kingSquares[Us] = SQ_NONE; + e->pawnAttacks[Us] = pawn_attacks_bb(ourPawns); + + // Unsupported enemy pawns attacked twice by us + score += Attacked2Unsupported * popcount( theirPawns + & pawn_double_attacks_bb(ourPawns) + & ~pawn_attacks_bb(theirPawns)); // Loop through all pawns of the current color and score each pawn while ((s = *pl++) != SQ_NONE)