bool is_chess960() const;
Thread* this_thread() const;
bool is_immediate_game_end() const;
- bool is_game_end(Value& result, int ply = 0) const;
- bool is_optional_game_end(Value& result, int ply = 0, int countStarted = 0) const;
bool is_immediate_game_end(Value& result, int ply = 0) const;
+ bool is_optional_game_end() const;
+ bool is_optional_game_end(Value& result, int ply = 0, int countStarted = 0) const;
+ bool is_game_end(Value& result, int ply = 0) const;
Value material_counting_result() const;
bool has_game_cycle(int ply) const;
bool has_repeated() const;
return is_immediate_game_end(result);
}
+inline bool Position::is_optional_game_end() const {
+ Value result;
+ return is_optional_game_end(result);
+}
+
inline bool Position::is_game_end(Value& result, int ply) const {
return is_immediate_game_end(result, ply) || is_optional_game_end(result, ply);
}
Time.init(rootPos, Limits, us, rootPos.game_ply());
TT.new_search();
- if (rootMoves.empty())
+ if (rootMoves.empty() || (Options["Protocol"] == "xboard" && rootPos.is_optional_game_end()))
{
rootMoves.emplace_back(MOVE_NONE);
Value variantResult;
: rootPos.checkers() ? rootPos.checkmate_value()
: rootPos.stalemate_value();
if (Options["Protocol"] == "xboard")
+ {
+ // rotate MOVE_NONE to front (for optional game end)
+ std::rotate(rootMoves.rbegin(), rootMoves.rbegin() + 1, rootMoves.rend());
sync_cout << ( result == VALUE_DRAW ? "1/2-1/2 {Draw}"
: (rootPos.side_to_move() == BLACK ? -result : result) == VALUE_MATE ? "1-0 {White wins}"
: "0-1 {Black wins}")
<< sync_endl;
+ }
else
sync_cout << "info depth 0 score "
<< UCI::value(result)