Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions src/position.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1660,10 +1660,10 @@ void Position::do_move(Move m, StateInfo& newSt, bool givesCheck) {
board[capsq] = NO_PIECE;
if (captures_to_hand())
{
Piece pieceToHand = !capturedPromoted || drop_loop() ? ~captured
: unpromotedCaptured ? ~unpromotedCaptured
: make_piece(~color_of(captured), main_promotion_pawn_type(color_of(captured)));
add_to_hand(pieceToHand);
Piece pieceToHand = !capturedPromoted || drop_loop() ? make_piece(sideToMove, type_of(captured))
: unpromotedCaptured ? make_piece(sideToMove, type_of(unpromotedCaptured))
: make_piece(sideToMove, main_promotion_pawn_type(color_of(captured)));
add_to_hand(pieceToHand);
k ^= Zobrist::inHand[pieceToHand][pieceCountInHand[color_of(pieceToHand)][type_of(pieceToHand)] - 1]
^ Zobrist::inHand[pieceToHand][pieceCountInHand[color_of(pieceToHand)][type_of(pieceToHand)]];

Expand All @@ -1673,6 +1673,7 @@ void Position::do_move(Move m, StateInfo& newSt, bool givesCheck) {
dp.handCount[1] = pieceCountInHand[color_of(pieceToHand)][type_of(pieceToHand)];
}
}

else if (Eval::useNNUE)
dp.handPiece[1] = NO_PIECE;

Expand Down
23 changes: 22 additions & 1 deletion src/variant.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -596,7 +596,7 @@ namespace {
v->flagRegion[WHITE] = Rank8BB;
return v;
}

// Three-check chess
// Check the king three times to win
// https://lichess.org/variant/threeCheck
Expand All @@ -614,6 +614,7 @@ namespace {
v->nnueAlias = "3check";
return v;
}

// Crazyhouse
// Chess with piece drops
// https://en.wikipedia.org/wiki/Crazyhouse
Expand All @@ -625,6 +626,7 @@ namespace {
v->capturesToHand = true;
return v;
}

// Loop chess
// Variant of crazyhouse where promoted pawns are not demoted when captured
// https://en.wikipedia.org/wiki/Crazyhouse#Variations
Expand All @@ -634,6 +636,23 @@ namespace {
v->nnueAlias = "crazyhouse";
return v;
}

//Capture-Anything
// https://www.chess.com/terms/capture-anything-chess
Variant* captureanything_variant() {
Variant* v = chess_variant_base()->init();
v->selfCapture = true;
return v;
}

//RecycleChess
// # https://brainking.com/en/GameRules?tp=9
Variant* recycle_variant() {
Variant* v = crazyhouse_variant()->init();
v->selfCapture = true;
return v;
}

// Chessgi
// Variant of loop chess where pawns can be dropped to the first rank
// https://en.wikipedia.org/wiki/Crazyhouse#Variations
Expand Down Expand Up @@ -1872,6 +1891,8 @@ void VariantMap::init() {
add("isolation7x7", isolation7x7_variant());
add("snailtrail", snailtrail_variant());
add("fox-and-hounds", fox_and_hounds_variant());
add("captureanything", captureanything_variant());
add("recycle", recycle_variant());
#ifdef ALLVARS
add("duck", duck_variant());
#endif
Expand Down
5 changes: 0 additions & 5 deletions src/variants.ini
Original file line number Diff line number Diff line change
Expand Up @@ -2051,8 +2051,3 @@ mandatoryPiecePromotion = true
# Iron pieces demo: pawns are uncapturable; everything else behaves normally.
[iron-pawns:chess]
ironPieceTypes = p

# Chess, but you may capture your own pieces and pawns
# https://www.chess.com/terms/capture-anything-chess
[capture-anything:chess]
selfCapture = true
Loading