Adventure
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.
NOTE: The AdventureDraft module is not even close to being well designed. See Chapter 9.3 in the course materials.
Value members
Concrete methods
Determines if the adventure is complete, that is, if the player has won.
Determines if the adventure is complete, that is, if the player has won.
Determines whether the player has won, lost, or quit, thereby ending the game.
Determines whether the player has won, lost, or quit, thereby ending the game.
Requests a command from the player, plays a game turn accordingly, and prints out a report of what happened.
Requests a command from the player, plays a game turn accordingly, and prints out a report of what happened.
Prints out a description of the player character’s current location, as seen by the character.
Prints out a description of the player character’s current location, as seen by the character.
Prints out 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 the quest.
Prints out 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 the quest.
Prints out a message that is to be displayed to the player at the beginning of the game.
Prints out a message that is to be displayed to the player at the beginning of the game.
Runs the game. First, a welcome message is printed, then the player gets the chance to play any number of turns until the game is over, and finally a goodbye message is printed.
Runs the game. First, a welcome message is printed, then the player gets the chance to play any number of turns until the game is over, and finally a goodbye message is printed.
Concrete fields
The character who is the protagonist of the adventure and whom the real-life player controls.
The character who is the protagonist of the adventure and whom the real-life player controls.