Trees | Indices | Help |
|
---|
|
object --+ | 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:
This version of the class has a lot of "hard-coded" data
which represents a very specific adventure game involving a small
trip through a twisted forest and some other game-specific features
such as a time limit and a specific goal location for the player.
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.
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
Inherited from |
|
|||
Inherited from |
|
Sets up a new "Forest adventure" game.
|
Returns the name (or title) of the adventure game.
|
Returns an object representing the player character that the user controls.
|
Returns the number of turns the adventure has lasted so far.
|
Plays one turn of the adventure game. This involves the player character executing the given command - indeed, that is the only thing that happens during a turn of the basic forest adventure game. Some more elaborate adventure games could have other creatures move or act after the player, or could feature other world events independent of the player's actions. Playing a turn advances the turn count of the adventure by one (though giving a command that the game does not understand does not count as a turn).
|
Determines if the adventure is complete, i.e., if the player has won.
|
Determines if the adventure is over.
|
Returns the text to be displayed to the user at the beginning of the game.
|
Returns the text to be displayed to the user at the end of the game. The text will vary depending on whether or not the player has completed the quest.
See Also: #is_over() |
Trees | Indices | Help |
|
---|
Generated by Epydoc 3.0.1 on Thu Sep 8 19:19:04 2011 | http://epydoc.sourceforge.net |