From 7885fa5bd3c8aae1e992ec80cbaaab1177502426 Mon Sep 17 00:00:00 2001 From: peregrineshahin Date: Mon, 4 Dec 2023 00:39:41 +0300 Subject: [PATCH] Track seldepth in qsearch too Sometimes if we count the reported PV length, it turns out to be longer than the selective depth reported. This fixes this behavior by applying the selective depth to qsearch since we do report PVs from it as well. Passed non-regression STC: https://tests.stockfishchess.org/tests/view/656cf5b66980e15f69c7499d LLR: 2.96 (-2.94,2.94) <-1.75,0.25> Total: 223648 W: 56372 L: 56356 D: 110920 Ptnml(0-2): 710, 25580, 59231, 25590, 713 closes https://github.com/official-stockfish/Stockfish/pull/4903 No functional change --- src/search.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/search.cpp b/src/search.cpp index 89879374..10a36cbf 100644 --- a/src/search.cpp +++ b/src/search.cpp @@ -1421,6 +1421,10 @@ Value qsearch(Position& pos, Stack* ss, Value alpha, Value beta, Depth depth) { ss->inCheck = pos.checkers(); moveCount = 0; + // Used to send selDepth info to GUI (selDepth counts from 1, ply from 0) + if (PvNode && thisThread->selDepth < ss->ply + 1) + thisThread->selDepth = ss->ply + 1; + // Step 2. Check for an immediate draw or maximum ply reached if (pos.is_draw(ss->ply) || ss->ply >= MAX_PLY) return (ss->ply >= MAX_PLY && !ss->inCheck) ? evaluate(pos) : VALUE_DRAW; -- 2.39.2