1
0
Fork 0
mirror of https://github.com/sockspls/badfish synced 2025-04-30 00:33:09 +00:00

No voting for TB loss / mate.

Just as we pick the shortest mate also make sure we stave off mate as long as possible.

https://github.com/official-stockfish/Stockfish/pull/2603

bench: 5138771
This commit is contained in:
mstembera 2020-03-29 14:09:19 -07:00 committed by Joost VandeVondele
parent 0b8ce4b303
commit 84f3bf594d

View file

@ -280,7 +280,7 @@ void MainThread::search() {
std::map<Move, int64_t> votes;
Value minScore = this->rootMoves[0].score;
// Find out minimum score
// Find minimum score
for (Thread* th: Threads)
minScore = std::min(minScore, th->rootMoves[0].score);
@ -290,14 +290,15 @@ void MainThread::search() {
votes[th->rootMoves[0].pv[0]] +=
(th->rootMoves[0].score - minScore + 14) * int(th->completedDepth);
if (bestThread->rootMoves[0].score >= VALUE_TB_WIN_IN_MAX_PLY)
if (abs(bestThread->rootMoves[0].score) >= VALUE_TB_WIN_IN_MAX_PLY)
{
// Make sure we pick the shortest mate / TB conversion
// Make sure we pick the shortest mate / TB conversion or stave off mate the longest
if (th->rootMoves[0].score > bestThread->rootMoves[0].score)
bestThread = th;
}
else if ( th->rootMoves[0].score >= VALUE_TB_WIN_IN_MAX_PLY
|| votes[th->rootMoves[0].pv[0]] > votes[bestThread->rootMoves[0].pv[0]])
|| ( th->rootMoves[0].score > VALUE_TB_LOSS_IN_MAX_PLY
&& votes[th->rootMoves[0].pv[0]] > votes[bestThread->rootMoves[0].pv[0]]))
bestThread = th;
}
}