A try-again function


Hi. In Battleship!, we give the player 4 turns to win the game. When the player chooses a location outside the ocean or repeats an earlier try, the turn is over, but he didn't add a "X" to the board. Might it be possible to give the player a try-again when he makes those mistakes? Those mistakes should then not count as turns. In this way the player will either win the game or have at least 4 "X" on the board. Does anybody have a solution?


Keep asking for input in a loop until the input is valid, and only then execute the turn.