From 236edd83c44ad5825b87b840dc5e4806f605f419 Mon Sep 17 00:00:00 2001 From: rektdie Date: Fri, 30 May 2025 10:20:29 +0200 Subject: [PATCH 1/2] added history LMR | bench 3143225 --- source/search.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/source/search.cpp b/source/search.cpp index 4012606..6c4aff0 100644 --- a/source/search.cpp +++ b/source/search.cpp @@ -114,7 +114,7 @@ bool IsDraw(Board &board, SearchContext& ctx) { return IsFifty(board) || IsInsuffMat(board) || IsThreefold(board, ctx); } -static int GetReductions(Board &board, Move &move, int depth, int moveSeen, int ply, bool cutnode) { +static int GetReductions(Board &board, Move &move, int depth, int moveSeen, int ply, bool cutnode, SearchContext& ctx) { int reduction = 0; // Late Move Reduction @@ -123,6 +123,10 @@ static int GetReductions(Board &board, Move &move, int depth, int moveSeen, int if (cutnode) reduction += 2; + + // History LMR + int historyReduction = ctx.history[board.sideToMove][move.MoveFrom()][move.MoveTo()] / 4096; + reduction -= std::clamp(historyReduction, -3, 3); } return std::clamp(reduction, -1, depth - 1); @@ -335,7 +339,7 @@ SearchResults PVS(Board& board, int depth, int alpha, int beta, int ply, SearchC ctx.positionHistory[copy.positionIndex] = copy.hashKey; ctx.nodes++; - int reductions = GetReductions(board, currMove, depth, moveSeen, ply, cutnode); + int reductions = GetReductions(board, currMove, depth, moveSeen, ply, cutnode, ctx); int newDepth = depth + copy.InCheck() - 1; -- 2.47.3 From 0f328d321c77939249696ebd03c58ff161bfee42 Mon Sep 17 00:00:00 2001 From: rektdie Date: Fri, 30 May 2025 10:38:08 +0200 Subject: [PATCH 2/2] changed history lmr divisor to 8192 | bench 4220135 --- source/search.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/source/search.cpp b/source/search.cpp index 6c4aff0..c7021c0 100644 --- a/source/search.cpp +++ b/source/search.cpp @@ -125,8 +125,8 @@ static int GetReductions(Board &board, Move &move, int depth, int moveSeen, int reduction += 2; // History LMR - int historyReduction = ctx.history[board.sideToMove][move.MoveFrom()][move.MoveTo()] / 4096; - reduction -= std::clamp(historyReduction, -3, 3); + int historyReduction = ctx.history[board.sideToMove][move.MoveFrom()][move.MoveTo()] / 8192; + reduction -= historyReduction; } return std::clamp(reduction, -1, depth - 1); -- 2.47.3