Skip to content

Commit 0835ba5

Browse files
mstemberamstembera
authored andcommitted
Use adjustedDepth for completedDepth and lastBestMoveDepth as pointed out by @locutus2
bench: 3456274
1 parent ccedb94 commit 0835ba5

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
@@ -361,6 +361,7 @@ void Thread::search() {
361361

362362
size_t pvFirst = 0;
363363
pvLast = 0;
364+
Depth adjustedDepth = rootDepth;
364365

365366
// MultiPV loop. We perform a full root search for each PV line
366367
for (pvIdx = 0; pvIdx < multiPV && !Threads.stop; ++pvIdx)
@@ -397,7 +398,7 @@ void Thread::search() {
397398
int failedHighCnt = 0;
398399
while (true)
399400
{
400-
Depth adjustedDepth = std::max(ONE_PLY, rootDepth - failedHighCnt * ONE_PLY);
401+
adjustedDepth = std::max(ONE_PLY, rootDepth - failedHighCnt * ONE_PLY);
401402
bestValue = ::search<PV>(rootPos, ss, alpha, beta, adjustedDepth, false);
402403

403404
// Bring the best move to the front. It is critical that sorting
@@ -454,15 +455,15 @@ void Thread::search() {
454455

455456
if ( mainThread
456457
&& (Threads.stop || pvIdx + 1 == multiPV || Time.elapsed() > 3000))
457-
sync_cout << UCI::pv(rootPos, rootDepth, alpha, beta) << sync_endl;
458+
sync_cout << UCI::pv(rootPos, adjustedDepth, alpha, beta) << sync_endl;
458459
}
459460

460461
if (!Threads.stop)
461-
completedDepth = rootDepth;
462+
completedDepth = adjustedDepth;
462463

463464
if (rootMoves[0].pv[0] != lastBestMove) {
464465
lastBestMove = rootMoves[0].pv[0];
465-
lastBestMoveDepth = rootDepth;
466+
lastBestMoveDepth = adjustedDepth;
466467
}
467468

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

0 commit comments

Comments
 (0)