mirror of
https://github.com/coding-horror/basic-computer-games.git
synced 2025-12-12 07:40:50 -08:00
44_Hangman ruby: randomize seed and use the shuffled array for puzzle order.
This commit is contained in:
@@ -8,7 +8,7 @@ class Canvas
|
||||
end
|
||||
BUFFER << line
|
||||
end
|
||||
|
||||
|
||||
clear
|
||||
end
|
||||
|
||||
@@ -253,14 +253,14 @@ end
|
||||
def main
|
||||
puts "#{(" " * 32)}HANGMAN"
|
||||
|
||||
shuffled = WORDS.shuffle(random: Random.new(1))
|
||||
shuffled = WORDS.shuffle(random: Random.new)
|
||||
current_word = 0
|
||||
word_count = shuffled.length
|
||||
|
||||
keep_playing = true
|
||||
while keep_playing
|
||||
|
||||
play_game(WORDS[current_word])
|
||||
play_game(shuffled[current_word])
|
||||
current_word += 1
|
||||
|
||||
if current_word == word_count
|
||||
|
||||
Reference in New Issue
Block a user