public void BattleshipsMenu() { bool running = true; do { Console.WriteLine("Battle Ships Menu \n"); Console.WriteLine("1. Start new game \n2. Deploy ship. \n0. Exit "); string choice = GetUserChoice(); switch (choice) { case "1": Console.Clear(); battleships = new Battleships(); battleships.Skifttur(); Console.WriteLine(battleships.GetBoardView(battleships.board, battleships.board2)); break; case "2": DeployMenu(); battleships.Skifttur(); Console.WriteLine(battleships.GetBoardView(battleships.board, battleships.board2)); break; case "0": running = false; break; default: ShowMenuSelectionError(); break; } } while (running); }
public void CanDeployShipOnAllBoards() { battleShips.Skifttur(); int shipLength = 4; char shipNumber = '4'; int startx = 2; int starty = 2; bool horizontal = true; // board 1 battleShips.DeployShip(shipLength, startx, starty, horizontal, shipNumber); for (int i = 0; i < shipLength; i++) { Assert.AreEqual('4', battleShips.board[(startx - 1) + i, (starty - 1)]); } battleShips.Skifttur(); battleShips.Skifttur(); battleShips.Skifttur(); battleShips.Skifttur(); battleShips.Skifttur(); //Skifter tur fem gange for at ændre board. // board 2 battleShips.DeployShip(shipLength, startx, starty, horizontal, shipNumber); for (int i = 0; i < shipLength; i++) { Assert.AreEqual('4', battleShips.board[(startx - 1) + i, (starty - 1)]); } }