From ef283da18b163cbe11b96510955f4e91e115d45c Mon Sep 17 00:00:00 2001 From: Sofia Kim Date: Thu, 9 Feb 2017 09:40:19 -0800 Subject: [PATCH] Create random.rb --- random.rb | 43 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 random.rb diff --git a/random.rb b/random.rb new file mode 100644 index 0000000..cc39e7d --- /dev/null +++ b/random.rb @@ -0,0 +1,43 @@ +adj = [] +style = [] +foods = [] + +puts "how many items would you like?" +items = gets.chomp.to_i + +puts "Describe how your #{items} foods want to be each" +items.times do + adjective = gets.chomp + adj.push(adjective) +end + +puts "What type of style would you want for your #{items} foods?" +items.times do + styling = gets.chomp + style.push(styling) +end + +puts "What kind of #{items} dishs would you want?" +items.times do + dish = gets.chomp + foods.push(dish) +end + +i = 1 +items.times do + index_x = rand(0...(adj.length)) + index_y = rand(0...(style.length)) + index_z = rand(0...(foods.length)) + + x = adj[index_x] + y = style[index_y] + z = foods[index_z] + + menu = "#{i}: #{x} #{y} #{z}" + puts menu + + adj.delete_at(index_x) + style.delete_at(index_y) + foods.delete_at(index_z) + i +=1 +end