Skip to content

Create menu_generator.rb #33

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

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
79 changes: 79 additions & 0 deletions menu_generator.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
#creates menues based on arrays of descriptors with other iterations
#for ada 01 ruby


adj = ["hot", "spicy", "tasty", "fragrant", "aromatic", "oily", "cold", "sliced", "blended", "salted",]
cooked = ["braised", "sautéed", "flambéed", "fried", "boiled", "poached", "frozen", "microwaved", "steamed", "brûléed"]
food = ["eggs", "bananas", "broccoli", "cauliflower", "apples", "bread", "salad", "pecans", "crackers", "potatoes"]

## initial assignment
10.times do |n|
item = "#{adj[rand(9)]} #{cooked[rand(9)]} #{food[rand(9)]}"
puts "#{n+1}. #{item}"
Copy link
Collaborator

Choose a reason for hiding this comment

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

You're right that you don't strictly need item here. However, it never hurts to break a complex bit of code up into multiple lines / variables. This can often make it much easier to read and to reason about.

end



## edit for number of desired items
# print "How many menu items are you looking for today? "
# number = gets.chomp.to_i
# until number<= 10
# print "That menu is excessive. Try a smaller menu: "
# number= gets.chomp.to_i
# end
#
# number.times do |n|
# item = "#{adj[rand(9)]} #{cooked[rand(9)]} #{food[rand(9)]}"
# puts "#{n+1}. #{item}"
# end


##edit for non repeating random numbers - didn't get very far.
# print "How many menu items are you looking for today? "
# number = gets.chomp.to_i
# until number<= 10
# print "That menu is excessive. Try a smaller menu: "
# number= gets.chomp.to_i
# end
#
# number.times do |n|
# item = "#{adj[rand(9)]} #{cooked[rand(9)]} #{food[rand(9)]}"
# puts "#{n+1}. #{item}"
# end


## broken code for non repeating random numbers
# rn = (0..10).to_a.shuffle.take(1)
# puts rn
# puts



## for user input for all options
# adj = []
# cooked = []
# food = []
#
# print "How many menu items are you looking for today? "
# number = gets.chomp.to_i
#
# puts "Ok, give me #{number} foods you have to work with:"
# number.times do
# food.push(gets.chomp)
# end
#
# puts "Next give me #{number} of descriptors for your dishes:"
# number.times do
# adj.push(gets.chomp)
# end
#
# puts "Finally give me #{number} ways you know how to cook those foods:"
# number.times do
# cooked.push(gets.chomp)
# end
#
# puts "Based on those options, my recommended menu is:"
# number.times do |n|
# item = "#{adj[rand(number-1)]} #{cooked[rand(number-1)]} #{food[rand(number-1)]}"
# puts "#{n+1}. #{item}"
# end