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

index 2ad2378..be3fefe 100644 (file)
--- a/README.md
+++ b/README.md
@@ -61,6 +61,7 @@ The games currently supported besides chess are listed below. Fairy-Stockfish ca
 - [Tori shogi](https://en.wikipedia.org/wiki/Tori_shogi)
 - [Yari shogi](https://en.wikipedia.org/wiki/Yari_shogi)
 - [Okisaki shogi](https://en.wikipedia.org/wiki/Okisaki_shogi)
+- [Sho shogi](https://en.wikipedia.org/wiki/Sho_shogi)
 
 ### Related games
 - [Amazons](https://en.wikipedia.org/wiki/Game_of_the_Amazons)
index 6f3f048..3c63bdf 100644 (file)
@@ -904,11 +904,32 @@ namespace {
         v->nnueFeatures = NNUE_SHOGI;
         return v;
     }
+    // Sho-Shogi
+    // 16-th century shogi variant with one additional piece and no drops
+    // https://en.wikipedia.org/wiki/Sho_shogi
+    Variant* shoshogi_variant() {
+        Variant* v = shogi_variant();
+        v->pieceToCharTable = "PNBRLSE..G.+.++.++Kpnbrlse..g.+.++.++k";
+        v->remove_piece(KING);
+        v->add_piece(COMMONER, 'k');
+        v->add_piece(CUSTOM_PIECES, 'e', "FsfW"); // drunk elephant
+        v->startFen = "lnsgkgsnl/1r2e2b1/ppppppppp/9/9/9/PPPPPPPPP/1B2E2R1/LNSGKGSNL w 0 1";
+        v->capturesToHand = false;
+        v->pieceDrops = false;
+        v->promotedPieceType[CUSTOM_PIECES] = COMMONER;
+        v->castlingKingPiece = COMMONER;
+        v->extinctionValue = -VALUE_MATE;
+        v->extinctionPieceTypes = {COMMONER};
+        v->extinctionPseudoRoyal = true;
+        v->extinctionPieceCount = 0;
+        return v;
+    }
     // Yari shogi
     // https://en.wikipedia.org/wiki/Yari_shogi
     Variant* yarishogi_variant() {
         Variant* v = variant_base();
         v->variantTemplate = "shogi";
+        v->pieceToCharTable = "PNBR.......++++Kpnbr.......++++k";
         v->maxRank = RANK_9;
         v->maxFile = FILE_G;
         v->reset_pieces();
@@ -1374,6 +1395,7 @@ void VariantMap::init() {
     add("minixiangqi", minixiangqi_variant()->conclude());
 #ifdef LARGEBOARDS
     add("shogi", shogi_variant()->conclude());
+    add("shoshogi", shoshogi_variant()->conclude());
     add("yarishogi", yarishogi_variant()->conclude());
     add("okisakishogi", okisakishogi_variant()->conclude());
     add("capablanca", capablanca_variant()->conclude());
index 5262a62..b1ba103 100755 (executable)
@@ -121,6 +121,7 @@ fi
 # large-board variants
 if [[ $1 == "all" ||  $1 == "largeboard" ]]; then
   expect perft.exp shogi startpos 4 719731 > /dev/null
+  expect perft.exp shoshogi startpos 4 445372 > /dev/null  # configurable pieces
   expect perft.exp yarishogi startpos 4 158404 > /dev/null  # configurable pieces
   expect perft.exp capablanca startpos 4 805128 > /dev/null
   expect perft.exp embassy startpos 4 809539 > /dev/null