Viinaharava Docs
Fall 2026
API

# CompassDir

o1.grid.CompassDir
See the CompassDir companion enum
object CompassDir

This companion object of type `CompassDir` provides a selection of related constants and utility methods.

This object has an alias in the top-level package o1, so it’s accessible to students simply via `import o1.*`.

## Attributes

Companion
  enum
Graph
Supertypes
  trait Sum
  trait Mirror
  class Object
  trait Matchable
  class Any
Self type
  CompassDir.type

## Members list

### Type members

#### Inherited and Abstract types

type MirroredElemLabels <: Tuple

The names of the product elements.

The names of the product elements.

## Attributes

Inherited from:
  Mirror

type MirroredLabel <: String

The name of the type.

The name of the type.

## Attributes

Inherited from:
  Mirror

### Value members

#### Concrete methods

def fromArrowKey(key: Key): Option[CompassDir]

Returns the CompassDir that corresponds to the given arrow key. For example, the right arrow corresponds to `East`.

Returns the CompassDir that corresponds to the given arrow key. For example, the right arrow corresponds to `East`.

## Parameters

key

  any key on the keyboard

## Attributes

Returns

  one of the four `CompassDir`s; `None` if the given key is not one of the four arrow keys

See also

  fromWASD, fromKey

def fromKey(key: Key): Option[CompassDir]

Returns the CompassDir that corresponds to the given arrow key. For example, the right arrow or the D key corresponds to `East`.

Returns the CompassDir that corresponds to the given arrow key. For example, the right arrow or the D key corresponds to `East`.

## Parameters

key

  any key on the keyboard

## Attributes

Returns

  one of the four `CompassDir`s; `None` if the given key is not one of the four arrow keys or one of the four WASD keys

See also

  fromArrowKey, fromWASD

def fromWASD(key: Key): Option[CompassDir]

Returns the CompassDir that corresponds to the given WASD key. For example, the D key corresponds to `East`.

Returns the CompassDir that corresponds to the given WASD key. For example, the D key corresponds to `East`.

## Parameters

key

  any key on the keyboard

## Attributes

Returns

  one of the four `CompassDir`s; `None` if the given key is not one of the four WASD keys

See also

  fromArrowKey, fromKey

#### Concrete fields

val Clockwise: Vector[CompassDir]

a collection of all the four directions, in clockwise order starting with `North`

a collection of all the four directions, in clockwise order starting with `North`

## Attributes

val Count: Int

The number of the compass directions represented by class `CompassDir`. Four, that is.

The number of the compass directions represented by class `CompassDir`. Four, that is.

## Attributes

### Givens

given derived$CanEqual: CanEqual[CompassDir, CompassDir]