Adventure Docs
Fall 2026
API

# o1.adventure

package o1.adventure

## Members list

### Packages

package o1.adventure.ui

### Type members

#### Classlikes

class Action(`input`: String)

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.

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.

## Parameters

input

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

## Attributes

Supertypes
  class Object
  trait Matchable
  class Any

class 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.

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 that pertains 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.

## Attributes

Supertypes
  class Object
  trait Matchable
  class Any

class Area(var `name`: String, var `description`: String)

The class `Area` represents locations in a text adventure game world. A game world consists of areas. In general, an “area” can be pretty much anything: a room, a building, an acre of forest, or something completely different. What different areas have in common is that players can be located in them and that they can have exits leading to other, neighboring areas. An area also has a name and a description.

The class `Area` represents locations in a text adventure game world. A game world consists of areas. In general, an “area” can be pretty much anything: a room, a building, an acre of forest, or something completely different. What different areas have in common is that players can be located in them and that they can have exits leading to other, neighboring areas. An area also has a name and a description.

## Parameters

description

  a basic description of the area (typically not including information about items)

name

  the name of the area

## Attributes

Supertypes
  class Object
  trait Matchable
  class Any

class Item(val `name`: String, val `description`: String)

The class `Item` represents items in a text adventure game. Each item has a name and a longer description. (In later versions of the adventure game, items may have other features as well.)

The class `Item` represents items in a text adventure game. Each item has a name and a longer description. (In later versions of the adventure game, items may have other features as well.)

N.B. It is assumed, but not enforced by this class, that items have unique names. That is, no two items in a game world have the same name.

## Parameters

description

  the item’s description

name

  the item’s name

## Attributes

Supertypes
  class Object
  trait Matchable
  class Any

class Player(`startingArea`: Area)

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

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.

## Parameters

startingArea

  the player’s initial location

## Attributes

Supertypes
  class Object
  trait Matchable
  class Any