Zork
Note: This is an advanced problem suitable for pairs, groups or talented individual students.
Zork was an early interactive computer game. It was initially released in 1977.
According to Wikipedia:
Zork is set in "the ruins of an ancient empire lying far underground". The player is a nameless adventurer "who is venturing into this dangerous land in search of wealth and adventure". The goal is to return from exploring the "Great Underground Empire" (GUE, for short) alive and with all treasures needed to complete each adventure,[6] ultimately inheriting the title of Dungeon Master.
We're not going to do all that. But in the spirit of Zork (and adventure) write an application that asks people what direction they wish to travel in. Once they tell you the direction, move them to the next room and tell them what is in it and what direction the other exits are.
Your setting will be a seven room haunted house. Good luck!
room | contains | doors to (direction & room #) | |
#1 | foyer | dead scorpion | room n2 |
#2 | front room | piano | rooms s1,w3, e4 |
#3 | library | spiders | rooms e2 & n5 |
#4 | kitchen | bats | rooms w2 & n7 |
#5 |
dining room |
dust empty box |
room s3 |
#6 | vault | 3 walking skeletons | room e7 |
#7 | parlor | treasure chest | rooms w6, s4 |
Here's what your version of Zork will look like at the console:
You are standing in the front room of an old house.
You see a dead scorpion.
You can (1)exit to the east, (2) exit to the west.
1
You are standing in a library.
You see spiders.
You can (1) exit to the north, (2) exit to the east.