Merge pull request #124 from rektdie/lmr-rework
little lmr rework | bench 4738833
This commit was merged in pull request #124.
This commit is contained in:
1 file changed
+8
-5
+8
-5
@@ -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,10 +169,12 @@ static int GetReductions(Board &board, Move &move, int depth, int moveSeen, int
|
|||||||
if (!improving)
|
if (!improving)
|
||||||
reduction += lmrImproving;
|
reduction += lmrImproving;
|
||||||
|
|
||||||
|
if (move.IsQuiet()) {
|
||||||
|
// History LMR
|
||||||
|
|
||||||
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
|
|
||||||
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.GetNPly(board, move, ctx, ply, 1);
|
historyReduction += ctx->conthist.GetNPly(board, move, ctx, ply, 1);
|
||||||
@@ -181,12 +183,13 @@ static int GetReductions(Board &board, Move &move, int depth, int moveSeen, int
|
|||||||
historyReduction += ctx->conthist.GetNPly(board, move, ctx, ply, 2);
|
historyReduction += ctx->conthist.GetNPly(board, move, ctx, ply, 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
reduction /= 1024;
|
|
||||||
|
|
||||||
historyReduction = historyReduction / lmrHistoryDivisor;
|
historyReduction = historyReduction / lmrHistoryDivisor;
|
||||||
|
|
||||||
reduction -= historyReduction;
|
reduction -= historyReduction * 1024;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
reduction /= 1024;
|
||||||
|
|
||||||
return std::clamp(reduction, -1, depth - 1);
|
return std::clamp(reduction, -1, depth - 1);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user