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

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

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

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

Summary

Types

Player's color

Player's name

t()

A player struct for the Multi-Player Buzzword Bingo game

Functions

Creates a player struct with the given name and color.

Types

color()

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

Player's color

name()

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

Player's name

t()

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

A player struct for the Multi-Player Buzzword Bingo game

Functions

new(name, color)

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

Creates a player struct with the given name and color.

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}