Islands.Tally (Islands Tally v0.1.30)

View Source

Creates a tally struct for the Game of Islands.
Also displays the summary of a Game of Islands.

The tally struct contains the fields:

  • game_state
  • player1_state
  • player2_state
  • request
  • response
  • board
  • board_score
  • guesses
  • guesses_score

representing the properties of a tally in the Game of Islands.

Inspired by the book Functional Web Development by Lance Halvorsen.
Also inspired by the course Elixir for Programmers by Dave Thomas.

Summary

Types

t()

A tally struct for the Game of Islands

Functions

Creates a tally struct for the specified player.

Displays the summary of a game for the specified player.

Types

t()

@type t() :: %Islands.Tally{
  board: Islands.Board.t(),
  board_score: Islands.Score.t(),
  game_state: Islands.State.game_state(),
  guesses: Islands.Guesses.t(),
  guesses_score: Islands.Score.t(),
  player1_state: Islands.State.player_state(),
  player2_state: Islands.State.player_state(),
  request: Islands.Request.t(),
  response: Islands.Response.t()
}

A tally struct for the Game of Islands

Functions

new(game, player_id)

@spec new(Islands.Game.t(), Islands.PlayerID.t()) :: t() | {:error, atom()}

Creates a tally struct for the specified player.

summary(tally, player_id, message \\ [])

@spec summary(t(), Islands.PlayerID.t(), IO.ANSI.Plus.ansilist()) :: :ok

Displays the summary of a game for the specified player.