Islands.Board (Islands Board v0.1.18) View Source

Models a board in the Game of Islands.

Based on the book Functional Web Development by Lance Halvorsen.

Link to this section Summary

Link to this section Types

Specs

islands() :: %{required(Islands.Island.type()) => Islands.Island.t()}

Specs

t() :: %Islands.Board{islands: islands(), misses: Islands.Island.coords()}

Link to this section Functions

Link to this function

all_islands_positioned?(board)

View Source

Specs

all_islands_positioned?(t()) :: boolean()

Specs

forested_types(t()) :: [Islands.Island.type()]

Specs

grid_positions(t()) :: %{required(Islands.Island.type()) => map()}

Specs

Specs

hit_cells(t()) :: %{required(Islands.Island.type()) => [<<_::2, _::_*8>>]}

Specs

hits(t()) :: non_neg_integer()

Specs

miss_squares(t()) :: %{squares: [Islands.Coord.square()]}

Specs

misses(t()) :: non_neg_integer()

Specs

new() :: t()
Link to this function

position_island(board, island)

View Source

Specs

position_island(t(), Islands.Island.t()) :: t() | {:error, atom()}