View Source Buzzword.Bingo.Player (Buzzword Bingo Player v0.1.3)

Creates a player struct for the Multi-Player Bingo game.

The player struct contains the fields name and color representing the characteristics of a player in the Multi-Player Bingo game.

Based on the course Multi-Player Bingo by Mike and Nicole Clark.

Link to this section Summary

Types

Player's color

Player's name

t()

A player struct for the Multi-Player Bingo game

Functions

Creates a player struct with the given name and color.

Link to this section Types

@type color() :: String.t()

Player's color

@type name() :: String.t()

Player's name

@type t() :: %Buzzword.Bingo.Player{color: color(), name: name()}

A player struct for the Multi-Player Bingo game

Link to this section Functions

@spec new(name(), color()) :: t() | {:error, atom()}

Creates a player struct with the given name and color.

examples

Examples

iex> alias Buzzword.Bingo.Player
iex> Player.new("Helen", "#f9cedf")
%Player{name: "Helen", color: "#f9cedf"}

iex> alias Buzzword.Bingo.Player
iex> Player.new("Jimmy", "deep_sky_blue")
%Player{name: "Jimmy", color: "deep_sky_blue"}

iex> alias Buzzword.Bingo.Player
iex> Player.new("Jane", 'red')
{:error, :invalid_player_args}