Consider Janggi cannon capture restrictions in SEE
authorFabian Fichter <ianfab@users.noreply.github.com>
Mon, 4 May 2020 20:38:20 +0000 (22:38 +0200)
committerFabian Fichter <ianfab@users.noreply.github.com>
Mon, 4 May 2020 20:38:20 +0000 (22:38 +0200)
Closes #106.

src/position.cpp

index 05e89b1..73698b2 100644 (file)
@@ -743,6 +743,9 @@ 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);
         blockers |= b;
         if (b & pieces(color_of(piece_on(s))))
             pinners |= sniperSq;
@@ -1718,6 +1721,10 @@ bool Position::see_ge(Move m, Value threshold) const {
           attackers |= attacks_bb(~stm, ROOK, to, occupied & ~pieces(ROOK)) & pieces(stm, KING);
   }
 
+  // Janggi cannons can not capture each other
+  if (type_of(moved_piece(m)) == JANGGI_CANNON && !(attackers & pieces(~stm) & ~pieces(JANGGI_CANNON)))
+      attackers &= ~pieces(~stm, JANGGI_CANNON);
+
   while (true)
   {
       stm = ~stm;