forked from Ada-C8/Random-Menu
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrandom_menu_generator.rb
47 lines (38 loc) · 1.27 KB
/
random_menu_generator.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#generates 10 random menu items from 3 arrays
adjective = ["Slippery", "Old", "Toasted", "Aged", "Baked", "Grilled",
"Charred", "Roasted", "Southwestern-Style", "Cold"]
style = ["Broiled", "Boiled", "Pan-Fried", "Sauteed", "Poached",
"Chipotle", "Sriracha", "Vodka-Infused", "Jalapeno", "Adobo-Rubbed"]
food = ["Hot Dogs", "Tomatoes", "Beans", "Shrimp", "Noodles",
"Mushrooms", "Fish & Chips", "Tacos", "Lasagna", "Chicken"]
#stores options picked by random generator
picked = []
picked_adjective = ""
picked_style = ""
picked_food = ""
#loops to create menu items 1-10
(1..10).each do |num|
print "#{num} "
#chooses one word randomly from adjective, style, food arrays
#checks if word already exists in picked array
#prints a word not in array
#adds word to array
picked_adjective = adjective[rand(0..9)]
while picked.include?(picked_adjective)
picked_adjective = adjective[rand(0..9)]
end
print "#{picked_adjective} "
picked << picked_adjective
picked_style = style[rand(0..9)]
while picked.include?(picked_style)
picked_style = style[rand(0..9)]
end
print "#{picked_style} "
picked << picked_style
picked_food = food[rand(0..9)]
while picked.include?(picked_food)
picked_food = food[rand(0..9)]
end
puts picked_food
picked << picked_food
end