v0.1.0 GameApp.Server
GameApp.Server
provides a stateful process that maintains an internal game
state and provides a public API for interacting with the game.
Link to this section Summary
Functions
Returns a specification to start this module under a supervisor.
Returns the pid
of the game server process registered under the
given shortcode
, or nil
if no process is registered.
Generates a 4-letter code used as the identifier for a game server.
Joins a player to the game with the given shortcode.
Removes a player from the game with the given shortcode.
Selects a prompt to set for the current round.
Selects a reaction for the given player in the current round.
Selects a winner for the current round.
Starts the game with the given shortcode.
Starts the next round for the game with the given shortcode.
Returns a summary of the game state for a game with the given shortcode.
Returns a tuple used to register and lookup a game server process by name.
Link to this section Functions
child_spec(init_arg)
Returns a specification to start this module under a supervisor.
See Supervisor
.
Returns the pid
of the game server process registered under the
given shortcode
, or nil
if no process is registered.
Generates a 4-letter code used as the identifier for a game server.
Joins a player to the game with the given shortcode.
Removes a player from the game with the given shortcode.
select_prompt(shortcode, prompt, channel_pid)
Selects a prompt to set for the current round.
select_reaction(shortcode, player, reaction, channel_pid)
select_reaction(String.t(), GameApp.Player.t(), String.t(), pid()) :: :ok
Selects a reaction for the given player in the current round.
select_winner(shortcode, winner, channel_pid)
select_winner(String.t(), GameApp.Player.t() | nil, pid()) :: :ok
Selects a winner for the current round.
Starts the game with the given shortcode.
start_link(shortcode, player, config \\ %GameConfig{})
start_link(String.t(), GameApp.Player.t(), GameApp.Config.t()) :: {:ok, pid()} | :ignore | {:error, {:already_started, pid()} | term()}
Starts the next round for the game with the given shortcode.
Returns a summary of the game state for a game with the given shortcode.
via_tuple(shortcode)
Returns a tuple used to register and lookup a game server process by name.