From 20f941f9c8cc0dd155a655a2e473fd0e371bf09d Mon Sep 17 00:00:00 2001 From: Fabian Fichter Date: Thu, 30 Jan 2020 21:44:43 +0100 Subject: [PATCH] Support USI extensions Improve Shogi GUI compatibility by supporting: - bestmove resign - go byoyomi Closes #71. --- src/uci.cpp | 11 ++++++++++- 1 files changed, 10 insertions(+), 1 deletions(-) diff --git a/src/uci.cpp b/src/uci.cpp index 2b4054f..c55a08f 100644 --- a/src/uci.cpp +++ b/src/uci.cpp @@ -142,6 +142,15 @@ namespace { else if (token == "opptime") is >> limits.time[~pos.side_to_move()]; else if (token == "increment") is >> limits.inc[pos.side_to_move()]; else if (token == "oppinc") is >> limits.inc[~pos.side_to_move()]; + // USI commands + else if (token == "byoyomi") + { + int byoyomi = 0; + is >> byoyomi; + limits.inc[WHITE] = limits.inc[BLACK] = byoyomi; + limits.time[WHITE] += byoyomi; + limits.time[BLACK] += byoyomi; + } Threads.start_thinking(pos, states, limits, ponderMode); } @@ -366,7 +375,7 @@ string UCI::move(const Position& pos, Move m) { Square to = to_sq(m); if (m == MOVE_NONE) - return "(none)"; + return Options["Protocol"] == "usi" ? "resign" : "(none)"; if (m == MOVE_NULL) return "0000"; -- 1.7.0.4