Implement XBoard Betza notation for castling
authorFabian Fichter <ianfab@users.noreply.github.com>
Sun, 12 Jan 2020 20:35:03 +0000 (21:35 +0100)
committerFabian Fichter <ianfab@users.noreply.github.com>
Sun, 12 Jan 2020 20:35:03 +0000 (21:35 +0100)
src/ucioption.cpp

index c01c30f..c5e119a 100644 (file)
@@ -73,12 +73,15 @@ void on_variant_change(const Option &o) {
                   << " " << v->startFen
                   << sync_endl;
         // Send piece command with Betza notation
+        // https://www.gnu.org/software/xboard/Betza.html
         for (PieceType pt : v->pieceTypes)
         {
             string suffix =   pt == PAWN && v->doubleStep     ? "ifmnD"
                             : pt == KING && v->cambodianMoves ? "ismN"
                             : pt == FERS && v->cambodianMoves ? "ifnD"
                                                               : "";
+            if (pt == KING && v->castling)
+                 suffix += "O" + std::to_string((v->castlingKingsideFile - v->castlingQueensideFile) / 2);
             if (v->pieceDrops)
             {
                 if (pt == PAWN && !v->firstRankPawnDrops)