Example #1
0
 public void ValidateShipLocation(int row, int column)
 {
     if (VisibleBoard.Board[row, column].Contains(">"))
     {
         rowSelection    = UserInterface.GetUserInputInt("Invalid selection. Please pick a row:");
         columnSelection = UserInterface.GetUserInputInt("Please pick a column:");
         ValidateShipLocation(rowSelection, columnSelection);
     }
 }
Example #2
0
 public void SetShipLocations()
 {
     for (int i = 0; i < armada.Fleet.Length; i++)
     {
         rowSelection    = UserInterface.GetUserInputInt($"Pick a row for your {armada.Fleet[i].Name}!");
         columnSelection = UserInterface.GetUserInputInt($"Pick a column for your {armada.Fleet[i].Name}!");
         SetShipDirection(armada.Fleet[i]);
         ValidateShipLocation(rowSelection, columnSelection);
         AddShipToBoard(armada.Fleet[i]);
         VisibleBoard.PrintBoard();
     }
 }
Example #3
0
 public void ChooseHitLocation(HiddenBoard activeBoard)
 {
     rowSelection    = UserInterface.GetUserInputInt("Pick the row of your hit!\n");
     columnSelection = UserInterface.GetUserInputInt("Pick the column of your hit!\n");
     activeBoard.Board[rowSelection, columnSelection] = "X";
 }
Example #4
0
 public void SetShipDirection(Ship ship)
 {
     //use to set vertical or horizontal orientation of ship
     ship.OrientationCode = UserInterface.GetUserInputInt("Which direction would you like your ship to go? (1 for horizontal, 2 for vertical)");
 }