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
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
@spec board_score(Islands.Game.t(), Islands.PlayerID.t()) :: t()
Creates a score struct from a player's board struct.
Prints score
formatted with embedded ANSI escapes.
@spec guesses_score(Islands.Game.t(), Islands.PlayerID.t()) :: t()
Creates a score struct from an opponent's board struct.