View Source Islands.Score (Islands Score v0.1.45)

A score struct and functions for the Game of Islands.

The score struct contains the fields name, gender, hits, misses and forested_types representing the characteristics of a score in the Game of Islands.

Inspired by the book Functional Web Development by Lance Halvorsen.

Summary

Types

t()

A score struct for the Game of Islands

Functions

Creates a score struct from a player's board struct.

Prints score formatted with embedded ANSI escapes.

Creates a score struct from an opponent's board struct.

Types

@type t() :: %Islands.Score{
  forested_types: [Islands.Island.type()],
  gender: Islands.Player.gender(),
  hits: non_neg_integer(),
  misses: non_neg_integer(),
  name: Islands.Player.name()
}

A score struct for the Game of Islands

Functions

Link to this function

board_score(game, player_id)

View Source
@spec board_score(Islands.Game.t(), Islands.PlayerID.t()) :: t()

Creates a score struct from a player's board struct.

@spec format(t(), Keyword.t()) :: :ok

Prints score formatted with embedded ANSI escapes.

Link to this function

guesses_score(game, player_id)

View Source
@spec guesses_score(Islands.Game.t(), Islands.PlayerID.t()) :: t()

Creates a score struct from an opponent's board struct.