Merge pull request #41 from rektdie/new_depth_fix

increased depth immidiately previously on check | bench 3103117
This commit was merged in pull request #41.
This commit is contained in:
rektdie authored and GitHub committed 2025-03-29 17:07:44 +01:00
commit 5585d44615
1 file changed
+8 -8
+8 -8
View File
@@ -207,9 +207,7 @@ SearchResults PVS(Board board, int depth, int alpha, int beta, int ply) {
const int staticEval = HCE::Evaluate(board);
if (board.InCheck()) {
depth++;
} else {
if (!board.InCheck()) {
if (ply) {
// Reverse Futility Pruning
int margin = 100 * depth;
@@ -267,26 +265,28 @@ SearchResults PVS(Board board, int depth, int alpha, int beta, int ply) {
int reductions = GetReductions(board, currMove, depth, moveSeen, ply);
int newDepth = depth + board.InCheck() - 1;
// First move (suspected PV node)
if (!i) {
// Full search
score = -PVS<isPV>(copy, depth - 1, -beta, -alpha, ply + 1).score;
score = -PVS<isPV>(copy, newDepth, -beta, -alpha, ply + 1).score;
} else if (reductions) {
// Null-window search with reductions
score = -PVS<false>(copy, depth - 1 - reductions, -alpha-1, -alpha, ply + 1).score;
score = -PVS<false>(copy, newDepth - reductions, -alpha-1, -alpha, ply + 1).score;
if (score > alpha) {
// Null-window search now without the reduction
score = -PVS<false>(copy, depth - 1, -alpha-1, -alpha, ply + 1).score;
score = -PVS<false>(copy, newDepth, -alpha-1, -alpha, ply + 1).score;
}
} else {
// Null-window search
score = -PVS<false>(copy, depth - 1, -alpha-1, -alpha, ply + 1).score;
score = -PVS<false>(copy, newDepth, -alpha-1, -alpha, ply + 1).score;
}
// Check if we need to do full window re-search
if (i && score > alpha && score < beta) {
score = -PVS<isPV>(copy, depth - 1, -beta, -alpha, ply + 1).score;
score = -PVS<isPV>(copy, newDepth, -beta, -alpha, ply + 1).score;
}
if (searchStopped) return 0;