コード例 #1
0
        public void PrintGameBoard(Player player)
        {
            Console.Clear();
            string boat = "\u2588  ";

            for (int y = board.GetLength(0) - 1; y >= 0; y--)
            {
                for (int x = 0; x < board.GetLength(0); x++)
                {
                    if (board[x, y] == "X  ")
                    {
                        Console.Write(board[x, y]);
                    }
                    else if (myDestroyer.ShipOnLocation(x, y) && x != 0 && y != 0)
                    {
                        Console.Write(boat);
                    }
                    else if (mySubmarine.ShipOnLocation(x, y) && x != 0 && y != 0)
                    {
                        Console.Write(boat);
                    }
                    else if (myBattleship.ShipOnLocation(x, y) && x != 0 && y != 0)
                    {
                        Console.Write(boat);
                    }
                    else if (myAircraftCarrier.ShipOnLocation(x, y) && x != 0 && y != 0)
                    {
                        Console.Write(boat);
                    }
                    else
                    {
                        Console.Write(board[x, y]);
                    }
                    if (x + 1 == board.GetLength(0))
                    {
                        Console.WriteLine();
                    }
                }
            }
        }