AdventureDraft Docs
Fall 2026
API

# Player

o1.adventure.draft.Player
class Player(`startingArea`: Area)

A `Player` object represents a player character controlled by the real-life user of the program.

A player object’s state is mutable: the player’s location and possessions can change, for instance.

NOTE: The AdventureDraft module is not even close to being well-designed. See Chapter 9.3 in the course materials.

## Parameters

startingArea

  the player’s initial location

## Attributes

Graph
Supertypes
  class Object
  trait Matchable
  class Any

## Members list

### Value members

#### Concrete methods

def go(`direction`: String): Unit

Attempts to move the player in the given direction. This is successful if there is an exit from the player’s current location towards the direction name. Prints out the results of the action.

Attempts to move the player in the given direction. This is successful if there is an exit from the player’s current location towards the direction name. Prints out the results of the action.

## Attributes

def hasQuit: Boolean

Determines whether the player has indicated a desire to quit the game.

Determines whether the player has indicated a desire to quit the game.

## Attributes

def location: Area

Returns the current location of the player.

Returns the current location of the player.

## Attributes

def quit(): Unit

Signals that the player wants to quit the game.

Signals that the player wants to quit the game.

## Attributes

def rest(): Unit

Causes the player to rest for a short while. (This has no substantial effect in game terms.) Prints out a message stating that the player rests.

Causes the player to rest for a short while. (This has no substantial effect in game terms.) Prints out a message stating that the player rests.

## Attributes

override def toString: String

Returns a brief description of the player’s state, for debugging purposes.

Returns a brief description of the player’s state, for debugging purposes.

## Attributes

Definition Classes
  Any