コード例 #1
0
ファイル: BitBoards.cs プロジェクト: taddieken95/ChessLib
        public static BitBoard XrayBishopAttacks(this Square square, BitBoard occupied, BitBoard blockers)
        {
            var attacks = square.BishopAttacks(occupied);

            blockers &= attacks;
            return(attacks ^ square.BishopAttacks(occupied ^ blockers));
        }
コード例 #2
0
ファイル: BitBoards.cs プロジェクト: taddieken95/ChessLib
 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);
 }
コード例 #3
0
        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);
            }
        }