Skip to content

Instantly share code, notes, and snippets.

@sujal
Created January 28, 2011 03:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sujal/799772 to your computer and use it in GitHub Desktop.
Save sujal/799772 to your computer and use it in GitHub Desktop.
How I choose lunch at the ESPN cafeteria each day
require 'lunch_choice_observation'
LUNCH_CHOICES = ["Pizza", "Salad"]
SIDE_CHOICES = ["Clif Bar", "Popchips", "Glenny's Soy Crisps"]
DRINK_CHOICES = ["Diet Pepsi", "Diet Dr. Pepper", "VitaminWater Zero", "Sprite Zero",
"Water", "Water", "Water", "Water", "Water", "Water"]
def choose_lunch
choices = Array.new
number_of_items_today = rand(2)+1
number_of_items_today.times do |x|
choices << LUNCH_CHOICES[rand(LUNCH_CHOICES.length)]
end
choices.uniq!
if number_of_items_today == 1
if rand(5) > 2
choices << SIDE_CHOICES[rand(SIDE_CHOICES.length)]
end
end
LunchChoiceObservation.observe!
if LunchChoiceObservation.interesting_side?
choices.slice!(1,2)
choices << LunchChoiceObservation.interesting_side
end
if self.super_tired?
choices << "Sugar Free Red Bull 12oz"
else
choices << DRINK_CHOICES[rand(DRINK_CHOICES.length)]
end
choices
end
puts choose_lunch
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment