defgold_roomputs"This room is full of gold. How much do you take?"print"> "choice=$stdin.gets.chomp# this line has a bug, so fix it#if choice.include?("0") || choice.include?("1")ifchoice=~/\d/how_much=choice.to_ielsedead("Man, learn to type a number.")endifhow_much<50puts"Nice, you're not greedy, you win!"exit(0)elsedead("You greedy bastard!")endenddefbear_roomputs"There is a bear here."puts"The bear has a bunch of honey."puts"The fat bear is in front of another door."puts"How are you going to move the bear?"bear_moved=falsewhiletrueprint"> "choice=$stdin.gets.chompifchoice=="take honey"dead("The bear looks at you then slaps your face off.")elsifchoice=="taunt bear"&&!bear_movedputs"The bear has moved from the door.You can go through it now."bear_moved=trueelsifchoice=="taunt bear"&&bear_moveddead("The bear gets pissed off and chews your leg off.")elsifchoice=="open door"&&bear_movedgold_roomelseputs"I got no idea what that means."endendenddefcthulhu_roomputs"Here you see the great evil Cthulhu."puts"He, it, whatever stares at you and you go insane."puts"Do you flee for your life or eat your head?"print"> "choice=$stdin.gets.chompifchoice.include?"flee"startelsifchoice.include?"head"dead("Well that was tasty!")elsecthulhu_roomendenddefdead(why)putswhy,"Good job!"exit(0)enddefstartputs"You are in a dark room."puts"There is a door to your right and left."puts"Which one do you take?"print"> "choice=$stdin.gets.chompifchoice=="left"bear_roomelsifchoice=="right"cthulhu_roomelsedead("You stumble around the room until you starve.")endendstart