AdventureDraft Docs
Fall 2025
API

# Adventure

o1.adventure.draft.Adventure
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.

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

## Attributes

Graph
Supertypes
  class Object
  trait Matchable
  class Any

## Members list

### Value members

#### Concrete methods

def isComplete: Boolean

Determines if the adventure is complete, that is, if the player has won.

Determines if the adventure is complete, that is, if the player has won.

## Attributes

def isOver: Boolean

Determines whether the player has won, lost, or quit, thereby ending the game.

Determines whether the player has won, lost, or quit, thereby ending the game.

## Attributes

def playTurn(): Unit

Requests a command from the player, plays a game turn accordingly, and prints out a report of what happened.

Requests a command from the player, plays a game turn accordingly, and prints out a report of what happened.

## Attributes

def printAreaInfo(): Unit

Prints out a description of the player character’s current location, as seen by the character.

Prints out a description of the player character’s current location, as seen by the character.

## Attributes

def printGoodbye(): Unit

Prints out a message that is to be displayed to the player at the end of the game. The message will be different depending on whether the player has completed the quest.

Prints out a message that is to be displayed to the player at the end of the game. The message will be different depending on whether the player has completed the quest.

## Attributes

def printWelcome(): Unit

Prints out a message that is to be displayed to the player at the beginning of the game.

Prints out a message that is to be displayed to the player at the beginning of the game.

## Attributes

def run(): Unit

Runs the game. First, a welcome message is printed, then the player gets the chance to play any number of turns until the game is over, and finally a goodbye message is printed.

Runs the game. First, a welcome message is printed, then the player gets the chance to play any number of turns until the game is over, and finally a goodbye message is printed.

## Attributes

#### Concrete fields

val clearing: Area
val destination: Area
val home: Area
val middle: Area
val northForest: Area
val player: Player

The character who is the protagonist of the adventure and whom the real-life player controls.

The character who is the protagonist of the adventure and whom the real-life player controls.

## Attributes

val southForest: Area
val tangle: Area
val timeLimit: Int

The maximum number of turns that this adventure game allows before time runs out.

The maximum number of turns that this adventure game allows before time runs out.

## Attributes

val title: String
var turnCount: Int

The number of turns that have passed since the start of the game.

The number of turns that have passed since the start of the game.

## Attributes