Some of the first video games in the 1970's were text-based adventure games, where the player navigated through a maze of rooms in search of treasure or prey. Consider a simple environment made up of rooms, each of which has two doors connecting it to adjacent rooms. A player can navigate from room to room in the maze by selecting and walking through either the left or right door in each successive room.
For example, consider the following maze of connected rooms:
Starting at the room labeled entry
going left-left-right would
result in the player ending up in the room labeled exit
(going
from entry
to room1
to room3
to exit
).
Similarly, starting at room1
and going left-left would put the player
back in room1
again (going
from room1
to room3
back to room1
).
Your program will need to be able to read maze information from a file, store that information in some internal structure, and then repeatedly prompt the user for a starting room and a series of door selections. For each proposed path, your program should return the room where the player ends up after following that path. The format of the file is up to you, but it should be clearly organized so that other room mazes could easily be created and tested (you must submit a file representation of the above maze and at least one other maze). Similarly, the internal structure used to store and subsequently search the maze is your decision.