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

Creates a guesses struct for 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

t() :: %Islands.Guesses{
  hits: Islands.Island.coords(),
  misses: Islands.Island.coords()
}

Specs

type() :: :hit | :miss

Link to this section Functions

Link to this function

add(guesses, type, guess)

View Source

Specs

add(t(), type(), Islands.Coord.t()) :: t() | {:error, atom()}

Specs

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

Specs

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

Specs

new() :: t()