Minor cleanup
authorFabian Fichter <ianfab@users.noreply.github.com>
Mon, 25 Jan 2021 18:55:02 +0000 (19:55 +0100)
committerFabian Fichter <ianfab@users.noreply.github.com>
Mon, 25 Jan 2021 18:55:02 +0000 (19:55 +0100)
No functional change.

src/position.cpp

index 72df161..43a9f71 100644 (file)
@@ -783,13 +783,13 @@ Bitboard Position::attackers_to(Square s, Bitboard occupied, Color c, Bitboard j
       if (board_bb(c, pt) & s)
       {
           PieceType move_pt = pt == KING ? king_type() : pt;
-          // Consider asymmetrical move of horse
+          // Consider asymmetrical moves (e.g., horse)
           if (AttackRiderTypes[move_pt] & ASYMMETRICAL_RIDERS)
           {
-              Bitboard horses = PseudoAttacks[~c][move_pt][s] & pieces(c, pt);
-              while (horses)
+              Bitboard asymmetricals = PseudoAttacks[~c][move_pt][s] & pieces(c, pt);
+              while (asymmetricals)
               {
-                  Square s2 = pop_lsb(&horses);
+                  Square s2 = pop_lsb(&asymmetricals);
                   if (attacks_bb(c, move_pt, s2, occupied) & s)
                       b |= s2;
               }
@@ -1146,8 +1146,7 @@ bool Position::gives_check(Move m) const {
       janggiCannons ^= to;
 
   // Is there a discovered check?
-  if (  ((type_of(m) != DROP && (blockers_for_king(~sideToMove) & from)) || pieces(sideToMove, CANNON, BANNER)
-          || pieces(HORSE, ELEPHANT) || pieces(JANGGI_CANNON, JANGGI_ELEPHANT))
+  if (  ((type_of(m) != DROP && (blockers_for_king(~sideToMove) & from)) || (non_sliding_riders() & pieces(sideToMove)))
       && attackers_to(square<KING>(~sideToMove), (type_of(m) == DROP ? pieces() : pieces() ^ from) | to, sideToMove, janggiCannons))
       return true;