Skip to content

Instantly share code, notes, and snippets.

@parksilk
Last active January 15, 2016 23:00
Show Gist options
  • Save parksilk/4541201 to your computer and use it in GitHub Desktop.
Save parksilk/4541201 to your computer and use it in GitHub Desktop.
Dev Bootcamp Guessing Game Exercise
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