From: Fabian Fichter Date: Tue, 31 Mar 2020 18:31:57 +0000 (+0200) Subject: Prohibit non-passing moves not breaking bikjang X-Git-Url: http://winboard.nl/cgi-bin?a=commitdiff_plain;h=41d937b36b8bdf76c601e3974a9c32da56879827;p=fairystockfish.git Prohibit non-passing moves not breaking bikjang Closes #92. --- diff --git a/src/position.cpp b/src/position.cpp index bbf361a..629f37e 100644 --- a/src/position.cpp +++ b/src/position.cpp @@ -924,8 +924,9 @@ bool Position::legal(Move m) const { Bitboard occupied = (type_of(m) != DROP ? pieces() ^ from : pieces()) | to; - // Flying general rule - if (var->flyingGeneral && count(us)) + // Flying general rule and bikjang + // In case of bikjang passing is allowed + if ((var->flyingGeneral && count(us)) || (st->bikjang && !(type_of(moved_piece(m)) == KING && from == to))) { Square s = type_of(moved_piece(m)) == KING ? to : square(us); if (attacks_bb(~us, ROOK, s, occupied) & pieces(~us, KING) & ~square_bb(to)) diff --git a/tests/perft.sh b/tests/perft.sh index 706c823..aba4711 100755 --- a/tests/perft.sh +++ b/tests/perft.sh @@ -74,7 +74,7 @@ if [[ $1 == "largeboard" ]]; then 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 1075083 > /dev/null + expect perft.exp janggi startpos 4 1067293 > /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