Islands.Engine (Islands Engine v0.2.43) 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.
Stops a game server process normally. It won't be restarted.
Returns a sorted list of registered game names.
Returns the pid
of the game server process registered via the
given game_name
, or nil
if no such process is registered.
Lets the specified player guess a coordinate.
Starts a new game server process and supervises it.
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 at a player's request.
Returns the tally of a game for the specified player.
Link to this section Functions
Specs
add_player( Islands.Game.name(), Islands.Player.name(), Islands.Player.gender(), pid() ) :: Islands.Tally.t() | {:error, term()}
Adds the second player of a game.
Specs
end_game(Islands.Game.name()) :: :ok | {:error, term()}
Stops a game server process normally. It won't be restarted.
Specs
game_names() :: [Islands.Game.name()]
Returns a sorted list of registered game names.
Specs
game_pid(Islands.Game.name()) :: pid() | nil
Returns the pid
of the game server process registered via the
given game_name
, or nil
if no such process is registered.
Specs
guess_coord( Islands.Game.name(), Islands.PlayerID.t(), Islands.Coord.row(), Islands.Coord.col() ) :: Islands.Tally.t() | {:error, term()}
Lets the specified player guess a coordinate.
Specs
new_game( Islands.Game.name(), Islands.Player.name(), Islands.Player.gender(), pid() ) :: Supervisor.on_start_child()
Starts a new game server process and supervises it.
Specs
position_all_islands(Islands.Game.name(), Islands.PlayerID.t()) :: Islands.Tally.t() | {:error, term()}
Positions all islands on the specified player's board.
Specs
position_island( Islands.Game.name(), Islands.PlayerID.t(), Islands.Island.type(), Islands.Coord.row(), Islands.Coord.col() ) :: Islands.Tally.t() | {:error, term()}
Positions an island on the specified player's board.
Specs
set_islands(Islands.Game.name(), Islands.PlayerID.t()) :: Islands.Tally.t() | {:error, term()}
Declares all islands set for the specified player.
Specs
stop_game(Islands.Game.name(), Islands.PlayerID.t()) :: Islands.Tally.t() | {:error, term()}
Stops a game at a player's request.
Specs
tally(Islands.Game.name(), Islands.PlayerID.t()) :: Islands.Tally.t() | {:error, term()}
Returns the tally of a game for the specified player.