From 7561e85219f8b1ec0dc09f921f3fdcabd3a4a173 Mon Sep 17 00:00:00 2001 From: Tord Romstad Date: Tue, 12 Jul 2022 20:56:54 +0200 Subject: [PATCH] Add in-built support for Miguel Illescas' Dragon Chess. (#505) --- README.md | 3 ++- src/variant.cpp | 21 ++++++++++++++++++++- 2 files changed, 22 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 1bbda2f..1fd8227 100644 --- a/README.md +++ b/README.md @@ -56,6 +56,7 @@ The games currently supported besides chess are listed below. Fairy-Stockfish ca - [Atomic](https://en.wikipedia.org/wiki/Atomic_chess) - [Horde](https://en.wikipedia.org/wiki/Dunsany%27s_Chess#Horde_Chess), [Maharajah and the Sepoys](https://en.wikipedia.org/wiki/Maharajah_and_the_Sepoys) - [Knightmate](https://www.chessvariants.com/diffobjective.dir/knightmate.html), [Nightrider](https://en.wikipedia.org/wiki/Nightrider_(chess)), [Grasshopper](https://en.wikipedia.org/wiki/Grasshopper_chess) +- [Dragon Chess](https://www.edami.com/dragonchess/) ### Shogi variants - [Minishogi](https://en.wikipedia.org/wiki/Minishogi), [EuroShogi](https://en.wikipedia.org/wiki/EuroShogi), [Judkins shogi](https://en.wikipedia.org/wiki/Judkins_shogi) @@ -80,7 +81,7 @@ See the [Fairy-Stockfish Wiki](https://github.com/ianfab/Fairy-Stockfish/wiki) f ## Bindings -Besides the C++ engine, this project also includes bindings for other programming languages in order to be able to use it as a library for chess variants. They support move, SAN, and FEN generation, as well as checking of game end conditions for all variants supported by Fairy-Stockfish. Since the bindings are using the C++ code, they are very performant compared to libraries directly written in the respective target language. +Besides the C++ engine, this project also includes bindings for other programming languages in order to be able to use it as a library for chess variants. They support move, SAN, and FEN generation, as well as checking of game end conditions for all variants supported by Fairy-Stockfish. Since the bindings are using the C++ code, they are very performant compared to libraries directly written in the respective target language. ### Python diff --git a/src/variant.cpp b/src/variant.cpp index 24c8386..dfd8573 100644 --- a/src/variant.cpp +++ b/src/variant.cpp @@ -86,7 +86,7 @@ namespace { v->castling = false; v->doubleStep = false; return v; - } + } // Makruk (Thai Chess) // https://en.wikipedia.org/wiki/Makruk Variant* makruk_variant() { @@ -552,6 +552,24 @@ namespace { v->capturesToHand = true; return v; } + // Dragon Chess + // 8x8 variant invented by Miguel Illescas: + // https://www.edami.com/dragonchess/ + // Like regular chess, but with an extra piece, the dragon, which moves like + // an archbishop (i.e. bishop+knight). The dragon can be dropped at an empty + // square on the back rank instead of making a normal move. + Variant* dragon_variant() { + Variant *v = chess_variant_base()->init(); + v->variantTemplate = "bughouse"; + v->pieceToCharTable = "PNBRQ............D...Kpnbrq............d...k"; + v->add_piece(ARCHBISHOP, 'd'); + v->startFen = "rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR[Dd] w KQkq - 0 1"; + v->pieceDrops = true; + v->capturesToHand = false; + v->whiteDropRegion = Rank1BB; + v->blackDropRegion = Rank8BB; + return v; + } // Base used for most shogi variants Variant* minishogi_variant_base() { Variant* v = variant_base()->init(); @@ -1469,6 +1487,7 @@ void VariantMap::init() { add("sittuyin", sittuyin_variant()); add("seirawan", seirawan_variant()); add("shouse", shouse_variant()); + add("dragon", dragon_variant()); add("minishogi", minishogi_variant()); add("mini", minishogi_variant()); add("kyotoshogi", kyotoshogi_variant()); -- 1.7.0.4