From 76896471d8f41327e3f89576102900de0f4a1a94 Mon Sep 17 00:00:00 2001 From: Fabian Fichter Date: Sun, 10 May 2020 15:18:33 +0200 Subject: [PATCH] Improve Winboard compatibility for Janggi * Add Betza notation of palace moves * Change piece char table to avoid check detection --- src/ucioption.cpp | 15 +++++++++++++++ src/variant.cpp | 1 + 2 files changed, 16 insertions(+), 0 deletions(-) diff --git a/src/ucioption.cpp b/src/ucioption.cpp index 0509cb2..894ac61 100644 --- a/src/ucioption.cpp +++ b/src/ucioption.cpp @@ -80,8 +80,23 @@ void on_variant_change(const Option &o) { : pt == KING && v->cambodianMoves ? "ismN" : pt == FERS && v->cambodianMoves ? "ifnD" : ""; + // Janggi palace moves + if (v->diagonalLines) + { + PieceType pt2 = pt == KING ? v->kingType : pt; + if (pt2 == WAZIR) + suffix += "F"; + else if (pt2 == SOLDIER) + suffix += "fF"; + else if (pt2 == ROOK) + suffix += "B"; + else if (pt2 == JANGGI_CANNON) + suffix += "pB"; + } + // Castling if (pt == KING && v->castling) suffix += "O" + std::to_string((v->castlingKingsideFile - v->castlingQueensideFile) / 2); + // Drop region if (v->pieceDrops) { if (pt == PAWN && !v->firstRankPawnDrops) diff --git a/src/variant.cpp b/src/variant.cpp index f98ab93..8e0b517 100644 --- a/src/variant.cpp +++ b/src/variant.cpp @@ -854,6 +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->remove_piece(FERS); v->remove_piece(CANNON); v->remove_piece(ELEPHANT); -- 1.7.0.4