Skip to content

Commit efe115e

Browse files
niklasfIIvec
authored andcommitted
Fix last search info carried over to mate position
When starting search in a mate or stalemate position, Stockfish does not even care to reinitialize and start worker threads. However after search all threads are checked for the best move. This can lead to bestmove and info beeing carried over from the last search. Example session: setoption name threads value 7 go movetime 4000 position startpos moves f2f3 e7e5 g2g4 d8h4 go movetime 4000 Actual output is like (almost always): [...] bestmove e2e4 info depth 0 score mate 0 info depth 20 seldepth 29 multipv 1 score cp 28 [...] pv e2e4 bestmove e2e4 Expected output / output after fix: [...] bestmove e2e4 ponder e7e6 info depth 0 score mate 0 bestmove (none) Resolves #623
1 parent 9b81080 commit efe115e

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/search.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -359,7 +359,8 @@ void MainThread::search() {
359359
Thread* bestThread = this;
360360
if ( !this->easyMovePlayed
361361
&& Options["MultiPV"] == 1
362-
&& !Skill(Options["Skill Level"]).enabled())
362+
&& !Skill(Options["Skill Level"]).enabled()
363+
&& rootMoves[0].pv[0] != MOVE_NONE)
363364
{
364365
for (Thread* th : Threads)
365366
if ( th->completedDepth > bestThread->completedDepth

0 commit comments

Comments
 (0)