capthist lmr | bench 4306521 #133

Merged
rektdie merged 1 commits from capthist-lmr into main 2025-12-15 13:42:29 +01:00
+13 -4
View File
@@ -174,25 +174,34 @@ 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());
if (move.GetFlags() == epCapture) {
targetType = Pawn;
}
historyReduction = ctx->capthist[board.sideToMove][attackerType][targetType][move.MoveTo()];
}
historyReduction = historyReduction / lmrHistoryDivisor; historyReduction = historyReduction / lmrHistoryDivisor;
reduction -= historyReduction * 1024; reduction -= historyReduction * 1024;
} }
}
reduction /= 1024; reduction /= 1024;