Islands Engine v0.1.18 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

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(player1_name, player2_name, player2_pid) View Source
add_player(String.t(), String.t(), pid()) :: Islands.Engine.Tally.t()

Adds the second player of a game.

Link to this function end_game(player1_name) View Source
end_game(String.t()) :: :ok

Ends a game.

Link to this function guess_coord(player1_name, player_id, row, col) View Source
guess_coord(
  String.t(),
  Islands.Engine.Game.player_id(),
  Islands.Engine.Coord.row(),
  Islands.Engine.Coord.col()
) :: Islands.Engine.Tally.t()

Allows a player to guess a coordinate.

Link to this function new_game(player1_name, player1_pid) View Source
new_game(String.t(), pid()) :: Supervisor.on_start_child()

Starts a new game.

Link to this function position_all_islands(player1_name, player_id) View Source
position_all_islands(String.t(), Islands.Engine.Game.player_id()) ::
  Islands.Engine.Tally.t()

Positions all islands on a player’s board.

Link to this function position_island(player1_name, player_id, island_type, row, col) View Source
position_island(
  String.t(),
  Islands.Engine.Game.player_id(),
  Islands.Engine.Island.type(),
  Islands.Engine.Coord.row(),
  Islands.Engine.Coord.col()
) :: Islands.Engine.Tally.t()

Positions an island on a player’s board.

Link to this function set_islands(player1_name, player_id) View Source
set_islands(String.t(), Islands.Engine.Game.player_id()) ::
  Islands.Engine.Tally.t()

Declares all islands set for a player.

Link to this function stop_game(player1_name, player_id) View Source
stop_game(String.t(), Islands.Engine.Game.player_id()) ::
  Islands.Engine.Tally.t()

Stops a game.

Link to this function tally(player1_name, player_id) View Source
tally(String.t(), Islands.Engine.Game.player_id()) :: Islands.Engine.Tally.t()

Returns the tally of a game for a given player.