-//squares threatened by pawn attacks
-template <Color Us>
-Bitboard threatsByPawn (const Position& pos)
-{
- return pawn_attacks_bb<Us>(pos.pieces(Us, PAWN));
-}
-
-//squares threatened by minor attacks
-template <Color Us>
-Bitboard threatsByMinor (const Position& pos)
-{
- Bitboard our = pos.pieces(Us, KNIGHT, BISHOP);
- Bitboard threats = 0;
- while (our)
- {
- Square s = pop_lsb(our);
- if (type_of(pos.piece_on(s)) == KNIGHT)
- threats |= attacks_bb<KNIGHT>(s, pos.pieces());
- else
- threats |= attacks_bb<BISHOP>(s, pos.pieces());
- }
- return threats;
-}
-
-//squares threatened by rook attacks
-template <Color Us>
-Bitboard threatsByRook (const Position& pos)
-{
- Bitboard our = pos.pieces(Us, ROOK);
- Bitboard threats = 0;
- while (our)
- {
- Square s = pop_lsb(our);
- threats |= attacks_bb<ROOK>(s, pos.pieces());
- }
- return threats;
-}
-