View Source Islands.Player (Islands Player v0.1.29)
Creates a player struct for the Game of Islands.
The player struct contains the fields name
, gender
, pid
, board
and
guesses
representing the characteristics of a player in the Game of Islands.
Based on the book Functional Web Development by Lance Halvorsen.
Link to this section Summary
Functions
Creates a player struct from name
, gender
and pid
.
Link to this section Types
@type gender() :: :f | :m
Player's gender
@type name() :: String.t()
Player's name
@type t() :: %Islands.Player{ board: Islands.Board.t(), gender: gender(), guesses: Islands.Guesses.t(), name: name(), pid: pid() | nil }
A player struct for the Game of Islands
Link to this section Functions
Creates a player struct from name
, gender
and pid
.
examples
Examples
iex> alias Islands.{Board, Guesses, Player}
iex> Player.new("Joe", :m, nil)
%Player{
name: "Joe",
gender: :m,
pid: nil,
board: Board.new(),
guesses: Guesses.new()
}