Islands.Text.Client (Islands Text Client v0.2.35) View Source
Text client for the Game of Islands.
Inspired by the book Functional Web Development by Lance Halvorsen.
Also inspired by the course Elixir for Programmers by Dave Thomas.
Link to this section Summary
Link to this section Functions
Specs
engine_node() :: node()
Returns the islands engine node.
Examples
iex> alias Islands.Text.Client
iex> engine_node = Client.engine_node
iex> "#{engine_node}" =~ "islands_engine@"
true
Specs
join( Islands.Game.name(), Islands.Player.name(), Islands.Player.gender(), Keyword.t() ) :: no_return()
Lets player2 join a game.
Player2 runs in a node with any short name...
cd islands_text_client
iex --sname client2 -S mix
Player2 joins a game from her node like so:
Islands.Text.Client.join("Eden", "Eve", :f)
Parameters
game_name
- game name (string)player2_name
- player2 name (string)gender
- gender as either :f or :m (atom)options
- up to 2 options (keyword)
Options
:mode
- (:manual
or:auto
) specifies whether player2 will play in manual or auto mode; defaults to:manual
.:pause
- (nonnegative integer) specifies the duration in milliseconds of the pause between moves in auto mode (should be between 0 and 10,000); defaults to0
milliseconds.
Specs
start( Islands.Game.name(), Islands.Player.name(), Islands.Player.gender(), Keyword.t() ) :: no_return()
Lets player1 start a game.
App islands_engine
must run in node with short name islands_engine
...
cd islands_engine
iex --sname islands_engine -S mix
:observer.start # optional
Player1 runs in a node with any short name...
cd islands_text_client
iex --sname client1 -S mix
Player1 starts a game from his node like so:
Islands.Text.Client.start("Eden", "Adam", :m)
Parameters
game_name
- game name (string)player1_name
- player1 name (string)gender
- gender as either :f or :m (atom)options
- up to 2 options (keyword)
Options
:mode
- (:manual
or:auto
) specifies whether player1 will play in manual or auto mode; defaults to:manual
.:pause
- (nonnegative integer) specifies the duration in milliseconds of the pause between moves in auto mode (should be between 0 and 10,000); defaults to0
milliseconds.