From: Fabian Fichter Date: Sat, 16 May 2020 13:57:58 +0000 (+0200) Subject: Full Winboard compatibility for Janggi X-Git-Url: http://winboard.nl/cgi-bin?a=commitdiff_plain;h=fe76148a1a14541e659af2d7762fe7642663c95c;p=fairystockfish.git Full Winboard compatibility for Janggi * Adapt to Winboard's handling of passing moves * Replace piece image for soldier to avoid promotion issues --- diff --git a/src/variant.cpp b/src/variant.cpp index 621cfe0..d5c471c 100644 --- a/src/variant.cpp +++ b/src/variant.cpp @@ -854,7 +854,7 @@ namespace { // https://en.wikipedia.org/wiki/Janggi Variant* janggi_variant() { Variant* v = xiangqi_variant(); - v->pieceToCharTable = "PN.R.AB....C.........Kpn.r.ab....c.........k"; + v->pieceToCharTable = ".N.R.AB.P..C.........K.n.r.ab.p..c.........k"; v->remove_piece(FERS); v->remove_piece(CANNON); v->remove_piece(ELEPHANT); diff --git a/src/xboard.cpp b/src/xboard.cpp index f37f349..e8adfb7 100644 --- a/src/xboard.cpp +++ b/src/xboard.cpp @@ -236,7 +236,29 @@ void StateMachine::process_command(Position& pos, std::string token, std::istrin { std::string fen; std::getline(is >> std::ws, fen); - setboard(pos, states, fen); + // Check if setboard actually indicates a passing move + // to avoid unnecessarily clearing the move history + if (pos.king_pass()) + { + StateInfo st; + Position p; + p.set(pos.variant(), fen, pos.is_chess960(), &st, pos.this_thread()); + Move m; + std::string passMove = "pass"; + if ((m = UCI::to_move(pos, passMove)) != MOVE_NONE) + do_move(pos, moveList, states, m); + // apply setboard if passing does not lead to a match + if (pos.key() != p.key()) + setboard(pos, states, fen); + } + else + setboard(pos, states, fen); + // Winboard sends setboard after passing moves + if (pos.side_to_move() == playColor) + { + go(pos, limits, states); + moveAfterSearch = true; + } } else if (token == "cores") {