SP style pvs

bench: 1204778
This commit is contained in:
rektdie committed 2026-03-28 03:20:07 +01:00
1 parent a6472893a8
commit 64981dad3e
2 files changed
+15 -19

No files matched your search

+13 -19
View File
@@ -664,32 +664,26 @@ SearchResults PVS(Board& board, int depth, int alpha, int beta, int ply, SearchC
int reductions = GetReductions<isPV>(board, currMove, depth, moveSeen, ply, cutnode, improving, corrplexity, ttpv, ttpvFailLow, ctx); int reductions = GetReductions<isPV>(board, currMove, depth, moveSeen, ply, cutnode, improving, corrplexity, ttpv, ttpvFailLow, ctx);
int newDepth = depth + (copy.InCheck() && !ctx->excluded) - 1 + extension; int newDepth = depth + (copy.InCheck() && !ctx->excluded) - 1 + extension;
int reduced = newDepth - reductions;
U64 nodesBeforeSearch = ctx->nodes; U64 nodesBeforeSearch = ctx->nodes;
// First move (suspected PV node) if (reductions > 0) {
if (!moveSeen) { score = -PVS<false, mode>(copy, reduced, -alpha - 1, -alpha, ply + 1, ctx, true).score;
// Full search
if constexpr (isPV) {
score = -PVS<isPV, mode>(copy, newDepth, -beta, -alpha, ply + 1, ctx, false).score;
} else {
score = -PVS<isPV, mode>(copy, newDepth, -beta, -alpha, ply + 1, ctx, !cutnode).score;
}
} else if (reductions) {
// Null-window search with reductions
score = -PVS<false, mode>(copy, newDepth - reductions, -alpha-1, -alpha, ply + 1, ctx, true).score;
if (score > alpha) { if (score > alpha && reduced < newDepth) {
// Null-window search now without the reduction const bool goDeeper = score > results.score + lmrDeeperBase + lmrDeeperScalar * newDepth;
score = -PVS<false, mode>(copy, newDepth, -alpha-1, -alpha, ply + 1, ctx, !cutnode).score; const bool goShallower = score < results.score + newDepth;
newDepth += goDeeper - goShallower;
score = -PVS<false, mode>(copy, newDepth, -alpha - 1, -alpha, ply + 1, ctx, !cutnode).score;
} }
} else { } else if (!isPV || moveSeen > 1) {
// Null-window search score = -PVS<false, mode>(copy, newDepth, -alpha - 1, -alpha, ply + 1, ctx, !cutnode).score;
score = -PVS<false, mode>(copy, newDepth, -alpha-1, -alpha, ply + 1, ctx, !cutnode).score;
} }
// Check if we need to do full window re-search if (isPV && (moveSeen == 0 || score > alpha)) {
if (moveSeen && score > alpha && score < beta) {
score = -PVS<isPV, mode>(copy, newDepth, -beta, -alpha, ply + 1, ctx, false).score; score = -PVS<isPV, mode>(copy, newDepth, -beta, -alpha, ply + 1, ctx, false).score;
} }
+2
View File
@@ -17,6 +17,8 @@
X_INT(lmrImproving, 1024, 6000, 10000) \ X_INT(lmrImproving, 1024, 6000, 10000) \
X_INT(lmrCorrplexity, 1024, 6000, 10000) \ X_INT(lmrCorrplexity, 1024, 6000, 10000) \
X_INT(lmrTTPVFailLow, 1024, 6000, 10000) \ X_INT(lmrTTPVFailLow, 1024, 6000, 10000) \
X_INT(lmrDeeperBase, 30, 6000, 10000) \
X_INT(lmrDeeperScalar, 4, 6000, 10000) \
X_INT(rfpBase, 25, 50, 200) \ X_INT(rfpBase, 25, 50, 200) \
X_INT(rfpMargin, 100, 50, 200) \ X_INT(rfpMargin, 100, 50, 200) \
X_INT(fpMargin, 100, 50, 200) \ X_INT(fpMargin, 100, 50, 200) \