Skip to content

Commit

Permalink
add Nuclear (#703)
Browse files Browse the repository at this point in the history
  • Loading branch information
RainRat authored Aug 26, 2023
1 parent 8c9c934 commit 84e305f
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 2 deletions.
1 change: 1 addition & 0 deletions src/parser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -360,6 +360,7 @@ Variant* VariantParser<DoCheck>::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]);
Expand Down
2 changes: 1 addition & 1 deletion src/position.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
1 change: 1 addition & 0 deletions src/variant.h
Original file line number Diff line number Diff line change
Expand Up @@ -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] = {};
Expand Down
14 changes: 13 additions & 1 deletion src/variants.ini
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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 = -

0 comments on commit 84e305f

Please sign in to comment.