public static BitBoard XrayBishopAttacks(this Square square, BitBoard occupied, BitBoard blockers) { var attacks = square.BishopAttacks(occupied); blockers &= attacks; return(attacks ^ square.BishopAttacks(occupied ^ blockers)); }
public static BitBoard GetAttacks(this Square square, EPieceType pieceType, BitBoard occupied = new BitBoard()) { return(pieceType == EPieceType.Knight || pieceType == EPieceType.King ? PseudoAttacksBB[pieceType.AsInt(), square.AsInt()] : pieceType == EPieceType.Bishop ? square.BishopAttacks(occupied) : pieceType == EPieceType.Rook ? square.RookAttacks(occupied) : pieceType == EPieceType.Queen ? square.QueenAttacks(occupied) : Zero); }
public static BitBoard GetAttacks(this Square square, EPieceType pieceType, BitBoard occupied = new BitBoard()) { switch (pieceType) { case EPieceType.Knight: case EPieceType.King: return(PseudoAttacksBB[pieceType.AsInt(), square.AsInt()]); case EPieceType.Bishop: return(square.BishopAttacks(occupied)); case EPieceType.Rook: return(square.RookAttacks(occupied)); case EPieceType.Queen: return(square.QueenAttacks(occupied)); default: return(EmptyBitBoard); } }