Beispiel #1
0
        public void PrintShotBoard(Player player)
        {
            Console.WriteLine(player.Name);

            for (int x = 0; x < GameEngine.GridSize; x++)
            {
                string line = "";
                for (int y = 0; y < GameEngine.GridSize; y++)
                {
                    var shot = player.FiringGrid.Map[x, y];

                    if (shot != null && shot.Hit)
                    {
                        line += Ship.ShipDisplayChar(shot.ShipClassification);
                    }
                    else if (shot != null)
                    {
                        line += "X";
                    }
                    else
                    {
                        line += "~";
                    }
                }

                Console.WriteLine(line);
            }
        }
Beispiel #2
0
        void PrintBoard(Player player)
        {
            Console.WriteLine(player.Name);

            for (int x = 0; x < GameEngine.GridSize; x++)
            {
                string line = "";
                for (int y = 0; y < GameEngine.GridSize; y++)
                {
                    var ship = player.GetShip(x, y);
                    if (ship != null)
                    {
                        line += Ship.ShipDisplayChar(ship.Classification);
                    }
                    else
                    {
                        line += "~";
                    }
                }
                Console.WriteLine(line);
            }
        }