mirror of
https://github.com/sockspls/badfish
synced 2025-07-11 19:49:14 +00:00
Score and Select Best Thread in same loop (#2125)
This is a non-functional simplification that combines vote counting and thread selecting in the same loop. It is possible that the best thread would be updated more frequently than master, but I'm not sure it matters here. Perhaps "mostVotes" is a better name than "bestVote?" STC (stopped early). LLR: 0.70 (-2.94,2.94) [-3.00,1.00] Total: 10714 W: 2329 L: 2311 D: 6074 http://tests.stockfishchess.org/tests/view/5ccc71470ebc5925cf03d244 No functional change.
This commit is contained in:
parent
3d076a0c50
commit
272936eaba
1 changed files with 4 additions and 4 deletions
|
@ -239,19 +239,19 @@ void MainThread::search() {
|
||||||
for (Thread* th: Threads)
|
for (Thread* th: Threads)
|
||||||
minScore = std::min(minScore, th->rootMoves[0].score);
|
minScore = std::min(minScore, th->rootMoves[0].score);
|
||||||
|
|
||||||
// Vote according to score and depth
|
// Vote according to score and depth, and select the best thread
|
||||||
|
int64_t bestVote = 0;
|
||||||
for (Thread* th : Threads)
|
for (Thread* th : Threads)
|
||||||
|
{
|
||||||
votes[th->rootMoves[0].pv[0]] +=
|
votes[th->rootMoves[0].pv[0]] +=
|
||||||
(th->rootMoves[0].score - minScore + 14) * int(th->completedDepth);
|
(th->rootMoves[0].score - minScore + 14) * int(th->completedDepth);
|
||||||
|
|
||||||
// Select best thread
|
|
||||||
auto bestVote = votes[this->rootMoves[0].pv[0]];
|
|
||||||
for (Thread* th : Threads)
|
|
||||||
if (votes[th->rootMoves[0].pv[0]] > bestVote)
|
if (votes[th->rootMoves[0].pv[0]] > bestVote)
|
||||||
{
|
{
|
||||||
bestVote = votes[th->rootMoves[0].pv[0]];
|
bestVote = votes[th->rootMoves[0].pv[0]];
|
||||||
bestThread = th;
|
bestThread = th;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
previousScore = bestThread->rootMoves[0].score;
|
previousScore = bestThread->rootMoves[0].score;
|
||||||
|
|
Loading…
Add table
Reference in a new issue