From 3abd7fe9cfbd8b9c5e0762abe3c5600f97333137 Mon Sep 17 00:00:00 2001 From: Fabian Fichter Date: Sun, 6 Jun 2021 21:01:31 +0200 Subject: [PATCH] Support Sho shogi --- README.md | 1 + src/variant.cpp | 22 ++++++++++++++++++++++ tests/perft.sh | 1 + 3 files changed, 24 insertions(+), 0 deletions(-) diff --git a/README.md b/README.md index 2ad2378..be3fefe 100644 --- 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) diff --git a/src/variant.cpp b/src/variant.cpp index 6f3f048..3c63bdf 100644 --- a/src/variant.cpp +++ b/src/variant.cpp @@ -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()); diff --git a/tests/perft.sh b/tests/perft.sh index 5262a62..b1ba103 100755 --- a/tests/perft.sh +++ b/tests/perft.sh @@ -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 -- 1.7.0.4