Islands Grid v0.1.7 Islands.Grid View Source
Creates a grid
(map of maps) for the Game of Islands.
Convenience module for client applications.
Converts a board
or guesses
struct to a grid
(map of maps).
Also converts a board
or guesses
struct to a list of maps.
Inspired by the book Functional Web Development by Lance Halvorsen.
Link to this section Summary
Functions
Returns an "empty" grid.
Converts a board
or guesses
struct to a grid
(map of maps).
Converts a board
or guesses
struct to a list of maps.
Link to this section Types
Link to this type
t()
View Source
t()
View Source
t() :: %{
optional(Islands.Coord.row()) => %{optional(Islands.Coord.col()) => atom()}
}
t() :: %{ optional(Islands.Coord.row()) => %{optional(Islands.Coord.col()) => atom()} }
Link to this type
tile_fun()
View Source
tile_fun()
View Source
tile_fun() :: (atom() -> IO.ANSI.Plus.ansidata())
tile_fun() :: (atom() -> IO.ANSI.Plus.ansidata())
Link to this section Functions
Link to this function
new()
View Source
new()
View Source
new() :: t()
new() :: t()
Returns an "empty" grid.
Link to this function
new(board_or_guesses)
View Source
new(board_or_guesses)
View Source
new(Islands.Board.t() | Islands.Guesses.t()) :: t()
new(Islands.Board.t() | Islands.Guesses.t()) :: t()
Converts a board
or guesses
struct to a grid
(map of maps).
Link to this function
to_maps(board_or_guesses, fun \\ &Tile.new/1)
View Source
to_maps(board_or_guesses, fun \\ &Tile.new/1)
View Source
to_maps(Islands.Board.t() | Islands.Guesses.t(), tile_fun()) :: [map()]
to_maps(Islands.Board.t() | Islands.Guesses.t(), tile_fun()) :: [map()]
Converts a board
or guesses
struct to a list of maps.