*moveList++ = make<T>(from, to);
// Gating moves
- if (pos.gating() && (pos.gates(us) & square_bb(from)))
+ if (pos.gating() && (pos.gates(us) & from))
for (PieceType pt_gating = PAWN; pt_gating <= KING; ++pt_gating)
if (pos.count_in_hand(us, pt_gating) && (pos.drop_region(us, pt_gating) & from))
*moveList++ = make_gating<T>(from, to, pt_gating, from);
- if (pos.gating() && T == CASTLING && (pos.gates(us) & square_bb(to)))
+ if (pos.gating() && T == CASTLING && (pos.gates(us) & to))
for (PieceType pt_gating = PAWN; pt_gating <= KING; ++pt_gating)
if (pos.count_in_hand(us, pt_gating) && (pos.drop_region(us, pt_gating) & to))
*moveList++ = make_gating<T>(from, to, pt_gating, to);
st->gatesBB[c] |= count<KING>(c) ? square<KING>(c) : make_square(FILE_E, relative_rank(c, castling_rank(), max_rank()));
// Do not set castling rights for gates unless there are no pieces in hand,
// which means that the file is referring to a chess960 castling right.
- else if (count_in_hand(c, ALL_PIECES))
+ else if (count_in_hand(c, ALL_PIECES) || captures_to_hand())
continue;
}
// Set castling rights for 960 gating variants
if (gating())
for (Color c : {WHITE, BLACK})
- if ((gates(c) & pieces(KING)) && !castling_rights(c) && count_in_hand(c, ALL_PIECES))
+ if ((gates(c) & pieces(KING)) && !castling_rights(c) && (count_in_hand(c, ALL_PIECES) || captures_to_hand()))
{
Bitboard castling_rooks = gates(c) & pieces(ROOK);
while (castling_rooks)
if (can_castle(WHITE_OOO))
ss << (chess960 ? char('A' + file_of(castling_rook_square(WHITE_OOO))) : 'Q');
- if (gating() && gates(WHITE))
+ if (gating() && gates(WHITE) && (count_in_hand(WHITE, ALL_PIECES) || captures_to_hand()))
for (File f = FILE_A; f <= max_file(); ++f)
- if ((gates(WHITE) & file_bb(f)) && count_in_hand(WHITE, ALL_PIECES))
+ if (gates(WHITE) & file_bb(f))
ss << char('A' + f);
if (can_castle(BLACK_OO))
if (can_castle(BLACK_OOO))
ss << (chess960 ? char('a' + file_of(castling_rook_square(BLACK_OOO))) : 'q');
- if (gating() && gates(BLACK))
+ if (gating() && gates(BLACK) && (count_in_hand(BLACK, ALL_PIECES) || captures_to_hand()))
for (File f = FILE_A; f <= max_file(); ++f)
- if ((gates(BLACK) & file_bb(f)) && count_in_hand(BLACK, ALL_PIECES))
+ if (gates(BLACK) & file_bb(f))
ss << char('a' + f);
if (!can_castle(ANY_CASTLING) && !(gating() && (gates(WHITE) | gates(BLACK))))
v->add_piece(CHANCELLOR, 'e');
v->startFen = "rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR[HEhe] w KQBCDFGkqbcdfg - 0 1";
v->gating = true;
- v->whiteDropRegion = Rank1BB;
- v->blackDropRegion = Rank8BB;
v->promotionPieceTypes = {ARCHBISHOP, CHANCELLOR, QUEEN, ROOK, BISHOP, KNIGHT};
return v;
}
+ Variant* shouse_variant() {
+ Variant* v = seirawan_variant();
+ v->pieceDrops = true;
+ v->capturesToHand = true;
+ return v;
+ }
Variant* minishogi_variant_base() {
Variant* v = fairy_variant_base();
v->variantTemplate = "shogi";
add("placement", placement_variant());
add("sittuyin", sittuyin_variant());
add("seirawan", seirawan_variant());
+ add("shouse", shouse_variant());
add("minishogi", minishogi_variant());
add("mini", minishogi_variant());
add("kyotoshogi", kyotoshogi_variant());