Last active
April 6, 2016 18:29
-
-
Save bendavis78/8ac94770f569fd365ba97c074a1b9186 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
max = 20 | |
number = rand(max) | |
puts "I'm thinking of a number between 1 and #{max}. Guess." | |
begin | |
answer = gets.to_i | |
difference = number - answer | |
byebug | |
if difference.abs < 3 | |
puts "Getting warm!" | |
else | |
puts "Getting cold :-(" | |
end | |
puts "Try again" if answer != number | |
end until number == answer | |
puts "You got it!" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment