Skip to content

Commit 37a5bf9

Browse files
mstemberamstembera
authored andcommitted
Use adjustedDepth for completedDepth and lastBestMoveDepth as pointed out by @locutus2
Rebased bench: 3314347
1 parent 86041cf commit 37a5bf9

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

src/search.cpp

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -368,6 +368,7 @@ void Thread::search() {
368368

369369
size_t pvFirst = 0;
370370
pvLast = 0;
371+
Depth adjustedDepth = rootDepth;
371372

372373
// MultiPV loop. We perform a full root search for each PV line
373374
for (pvIdx = 0; pvIdx < multiPV && !Threads.stop; ++pvIdx)
@@ -404,7 +405,7 @@ void Thread::search() {
404405
int failedHighCnt = 0;
405406
while (true)
406407
{
407-
Depth adjustedDepth = std::max(ONE_PLY, rootDepth - failedHighCnt * ONE_PLY);
408+
adjustedDepth = std::max(ONE_PLY, rootDepth - failedHighCnt * ONE_PLY);
408409
bestValue = ::search<PV>(rootPos, ss, alpha, beta, adjustedDepth, false);
409410

410411
// Bring the best move to the front. It is critical that sorting
@@ -461,15 +462,15 @@ void Thread::search() {
461462

462463
if ( mainThread
463464
&& (Threads.stop || pvIdx + 1 == multiPV || Time.elapsed() > 3000))
464-
sync_cout << UCI::pv(rootPos, rootDepth, alpha, beta) << sync_endl;
465+
sync_cout << UCI::pv(rootPos, adjustedDepth, alpha, beta) << sync_endl;
465466
}
466467

467468
if (!Threads.stop)
468-
completedDepth = rootDepth;
469+
completedDepth = adjustedDepth;
469470

470471
if (rootMoves[0].pv[0] != lastBestMove) {
471472
lastBestMove = rootMoves[0].pv[0];
472-
lastBestMoveDepth = rootDepth;
473+
lastBestMoveDepth = adjustedDepth;
473474
}
474475

475476
// Have we found a "mate in x"?

0 commit comments

Comments
 (0)