diff --git a/generator_user_input.rb b/generator_user_input.rb new file mode 100644 index 0000000..1baf022 --- /dev/null +++ b/generator_user_input.rb @@ -0,0 +1,32 @@ +# welcome message and user input (choosing amount of menu items) +puts "Welcome to Lauren's Restaurant!" +puts "How many menu items would you like to see? (10 max)" +num = gets.chomp.to_i + +puts "Okay, if you'd like to see #{num} menu options, \nyou unfortunately need to come up with those options!" + +adj = [] +style = [] +protein = [] +array = [adj, style, protein] + +prompts = ["Now, provide #{num} adjectives: ", + "Now, provide #{num} cooking styles: ", + "Please provide #{num} foods: "] + + 3.times do |i| + puts "#{prompts[i-1]}" + num.times do + array[i] << gets.chomp + end + end + + puts "Below is the menu you created!" + adj_sample = array[2].sample(num) + style_sample = array[1].sample(num) + protein_sample = array[0].sample(num) + + num.times do |i| + puts "#{i + 1}: #{adj_sample[i]} #{style_sample[i]} #{protein_sample[i]}" + i += 1 + end diff --git a/primary_requirements.rb b/primary_requirements.rb new file mode 100644 index 0000000..26aab00 --- /dev/null +++ b/primary_requirements.rb @@ -0,0 +1,42 @@ +# Come up with the three arrays of ten items each. +# Each list should be a different type of food +# or descriptor for that food. + +adj = %W[smelly creamy sticky stinky slimy strong stringy gooey pungent watery] +style = ["deep-fried", "steamed", "baked", "boiled", "caramelized", "charbroiled", "grilled", "marinated", "microwaved", "pan fried"] +protein = %W[steak chicken tacos kabobs beans tofu pork sandwiches bacon turkey] + +puts "Welcome to Lauren's Restaurant!" +puts "How many menu items would you like to see? (10 max)" +num = gets.chomp.to_i + +# to avoid duplicates, create a NEW array from OG array! +adj_arr = adj.shuffle +style_arr = style.shuffle +protein_arr = protein.shuffle + +# output message +# randomly pulls one item from each array +puts "\nBelow are your menu options:" +num.times do |i| + puts "#{i + 1}: #{adj_arr[i]} #{style_arr[i]} #{protein_arr[i]}" + i += 1 +end + +# ------ other things I tried: + +# First try: +# this works to meet primary requirements +# puts "\nBelow are your menu options:" +# 10.times do |i| +# puts "#{i}: #{adj.sample} #{style.sample} #{protein.sample}" +# i += 1 +# end + +# long winded way of eliminating duplicates +# for each (adj, style, and protein) +# adj_arr = [] +# until adj_arr.length == num do +# rand = adj.sample +# adj_arr.push(rand) unless adj_arr.include?(rand) +# end