Last active
January 15, 2016 23:00
-
-
Save parksilk/4541201 to your computer and use it in GitHub Desktop.
Dev Bootcamp Guessing Game Exercise
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
class GuessingGame | |
def initialize(answer) | |
@answer = answer | |
end | |
def guess(num_guess) | |
if num_guess > @answer then @result = :high | |
elsif num_guess < @answer then @result = :low | |
else @result = :correct | |
end | |
end | |
def solved? | |
if @result == :correct then true | |
else false | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment