From f86c535d15e3789da47bdfcea2f17e39762b5908 Mon Sep 17 00:00:00 2001 From: Madaleine Shields Date: Tue, 6 Feb 2018 11:13:23 -0800 Subject: [PATCH] Random Menu --- random_menu.rb | 54 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 54 insertions(+) create mode 100644 random_menu.rb diff --git a/random_menu.rb b/random_menu.rb new file mode 100644 index 0000000..864014e --- /dev/null +++ b/random_menu.rb @@ -0,0 +1,54 @@ +# Come up with the three arrays of ten items each. +# Each list should be a different type of food or descriptor for that food. +# +# the first array can contain adjectives, +# the second, cooking styles +# the third, foods. +# +# If this was the array selection, it could create a few items like: + +food_adjective = [] +cooking_style = [] +food_type = [] +random_menu_items= [] +puts "\nHow many items are on the menu?" +num_items = gets.chomp.to_i + +# toggle n for number of times +puts "\nFood Adjectives" +num_items.times do |i| + print "\n##{i + 1}: " + adjective = gets.chomp.downcase + food_adjective[i] = adjective +end + +puts "\nCooking Style" +num_items.times do |i| + print "\n##{i + 1}: " + style = gets.chomp.downcase + cooking_style[i] = style +end + +puts "\nFood Type" +num_items.times do |i| + print "\n#{i + 1}: " + type = gets.chomp.downcase + food_type[i] = type +end + +# p "#{food_adjective}" +# p "#{cooking_style}" +# p "#{food_type}" + +puts "\n===Random Menu===\n" + +num_items.times do |i| + +random_menu_items[i] = "#{food_adjective.delete(food_adjective.sample)} #{cooking_style.delete(cooking_style.sample)} #{food_type.delete(food_type.sample)}" +# Deletes the element from each array once used in randomly generating a combo of strings +puts "Meal ##{i + 1}: #{random_menu_items[i]}" +# p "#{food_adjective}" +# p "#{cooking_style}" +# p "#{food_type}" +end +puts ""