Author SHA1 Message Date
rektdie 2aaa560dd3 probcut improving | bench 1592105 2026-10-03 17:30:33 +02:00
2 changed files with 6 additions and 26 deletions

No files matched your search

+6 -10
View File
@@ -302,7 +302,6 @@ static SearchResults Quiescence(Board& board, int alpha, int beta, int ply, Sear
if (entry.hashKey == board.hashKey) {
ttHit = true;
entry.score = ScoreFromTT(entry.score, ply);
switch (entry.nodeType) {
case PV:
@@ -388,7 +387,7 @@ static SearchResults Quiescence(Board& board, int alpha, int beta, int ply, Sear
if (score >= beta) {
if (searchStopped.load(std::memory_order_relaxed)) return 0;
ctx->TT->WriteEntry(board.hashKey, 0, ScoreToTT(score, ply), CutNode, currMove, ttpv);
ctx->TT->WriteEntry(board.hashKey, 0, score, CutNode, currMove, ttpv);
return score;
}
@@ -403,7 +402,7 @@ static SearchResults Quiescence(Board& board, int alpha, int beta, int ply, Sear
results.score = bestScore;
if (searchStopped.load(std::memory_order_relaxed)) return 0;
ctx->TT->WriteEntry(board.hashKey, 0, ScoreToTT(results.score, ply), nodeType, results.bestMove, ttpv);
ctx->TT->WriteEntry(board.hashKey, 0, results.score, nodeType, results.bestMove, ttpv);
return results;
}
@@ -427,9 +426,6 @@ SearchResults PVS(Board& board, int depth, int alpha, int beta, int ply, SearchC
const bool ttHit = entry.hashKey == board.hashKey;
const bool ttpv = isPV | entry.ttpv;
if (ttHit)
entry.score = ScoreFromTT(entry.score, ply);
if constexpr (!isPV) {
if (ttHit) {
if (entry.depth >= depth &&
@@ -520,7 +516,7 @@ SearchResults PVS(Board& board, int depth, int alpha, int beta, int ply, SearchC
}
const int probcutBeta = beta + probcutBetaMargin;
const int probcutDepth = std::max(depth - 3, 1);
const int probcutDepth = std::max(depth - 3 - improving, 1);
if (depth >= 7 && std::abs(beta) < MATE_SCORE - MAX_DEPTH
&& (!entry.bestMove || !entry.bestMove.IsQuiet())
@@ -559,7 +555,7 @@ SearchResults PVS(Board& board, int depth, int alpha, int beta, int ply, SearchC
if (searchStopped.load(std::memory_order_relaxed)) return 0;
if (score >= probcutBeta) {
ctx->TT->WriteEntry(board.hashKey, probcutDepth, ScoreToTT(score, ply), CutNode, currMove, ttpv);
ctx->TT->WriteEntry(board.hashKey, probcutDepth, score, CutNode, currMove, ttpv);
return score;
}
@@ -788,7 +784,7 @@ SearchResults PVS(Board& board, int depth, int alpha, int beta, int ply, SearchC
}
if (!ctx->excluded)
ctx->TT->WriteEntry(board.hashKey, depth, ScoreToTT(score, ply), CutNode, currMove, ttpv);
ctx->TT->WriteEntry(board.hashKey, depth, score, CutNode, currMove, ttpv);
return score;
}
}
@@ -809,7 +805,7 @@ SearchResults PVS(Board& board, int depth, int alpha, int beta, int ply, SearchC
ctx->corrhist.UpdateAll(board, depth, corrHistBonus);
}
ctx->TT->WriteEntry(board.hashKey, depth, ScoreToTT(results.score, ply), nodeType, results.bestMove, ttpv);
ctx->TT->WriteEntry(board.hashKey, depth, results.score, nodeType, results.bestMove, ttpv);
}
return results;
}
-16
View File
@@ -34,22 +34,6 @@ constexpr int CORRHIST_MAX = 16384;
constexpr int32_t ScoreNone = -255000;
constexpr int inf = 100000;
inline int ScoreToTT(int score, int ply) {
if (score >= MATE_SCORE - MAX_DEPTH)
return score + ply;
if (score <= -MATE_SCORE + MAX_DEPTH)
return score - ply;
return score;
}
inline int ScoreFromTT(int score, int ply) {
if (score >= MATE_SCORE - MAX_DEPTH)
return score - ply;
if (score <= -MATE_SCORE + MAX_DEPTH)
return score + ply;
return score;
}
inline int lmrTable[2][MAX_DEPTH+1][MAX_MOVES];
#ifdef TUNING