Islands Game v0.1.10 Islands.Game View Source

Models a game in the Game of Islands.

Inspired by the book Functional Web Development by Lance Halvorsen.

Link to this section Summary

Link to this section Types

Link to this type

t()

View Source
t() :: %Islands.Game{
  name: String.t(),
  player1: Islands.Player.t(),
  player2: Islands.Player.t(),
  request: Islands.Request.t(),
  response: Islands.Response.t(),
  state: Islands.State.t()
}

Link to this section Functions

Callback implementation for Access.fetch/2.

Link to this function

get_and_update(game, key, fun)

View Source

Callback implementation for Access.get_and_update/3.

Link to this function

new(name, player1_name, gender, pid)

View Source
new(String.t(), String.t(), Islands.Player.gender(), pid()) ::
  t() | {:error, atom()}
Link to this function

notify_player(game, player_id)

View Source
notify_player(t(), Islands.PlayerID.t()) :: t()
Link to this function

player_board(game, player_id)

View Source
player_board(t(), Islands.PlayerID.t()) :: Islands.Board.t()

Callback implementation for Access.pop/2.

Link to this function

update_board(game, player_id, board)

View Source
update_board(t(), Islands.PlayerID.t(), Islands.Board.t()) :: t()
Link to this function

update_guesses(game, player_id, hit_or_miss, guess)

View Source
update_guesses(
  t(),
  Islands.PlayerID.t(),
  Islands.Guesses.type(),
  Islands.Coord.t()
) :: t()
Link to this function

update_player(game, player_id, name, gender, pid)

View Source
update_player(
  t(),
  Islands.PlayerID.t(),
  String.t(),
  Islands.Player.gender(),
  pid()
) :: t()
Link to this function

update_request(game, request)

View Source
update_request(t(), Islands.Request.t()) :: t()
Link to this function

update_response(game, response)

View Source
update_response(t(), Islands.Response.t()) :: t()
Link to this function

update_state(game, state)

View Source
update_state(t(), Islands.State.t()) :: t()