Skip to content

Instantly share code, notes, and snippets.

@kenrett
Last active December 14, 2015 18:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save kenrett/5130538 to your computer and use it in GitHub Desktop.
Save kenrett/5130538 to your computer and use it in GitHub Desktop.
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