From 6634f41ac9e76fe623dd36d312b6955ab2c66a4f Mon Sep 17 00:00:00 2001 From: Alain SAVARD Date: Tue, 8 May 2018 11:00:51 +0200 Subject: [PATCH] Drop the lever condition for backwards MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit We can view the patch version as adding some "undermining bonus" for level pawns, when the defending side can not easily avoid the exchange by advancing her pawn. • Case 1) White b2,c3, Black a3,b3: Black is breaking through, b2 deserves a penalty • Case 2) White b2,c3, Black a3,c4: if b2xa3 then White ends up with a weak pawn on a3 and probably a weak pawn on c3 too. In either case, White can still not safely play b2-b3 and make a phalanx with c3, which is the essence of a backward pawn definition. Passed STC in SPRT[0, 4]: LLR: -2.96 (-2.94,2.94) [0.00,4.00] Total: 131169 W: 26523 L: 26199 D: 78447 http://tests.stockfishchess.org/tests/view/5aefa4d50ebc5902a409a151 ELO 1.19 [-0.38,2.88] (95%) Passed LTC in SPRT[-3, 1]: LLR: 2.96 (-2.94,2.94) [-3.00,1.00] Total: 24824 W: 3732 L: 3617 D: 17475 http://tests.stockfishchess.org/tests/view/5af04d3f0ebc5902a88b2e55 ELO 1.27 [-1.21,3.70] (95%) Closes https://github.com/official-stockfish/Stockfish/pull/1584 How to continue from there? There were some promising tests a couple of months ago about adding a lever condition for king danger in evaluate.cpp, maybe it would be time to re-try this after all the recent changes in pawns.cpp Bench: 4773882 --- src/movepick.h | 10 ++++++++-- src/pawns.cpp | 6 +++--- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/src/movepick.h b/src/movepick.h index 666cca36..b6e5620e 100644 --- a/src/movepick.h +++ b/src/movepick.h @@ -117,8 +117,14 @@ public: MovePicker(const MovePicker&) = delete; MovePicker& operator=(const MovePicker&) = delete; MovePicker(const Position&, Move, Value, const CapturePieceToHistory*); - MovePicker(const Position&, Move, Depth, const ButterflyHistory*, const CapturePieceToHistory*, Square); - MovePicker(const Position&, Move, Depth, const ButterflyHistory*, const CapturePieceToHistory*, const PieceToHistory**, Move, Move*); + MovePicker(const Position&, Move, Depth, const ButterflyHistory*, + const CapturePieceToHistory*, + Square); + MovePicker(const Position&, Move, Depth, const ButterflyHistory*, + const CapturePieceToHistory*, + const PieceToHistory**, + Move, + Move*); Move next_move(bool skipQuiets = false); private: diff --git a/src/pawns.cpp b/src/pawns.cpp index ca9c3023..8b997b60 100644 --- a/src/pawns.cpp +++ b/src/pawns.cpp @@ -118,8 +118,8 @@ namespace { // A pawn is backward when it is behind all pawns of the same color // on the adjacent files and cannot be safely advanced. - backward = !lever && !(ourPawns & pawn_attack_span(Them, s + Up)) - && (stoppers & (leverPush | (s + Up))); + backward = !(ourPawns & pawn_attack_span(Them, s + Up)) + && (stoppers & (leverPush | (s + Up))); // Passed pawns will be properly scored in evaluation because we need // full attack info to evaluate them. Include also not passed pawns @@ -223,7 +223,7 @@ Value Entry::evaluate_shelter(const Position& pos, Square ksq) { Value safety = (ourPawns & file_bb(ksq)) ? Value(5) : Value(-5); - if ((shift(theirPawns) & (FileABB | FileHBB) & BlockRanks) & ksq) + if (shift(theirPawns) & (FileABB | FileHBB) & BlockRanks & ksq) safety += 374; File center = std::max(FILE_B, std::min(FILE_G, file_of(ksq))); -- 2.39.2