Islands.Board.Response (Islands Board v0.1.25) View Source

A 4-element tuple reflecting the effect of a guess (hit or miss) on a board.

Link to this section Summary

Types

Preliminary response to a guess

t()

Full response to a guess

Functions

Checks if guess hit any island on board.

Converts a preliminary response to a guess into a full response.

Link to this section Types

Specs

guess_check() :: {:hit, Islands.Island.t()} | {:miss, Islands.Coord.t()}

Preliminary response to a guess

Specs

t() ::
  {:hit | :miss, Islands.Island.type() | :none, :no_win | :win,
   Islands.Board.t()}

Full response to a guess

Link to this section Functions

Link to this function

check_guess(board, guess)

View Source

Specs

Checks if guess hit any island on board.

Returns {:hit, hit_island}, where hit_island is the island hit by guess once updated, or {:miss, guess} if guess was a miss.

Link to this function

format_response(guess_check, board)

View Source

Specs

format_response(guess_check(), Islands.Board.t()) :: t()

Converts a preliminary response to a guess into a full response.