View Source FiveHundred.Game (Five Hundred v0.1.0)
Models a game of 500
TODO:
- score
Link to this section Summary
Link to this section Types
@type game_code() :: String.t()
@type state() :: :bidding | :playing | :waiting_for_players | :finished
@type t() :: %FiveHundred.Game{ bid_exclusion: [FiveHundred.Player.t()], game_code: nil | game_code(), last_round_winner: nil | integer(), max_players: integer(), players: [FiveHundred.Player.t()], state: state(), turn: nil | integer(), winning_bid: nil | FiveHundred.PlayerBid.t() }
Link to this section Functions
@spec bid(t(), FiveHundred.PlayerBid.t()) :: {:ok, %FiveHundred.Game{ bid_exclusion: term(), game_code: term(), last_round_winner: term(), max_players: term(), players: term(), state: term(), turn: term(), winning_bid: term() }} | {:error, :last_round_winner_must_bid_first | :not_bidding | :bid_not_high_enough | :cannot_bid}
@spec ensure_bid_is_higher(t(), FiveHundred.PlayerBid.t()) :: {:ok, t()} | {:error, :bid_not_high_enough}
@spec join_game(t(), FiveHundred.Player.t()) :: {:ok, t()} | {:error, :max_players}
@spec set_winning_bid(t(), FiveHundred.PlayerBid.t()) :: {:ok, t()} | {:error, atom()}