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); }
/// <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; }