From 925289015f18105c9bfc51bd734feda44f030eed Mon Sep 17 00:00:00 2001 From: rektdie Date: Wed, 29 Oct 2025 23:48:57 +0100 Subject: [PATCH] added corrplexity to lmr | bench 4317404 --- source/search.cpp | 12 +++++++++--- source/tunables.h | 1 + 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/source/search.cpp b/source/search.cpp index 006fd91..5d701b5 100644 --- a/source/search.cpp +++ b/source/search.cpp @@ -153,7 +153,7 @@ bool IsDraw(Board &board, SearchContext* ctx) { } template -static int GetReductions(Board &board, Move &move, int depth, int moveSeen, int ply, bool cutnode, bool improving, SearchContext* ctx) { +static int GetReductions(Board &board, Move &move, int depth, int moveSeen, int ply, bool cutnode, bool improving, bool corrplexity, SearchContext* ctx) { int reduction = 0; // Late Move Reduction @@ -169,6 +169,9 @@ static int GetReductions(Board &board, Move &move, int depth, int moveSeen, int if (!improving) reduction += lmrImproving; + if (corrplexity) + reduction -= lmrCorrplexity; + if (move.IsQuiet()) { // History LMR @@ -427,9 +430,12 @@ SearchResults PVS(Board& board, int depth, int alpha, int beta, int ply, SearchC if (depth <= 0) return Quiescence(board, alpha, beta, ply, ctx); - const int staticEval = AdjustEval(board, ctx, NNUE::net.Evaluate(board)); + int rawEval = NNUE::net.Evaluate(board); + const int staticEval = AdjustEval(board, ctx, rawEval); ctx->ss[ply].eval = staticEval; + bool corrplexity = std::abs(rawEval - staticEval) > 70; + const bool improving = [&] { if (board.InCheck()) @@ -643,7 +649,7 @@ SearchResults PVS(Board& board, int depth, int alpha, int beta, int ply, SearchC if (ply && depth <= 10 && !SEE(board, currMove, SEEThreshold)) continue; - int reductions = GetReductions(board, currMove, depth, moveSeen, ply, cutnode, improving, ctx); + int reductions = GetReductions(board, currMove, depth, moveSeen, ply, cutnode, improving, corrplexity, ctx); int newDepth = depth + copy.InCheck() - 1 + extension; diff --git a/source/tunables.h b/source/tunables.h index 08a10ad..9d351f2 100644 --- a/source/tunables.h +++ b/source/tunables.h @@ -14,6 +14,7 @@ X_INT(lmrIsPV, 1024, 512, 2048) \ X_INT(lmrHistoryDivisor, 8192, 6000, 10000) \ X_INT(lmrImproving, 1024, 6000, 10000) \ + X_INT(lmrCorrplexity, 1024, 6000, 10000) \ X_INT(rfpBase, 25, 50, 200) \ X_INT(rfpMargin, 100, 50, 200) \ X_INT(fpMargin, 100, 50, 200) \