Islands Engine v0.1.69 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
Starts a new game
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
Link to this section Functions
add_player(String.t(), String.t(), pid()) :: Islands.Engine.Game.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 process is registered.
guess_coord( String.t(), Islands.Engine.Game.player_id(), Islands.Engine.Coord.row(), Islands.Engine.Coord.col() ) :: Islands.Engine.Game.Tally.t() | :ok
Allows a player to guess a coordinate.
new_game(String.t(), String.t(), pid()) :: Supervisor.on_start_child()
Starts a new game.
position_all_islands(String.t(), Islands.Engine.Game.player_id()) :: Islands.Engine.Game.Tally.t() | :ok
Positions all islands on a player’s board.
position_island( String.t(), Islands.Engine.Game.player_id(), Islands.Engine.Island.type(), Islands.Engine.Coord.row(), Islands.Engine.Coord.col() ) :: Islands.Engine.Game.Tally.t() | :ok
Positions an island on a player’s board.
set_islands(String.t(), Islands.Engine.Game.player_id()) :: Islands.Engine.Game.Tally.t() | :ok
Declares all islands set for a player.
stop_game(String.t(), Islands.Engine.Game.player_id()) :: Islands.Engine.Game.Tally.t() | :ok
Stops a game.
tally(String.t(), Islands.Engine.Game.player_id()) :: Islands.Engine.Game.Tally.t() | :ok
Returns the tally of a game for a given player.