forked from Ada-C8/Random-Menu
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathRandomMenuGeneratorAmyL.rb
124 lines (109 loc) · 3.38 KB
/
RandomMenuGeneratorAmyL.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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
### Random Menu Generator ###
### three arrays of foods and descriptors
### randomly pull an item from each of the three arrays
adj= ["hot", "crunchy", "spicy", "crispy", "mellow", "flaming", "cold", "tender", "interesting", "fresh"]
style= ["roasted", "sauteed", "oven-baked", "grilled", "fried", "blended", "barbequed", "whipped", "sous-vide", "boiled"]
food = ["egg", "noodles", "ramen", "burger", "pizza", "rice", "brocolli", "soup", "surprise", "wrap"]
#### Version 3
# This version asks users how many menu items they want to see and prompts users until they select a valid number.
puts "Welcome to the random menu generator! How many menu items would you like today?"
choices = gets.chomp.to_i
until (choices > 0 && choices < 11) do
puts "Please pick a number from 1-10."
choices = gets.chomp.to_i rescue nil
end
if choices <= food.length
i = 1
while i < (choices + 1)
index1 = rand(0...adj.length)
item_adj = adj[index1]
adj.delete_at(index1)
index2 = rand(0...style.length)
item_style= style[index2]
style.delete_at(index2)
index3= rand(0...food.length)
item_food = food[index3]
food.delete_at(index3)
puts "#{i}. #{item_adj} #{item_style} #{item_food}"
i +=1
end
end
### Random Menu Generator ###
### three arrays of foods and descriptors
### randomly pull an item from each of the three arrays
# adj= ["hot", "crunchy", "spicy", "crispy", "mellow", "flaming", "cold", "tender", "interesting", "fresh"]
# style= ["roasted", "sauteed", "oven-baked", "grilled", "fried", "blended", "barbequed", "whipped", "sous-vide", "boiled"]
# food = ["egg", "noodles", "ramen", "burger", "pizza", "rice", "brocolli", "soup", "surprise", "wrap"]
#
# #### Version 3.1
# # This version asks users how many menu items they want to see, asks customers to input
#
# adj = []
# style = []
# food = []
#
#
# puts "Welcome to the Random Menu Generator! We have three options to create your menu item: Adjective, style, and food item."
# puts "How many adjectives would you like to provide?"
# adj_num = gets.chomp.to_i
#
# until adj.length == adj_num
# puts "Please provide an adjective."
# adj_input= gets.chomp.to_s rescue nil
# adj << adj_input
# end
#
# puts "How many styles would you like to provide?"
# style_num = gets.chomp.to_i
#
# until style.length == style_num
# puts "Please provide a style."
# style_input= gets.chomp.to_s rescue nil
# adj << style_input
# end
#
# puts "How many food items would you like to provide?"
# food_num = gets.chomp.to_i
#
# until food.length == food_num
# puts "Please provide a style."
# food_input= gets.chomp.to_s rescue nil
# adj << food_input
# end
#
#
# puts "Great! Thank you for providing your input."
# puts "How many menu items would you like today?"
# choices = gets.chomp.to_i
#
# min= [adj.length, style.length, food.length].min
# until (choices > 0 && choices <= min) do
# puts "Please pick a number from 1- #{min}."
# choices = gets.chomp.to_i rescue nil
# end
#
# if choices <= food.length
#
# i = 1
#
# while i < (choices + 1)
#
#
# index1 = rand(0...adj.length)
# item_adj = adj[index1]
# adj.delete_at(index1)
#
# index2 = rand(0...style.length)
# item_style= style[index2]
# style.delete_at(index2)
#
# index3= rand(0...food.length)
# item_food = food[index3]
# food.delete_at(index3)
#
# puts "#{i}. #{item_adj} #{item_style} #{item_food}"
#
# i +=1
# end
#
# end