Fix Janggi cannon pin detection (#106)
authorFabian Fichter <ianfab@users.noreply.github.com>
Tue, 5 May 2020 17:47:48 +0000 (19:47 +0200)
committerFabian Fichter <ianfab@users.noreply.github.com>
Tue, 5 May 2020 17:47:48 +0000 (19:47 +0200)
src/position.cpp

index 73698b2..c74f933 100644 (file)
@@ -744,8 +744,8 @@ Bitboard Position::slider_blockers(Bitboard sliders, Square s, Bitboard& pinners
     if (b && (!more_than_one(b) || ((AttackRiderTypes[type_of(piece_on(sniperSq))] & HOPPING_RIDERS) && popcount(b) == 2)))
     {
         // Janggi cannons block each other
-        if ((pieces(JANGGI_CANNON) & sniperSq) && (pieces(JANGGI_CANNON) & blockers))
-            blockers &= pieces(JANGGI_CANNON);
+        if ((pieces(JANGGI_CANNON) & sniperSq) && (pieces(JANGGI_CANNON) & b))
+            b &= pieces(JANGGI_CANNON);
         blockers |= b;
         if (b & pieces(color_of(piece_on(s))))
             pinners |= sniperSq;