Skip to content

Commit

Permalink
Merge remote-tracking branch 'fairy/master' into tools
Browse files Browse the repository at this point in the history
  • Loading branch information
ianfab committed Aug 26, 2023
2 parents 5245d1c + 84e305f commit a7e7722
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 3 deletions.
3 changes: 2 additions & 1 deletion src/parser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ namespace {
int rank;
std::stringstream ss(value);
target = 0;
while (!ss.eof() && ss >> file && ss >> rank)
while (!ss.eof() && ss >> file && file != '-' && ss >> rank)
{
if (Rank(rank - 1) > RANK_MAX || (file != '*' && File(tolower(file) - 'a') > FILE_MAX))
return false;
Expand Down 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 @@ -2008,7 +2008,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
20 changes: 19 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 @@ -341,6 +342,12 @@ capturesToHand = true
dropChecks = false
whiteDropRegion = *1 *2 *3 *4 *5
blackDropRegion = *6 *7 *8 *9 *10
mobilityRegionWhiteFers = d1 f1 e2 d3 f3
mobilityRegionBlackFers = d8 f8 e9 d10 f10
mobilityRegionWhiteElephant = c1 g1 a3 e3 i3 c5 g5
mobilityRegionBlackElephant = c6 g6 a8 e8 i8 c10 g10
mobilityRegionWhiteSoldier = a4 a5 c4 c5 e4 e5 g4 g5 i4 i5 *6 *7 *8 *9 *10
mobilityRegionBlackSoldier = *1 *2 *3 *4 *5 a6 a7 c6 c7 e6 e7 g6 g7 i6 i7

# Hybrid variant of janggi and crazyhouse
[janggihouse:janggi]
Expand Down Expand Up @@ -1328,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 @@ -1576,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 a7e7722

Please sign in to comment.