static void Main(string[] args) { Game game = new Game(); game.FillNewMap(); Ship battleship = new Ship(5); Ship destroyerA = new Ship(4); Ship destroyerB = new Ship(4); battleship.Spawn(game.map); destroyerA.Spawn(game.map); destroyerB.Spawn(game.map); while (!game.GameWon()) { game.DrawMap(); game.ShootTarget(game.GetTarget(Console.ReadLine())); } Console.WriteLine("Congrats!"); }
public void PlaceShipWhenDetailsAvailable() { Game game = new Game(); Ship ship = new Ship(4); int shipFieldCounter = 0; ship.Spawn(game.map); for (int i = 0; i < 10; i++) { for (int j = 0; j < 10; j++) { if (game.map[j, i] == State.HiddenShip) { shipFieldCounter++; } } } Assert.Equal(4, shipFieldCounter); }