Advertisement
Guest User

Untitled

a guest
Feb 10th, 2025
251
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.62 KB | None | 0 0
  1. String[] userInputCoords = new Scanner(System.in).nextLine().toUpperCase().split(" ");
  2.  
  3. while (!userInputCoords[0].matches(ConstantsModel.COORDS_REGEX)
  4.     && !userInputCoords[1].matches(ConstantsModel.COORDS_REGEX)) {
  5.     System.out.println(ConstantsModel.TELL_ERROR);
  6.     askCoords(ship.getName(), ship.getSize());
  7.     serInputCoords = new Scanner(System.in).nextLine().toUpperCase().split(" ");
  8. }
  9.  
  10. int[] parsedCoords = parseCoordsToArrayIndexes(userInputCoords);
  11. int[] fullShipCoords = extrapolateBodyCoords(parsedCoords, ship.getSize());
  12. CoordinateModel[] shipCoordinates = new CoordinateModel[fullShipCoords.length];
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement