Closes #91.
moveList = make_move_and_gating<NORMAL>(pos, moveList, Us, ksq, pop_lsb(&b));
// Passing move by king
- if (pos.pass_on_stalemate())
+ if (pos.king_pass())
*moveList++ = make<SPECIAL>(ksq, ksq);
if (Type != CAPTURES && pos.can_castle(CastlingRights(OO | OOO)))
parse_attribute("seirawanGating", v->seirawanGating);
parse_attribute("cambodianMoves", v->cambodianMoves);
parse_attribute("diagonalLines", v->diagonalLines);
- parse_attribute("passOnStalemate", v->passOnStalemate);
+ parse_attribute("kingPass", v->kingPass);
+ parse_attribute("kingPassOnStalemate", v->kingPassOnStalemate);
parse_attribute("makpongRule", v->makpongRule);
parse_attribute("flyingGeneral", v->flyingGeneral);
parse_attribute("xiangqiSoldier", v->xiangqiSoldier);
if (immobility_illegal() && (type_of(m) == DROP || type_of(m) == NORMAL) && !(moves_bb(us, type_of(moved_piece(m)), to, 0) & board_bb()))
return false;
- // Illegal passing move
- if (pass_on_stalemate() && type_of(m) == SPECIAL && from == to && !checkers())
+ // Illegal king passing move
+ if (king_pass_on_stalemate() && type_of(m) == SPECIAL && from == to && !checkers())
{
for (const auto& move : MoveList<NON_EVASIONS>(*this))
if (!(type_of(move) == SPECIAL && from == to) && legal(move))
Piece captured = type_of(m) == ENPASSANT ? make_piece(them, PAWN) : piece_on(to);
if (to == from)
{
- assert((type_of(m) == PROMOTION && sittuyin_promotion()) || (type_of(m) == SPECIAL && pass_on_stalemate()));
+ assert((type_of(m) == PROMOTION && sittuyin_promotion()) || (type_of(m) == SPECIAL && king_pass()));
captured = NO_PIECE;
}
st->capturedpromoted = is_promoted(to);
Piece pc = piece_on(to);
assert(type_of(m) == DROP || empty(from) || type_of(m) == CASTLING || is_gating(m)
- || (type_of(m) == PROMOTION && sittuyin_promotion()) || (type_of(m) == SPECIAL && pass_on_stalemate()));
+ || (type_of(m) == PROMOTION && sittuyin_promotion())
+ || (type_of(m) == SPECIAL && king_pass()));
assert(type_of(st->capturedPiece) != KING);
// Remove gated piece
bool seirawan_gating() const;
bool cambodian_moves() const;
Bitboard diagonal_lines() const;
- bool pass_on_stalemate() const;
+ bool king_pass() const;
+ bool king_pass_on_stalemate() const;
bool unpromoted_soldier(Color c, Square s) const;
bool makpong() const;
// winning conditions
return var->diagonalLines;
}
-inline bool Position::pass_on_stalemate() const {
+inline bool Position::king_pass() const {
assert(var != nullptr);
- return var->passOnStalemate;
+ return var->kingPass || var->kingPassOnStalemate;
+}
+
+inline bool Position::king_pass_on_stalemate() const {
+ assert(var != nullptr);
+ return var->kingPassOnStalemate;
}
inline bool Position::unpromoted_soldier(Color c, Square s) const {
v->bikjangRule = true;
v->diagonalLines = make_bitboard(SQ_D1, SQ_F1, SQ_E2, SQ_D3, SQ_F3,
SQ_D8, SQ_F8, SQ_E9, SQ_D10, SQ_F10);
- v->passOnStalemate = true;
+ v->kingPass = true;
v->nFoldValue = -VALUE_MATE;
v->perpetualCheckIllegal = true;
return v;
bool seirawanGating = false;
bool cambodianMoves = false;
Bitboard diagonalLines = 0;
- bool passOnStalemate = false;
+ bool kingPass = false;
+ bool kingPassOnStalemate = false;
bool makpongRule = false;
bool flyingGeneral = false;
bool xiangqiSoldier = false;
# seirawanGating: allow gating of pieces in hand like in S-Chess, requires "gating = true" [bool] (default: false)
# cambodianMoves: enable special moves of cambodian chess, requires "gating = true" [bool] (default: false)
# diagonalLines: enable special moves along diagonal for specific squares (Janggi) [Bitboard]
-# passOnStalemate: allow passing by king in case of stalemate [bool] (default: false)
+# kingPass: allow passing by king [bool] (default: false)
+# kingPassOnStalemate: allow passing by king in case of stalemate [bool] (default: false)
# makpongRule: the king may not move away from check [bool] (default: false)
# flyingGeneral: disallow general face-off like in xiangqi [bool] (default: false)
# xiangqiSoldier: restrict soldier to shogi pawn movements on first five ranks [bool] (default: false)
expect perft.exp courier startpos 4 500337 > /dev/null
expect perft.exp grand startpos 3 259514 > /dev/null
expect perft.exp xiangqi startpos 4 3290240 > /dev/null
- expect perft.exp janggi startpos 4 948468 > /dev/null
- expect perft.exp janggi "fen 1n1kaabn1/cr2N4/5C1c1/p1pNp3p/9/9/P1PbP1P1P/3r1p3/4A4/R1BA1KB1R b - - 0 1" 4 70256 > /dev/null
+ expect perft.exp janggi startpos 4 1075083 > /dev/null
+ expect perft.exp janggi "fen 1n1kaabn1/cr2N4/5C1c1/p1pNp3p/9/9/P1PbP1P1P/3r1p3/4A4/R1BA1KB1R b - - 0 1" 4 76826 > /dev/null
fi
rm perft.exp