- // Vote according to score and depth, and select the best thread
- for (Thread* th : Threads)
- {
- votes[th->rootMoves[0].pv[0]] +=
- (th->rootMoves[0].score - minScore + 14) * int(th->completedDepth);
-
- if (bestThread->rootMoves[0].score >= VALUE_MATE_IN_MAX_PLY)
- {
- // Make sure we pick the shortest mate
- if (th->rootMoves[0].score > bestThread->rootMoves[0].score)
- bestThread = th;
- }
- else if ( th->rootMoves[0].score >= VALUE_MATE_IN_MAX_PLY
- || votes[th->rootMoves[0].pv[0]] > votes[bestThread->rootMoves[0].pv[0]])
- bestThread = th;
- }
- }
-
- previousScore = bestThread->rootMoves[0].score;