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
# Load the dictionary, store it in an array, shuffle it | |
dictionary = File.open('dictionary.txt') | |
dictionary_array = dictionary.readlines | |
dictionary_array.shuffle! | |
# Intro text, wait for user to type 'start' | |
puts "\n<<< Terminal Hangman >>>\n\n" | |
puts "Type \"start\" to begin a new game\n" | |
turn = 0 | |
rematch = nil |
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
def fizz_buzz_1(max) | |
arr = [] | |
(1..max).each do |n| | |
if ((n % 3 == 0) && (n % 5 == 0)) | |
arr << "FizzBuzz" | |
elsif (n % 3 == 0) | |
arr << "Fizz" | |
elsif (n % 5 == 0) | |
arr << "Buzz" | |
else |