Skip to content

Instantly share code, notes, and snippets.

@buwilliams
Created December 30, 2015 00:08
Show Gist options
  • Save buwilliams/89828ce2c17fc48c8eec to your computer and use it in GitHub Desktop.
Save buwilliams/89828ce2c17fc48c8eec to your computer and use it in GitHub Desktop.
Revealed Word for Hangman
word = "Vadar"
guesses = ["a", "r"]
revealed_word = word.chars.map { |c|
guesses.include?(c) ? c : '-'
}.join('')
puts revealed_word
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment