Support Opulent chess
authorFabian Fichter <ianfab@users.noreply.github.com>
Sun, 6 Jun 2021 19:28:13 +0000 (21:28 +0200)
committerFabian Fichter <ianfab@users.noreply.github.com>
Sun, 6 Jun 2021 19:28:13 +0000 (21:28 +0200)
README.md
src/variant.cpp
tests/perft.sh

index be3fefe..6fb6826 100644 (file)
--- a/README.md
+++ b/README.md
@@ -38,7 +38,7 @@ The games currently supported besides chess are listed below. Fairy-Stockfish ca
 
 ### Chess variants
 - [Capablanca](https://en.wikipedia.org/wiki/Capablanca_Chess), [Janus](https://en.wikipedia.org/wiki/Janus_Chess), [Modern](https://en.wikipedia.org/wiki/Modern_Chess_(chess_variant)), [Chancellor](https://en.wikipedia.org/wiki/Chancellor_Chess), [Embassy](https://en.wikipedia.org/wiki/Embassy_Chess), [Gothic](https://www.chessvariants.com/large.dir/gothicchess.html), [Capablanca random chess](https://en.wikipedia.org/wiki/Capablanca_Random_Chess)
-- [Grand](https://en.wikipedia.org/wiki/Grand_Chess), [Shako](https://www.chessvariants.com/large.dir/shako.html), [Centaur](https://www.chessvariants.com/large.dir/contest/royalcourt.html), [Tencubed](https://www.chessvariants.com/contests/10/tencubedchess.html)
+- [Grand](https://en.wikipedia.org/wiki/Grand_Chess), [Shako](https://www.chessvariants.com/large.dir/shako.html), [Centaur](https://www.chessvariants.com/large.dir/contest/royalcourt.html), [Tencubed](https://www.chessvariants.com/contests/10/tencubedchess.html), [Opulent](https://www.chessvariants.com/rules/opulent-chess)
 - [Chess960](https://en.wikipedia.org/wiki/Chess960), [Placement/Pre-Chess](https://www.chessvariants.com/link/placement-chess)
 - [Crazyhouse](https://en.wikipedia.org/wiki/Crazyhouse), [Loop](https://en.wikipedia.org/wiki/Crazyhouse#Variations), [Chessgi](https://en.wikipedia.org/wiki/Crazyhouse#Variations), [Pocket Knight](http://www.chessvariants.com/other.dir/pocket.html), Capablanca-Crazyhouse
 - [Bughouse](https://en.wikipedia.org/wiki/Bughouse_chess), [Koedem](http://schachclub-oetigheim.de/wp-content/uploads/2016/04/Koedem-rules.pdf)
index 3c63bdf..4f8bfc4 100644 (file)
@@ -1138,6 +1138,7 @@ namespace {
     // https://en.wikipedia.org/wiki/Grand_chess
     Variant* grand_variant() {
         Variant* v = chess_variant_base();
+        v->variantTemplate = "grand";
         v->pieceToCharTable = "PNBRQ..AC............Kpnbrq..ac............k";
         v->maxRank = RANK_10;
         v->maxFile = FILE_J;
@@ -1159,6 +1160,26 @@ namespace {
         v->castling = false;
         return v;
     }
+    // Opulent chess
+    // Variant of Grand chess with two extra pieces
+    // https://www.chessvariants.com/rules/opulent-chess
+    Variant* opulent_variant() {
+        Variant* v = grand_variant();
+        v->pieceToCharTable = "PNBRQ..AC....W.......LKpnbrq..ac....w.......lk";
+        v->remove_piece(KNIGHT);
+        v->add_piece(CUSTOM_PIECES, 'n', "NW");
+        v->add_piece(CUSTOM_PIECES + 1, 'w', "CF");
+        v->add_piece(CUSTOM_PIECES + 2, 'l', "FDH");
+        v->startFen = "rw6wr/clbnqknbla/pppppppppp/10/10/10/10/PPPPPPPPPP/CLBNQKNBLA/RW6WR w - - 0 1";
+        v->promotionPieceTypes.erase(KNIGHT);
+        v->promotionPieceTypes.insert(CUSTOM_PIECES);
+        v->promotionPieceTypes.insert(CUSTOM_PIECES + 1);
+        v->promotionPieceTypes.insert(CUSTOM_PIECES + 2);
+        v->promotionLimit[CUSTOM_PIECES] = 2;
+        v->promotionLimit[CUSTOM_PIECES + 1] = 2;
+        v->promotionLimit[CUSTOM_PIECES + 2] = 2;
+        return v;
+    }
     // Tencubed
     // https://www.chessvariants.com/contests/10/tencubedchess.html
     Variant* tencubed_variant() {
@@ -1410,6 +1431,7 @@ void VariantMap::init() {
     add("jesonmor", jesonmor_variant()->conclude());
     add("courier", courier_variant()->conclude());
     add("grand", grand_variant()->conclude());
+    add("opulent", opulent_variant()->conclude());
     add("tencubed", tencubed_variant()->conclude());
     add("shako", shako_variant()->conclude());
     add("clobber10", clobber10_variant()->conclude());
index b1ba103..847f48b 100755 (executable)
@@ -131,6 +131,7 @@ if [[ $1 == "all" ||  $1 == "largeboard" ]]; then
   expect perft.exp courier startpos 4 500337 > /dev/null
   expect perft.exp grand startpos 3 259514 > /dev/null
   expect perft.exp grand "fen r8r/1nbqkcabn1/ppp2ppppp/3p6/4pP4/10/10/PPPPP1PPPP/1NBQKCABN1/R8R w - e7 0 3" 2 5768 > /dev/null
+  expect perft.exp opulent startpos 3 133829 > /dev/null
   expect perft.exp xiangqi startpos 4 3290240 > /dev/null
   expect perft.exp xiangqi "fen 1rbaka2R/5r3/6n2/2p1p1p2/4P1bP1/PpC3Bc1/1nPR2P2/2N2AN2/1c2K1p2/2BAC4 w - - 0 1" 4 4485547 > /dev/null
   expect perft.exp xiangqi "fen 4kcP1N/8n/3rb4/9/9/9/9/3p1A3/4K4/5CB2 w - - 0 1" 4 92741 > /dev/null