Created
January 6, 2012 04:44
-
-
Save AnimaWish/1569020 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
def prompt() | |
print "-> " | |
end | |
class Medical | |
def bed() | |
puts "You awake to the sound of alarms and flames. You're lying on a bed 3 meters from a raging fire. What do you do?" | |
prompt | |
response = gets.chomp.downcase | |
if response.include? "stand" | |
puts "You stand up quickly, and then examine your surroundings in more detail. You realize that you're in the Medical Bay. It's only then that you feel the blood running down your leg. Upon closer inspection, you see that you have a deep gash in your stomach that is bleeding profusely. You take off your uniform and tie it snugly around yourself, but you know that you will bleed to death very soon if you don't get medical attention." | |
else | |
puts "That doesn't work." | |
return :bed | |
end | |
end | |
end | |
class Game | |
def initialize(start) | |
@start = start | |
puts @start.inspect | |
$blood = 1 | |
if $blood == 5 | |
puts "You can feel your life force draining. You're halfway to death's door." | |
elsif $blood == 10 | |
puts "You stumble and fall. After struggling for several minutes, you're unable to stand back up; you've lost too much blood. Realizing the futility of your strugle, you rest your head on the ground and accept death's embrace." | |
Process.exit(1) | |
end | |
end | |
def play() | |
puts "@start =>" + @start.inspect | |
next_room = @start | |
while true | |
puts "\n~~~~~~~" | |
room = method(next_room) | |
next_room = room.call | |
end | |
end | |
end | |
realdeal = Game.new(Medical) | |
realdeal.play() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment