Islands Engine v0.2.0 Islands.Engine View Source

Models the Game of Islands.

Based on the book Functional Web Development by Lance Halvorsen.

Link to this section Summary

Functions

Adds the second player of a game

Ends a game

Returns a sorted list of registered game names

Returns the pid of the game server process registered under the given game_name, or nil if no process is registered

Allows a player to guess a coordinate

Positions all islands on a player's board

Positions an island on a player's board

Declares all islands set for a player

Returns the tally of a game for a given player

Link to this section Functions

Link to this function

add_player(game_name, player2_name, player2_pid) View Source
add_player(String.t(), String.t(), pid()) ::
  Islands.Engine.Game.Tally.t() | :ok

Adds the second player of a game.

Link to this function

end_game(game_name) View Source
end_game(String.t()) :: :ok

Ends a game.

Link to this function

game_names() View Source
game_names() :: [String.t()]

Returns a sorted list of registered game names.

Link to this function

game_pid(game_name) View Source
game_pid(String.t()) :: pid() | nil

Returns the pid of the game server process registered under the given game_name, or nil if no process is registered.

Allows a player to guess a coordinate.

Link to this function

new_game(game_name, player1_name, player1_pid) View Source

Starts a new game.

Link to this function

position_all_islands(game_name, player_id) View Source

Positions all islands on a player's board.

Positions an island on a player's board.

Declares all islands set for a player.

Stops a game.

Returns the tally of a game for a given player.