From c0570a8bd119f10e0300aadbbe46dbffe5ed4df1 Mon Sep 17 00:00:00 2001 From: dhb <1084714805@qq.com> Date: Fri, 14 Jun 2024 14:24:01 +0800 Subject: [PATCH] use statScore to adjust futility margin (div 256 clamp 0) test r15 --- Rapfi/search/ab/parameter.h | 6 ++++-- Rapfi/search/ab/search.cpp | 7 ++++++- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/Rapfi/search/ab/parameter.h b/Rapfi/search/ab/parameter.h index d21ff68c..8a221b63 100644 --- a/Rapfi/search/ab/parameter.h +++ b/Rapfi/search/ab/parameter.h @@ -67,10 +67,12 @@ constexpr Value razorMargin(Depth d) /// Static futility pruning depth & margins template -constexpr Value futilityMargin(Depth d, bool noTTCutNode, bool improving) +constexpr Value futilityMargin(Depth d, bool noTTCutNode, bool improving, int statScore) { constexpr int FutilityScale[RULE_NB] = {63, 61, 78}; - return Value(std::max(int((FutilityScale[R] - 13 * noTTCutNode) * (d - improving)), 0)); + int margin = + int((FutilityScale[R] - 13 * noTTCutNode) * (d - (1 + improving))) - statScore / 256; + return Value(std::max(margin, 0)); } /// Null move pruning margin diff --git a/Rapfi/search/ab/search.cpp b/Rapfi/search/ab/search.cpp index d8515780..d5dc1183 100644 --- a/Rapfi/search/ab/search.cpp +++ b/Rapfi/search/ab/search.cpp @@ -841,7 +841,12 @@ Value search(Board &board, SearchStack *ss, Value alpha, Value beta, Depth depth // Step 8. Futility pruning: child node (~70 elo) if (!PvNode && eval < VALUE_MATE_IN_MAX_PLY // Do not return unproven wins && beta > VALUE_MATED_IN_MAX_PLY // Confirm non-losing move exists - && eval - futilityMargin(depth - 1, cutNode && !ttHit, improvement > 0) >= beta + && eval + - futilityMargin(depth, + cutNode && !ttHit, + improvement > 0, + (ss - 1)->statScore) + >= beta && !((ss - 2)->moveP4[self] >= E_BLOCK4 && (ss - 4)->moveP4[self] >= E_BLOCK4)) return eval;