]> git.sesse.net Git - stockfish/commitdiff
Always print an info line before a bestmove
authorJoost VandeVondele <Joost.VandeVondele@gmail.com>
Mon, 31 Aug 2020 20:53:20 +0000 (22:53 +0200)
committerJoost VandeVondele <Joost.VandeVondele@gmail.com>
Tue, 1 Sep 2020 07:26:56 +0000 (09:26 +0200)
if very few nodes are being searched before a bestmove is reported,
an info line might be missing.

fixes https://github.com/official-stockfish/Stockfish/issues/2757

closes https://github.com/official-stockfish/Stockfish/pull/3088

no functional change

src/search.cpp

index c676bd6d62ca05d46f5851ca5211f661f6a50f7b..c15cd7537e6a8589160842f596a735b1f377317a 100644 (file)
@@ -1861,12 +1861,15 @@ string UCI::pv(const Position& pos, Depth depth, Value alpha, Value beta) {
   {
       bool updated = rootMoves[i].score != -VALUE_INFINITE;
 
-      if (depth == 1 && !updated)
+      if (depth == 1 && !updated && i > 0)
           continue;
 
-      Depth d = updated ? depth : depth - 1;
+      Depth d = updated ? depth : std::max(1, depth - 1);
       Value v = updated ? rootMoves[i].score : rootMoves[i].previousScore;
 
+      if (v == -VALUE_INFINITE)
+          v = VALUE_ZERO;
+
       bool tb = TB::RootInTB && abs(v) < VALUE_MATE_IN_MAX_PLY;
       v = tb ? rootMoves[i].tbScore : v;