View Source Briscola.Player (Briscola v0.1.1)

Struct for a player in the game of Briscola. Players have a hand of playing cards and a pile of won cards. The pile of won cards is used for scoring.

Summary

Functions

Create a new player.

Remove a specific card from a player's hand.

Calculate the score of a player. The score is the sum of the scores of the cards in the player's pile.

Add cards to a player's score pile.

Types

t()

@type t() :: %Briscola.Player{hand: [Briscola.Card.t()], pile: [Briscola.Card.t()]}

Functions

new()

@spec new() :: t()

Create a new player.

remove_from_hand(player, card)

@spec remove_from_hand(t(), Briscola.Card.t()) :: t()

Remove a specific card from a player's hand.

score(player)

@spec score(t()) :: integer()

Calculate the score of a player. The score is the sum of the scores of the cards in the player's pile.

take_trick(player, cards)

@spec take_trick(t(), [Briscola.Card.t()]) :: t()

Add cards to a player's score pile.