Islands.Grid (Islands Grid v0.1.16) View Source

Creates a grid (map of maps) for the Game of Islands.

Convenience module for client applications.

Converts a board or guesses struct into a grid (map of maps). Also converts a board or guesses struct into 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 into a grid (map of maps).

Converts a board or guesses struct into a list of maps.

Link to this section Types

Specs

t() :: %{
  required(Islands.Coord.row()) => %{required(Islands.Coord.col()) => atom()}
}

Specs

tile_fun() :: (atom() -> IO.ANSI.Plus.ansidata())

Link to this section Functions

Specs

new() :: t()

Returns an "empty" grid.

Specs

Converts a board or guesses struct into a grid (map of maps).

Link to this function

to_maps(board_or_guesses, fun \\ &Tile.new/1)

View Source

Specs

to_maps(Islands.Board.t() | Islands.Guesses.t(), tile_fun()) :: [map()]

Converts a board or guesses struct into a list of maps.