Revert "Lmr rework" #123

Closed
rektdie wants to merge 5 commits from revert-122-lmr-rework into main
pull from: revert-122-lmr-rework
Showing only changes of commit 48b40ec9ff - Show all commits
+22 -20
View File
@@ -167,37 +167,39 @@ 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)
reduction += lmrCutnode; reduction += lmrCutnode;
if constexpr (isPV) if (!move.IsCapture()) {
reduction -= lmrIsPV; if constexpr (isPV)
reduction -= lmrIsPV;
if (!improving) if (!improving)
reduction += lmrImproving; reduction += lmrImproving;
bool sourceThreatened = board.IsSquareThreatened(board.sideToMove, move.MoveFrom()); bool sourceThreatened = board.IsSquareThreatened(board.sideToMove, move.MoveFrom());
bool targetThreatened = board.IsSquareThreatened(board.sideToMove, move.MoveTo()); bool targetThreatened = board.IsSquareThreatened(board.sideToMove, move.MoveTo());
// History LMR // History LMR
int historyReduction = ctx->history[board.sideToMove][move.MoveFrom()][move.MoveTo()][sourceThreatened][targetThreatened]; int historyReduction = ctx->history[board.sideToMove][move.MoveFrom()][move.MoveTo()][sourceThreatened][targetThreatened];
if (ply > 0) { if (ply > 0) {
historyReduction += ctx->conthist.GetOnePly(board, move, ctx, ply); historyReduction += ctx->conthist.GetOnePly(board, move, ctx, ply);
if (ply > 1) if (ply > 1)
historyReduction += ctx->conthist.GetTwoPly(board, move, ctx, ply); historyReduction += ctx->conthist.GetTwoPly(board, move, ctx, ply);
}
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);
} }