1
0
Fork 0
mirror of https://github.com/sockspls/badfish synced 2025-04-29 16:23:09 +00:00

Remove unneeded depth tracking in qsearch

Since simplification of quiet checks in qsearch this depth isn't used by
any function at all apart movepicker, which also doesn't use passed
qsearch depth in any way, so can be removed. No functional change.

closes https://github.com/official-stockfish/Stockfish/pull/5514

No functional change
This commit is contained in:
Michael Chaly 2024-07-24 18:25:08 +03:00 committed by Disservin
parent 85893ac1cd
commit 607c3e404f
2 changed files with 4 additions and 5 deletions

View file

@ -1401,14 +1401,13 @@ moves_loop: // When in check, search starts here
// See https://www.chessprogramming.org/Horizon_Effect // See https://www.chessprogramming.org/Horizon_Effect
// and https://www.chessprogramming.org/Quiescence_Search // and https://www.chessprogramming.org/Quiescence_Search
template<NodeType nodeType> template<NodeType nodeType>
Value Search::Worker::qsearch(Position& pos, Stack* ss, Value alpha, Value beta, Depth depth) { Value Search::Worker::qsearch(Position& pos, Stack* ss, Value alpha, Value beta) {
static_assert(nodeType != Root); static_assert(nodeType != Root);
constexpr bool PvNode = nodeType == PV; constexpr bool PvNode = nodeType == PV;
assert(alpha >= -VALUE_INFINITE && alpha < beta && beta <= VALUE_INFINITE); assert(alpha >= -VALUE_INFINITE && alpha < beta && beta <= VALUE_INFINITE);
assert(PvNode || (alpha == beta - 1)); assert(PvNode || (alpha == beta - 1));
assert(depth <= 0);
// Check if we have an upcoming move that draws by repetition (~1 Elo) // Check if we have an upcoming move that draws by repetition (~1 Elo)
if (alpha < VALUE_DRAW && pos.upcoming_repetition(ss->ply)) if (alpha < VALUE_DRAW && pos.upcoming_repetition(ss->ply))
@ -1526,7 +1525,7 @@ Value Search::Worker::qsearch(Position& pos, Stack* ss, Value alpha, Value beta,
// first captures+checks, then captures only (but when in check, we simply search // first captures+checks, then captures only (but when in check, we simply search
// all evasions). // all evasions).
Square prevSq = ((ss - 1)->currentMove).is_ok() ? ((ss - 1)->currentMove).to_sq() : SQ_NONE; Square prevSq = ((ss - 1)->currentMove).is_ok() ? ((ss - 1)->currentMove).to_sq() : SQ_NONE;
MovePicker mp(pos, ttData.move, depth, &thisThread->mainHistory, &thisThread->captureHistory, MovePicker mp(pos, ttData.move, DEPTH_QS, &thisThread->mainHistory, &thisThread->captureHistory,
contHist, &thisThread->pawnHistory); contHist, &thisThread->pawnHistory);
// Step 5. Loop through all pseudo-legal moves until no moves remain or a beta // Step 5. Loop through all pseudo-legal moves until no moves remain or a beta
@ -1606,7 +1605,7 @@ Value Search::Worker::qsearch(Position& pos, Stack* ss, Value alpha, Value beta,
// Step 7. Make and search the move // Step 7. Make and search the move
thisThread->nodes.fetch_add(1, std::memory_order_relaxed); thisThread->nodes.fetch_add(1, std::memory_order_relaxed);
pos.do_move(move, st, givesCheck); pos.do_move(move, st, givesCheck);
value = -qsearch<nodeType>(pos, ss + 1, -beta, -alpha, depth - 1); value = -qsearch<nodeType>(pos, ss + 1, -beta, -alpha);
pos.undo_move(move); pos.undo_move(move);
assert(value > -VALUE_INFINITE && value < VALUE_INFINITE); assert(value > -VALUE_INFINITE && value < VALUE_INFINITE);

View file

@ -291,7 +291,7 @@ class Worker {
// Quiescence search function, which is called by the main search // Quiescence search function, which is called by the main search
template<NodeType nodeType> template<NodeType nodeType>
Value qsearch(Position& pos, Stack* ss, Value alpha, Value beta, Depth depth = 0); Value qsearch(Position& pos, Stack* ss, Value alpha, Value beta);
Depth reduction(bool i, Depth d, int mn, int delta) const; Depth reduction(bool i, Depth d, int mn, int delta) const;