diff --git a/src/search.cpp b/src/search.cpp index ffe724aa..2c924014 100644 --- a/src/search.cpp +++ b/src/search.cpp @@ -1505,7 +1505,7 @@ string UCI::pv(const Position& pos, Depth depth, Value alpha, Value beta) { for (size_t i = 0; i < multiPV; ++i) { - bool updated = (i <= PVIdx); + bool updated = (i <= PVIdx && rootMoves[i].score != -VALUE_INFINITE); if (depth == ONE_PLY && !updated) continue; diff --git a/src/search.h b/src/search.h index ba8a9053..1218ef3b 100644 --- a/src/search.h +++ b/src/search.h @@ -57,7 +57,8 @@ struct RootMove { explicit RootMove(Move m) : pv(1, m) {} - bool operator<(const RootMove& m) const { return m.score < score; } // Descending sort + bool operator<(const RootMove& m) const { + return m.score != score ? m.score < score : m.previousScore < previousScore; } // Descending sort bool operator==(const Move& m) const { return pv[0] == m; } bool extract_ponder_from_tt(Position& pos); diff --git a/src/uci.cpp b/src/uci.cpp index 91a2260e..893c7e2f 100644 --- a/src/uci.cpp +++ b/src/uci.cpp @@ -18,6 +18,7 @@ along with this program. If not, see . */ +#include #include #include #include @@ -229,6 +230,8 @@ void UCI::loop(int argc, char* argv[]) { string UCI::value(Value v) { + assert(-VALUE_INFINITE < v && v < VALUE_INFINITE); + stringstream ss; if (abs(v) < VALUE_MATE - MAX_PLY)