Skip to content

Instantly share code, notes, and snippets.

@jfarmer
Forked from kenrett/gist:5130538
Created March 10, 2013 21:50
Show Gist options
  • Save jfarmer/5130624 to your computer and use it in GitHub Desktop.
Save jfarmer/5130624 to your computer and use it in GitHub Desktop.
class GuessingGame
def initialize(answer)
@answer = answer
end
def guess(g)
if @answer < g
return :high
end
if @answer == g
return :correct
end
if @answer > g
return :low
end
end
def solved?
if g == :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