diff --git a/word_guess.rb b/word_guess.rb new file mode 100644 index 0000000..5b4a218 --- /dev/null +++ b/word_guess.rb @@ -0,0 +1,123 @@ +#Classes +class Game + + def initialize + get_word + make_art + make_marquee + end + + def get_word + while true + #promts user to enter a type of word they + #want to guess + print "What type of word would you like to guess?\n" + number = 1 + dictionary_hash = { + # sports: ["ball", "basket", "hoop", "stadium", "tennis", "gymnastics", "curling", "badminton", "referee", "athlete"], + food: ["apple", "soup", "breakfast", "sprinkles", "picnic", "pancake", "marshmallow", "horseradish", "cinnamon", "artichoke"] + } + #lists the types of food words to choose from + dictionary_hash.keys.each do |type| + print "#{ number }. #{ type.capitalize }\n" + number += 1 + end + type = gets.chomp.downcase.to_sym + #makes sure their type is included in our list + if dictionary_hash.keys.include?(type) + #generates the word to guess + @game_word = (dictionary_hash[type].sample) + print @game_word + break + else + puts "That's not a type of word we can use. The types are: " + end + end + end + + def make_marquee + marquee_array = [] + @game_word.length.times do + marquee_array << "_" + end + marquee_array.each do |space| + print "#{space} " + end + end + +def make_art + wrong_guess_0 = <