]> git.sesse.net Git - stockfish/commitdiff
Always print a best move when requested
authorMarco Costalba <mcostalba@gmail.com>
Sun, 22 Mar 2009 13:49:18 +0000 (14:49 +0100)
committerMarco Costalba <mcostalba@gmail.com>
Sun, 22 Mar 2009 22:53:10 +0000 (23:53 +0100)
Little fix merged from iPhone Glaurung.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
src/search.cpp

index 64acc3a89b640231155f13f0ccdaad796a19361d..8d6ddb8d33708c7443c6c8fb8b8a02d893c21b2a 100644 (file)
@@ -748,6 +748,11 @@ namespace {
                   << " hashfull " << TT.full() << std::endl;
 
     // Print the best move and the ponder move to the standard output
+    if (ss[0].pv[0] == MOVE_NONE)
+    {
+        ss[0].pv[0] = rml.get_move(0);
+        ss[0].pv[1] = MOVE_NONE;
+    }
     std::cout << "bestmove " << ss[0].pv[0];
     if (ss[0].pv[1] != MOVE_NONE)
         std::cout << " ponder " << ss[0].pv[1];
@@ -1389,6 +1394,9 @@ namespace {
         }
         TT.store(pos, value_to_tt(bestValue, ply), depth, m, VALUE_TYPE_LOWER);
     }
+
+    assert(bestValue > -VALUE_INFINITE && bestValue < VALUE_INFINITE);
+
     return bestValue;
   }