Pokex v0.2.0 Game View Source

The Game structure and gameplay functions

Here is where the whole state of a started game is kept. It holds the players, deck and pot.

The players attribute is %Table{} struct with the game’s players. The deck is a list of cards representing the remaining cards in the hands of the dealer. The pot is a struct where the bets are kept for each game.

You can do things such as Game.add_players/1 klp klp

Link to this section Summary

Functions

Adds the list of players to the Game.players in the order they are in the list

Takes a list of hands and distributes them to the players of the table sequensially

Exchanges card_list cards in hand for Player in spot_name with the top available in deck

Link to this section Functions

Link to this function add_players(game, player_list) View Source

Adds the list of players to the Game.players in the order they are in the list

The players are %Player{} structs

Returns {:ok, game} with the game struct with the players added or {:error, "Reason"}

Link to this function deal_hands(game, hand_list) View Source

Takes a list of hands and distributes them to the players of the table sequensially.

Returns game with the game struct with the hands added.

Link to this function exchange(game, spot_name, card_list) View Source

Exchanges card_list cards in hand for Player in spot_name with the top available in deck

Returns a new game {:ok, game} or {:error, reason} on failure