class Adventure extends AnyRef
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 which pertain 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.
- Alphabetic
- By Inheritance
- Adventure
- AnyRef
- Any
- Hide All
- Show All
- Public
- Protected
Instance Constructors
- new Adventure()
Value Members
- final def !=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- final def ##(): Int
- Definition Classes
- AnyRef → Any
- final def ==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- final def asInstanceOf[T0]: T0
- Definition Classes
- Any
- def clone(): AnyRef
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.CloneNotSupportedException]) @native() @HotSpotIntrinsicCandidate()
- final def eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- def equals(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef → Any
- final def getClass(): Class[_ <: AnyRef]
- Definition Classes
- AnyRef → Any
- Annotations
- @native() @HotSpotIntrinsicCandidate()
- def goodbyeMessage: String
Returns a message that is to be displayed to the player at the end of the game.
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.
- def hashCode(): Int
- Definition Classes
- AnyRef → Any
- Annotations
- @native() @HotSpotIntrinsicCandidate()
- def isComplete: Boolean
Determines if the adventure is complete, that is, if the player has won.
- final def isInstanceOf[T0]: Boolean
- Definition Classes
- Any
- def isOver: Boolean
Determines whether the player has won, lost, or quit, thereby ending the game.
- final def ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- final def notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native() @HotSpotIntrinsicCandidate()
- final def notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native() @HotSpotIntrinsicCandidate()
- def playTurn(command: String): String
Plays a turn by executing the given in-game command, such as "go west".
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.
- val player: Player
The character who is the protagonist of the adventure and whom the real-life player controls.
- final def synchronized[T0](arg0: => T0): T0
- Definition Classes
- AnyRef
- val timeLimit: Int
The maximum number of turns that this adventure game allows before time runs out.
- val title: String
The title of the adventure game.
- def toString: String
- Definition Classes
- AnyRef → Any
- var turnCount: Int
The number of turns that have passed since the start of the game.
- final def wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- final def wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException]) @native()
- final def wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- def welcomeMessage: String
Returns a message that is to be displayed to the player at the beginning of the game.
Deprecated Value Members
- def finalize(): Unit
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.Throwable]) @Deprecated @deprecated
- Deprecated
(Since version ) see corresponding Javadoc for more information.