Struct lib_hearts::Game
source · pub struct Game {
pub players: [Player; 4],
pub current_player_pos: usize,
pub current_hand: u8,
pub state: GameState,
pub hands: u8,
/* private fields */
}
Fields§
§players: [Player; 4]
§current_player_pos: usize
§current_hand: u8
§state: GameState
§hands: u8
Implementations§
source§impl Game
impl Game
pub fn new(player_builders: [(Uuid, bool); 4], hands: u8) -> Self
pub fn exchange_cards(&mut self, cards: [usize; 3]) -> Result<(), GameError>
pub fn get_player_cards( &self, player_id: Uuid ) -> [Option<(PositionInDeck, &Card)>; 13]
pub fn deal_cards(&mut self) -> Result<(), GameError>
pub fn play_bot(&mut self) -> Result<(), GameError>
pub fn validate_play(&self, card_to_play_idx: usize) -> Result<usize, GameError>
pub fn play(&mut self, card_to_play_idx: usize) -> Result<(), GameError>
pub fn compute_score(&mut self) -> Result<(), GameError>
pub fn current_player_id(&self) -> Option<Uuid>
pub fn current_player_is_bot(&self) -> bool
pub fn player_ids_in_order(&self) -> [Uuid; 4]
pub fn player_score_by_id(&self) -> [PlayerState; 4]
pub fn current_score_by_id(&self) -> [PlayerState; 4]
pub fn print_state(&self)
Trait Implementations§
Auto Trait Implementations§
impl RefUnwindSafe for Game
impl Send for Game
impl Sync for Game
impl Unpin for Game
impl UnwindSafe for Game
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more