Created
January 28, 2011 03:19
-
-
Save sujal/799772 to your computer and use it in GitHub Desktop.
How I choose lunch at the ESPN cafeteria each day
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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