From 84e305ff994c23cd1f153c4e23b52e6a54150dcf Mon Sep 17 00:00:00 2001 From: RainRat Date: Sat, 26 Aug 2023 03:29:54 -0700 Subject: [PATCH] add Nuclear (#703) --- src/parser.cpp | 1 + src/position.cpp | 2 +- src/variant.h | 1 + src/variants.ini | 14 +++++++++++++- 4 files changed, 16 insertions(+), 2 deletions(-) diff --git a/src/parser.cpp b/src/parser.cpp index a39cf39..43d2bc8 100644 --- a/src/parser.cpp +++ b/src/parser.cpp @@ -360,6 +360,7 @@ Variant* VariantParser::parse(Variant* v) { parse_attribute("blastImmuneTypes", v->blastImmuneTypes, v->pieceToChar); parse_attribute("mutuallyImmuneTypes", v->mutuallyImmuneTypes, v->pieceToChar); parse_attribute("petrifyOnCapture", v->petrifyOnCapture); + parse_attribute("petrifyBlastPieces", v->petrifyBlastPieces); parse_attribute("doubleStep", v->doubleStep); parse_attribute("doubleStepRegionWhite", v->doubleStepRegion[WHITE]); parse_attribute("doubleStepRegionBlack", v->doubleStepRegion[BLACK]); diff --git a/src/position.cpp b/src/position.cpp index 21ff18c..7363fc2 100644 --- a/src/position.cpp +++ b/src/position.cpp @@ -2003,7 +2003,7 @@ void Position::do_move(Move m, StateInfo& newSt, bool givesCheck) { } // Make a wall square where the piece was - if (var->petrifyOnCapture) + if (bsq == to ? var->petrifyOnCapture : var->petrifyBlastPieces) { st->wallSquares |= bsq; byTypeBB[ALL_PIECES] |= bsq; diff --git a/src/variant.h b/src/variant.h index 77c3443..0492dcc 100644 --- a/src/variant.h +++ b/src/variant.h @@ -67,6 +67,7 @@ struct Variant { PieceSet blastImmuneTypes = NO_PIECE_SET; PieceSet mutuallyImmuneTypes = NO_PIECE_SET; bool petrifyOnCapture = false; + bool petrifyBlastPieces = false; bool doubleStep = true; Bitboard doubleStepRegion[COLOR_NB] = {Rank2BB, Rank7BB}; Bitboard tripleStepRegion[COLOR_NB] = {}; diff --git a/src/variants.ini b/src/variants.ini index 9fc0a56..63bd4da 100644 --- a/src/variants.ini +++ b/src/variants.ini @@ -169,6 +169,7 @@ # blastImmuneTypes: pieces completely immune to explosions (even at ground zero) [PieceSet] (default: none) # mutuallyImmuneTypes: pieces that can't capture another piece of same types (e.g., kings (commoners) in atomar) [PieceSet] (default: none) # petrifyOnCapture: non-pawn pieces are turned into wall squares when capturing [bool] (default: false) +# petrifyBlastPieces: if petrify and blast combined, should pieces destroyed in the blast be petrified? [bool] (default: false) # doubleStep: enable pawn double step [bool] (default: true) # doubleStepRegionWhite: region where pawn double steps are allowed for white [Bitboard] (default: *2) # doubleStepRegionBlack: region where pawn double steps are allowed for black [Bitboard] (default: *2) @@ -1334,7 +1335,7 @@ customPiece1 = i:NN customPiece2 = h:mfWcfFfhmnN startFen = r8r/3nkqn3/hcb1ii1bch/1hhhhhhhh1/10/10/1HHHHHHHH1/HCB1II1BCH/3NKQN3/R8R #technically not needed because of initial setup -##enPassantRegion = 0 +##enPassantRegion = - ##castling = false #https://boardgamegeek.com/boardgame/32/buffalo-chess @@ -1582,3 +1583,14 @@ customPiece4 = w:mRpRFAcpR customPiece5 = f:mBpBWDcpB promotedPieceType = u:w a:w c:f i:f startFen = lnsgkgsnl/1rci1uab1/p1p1p1p1p/9/9/9/P1P1P1P1P/1BAU1ICR1/LNSGKGSNL[-] w 0 1 + +#https://www.chessvariants.com/difftaking.dir/deadsquare.html +[nuclear:atomic] +#define a piece that looks exactly like a pawn, but is not one. Takes care of major differences: +#1. Pawns can be petrified. +#2. Pawns can be destroyed by explosions. +pawn = - +customPiece1 = p:fmWfceFifmnD +pawnTypes = p +petrifyOnCapture = true +enPassantRegion = - -- 1.7.0.4