Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create random_menu.rb #25

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
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
108 changes: 108 additions & 0 deletions random_menu.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
### ARRAYS FOR FIRST THROUGH OPTIONAL #2
# adjs = ["Soft", "Hard", "Crunchy", "Crispy", "Creamy", "Candied", "Flaky", "Infused", "Juicy", "Spicay"]
#
# style = ["Pan-seared", "Cured", "Deep-Fried", "Braised", "Glazed", "Marinated", "Pureed", "Reduction", "Sauteed", "Charbroiled"]
#
# foods = ["Chicken", "Beef", "Fish", "Clams", "Ribs", "Shrimp", "Scallop", "Vegetables", "Tofu", "Lamb"]

### MAIN PROBLEM USE .SAMPLE METHOD TO PULL RANDOMLY FROM EACH ARRAY
# puts "Here are your 10 menu items for today!"
# puts
# puts "=" * 30
# puts
# 10.times do |i|
# puts "#{i +1}. #{adjs.sample} #{style.sample} #{foods.sample}"
# end

### OPTIONAL ENHANCEMENT #1 - Do not repeat menu item names
# puts
# puts "Here are your 10 menu items for today!"
# puts
# puts "=" * 30
# puts
# 10.times do |i|
# # Store random value
# adjs_value = adjs.sample
# style_value = style.sample
# foods_value = foods.sample
# # Print menu items
# puts "#{i + 1}. #{adjs_value} #{style_value} #{foods_value}"
#
# # Delete from array so that it will not be used again
# adjs.delete(adjs_value)
# style.delete(style_value)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a clever way to make sure all elements are unique. I also like that you've broken out the three steps (choose a word, print the word, delete it from the array) rather than trying to do it all in one line - good style instincts.

# foods.delete(foods_value)
# end

### OPTIONAL ENHANCEMENT #2 - Input number of menu items by user
# puts "How many food items would you like today?"
#
# input_num = gets.chomp.to_i
# # Input Validation for only up to 10 options
# until input_num <= 10 && input_num >= 1
# puts
# puts "Please enter a number from 1 to 10"
# puts
# puts "How many food items would you like today? Please input a number from 1 to 10"
# input_num = gets.chomp.to_i
# end
#
# puts
# puts "Here is your menu for today!"
# puts
# puts "=" * 30
# puts
# input_num.times do |i|
# # Store random value
# adjs_value = adjs.sample
# style_value = style.sample
# foods_value = foods.sample
#
# # Print menu items
# puts "#{i + 1}. #{adjs_value} #{style_value} #{foods_value}"
#
# # Delete from array so that it will not be used again
# adjs.delete(adjs_value)
# style.delete(style_value)
# foods.delete(foods_value)
# end

### OPTIONAL ENHANCEMENT #3 - User input to make menu
# all_adjs = []
# all_styles = []
# all_foods = []
#
# # puts "FOLLOW THE PROMPTS AND WE WILL MAKE YOUR 5 MENU FOR YOU!"
# 3.times do
# puts "Please enter a food adjective ie.crispy"
# input_adj = gets.chomp
# all_adjs << input_adj
#
# puts "Please enter a food cooking style ie.pan-fried"
# input_style = gets.chomp
# all_styles << input_style
#
# puts "Please enter a food type ie.shrimp"
# input_food = gets.chomp
# all_foods << input_food
# end
#
# puts
# puts "Here is your menu for today!"
# puts
# puts "=" * 30
# puts
# 3.times do |i|
# # Store random value
# adjs_value = all_adjs.sample
# style_value = all_styles.sample
# foods_value = all_foods.sample
#
# # Print menu items
# puts "#{i + 1}. #{adjs_value} #{style_value} #{foods_value}"
#
# # Delete from array so that it will not be used again
# all_adjs.delete(adjs_value)
# all_styles.delete(style_value)
# all_foods.delete(foods_value)
# end