Skip to content

Commit

Permalink
No voting for TB loss / mate.
Browse files Browse the repository at this point in the history
Just as we pick the shortest mate also make sure we stave off mate as long as possible.

official-stockfish#2603

bench: 5138771
  • Loading branch information
mstembera authored and vondele committed Apr 2, 2020
1 parent 0b8ce4b commit 84f3bf5
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/search.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand All @@ -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;
}
}
Expand Down

0 comments on commit 84f3bf5

Please sign in to comment.