Created
December 30, 2015 00:08
-
-
Save buwilliams/89828ce2c17fc48c8eec to your computer and use it in GitHub Desktop.
Revealed Word for Hangman
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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