forked from Ada-C7/Random-Menu
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrandom_menu.rb
65 lines (64 loc) · 1.68 KB
/
random_menu.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
# random_menu assignment from 02.08.2017
# by Tamiko Terada
puts "OH-SO-SEATTLE MENU GENERATOR"
# create new array of 10 descriptors
descriptor = [
"pan-seared",
"sous-vide",
"farm-raised",
"organic",
"local",
"rosemary-infused",
"a duet of",
"crispy",
"fire-roasted",
"ethically-raised"
]
# create new array with 10 meats
meat = [
"duck breast",
"dungeness crab",
"venison",
"filet mignon",
"rabbit",
"sockye salmon",
"Wagyu beef sirloin steak",
"Carlton Farm pork",
"lamb shank",
"albacore tuna"
]
# create new array with 10 pairing items
pairing = [
"hand-foraged wild onions",
"summer squash succotash",
"tri-colored kale",
"wild woodland mushrooms",
"oven-roasted beets",
"garlic and chive aioli",
"grilled radicchio",
"honey-roasted sunchokes",
"frangelico-blackberry compote",
"butternut squash rissoto"
]
# replace each array with shuffled array
descriptor.shuffle!
meat.shuffle!
pairing.shuffle!
# prompt user to enter in number of items
print "How many items do you want to see? > "
number_items = gets.to_i # accept input as integer
# only accept input that is between 1 and 10
until number_items > 0 && number_items <= 10 do
print "Please enter 1 ~ 10 > " # re-prompt for input
number_items = gets.to_i
end
# verify number to user / subheading
puts "Got it! Here are your #{number_items} items:"
# loop as many times as user specified
number_items.times do |position| # iteration variable
# number the menu items with array position + 1 (since it starts w/0)
print "#{position + 1}. "
# print the shuffled arrays according to the position
puts "#{descriptor[position]} #{meat[position]} with #{pairing[position]}"
end
puts "Bon appetite!"