Skip to content

Instantly share code, notes, and snippets.

@TheNotary
Last active May 20, 2016 07:11
Show Gist options
  • Save TheNotary/9dc70719716e0d03a1d2dcb7eecf50c8 to your computer and use it in GitHub Desktop.
Save TheNotary/9dc70719716e0d03a1d2dcb7eecf50c8 to your computer and use it in GitHub Desktop.
match(/guess (\S+)/, method: :guess)
def guess(m, guessed_word)
result = @game.guess(guessed_word)
reply = case result
when :missed_north
"My word comes after #{guessed_word}."
when :missed_south
"My word comes before #{guessed_word}."
when :correct
"#{m.user}: congratulations, that's the word! You win!"
when :not_a_word
"#{m.user}: sorry, #{guessed_word} isn't a word. At least, as far as I know"
when :no_game
"You haven't started a game yet. Use `!word start` to do that."
end
m.reply reply
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment