1
0
Fork 0
mirror of https://github.com/sockspls/badfish synced 2025-05-01 09:13:08 +00:00

Fix consistency between PV and bestmove output

In case that a non-root mainThread on a node is the new best thread in the cluster, it should always output its PV.
This commit is contained in:
noobpwnftw 2018-07-15 19:52:57 +08:00 committed by Stéphane Nicolet
parent 2405b38165
commit 80afeb0d3b
2 changed files with 2 additions and 3 deletions

View file

@ -58,8 +58,7 @@ static void BestMove(void* in, void* inout, int* len, MPI_Datatype* datatype) {
MoveInfo* r = static_cast<MoveInfo*>(inout); MoveInfo* r = static_cast<MoveInfo*>(inout);
for (int i=0; i < *len; ++i) for (int i=0; i < *len; ++i)
{ {
if ( (l[i].depth > r[i].depth || (l[i].depth == r[i].depth && l[i].rank < r[i].rank)) if (l[i].depth >= r[i].depth && l[i].score >= r[i].score)
&& (l[i].score >= r[i].score))
r[i] = l[i]; r[i] = l[i];
} }
} }

View file

@ -297,7 +297,7 @@ void MainThread::search() {
if (mi.rank == Cluster::rank()) { if (mi.rank == Cluster::rank()) {
// Send again PV info if we have a new best thread // Send again PV info if we have a new best thread
if (bestThread != this) if (!Cluster::is_root() || bestThread != this)
sync_cout << UCI::pv(bestThread->rootPos, bestThread->completedDepth, -VALUE_INFINITE, VALUE_INFINITE) << sync_endl; 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()); sync_cout << "bestmove " << UCI::move(bestThread->rootMoves[0].pv[0], rootPos.is_chess960());