Packages

class Action extends AnyRef

The class Action represents actions that a player may take in a text adventure game. Action objects are constructed on the basis of textual commands and are, in effect, parsers for such commands. An action object is immutable after creation.

Linear Supertypes
AnyRef, Any
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. Action
  2. AnyRef
  3. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. Protected

Instance Constructors

  1. new Action(input: String)

    input

    a textual in-game command such as "go east" or "rest"

Value Members

  1. def execute(actor: Player): Option[String]

    Causes the given player to take the action represented by this object, assuming that the command was understood.

    Causes the given player to take the action represented by this object, assuming that the command was understood. Returns a description of what happened as a result of the action (such as "You go west."). The description is returned in an Option wrapper; if the command was not recognized, None is returned.

  2. def toString: String

    Returns a textual description of the action object, for debugging purposes.

    Returns a textual description of the action object, for debugging purposes.

    Definition Classes
    Action → AnyRef → Any