View Source Hold.Coordinate (hold v0.1.0)
A coordinate in an xy plane with (0,0) being the top left corner.
Summary
Functions
Return all surrounding coordinates.
Return downward coordinate.
Return coordinate to the left
Create a new Coordinate
Return coordinate to the right
Return upward coordinate.
Types
Functions
Return all surrounding coordinates.
iex> Hold.Coordinate.around({1, 1})
[{1, 0}, {1, 2}, {2, 1}, {2, 0}, {2, 2}, {0, 1}, {0, 0}, {0, 2}]
Return downward coordinate.
iex> Hold.Coordinate.down({0, 1})
{1, 1}
iex> Hold.Coordinate.down({-1, 0})
{0, 0}
Return coordinate to the left
iex> Hold.Coordinate.left({1, 1})
{1, 0}
iex> Hold.Coordinate.left({0, -1})
{0, -2}
Create a new Coordinate
Return coordinate to the right
iex> Hold.Coordinate.right({1, 1})
{1, 2}
iex> Hold.Coordinate.right({0, -1})
{0, 0}
Return upward coordinate.
iex> Hold.Coordinate.up({0, 1})
{-1, 1}