pub fn pinned_bb(&self, c: Color) -> Bitboard {
        let ksq = self.find_king(c);
        if ksq.is_none() {
            return Bitboard::empty();
        }
        let ksq = ksq.unwrap();

        [
            (
                PieceType::Rook,
                BBFactory::rook_attack(ksq, &Bitboard::empty()),
            ),
            (
                PieceType::ProRook,
                BBFactory::rook_attack(ksq, &Bitboard::empty()),
            ),
            (
                PieceType::Bishop,
                BBFactory::bishop_attack(ksq, &Bitboard::empty()),
            ),
            (
                PieceType::ProBishop,
                BBFactory::bishop_attack(ksq, &Bitboard::empty()),
            ),
            (
                PieceType::Lance,
                BBFactory::lance_attack(c, ksq, &Bitboard::empty()),
            ),
        ]
        .iter()
        .fold(Bitboard::empty(), |mut accum, &(pt, ref mask)| {
            let bb = &(&self.type_bb[pt.index()] & &self.color_bb[c.flip().index()]) & mask;

            for psq in bb {
                let between = &BBFactory::between(ksq, psq) & &self.occupied_bb;
                if between.count() == 1 && (&between & &self.color_bb[c.index()]).is_any() {
                    accum |= &between;
                }
            }

            accum
        })
    }
/// Returns a list of squares at which a piece of the given color is pinned.
Returns a list of squares at which a piece of the given color is pinned.
Returns a list of squares at which a piece of the given color is pinned .
pub fn pinned_bb(&self, c: Color) -> Bitboard {
        let ksq = self.find_king(c);
        if ksq.is_none() {
            return Bitboard::empty();
        }
        let ksq = ksq.unwrap();
        [
            (
                PieceType::Rook,
                BBFactory::rook_attack(ksq, &Bitboard::empty()),
            ),
            (
                PieceType::ProRook,
                BBFactory::rook_attack(ksq, &Bitboard::empty()),
            ),
            (
                PieceType::Bishop,
                BBFactory::bishop_attack(ksq, &Bitboard::empty()),
            ),
            (
                PieceType::ProBishop,
                BBFactory::bishop_attack(ksq, &Bitboard::empty()),
            ),
            (
                PieceType::Lance,
                BBFactory::lance_attack(c, ksq, &Bitboard::empty()),
            ),
        ]
        .iter()
        .fold(Bitboard::empty(), |mut accum, &(pt, ref mask)| {
            let bb = &(&self.type_bb[pt.index()] & &self.color_bb[c.flip().index()]) & mask;
            for psq in bb {
                let between = &BBFactory::between(ksq, psq) & &self.occupied_bb;
                if between.count() == 1 && (&between & &self.color_bb[c.index()]).is_any() {
                    accum |= &between;
                }
            }
            accum
        })
    }
pub fn pinned_bb ( & self , c : Color ) -> Bitboard { let ksq = self . find_king ( c ) ; if ksq . is_none ( ) { return Bitboard :: empty ( ) ; } let ksq = ksq . unwrap ( ) ; [ ( PieceType :: Rook , BBFactory :: rook_attack ( ksq , & Bitboard :: empty ( ) ) , ) , ( PieceType :: ProRook , BBFactory :: rook_attack ( ksq , & Bitboard :: empty ( ) ) , ) , ( PieceType :: Bishop , BBFactory :: bishop_attack ( ksq , & Bitboard :: empty ( ) ) , ) , ( PieceType :: ProBishop , BBFactory :: bishop_attack ( ksq , & Bitboard :: empty ( ) ) , ) , ( PieceType :: Lance , BBFactory :: lance_attack ( c , ksq , & Bitboard :: empty ( ) ) , ) , ] . iter ( ) . fold ( Bitboard :: empty ( ) , | mut accum , & ( pt , ref mask ) | { let bb = & ( & self . type_bb [ pt . index ( ) ] & & self . color_bb [ c . flip ( ) . index ( ) ] ) & mask ; for psq in bb { let between = & BBFactory :: between ( ksq , psq ) & & self . occupied_bb ; if between . count ( ) == 1 && ( & between & & self . color_bb [ c . index ( ) ] ) . is_any ( ) { accum |= & between ; } } accum } ) }
Returns a list of squares at which a piece of the given color is pinned.
Returns a list of squares at which a piece of the given color is pinned .
&self
c
Color