Fix #11 Sittuyin promotion bug
authorFabian Fichter <ianfab@users.noreply.github.com>
Wed, 7 Nov 2018 20:02:23 +0000 (21:02 +0100)
committerFabian Fichter <ianfab@users.noreply.github.com>
Wed, 7 Nov 2018 20:02:23 +0000 (21:02 +0100)
Fix check detection for Sittuyin promotions.

src/position.cpp
tests/perft.sh

index 2400b54..e14ca16 100644 (file)
@@ -894,8 +894,7 @@ bool Position::gives_check(Move m) const {
   // Is there a discovered check?
   if (   type_of(m) != DROP
       && (st->blockersForKing[~sideToMove] & from)
-      && (  !aligned(from, to, square<KING>(~sideToMove))
-          || (attackers_to(square<KING>(~sideToMove), (pieces() ^ from) | to) & pieces(sideToMove))))
+      && (attackers_to(square<KING>(~sideToMove), (pieces() ^ from) | to) & pieces(sideToMove)))
       return true;
 
   switch (type_of(m))
index 1163dd3..4a54d0b 100755 (executable)
@@ -50,6 +50,7 @@ expect perft.exp horde startpos 6 5396554 > /dev/null
 expect perft.exp placement startpos 4 1597696 > /dev/null
 expect perft.exp sittuyin startpos 3 580096 > /dev/null
 expect perft.exp sittuyin "fen 8/8/6R1/s3r3/P5R1/1KP3p1/1F2kr2/8[-] b - - 0 72" 4 657824 > /dev/null
+expect perft.exp sittuyin "fen 2r5/6k1/6p1/3s2P1/3npR2/8/p2N2F1/3K4 w - - 1 50" 4 394031 > /dev/null
 
 rm perft.exp