The class Adventure represents text adventure games. An adventure consists of a player and a number of areas that make up the game world. It provides methods for playing the game one turn at a time and for checking the state of the game.
N.B. This version of the class has a lot of “hard-coded” information that pertains to a very specific adventure game that involves a small trip through a twisted forest. All newly created instances of class Adventure are identical to each other. To create other kinds of adventure games, you will need to modify or replace the source code of this class.
Returns a message that is to be displayed to the player at the end of the game. The message will be different depending on whether or not the player has completed their quest.
Returns a message that is to be displayed to the player at the end of the game. The message will be different depending on whether or not the player has completed their quest.
Plays a turn by executing the given in-game command, such as “go west”. Returns a textual report of what happened, or an error message if the command was unknown. In the latter case, no turns elapse.
Plays a turn by executing the given in-game command, such as “go west”. Returns a textual report of what happened, or an error message if the command was unknown. In the latter case, no turns elapse.