View Source FiveHundred.GameServer (Five Hundred v0.1.0)

Link to this section Summary

Functions

Returns a specification to start this module under a supervisor.

Request and return the current game state.

Join a running game server

Lookup the GameServer and report if it is found. Returns a boolean.

Start a GameServer with the specified game_code as the name.

Start a new game or join an existing game.

Return the :via tuple for referencing and interacting with a specific GameServer.

Link to this section Functions

Link to this function

broadcast_game_state(state)

View Source

Returns a specification to start this module under a supervisor.

See Supervisor.

Link to this function

get_current_game_state(game_code)

View Source
@spec get_current_game_state(FiveHundred.Game.game_code()) ::
  FiveHundred.Game.t() | {:error, String.t()}

Request and return the current game state.

Link to this function

join_game(game_code, player)

View Source
@spec join_game(FiveHundred.Game.game_code(), FiveHundred.Player.t()) ::
  :ok | {:error, String.t()}

Join a running game server

Link to this function

server_found?(game_code)

View Source
@spec server_found?(FiveHundred.Game.game_code()) :: boolean()

Lookup the GameServer and report if it is found. Returns a boolean.

Link to this function

start_link(name, player)

View Source

Start a GameServer with the specified game_code as the name.

Link to this function

start_or_join(game_code, player)

View Source
@spec start_or_join(FiveHundred.Game.game_code(), FiveHundred.Player.t()) ::
  {:ok, :started | :joined} | {:error, String.t()}

Start a new game or join an existing game.

Return the :via tuple for referencing and interacting with a specific GameServer.