Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions wk1_random_menu_generator.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Runs a random menu based on a set of predetermined items

arr1 = ["Creamy", "Spicy", "Mild", "Succulent", "Dairy-free", "Sweet and sour", "Crispy", "Savory", "Hot", "Cold"]
arr2 = ["steamed", "grilled", "marinated", "BBQ-ed", "candied", "par-boiled", "poached", "baked", "vegan", "seared"]
arr3 = ["casserole", "sandwich", "quiche", "tacos", "salmon", "tofu", "brussel sprouts", "cheesecake", "ribs", "tabbouleh"]

#print "How many of the 10 menu items would you like to view? "
# num = gets.chomp

10.times do |i|
puts "#{i+1}. #{arr1.sample} #{arr2.sample} #{arr3.sample}"
end

# shuffles arrays so it's a nonrepeating random list.
arr1_rand = arr1.shuffle
arr2_rand = arr2.shuffle
arr3_rand = arr3.shuffle

10.times do |i|
puts "#{i+1}. #{arr1_rand[i]} #{arr2_rand[i]} #{arr3_rand[i]}"
end