예제 #1
0
        public static bool CanPlayerPieceNameAttackSquare(Square square, Player player, Piece.PieceNames PieceName, out Piece attackingPiece)
        {
            attackingPiece = null;
            switch (PieceName)
            {
            case PieceNames.Bishop:
                return(PieceBishop.DoesPieceAttackSquare(square, player, out attackingPiece));

            case PieceNames.King:
                return(PieceKing.DoesPieceAttackSquare(square, player, out attackingPiece));

            case PieceNames.Knight:
                return(PieceKnight.DoesPieceAttackSquare(square, player, out attackingPiece));

            case PieceNames.Pawn:
                return(PiecePawn.DoesPieceAttackSquare(square, player, out attackingPiece));

            case PieceNames.Queen:
                return(PieceQueen.DoesPieceAttackSquare(square, player, out attackingPiece));

            case PieceNames.Rook:
                return(PieceRook.DoesPieceAttackSquare(square, player, out attackingPiece));
            }
            return(false);
        }
예제 #2
0
파일: Piece.cs 프로젝트: Squomp/Chess960
 /// <summary>
 ///  can a given player's piece name attack a given square?
 /// </summary>
 /// <param name="square"></param>
 /// <param name="player"></param>
 /// <param name="PieceName"></param>
 /// <returns></returns>
 public static bool CanPlayerPieceNameAttackSquare(Square square, Player player, Piece.PieceNames PieceName)
 {
     switch (PieceName)
     {
         case PieceNames.Bishop:
             return PieceBishop.DoesPieceAttackSquare(square, player);
         case PieceNames.King:
             return PieceKing.DoesPieceAttackSquare(square, player);
         case PieceNames.Knight:
             return PieceKnight.DoesPieceAttackSquare(square, player);
         case PieceNames.Pawn:
             return PiecePawn.DoesPieceAttackSquare(square, player);
         case PieceNames.Queen:
             return PieceQueen.DoesPieceAttackSquare(square, player);
         case PieceNames.Rook:
             return PieceRook.DoesPieceAttackSquare(square, player);
     }
     return false;
 }