Merge pull request #133 from rektdie/capthist-lmr

capthist lmr | bench 4306521
This commit was merged in pull request #133.
This commit is contained in:
rektdie authored and GitHub committed 2025-12-15 13:42:29 +01:00
commit 9e5f131105
1 file changed
+14 -5
+14 -5
View File
@@ -174,24 +174,33 @@ static int GetReductions(Board &board, Move &move, int depth, int moveSeen, int
if (corrplexity) if (corrplexity)
reduction -= lmrCorrplexity; reduction -= lmrCorrplexity;
if (move.IsQuiet()) { // History LMR
// History LMR int historyReduction = 0;
if (move.IsQuiet()) {
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());
int historyReduction = ctx->history[board.sideToMove][move.MoveFrom()][move.MoveTo()][sourceThreatened][targetThreatened]; 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);
if (ply > 1) if (ply > 1)
historyReduction += ctx->conthist.GetNPly(board, move, ctx, ply, 2); historyReduction += ctx->conthist.GetNPly(board, move, ctx, ply, 2);
} }
} else if (move.IsCapture()) {
int attackerType = board.GetPieceType(move.MoveFrom());
int targetType = board.GetPieceType(move.MoveTo());
historyReduction = historyReduction / lmrHistoryDivisor; if (move.GetFlags() == epCapture) {
targetType = Pawn;
}
reduction -= historyReduction * 1024; historyReduction = ctx->capthist[board.sideToMove][attackerType][targetType][move.MoveTo()];
} }
historyReduction = historyReduction / lmrHistoryDivisor;
reduction -= historyReduction * 1024;
} }
reduction /= 1024; reduction /= 1024;