From: Niklas Fiekas Date: Fri, 8 Apr 2016 15:20:47 +0000 (+0200) Subject: Fix last search info carried over to mate position X-Git-Url: https://git.sesse.net/?p=stockfish;a=commitdiff_plain;h=ee7a68ea5fc07e331df462b10f35dc770e9409c5 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 --- diff --git a/src/search.cpp b/src/search.cpp index dc488c2b..10d491c0 100644 --- a/src/search.cpp +++ b/src/search.cpp @@ -359,7 +359,8 @@ void MainThread::search() { Thread* bestThread = this; if ( !this->easyMovePlayed && Options["MultiPV"] == 1 - && !Skill(Options["Skill Level"]).enabled()) + && !Skill(Options["Skill Level"]).enabled() + && rootMoves[0].pv[0] != MOVE_NONE) { for (Thread* th : Threads) if ( th->completedDepth > bestThread->completedDepth