View Source Islands.Client.Player (Islands Client Player v0.1.42)

Models a player in the Game of Islands.

Inspired by the course Elixir for Programmers by Dave Thomas.

Summary

Functions

Reacts to a game state, makes a move and repeats until the game is over.

Functions

@spec play(Islands.Client.State.t()) :: no_return()

Reacts to a game state, makes a move and repeats until the game is over.

Player1 reacts to game state:

  • :initialized by waiting for game state :players_set
  • :players_set by waiting for game state :player1_turn
  • :player2_turn by waiting for game state :player1_turn or :game_over
  • :game_over by exiting the game

Player2 reacts to game state:

  • :players_set by waiting for game state :player2_turn
  • :player1_turn by waiting for game state :player2_turn or :game_over
  • :game_over by exiting the game