From 3b52410d4dbb3d7af526c28934af5204c04f43f8 Mon Sep 17 00:00:00 2001 From: ianfab Date: Wed, 22 Aug 2018 21:58:45 +0200 Subject: [PATCH] More robust shogi move parsing Allow optional equals sign at end of move string. --- src/uci.cpp | 11 +++++++++-- 1 files changed, 9 insertions(+), 2 deletions(-) diff --git a/src/uci.cpp b/src/uci.cpp index d17a467..ec8c044 100644 --- a/src/uci.cpp +++ b/src/uci.cpp @@ -316,8 +316,15 @@ string UCI::move(const Position& pos, Move m) { Move UCI::to_move(const Position& pos, string& str) { - if (str.length() == 5) // Junior could send promotion piece in uppercase - str[4] = char(tolower(str[4])); + if (str.length() == 5) + { + if (str[4] == '=') + // shogi moves refraining from promotion might use equals sign + str.pop_back(); + else + // Junior could send promotion piece in uppercase + str[4] = char(tolower(str[4])); + } for (const auto& m : MoveList(pos)) if (str == UCI::move(pos, m)) -- 1.7.0.4