Skip to content

Instantly share code, notes, and snippets.

@kyleburton
Created April 3, 2013 19:47
Show Gist options
  • Save kyleburton/5304612 to your computer and use it in GitHub Desktop.
Save kyleburton/5304612 to your computer and use it in GitHub Desktop.
For Fun
$meats = %w[fajita-veggie carnitas barbacoa chicken steak]
$rices = ['no-rice', 'white rice', 'brown rice']
$salsas = ['mild salsa', 'medium salsa', 'salsa roja']
$toppings = %w[sour-cream guacamole lettuce cheese]
def gen
ingredients = []
base = $meats[rand($meats.size)] + ' burrito with '
ingredients << $rices[rand($meats.size-1)]
if rand < 0.9
ingredients << $salsas[rand($salsas.size-1)]
end
toppings = $toppings.dup
1..3.times do
if rand < 0.9
idx = rand(toppings.size-1)
ingredients << toppings[idx]
toppings.delete_at idx
end
end
final = ingredients.pop
base + ingredients.join(", ") + " and " + final
end
while true
puts gen
end
__END__
head -n 10 /dev/burrito
barbacoa burrito with brown rice, medium salsa, sour-cream and guacamole
fajita-veggie burrito with brown rice, medium salsa, lettuce and guacamole
steak burrito with white rice, medium salsa, guacamole and sour-cream
chicken burrito with , mild salsa, sour-cream, guacamole and lettuce
chicken burrito with brown rice, medium salsa, guacamole, lettuce and sour-cream
chicken burrito with white rice, mild salsa, sour-cream, lettuce and guacamole
fajita-veggie burrito with no-rice, medium salsa, sour-cream, lettuce and guacamole
steak burrito with , mild salsa, lettuce, sour-cream and guacamole
steak burrito with no-rice, medium salsa, guacamole, lettuce and sour-cream
@cpm
Copy link

cpm commented Apr 4, 2013

I think line 9 is supposed to use $rices.size.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment