From acb0d204d56e16398c58822df2cc60b90ef1ae85 Mon Sep 17 00:00:00 2001 From: Michael Chaly Date: Tue, 11 Apr 2023 19:53:36 +0300 Subject: [PATCH] Simplify stats assignment for Pv nodes This patch is a simplification of my recent elo gainer. Logically the Elo gainer didn't make much sense and this patch simplifies it into smth more logical. Instead of assigning negative bonuses to all non-first moves that enter PV nodes we assign positive bonuses in full depth search after LMR only for moves that will result in a fail high - thus not assigning positive bonuses for moves that will go to pv search - so doing "almost" the same as we do in master now for them. Logic differs for some other moves, though, but this removes some lines of code. Passed STC: https://tests.stockfishchess.org/tests/view/642cf5cf77ff3301150dc5ec LLR: 2.94 (-2.94,2.94) <-1.75,0.25> Total: 409320 W: 109124 L: 109308 D: 190888 Ptnml(0-2): 1149, 45385, 111751, 45251, 1124 Passed LTC: https://tests.stockfishchess.org/tests/view/642fe75d20eb941419bde200 LLR: 2.94 (-2.94,2.94) <-1.75,0.25> Total: 260336 W: 70280 L: 70303 D: 119753 Ptnml(0-2): 99, 25236, 79528, 25199, 106 closes https://github.com/official-stockfish/Stockfish/pull/4522 Bench: 4286815 --- src/search.cpp | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/search.cpp b/src/search.cpp index 411befde..390c6b1c 100644 --- a/src/search.cpp +++ b/src/search.cpp @@ -1229,8 +1229,9 @@ moves_loop: // When in check, search starts here if (newDepth > d) value = -search(pos, ss+1, -(alpha+1), -alpha, newDepth, !cutNode); - int bonus = value > alpha ? stat_bonus(newDepth) - : -stat_bonus(newDepth); + int bonus = value <= alpha ? -stat_bonus(newDepth) + : value >= beta ? stat_bonus(newDepth) + : 0; update_continuation_histories(ss, movedPiece, to_sq(move), bonus); } @@ -1255,9 +1256,6 @@ moves_loop: // When in check, search starts here (ss+1)->pv[0] = MOVE_NONE; value = -search(pos, ss+1, -beta, -alpha, newDepth, false); - - if (moveCount > 1 && newDepth >= depth && !capture) - update_continuation_histories(ss, movedPiece, to_sq(move), -stat_bonus(newDepth)); } // Step 19. Undo move -- 2.39.2