Author SHA1 Message Date
rektdie e984510434 Merge pull request #197 from rektdie/mate-distance-pruning
mate distance pruning | bench 1632393
2026-10-08 15:21:36 +02:00
rektdie c7b545101e mate distance pruning | bench 1632393 2026-10-06 22:13:57 +02:00
+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;