public Ship(string playerName, int shipLength, ICoordinatesReader coordinateReader, IConsoleWrapper console) { if (coordinateReader == null) { throw new ArgumentNullException(nameof(coordinateReader)); } if (console == null) { throw new ArgumentNullException(nameof(console)); } if (string.IsNullOrWhiteSpace(playerName)) { throw new ArgumentException(nameof(playerName)); } if (shipLength != 3) { throw new ArgumentException(nameof(shipLength)); } _coordinateReader = coordinateReader; _console = console; PlayerName = playerName; ShipLength = shipLength; CoordinatesList = new List <Coordinates>(); HitShots = new List <Coordinates>(); MissedShots = new List <Coordinates>(); }
public void StartBattleship() { var player1 = "Player 1"; var player2 = "Player 2"; _coordinatesReader = new CoordinatesReader(); _console = new ConsoleWrapper(); var player1Board = InitialiseBoard(player1, 3); var player2Board = InitialiseBoard(player2, 3); Run(player1Board, player2Board); }