Islands State v0.1.6 Islands.State View Source
Implements a state machine for the Game of Islands.
Inspired by the book Functional Web Development by Lance Halvorsen.
Link to this section Summary
Functions
Callback implementation for Access.fetch/2.
Callback implementation for Access.get_and_update/3.
Callback implementation for Access.pop/2.
Link to this section Types
Link to this type
game_state()
View Sourcegame_state() :: :initialized | :players_set | :player1_turn | :player2_turn | :game_over
Link to this type
request()
View Sourcerequest() ::
:add_player
| {:position_island, Islands.PlayerID.t()}
| {:position_all_islands, Islands.PlayerID.t()}
| {:set_islands, Islands.PlayerID.t()}
| {:guess_coord, Islands.PlayerID.t()}
| {:win_check, :no_win | :win}
| :stop
Link to this type
t()
View Sourcet() :: %Islands.State{
game_state: game_state(),
player1_state: player_state(),
player2_state: player_state()
}
Link to this section Functions
Callback implementation for Access.fetch/2.
Callback implementation for Access.get_and_update/3.
Callback implementation for Access.pop/2.