| License | BSD-3-Clause |
|---|---|
| Safe Haskell | Safe-Inferred |
| Language | Haskell2010 |
Swarm.Language.Direction
Contents
Description
Types and helper functions for working with directions
Synopsis
- data Direction
- data AbsoluteDir
- data RelativeDir
- data PlanarRelativeDir
- directionSyntax :: Direction -> Text
- isCardinal :: Direction -> Bool
- allDirs :: [Direction]
Directions
The type of directions. Used e.g. to indicate which way a robot will turn.
Constructors
| DAbsolute AbsoluteDir | |
| DRelative RelativeDir |
Instances
data AbsoluteDir Source #
An absolute direction is one which is defined with respect to an external frame of reference; robots need a compass in order to use them.
NOTE: These values are ordered by increasing angle according to the standard mathematical convention. That is, the right-pointing direction, East, is considered the "reference angle" and the order proceeds counter-clockwise. See https://en.wikipedia.org/wiki/Polar_coordinate_system#Conventions
Do not alter this ordering, as there exist functions that depend on it
(e.g. nearestDirection and relativeTo).
Instances
data RelativeDir Source #
A relative direction is one which is defined with respect to the robot's frame of reference; no special capability is needed to use them.
Constructors
| DPlanar PlanarRelativeDir | |
| DDown |
Instances
data PlanarRelativeDir Source #
Caution: Do not alter this ordering, as there exist functions that depend on it
(e.g. nearestDirection and relativeTo).