Viinaharava Docs
Fall 2026
API

# CompassDir

o1.grid.CompassDir
See the CompassDir companion object
enum CompassDir(val xStep: Int, val yStep: Int)

The type `CompassDir` represents the cardinal compass directions in a grid-like coordinate system. There are exactly four instances of this type: `North`, `East`, `South` and `West`, which are also defined in this package.

All the `CompassDir` objects are immutable.

This type and its instances have aliases in the top-level package o1, so they are accessible to students simply via `import o1.*`.

## Parameters

xStep

  the change in x coordinate if one moves one step in this direction. For instance, `West` has an `xStep` of -1 and `North` has an `xStep` of 0.

yStep

  the change in y coordinate if one moves one step in this direction. For instance, `North` has an `yStep` of -1 and `West` has an `yStep` of 0.

## Attributes

See also

  GridPos

Companion
  object
Graph
Supertypes
  trait Enum
  trait Serializable
  trait Product
  trait Equals
  class Object
  trait Matchable
  class Any
  Show all

## Members list

### Type members

#### Enum entries

case East extends CompassDir

This immutable singleton object represents the eastwardly compass direction. It’s one of the four predefined instances of `CompassDir`. It has an alias in the top-level package o1, so it’s accessible to students simply via `import o1.*`.

This immutable singleton object represents the eastwardly compass direction. It’s one of the four predefined instances of `CompassDir`. It has an alias in the top-level package o1, so it’s accessible to students simply via `import o1.*`.

## Attributes

case North extends CompassDir

This immutable singleton object represents the northwardly compass direction. It’s one of the four predefined instances of `CompassDir`. It has an alias in the top-level package o1, so it’s accessible to students simply via `import o1.*`.

This immutable singleton object represents the northwardly compass direction. It’s one of the four predefined instances of `CompassDir`. It has an alias in the top-level package o1, so it’s accessible to students simply via `import o1.*`.

## Attributes

case South extends CompassDir

This immutable singleton object represents the southwardly compass direction. It’s one of the four predefined instances of `CompassDir`. It has an alias in the top-level package o1, so it’s accessible to students simply via `import o1.*`.

This immutable singleton object represents the southwardly compass direction. It’s one of the four predefined instances of `CompassDir`. It has an alias in the top-level package o1, so it’s accessible to students simply via `import o1.*`.

## Attributes

case West extends CompassDir

This immutable singleton object represents the westwardly compass direction. It’s one of the four predefined instances of `CompassDir`. It has an alias in the top-level package o1, so it’s accessible to students simply via `import o1.*`.

This immutable singleton object represents the westwardly compass direction. It’s one of the four predefined instances of `CompassDir`. It has an alias in the top-level package o1, so it’s accessible to students simply via `import o1.*`.

## Attributes