mirror of
https://github.com/sockspls/badfish
synced 2025-04-30 00:33:09 +00:00
Pick bestmove from the deepest thread.
STC: LLR: 2.96 (-2.94,2.94) [0.00,5.00] Total: 26930 W: 4441 L: 4214 D: 18275 LTC: LLR: 2.96 (-2.94,2.94) [0.00,5.00] Total: 7783 W: 1017 L: 876 D: 5890 No functional change in single thread mode Resolves #485
This commit is contained in:
parent
86f04dbcc0
commit
27c5cb5912
2 changed files with 20 additions and 3 deletions
|
@ -329,10 +329,22 @@ void MainThread::think() {
|
||||||
wait(Signals.stop);
|
wait(Signals.stop);
|
||||||
}
|
}
|
||||||
|
|
||||||
sync_cout << "bestmove " << UCI::move(rootMoves[0].pv[0], rootPos.is_chess960());
|
// Check if there are threads with a better score than main thread.
|
||||||
|
Thread* bestThread = this;
|
||||||
|
for (Thread* th : Threads)
|
||||||
|
if ( th->completedDepth > bestThread->completedDepth
|
||||||
|
&& th->rootMoves[0].score > bestThread->rootMoves[0].score)
|
||||||
|
bestThread = th;
|
||||||
|
|
||||||
if (rootMoves[0].pv.size() > 1 || rootMoves[0].extract_ponder_from_tt(rootPos))
|
// Send new PV when needed.
|
||||||
std::cout << " ponder " << UCI::move(rootMoves[0].pv[1], rootPos.is_chess960());
|
// FIXME: Breaks multiPV, and skill levels
|
||||||
|
if (bestThread != this)
|
||||||
|
sync_cout << UCI::pv(bestThread->rootPos, bestThread->completedDepth, -VALUE_INFINITE, VALUE_INFINITE) << sync_endl;
|
||||||
|
|
||||||
|
sync_cout << "bestmove " << UCI::move(bestThread->rootMoves[0].pv[0], rootPos.is_chess960());
|
||||||
|
|
||||||
|
if (bestThread->rootMoves[0].pv.size() > 1 || bestThread->rootMoves[0].extract_ponder_from_tt(rootPos))
|
||||||
|
std::cout << " ponder " << UCI::move(bestThread->rootMoves[0].pv[1], rootPos.is_chess960());
|
||||||
|
|
||||||
std::cout << sync_endl;
|
std::cout << sync_endl;
|
||||||
}
|
}
|
||||||
|
@ -352,6 +364,7 @@ void Thread::search(bool isMainThread) {
|
||||||
|
|
||||||
bestValue = delta = alpha = -VALUE_INFINITE;
|
bestValue = delta = alpha = -VALUE_INFINITE;
|
||||||
beta = VALUE_INFINITE;
|
beta = VALUE_INFINITE;
|
||||||
|
completedDepth = DEPTH_ZERO;
|
||||||
|
|
||||||
if (isMainThread)
|
if (isMainThread)
|
||||||
{
|
{
|
||||||
|
@ -472,6 +485,9 @@ void Thread::search(bool isMainThread) {
|
||||||
sync_cout << UCI::pv(rootPos, rootDepth, alpha, beta) << sync_endl;
|
sync_cout << UCI::pv(rootPos, rootDepth, alpha, beta) << sync_endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!Signals.stop)
|
||||||
|
completedDepth = rootDepth;
|
||||||
|
|
||||||
if (!isMainThread)
|
if (!isMainThread)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
|
|
@ -76,6 +76,7 @@ struct Thread : public ThreadBase {
|
||||||
Depth rootDepth;
|
Depth rootDepth;
|
||||||
HistoryStats history;
|
HistoryStats history;
|
||||||
MovesStats counterMoves;
|
MovesStats counterMoves;
|
||||||
|
Depth completedDepth;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue