Islands Engine v0.2.34 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 such process is registered.
Allows the specified player to guess a coordinate.
Starts a new game.
Positions all islands on the specified player's board.
Positions an island on the specified player's board.
Declares all islands set for the specified player.
Stops a game.
Returns the tally of the game for the specified player.
Allows to update the specified player.
Link to this section Functions
add_player(game_name, player2_name, gender, pid)
View Sourceadd_player(String.t(), String.t(), Islands.Player.gender(), pid()) :: Islands.Tally.t() | :ok
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 such process is registered.
guess_coord(game_name, player_id, row, col)
View Sourceguess_coord( String.t(), Islands.PlayerID.t(), Islands.Coord.row(), Islands.Coord.col() ) :: Islands.Tally.t() | :ok
Allows the specified player to guess a coordinate.
new_game(game_name, player1_name, gender, pid)
View Sourcenew_game(String.t(), String.t(), Islands.Player.gender(), pid()) :: Supervisor.on_start_child()
Starts a new game.
position_all_islands(game_name, player_id)
View Sourceposition_all_islands(String.t(), Islands.PlayerID.t()) :: Islands.Tally.t() | :ok
Positions all islands on the specified player's board.
position_island(game_name, player_id, island_type, row, col)
View Sourceposition_island( String.t(), Islands.PlayerID.t(), Islands.Island.type(), Islands.Coord.row(), Islands.Coord.col() ) :: Islands.Tally.t() | :ok
Positions an island on the specified player's board.
set_islands(game_name, player_id)
View Sourceset_islands(String.t(), Islands.PlayerID.t()) :: Islands.Tally.t() | :ok
Declares all islands set for the specified player.
stop_game(game_name, player_id)
View Sourcestop_game(String.t(), Islands.PlayerID.t()) :: Islands.Tally.t() | :ok
Stops a game.
tally(game_name, player_id)
View Sourcetally(String.t(), Islands.PlayerID.t()) :: Islands.Tally.t() | :ok
Returns the tally of the game for the specified player.
update_player(game_name, player_id, player_name, gender, pid)
View Sourceupdate_player( String.t(), Islands.PlayerID.t(), String.t(), Islands.Player.gender(), pid() ) :: Islands.Tally.t() | :ok
Allows to update the specified player.