Struct spades::Game [−][src]
pub struct Game { /* fields omitted */ }
Primary game state. Internally manages player rotation, scoring, and cards.
Methods
impl Game
[src]
impl Game
pub fn new(id: Uuid, player_ids: [Uuid; 4], max_points: i32) -> Game
[src]
pub fn new(id: Uuid, player_ids: [Uuid; 4], max_points: i32) -> Game
pub fn get_id(&self) -> &Uuid
[src]
pub fn get_id(&self) -> &Uuid
pub fn get_state(&self) -> &State
[src]
pub fn get_state(&self) -> &State
See State
pub fn get_team_a_score(&self) -> Result<&i32, GetError>
[src]
pub fn get_team_a_score(&self) -> Result<&i32, GetError>
pub fn get_team_b_score(&self) -> Result<&i32, GetError>
[src]
pub fn get_team_b_score(&self) -> Result<&i32, GetError>
pub fn get_team_a_bags(&self) -> Result<&i32, GetError>
[src]
pub fn get_team_a_bags(&self) -> Result<&i32, GetError>
pub fn get_team_b_bags(&self) -> Result<&i32, GetError>
[src]
pub fn get_team_b_bags(&self) -> Result<&i32, GetError>
pub fn get_current_player_id(&self) -> Result<&Uuid, GetError>
[src]
pub fn get_current_player_id(&self) -> Result<&Uuid, GetError>
Returns GetError
when the current game is not in the Betting or Trick stages.
pub fn get_hand_by_player_id(
&self,
player_id: Uuid
) -> Result<&Vec<Card>, GetError>
[src]
pub fn get_hand_by_player_id(
&self,
player_id: Uuid
) -> Result<&Vec<Card>, GetError>
Returns a GetError::InvalidUuid
if the game does not contain a player with the given Uuid
.
pub fn get_current_hand(&self) -> Result<&Vec<Card>, GetError>
[src]
pub fn get_current_hand(&self) -> Result<&Vec<Card>, GetError>
pub fn get_leading_suit(&self) -> Result<&Suit, GetError>
[src]
pub fn get_leading_suit(&self) -> Result<&Suit, GetError>
pub fn get_current_trick_cards(&self) -> Result<&[Card; 4], GetError>
[src]
pub fn get_current_trick_cards(&self) -> Result<&[Card; 4], GetError>
Returns an array with (only if in the trick stage).
pub fn get_hand(&self, player: usize) -> Result<&Vec<Card>, GetError>
[src]
pub fn get_hand(&self, player: usize) -> Result<&Vec<Card>, GetError>
Deprecated since 1.0.0
: Please use get_current_hand
or get_hand_by_player_id
pub fn get_winner_ids(&self) -> Result<(&Uuid, &Uuid), GetError>
[src]
pub fn get_winner_ids(&self) -> Result<(&Uuid, &Uuid), GetError>
pub fn play(
&mut self,
entry: GameTransition
) -> Result<TransitionSuccess, TransitionError>
[src]
pub fn play(
&mut self,
entry: GameTransition
) -> Result<TransitionSuccess, TransitionError>
The primary function used to progress the game state. The first GameTransition
argument must always be
GameTransition::Start
. The stages and player rotations are managed
internally. The order of GameTransition
arguments should be:
Start -> Bet * 4 -> Card * 13 -> Bet * 4 -> Card * 13 -> Bet * 4 -> ...