-
-
Save practicingruby/7583494 to your computer and use it in GitHub Desktop.
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
| bats = Hazard.new(:bats) | |
| bats.sensed("You hear a rustling sound.") | |
| bats.encountered do |narrator| | |
| narrator.say("Giant bats whisk you away to a new cavern!") | |
| new_room = random_room | |
| move(:bats, from: current_room, to: new_room) | |
| move(:hunter, from: current_room, to: new_room) | |
| end | |
| # ... | |
| wumpus = Hazard.new(:wumpus) | |
| wumpus.sensed("You smell something horrifying.") | |
| wumpus.encountered do |narrator| | |
| narrator.finish_story("The wumpus gobbled you up!") | |
| end | |
| # ... | |
| pit = Hazard.new(:pit) | |
| pit.sensed("You feel a very cold wind flowing through the cavern.") | |
| pit.encountered do |narrator| | |
| narrator.finish_story("You fell into a bottomless pit. Enjoy the ride!") | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment