Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
class GuessingGame
class GuessingGame
def initialize(answer)
@answer = answer
end
def guess(g)
@guess = g
if @answer < @guess
return :high
end
if @answer == @guess
return :correct
end
if @answer > @guess
return :low
end
end
def solved?
if @guess == :correct
return true
else
return false
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment