Fix generation of capturing palace king evasion
authorFabian Fichter <ianfab@users.noreply.github.com>
Sat, 4 Apr 2020 16:13:50 +0000 (18:13 +0200)
committerFabian Fichter <ianfab@users.noreply.github.com>
Sat, 4 Apr 2020 16:13:50 +0000 (18:13 +0200)
Example:
1n1kaabn1/cr2N4/5C1c1/p1pNp3p/9/9/P1PbP1P1P/3r1p3/4A4/R1BA1KB1R b - - 0 1

src/movegen.cpp
tests/perft.sh

index 7c80fe3..f3c0e08 100644 (file)
@@ -533,6 +533,8 @@ ExtMove* generate<EVASIONS>(const Position& pos, ExtMove* moveList) {
       if (diagType)
       {
           b = attacks_bb(us, diagType, ksq, pos.pieces()) & pos.board_bb(us, KING) & pos.diagonal_lines() & ~pos.pieces(us) & ~sliderAttacks;
+          if (!more_than_one(pos.checkers()))
+              b &= ~pos.checkers();
           while (b)
               moveList = make_move_and_gating<SPECIAL>(pos, moveList, us, ksq, pop_lsb(&b));
       }
index aba4711..891c351 100755 (executable)
@@ -75,7 +75,7 @@ if [[ $1 == "largeboard" ]]; then
   expect perft.exp grand startpos 3 259514 > /dev/null
   expect perft.exp xiangqi startpos 4 3290240 > /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
+  expect perft.exp janggi "fen 1n1kaabn1/cr2N4/5C1c1/p1pNp3p/9/9/P1PbP1P1P/3r1p3/4A4/R1BA1KB1R b - - 0 1" 4 76824 > /dev/null
 fi
 
 rm perft.exp