-
-
Save JoeyGo23/c65b10b0d14be2a3014f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def get_validated_user_input | |
while true | |
input = get_user_input | |
break if yield(input) | |
print_invalid_message | |
end | |
input | |
end | |
user_move = get_validated_user_input {|input| move_valid?(input, board)} | |
board_size = get_validated_user_input {|input| board_size_valid?(input, board_size_options)} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment