Merge pull request #197 from rektdie/mate-distance-pruning

mate distance pruning | bench 1632393
This commit was merged in pull request #197.
This commit is contained in:
rektdie authored and GitHub committed 2026-10-08 15:21:36 +02:00
commit e984510434
1 file changed
+16
+16
View File
@@ -484,6 +484,22 @@ SearchResults PVS(Board& board, int depth, int alpha, int beta, int ply, SearchC
if (ply > ctx->seldepth)
ctx->seldepth = ply;
if (ply) {
const int matedScore = -MATE_SCORE + ply;
if (matedScore > alpha) {
alpha = matedScore;
if (alpha >= beta)
return alpha;
}
const int mateScore = MATE_SCORE - ply;
if (mateScore < beta) {
beta = mateScore;
if (alpha >= beta)
return beta;
}
}
ctx->pvLine.SetLength(ply);
if (ply && (IsDraw(board, ctx))) return 0;