Packages

  • package root
    Definition Classes
    root
  • package o1
    Definition Classes
    root
  • package grid

    This package contains tools for working with grid-like two-dimensional structures.

    This package contains tools for working with grid-like two-dimensional structures.

    The contents of this package have aliases in the top-level package o1, so they are accessible to students simply via import o1._.

    Definition Classes
    o1
  • CompassDir
  • Grid
  • GridPos
  • package robots
    Definition Classes
    o1
  • package util
    Definition Classes
    o1
p

o1

grid

package grid

This package contains tools for working with grid-like two-dimensional structures.

The contents of this package have aliases in the top-level package o1, so they are accessible to students simply via import o1._.

Linear Supertypes
AnyRef, Any
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. grid
  2. AnyRef
  3. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. Protected

Type Members

  1. sealed abstract class CompassDir extends Product with Serializable

    The class CompassDir represents the cardinal compass directions in a grid-like coordinate system.

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

    All the CompassDir objects are immutable.

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

    See also

    GridPos

  2. abstract class Grid[Element] extends AnyRef

    The class Grid represents rectangular grids that contain elements of a particular kind.

    The class Grid represents rectangular grids that contain elements of a particular kind. Each element in a grid is located at a unique pair of coordinates, represented as a GridPos.

    X coordinates run from 0 to width-1, y coordinates from 0 to height-1. (0,0) corresponds to the upper left corner of the grid.

    There are different kinds of grids: the type of element that a grid contains is defined by a type parameter. For instance Grid[Square] is a grid where each pair of x and y coordinates contains a Square object, and Grid[House] is a grid containing House objects.

    A Grid is mutable: it is possible to replace an element at a particular GridPos with another. (Depending on the element type, the elements may be individually mutable, too.) The width and height of a grid never change, however.

    Upon creation, a Grid initializes itself by calling initialElements, which produces an initial state for the grid.

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

  3. case class GridPos(x: Int, y: Int) extends Product with Serializable

    An object of type GridPos represents a pair of integer coordinates on two axes named x and y.

    An object of type GridPos represents a pair of integer coordinates on two axes named x and y. Such a pair can be used to reference a point on a Grid.

    In this coordinate system, x increases "eastwards" and y increases "southwards".

    GridPos objecta are immutable.

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

    x

    an x coordinate

    y

    a y coordinate

Value Members

  1. object CompassDir extends Serializable

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

    This companion object of class 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._.

Inherited from AnyRef

Inherited from Any

Ungrouped