Created
June 7, 2017 22:05
-
-
Save adayNU/cc5528a3f528c5e22150b6d55e66c917 to your computer and use it in GitHub Desktop.
This file contains 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
class Benihana | |
Courses = { | |
"Soup" => 10, | |
"Salad" => 10, | |
"Veggies and Shrimp" => 20, | |
"Fried Rice" => 25, | |
"Rocky's Choice" => 35 | |
} | |
private_constant :Courses | |
def initialize | |
@sake_bomb_count = 0 | |
@hunger_level = 100 | |
end | |
def self.courses | |
Courses.keys | |
end | |
def eat_course(course) | |
if !Courses.include? course | |
puts "That's not a course they serve... How drunk are you, and where did you get that #{course}?!" | |
return nil | |
end | |
safe_eat(Courses[course]) | |
end | |
def take_sake_bomb | |
@sake_bomb_count += 1 | |
end | |
def hunger_level | |
return @hunger_level | |
end | |
def sake_bomb_count | |
return @sake_bomb_count | |
end | |
private | |
def safe_eat(course_cost) | |
if @hunger_level < course_cost | |
puts "You're too full, bro. Stop eating." | |
return nil | |
end | |
@hunger_level -= course_cost | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Example usage: