little lmr rework | bench 4738833 #124

Merged
rektdie merged 1 commits from lmr-rework into main 2025-10-26 22:31:28 +01:00
Showing only changes of commit d76e7796bc - Show all commits
+18 -15
View File
@@ -157,7 +157,7 @@ static int GetReductions(Board &board, Move &move, int depth, int moveSeen, int
int reduction = 0; int reduction = 0;
// Late Move Reduction // Late Move Reduction
if (depth >= 2 && moveSeen >= 2 + (2 * isPV) && !move.IsCapture()) { if (depth >= 2 && moveSeen >= 2 + (2 * isPV)) {
reduction = lmrTable[move.IsQuiet()][depth][moveSeen] * 1024; reduction = lmrTable[move.IsQuiet()][depth][moveSeen] * 1024;
if (cutnode) if (cutnode)
@@ -169,25 +169,28 @@ static int GetReductions(Board &board, Move &move, int depth, int moveSeen, int
if (!improving) if (!improving)
reduction += lmrImproving; reduction += lmrImproving;
bool sourceThreatened = board.IsSquareThreatened(board.sideToMove, move.MoveFrom()); if (move.IsQuiet()) {
bool targetThreatened = board.IsSquareThreatened(board.sideToMove, move.MoveTo()); // History LMR
// History LMR bool sourceThreatened = board.IsSquareThreatened(board.sideToMove, move.MoveFrom());
int historyReduction = ctx->history[board.sideToMove][move.MoveFrom()][move.MoveTo()][sourceThreatened][targetThreatened]; bool targetThreatened = board.IsSquareThreatened(board.sideToMove, move.MoveTo());
if (ply > 0) {
historyReduction += ctx->conthist.GetNPly(board, move, ctx, ply, 1);
if (ply > 1) int historyReduction = ctx->history[board.sideToMove][move.MoveFrom()][move.MoveTo()][sourceThreatened][targetThreatened];
historyReduction += ctx->conthist.GetNPly(board, move, ctx, ply, 2); if (ply > 0) {
historyReduction += ctx->conthist.GetNPly(board, move, ctx, ply, 1);
if (ply > 1)
historyReduction += ctx->conthist.GetNPly(board, move, ctx, ply, 2);
}
historyReduction = historyReduction / lmrHistoryDivisor;
reduction -= historyReduction * 1024;
} }
reduction /= 1024;
historyReduction = historyReduction / lmrHistoryDivisor;
reduction -= historyReduction;
} }
reduction /= 1024;
return std::clamp(reduction, -1, depth - 1); return std::clamp(reduction, -1, depth - 1);
} }