^(AllSquares << (s2 + !(s1 < s2))));
}
+inline Bitboard between_bb(Square s1, Square s2, PieceType pt) {
+ if (pt == HORSE)
+ return PseudoAttacks[WHITE][WAZIR][s2] & PseudoAttacks[WHITE][FERS][s1];
+ else if (pt == JANGGI_ELEPHANT)
+ return (PseudoAttacks[WHITE][WAZIR][s2] & PseudoAttacks[WHITE][ALFIL][s1])
+ | (PseudoAttacks[WHITE][KNIGHT][s2] & PseudoAttacks[WHITE][FERS][s1]);
+ else
+ return between_bb(s1, s2);
+}
+
/// forward_ranks_bb() returns a bitboard representing the squares on the ranks
/// in front of the given one, from the point of view of the given color. For instance,
{
Bitboard b = sliders & (PseudoAttacks[~c][pt][s] ^ LeaperAttacks[~c][pt][s]) & pieces(c, pt);
if (b)
- snipers |= b & ~attacks_bb(~c, pt, s, pieces());
+ {
+ // Consider asymmetrical moves (e.g., horse)
+ if (AttackRiderTypes[pt] & ASYMMETRICAL_RIDERS)
+ {
+ Bitboard asymmetricals = PseudoAttacks[~c][pt][s] & pieces(c, pt);
+ while (asymmetricals)
+ {
+ Square s2 = pop_lsb(&asymmetricals);
+ if (!(attacks_from(c, pt, s2) & s))
+ snipers |= s2;
+ }
+ }
+ else
+ snipers |= b & ~attacks_bb(~c, pt, s, pieces());
+ }
}
Bitboard occupancy = pieces() ^ snipers;
while (snipers)
{
Square sniperSq = pop_lsb(&snipers);
- Bitboard b = between_bb(s, sniperSq) & occupancy;
+ Bitboard b = between_bb(s, sniperSq, type_of(piece_on(sniperSq))) & occupancy;
if (b && (!more_than_one(b) || ((AttackRiderTypes[type_of(piece_on(sniperSq))] & HOPPING_RIDERS) && popcount(b) == 2)))
{