added utils
This commit is contained in:
parent
30d55ecacb
commit
e4b5725c66
2 changed files with 12 additions and 0 deletions
|
@ -19,4 +19,12 @@ impl Card {
|
||||||
value,
|
value,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn get_suit(self) -> Suit {
|
||||||
|
self.suit
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn get_value(self) -> u8 {
|
||||||
|
self.value
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,6 +30,10 @@ impl Deck {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn get_deck(self) -> Vec<Card> {
|
||||||
|
self.deck
|
||||||
|
}
|
||||||
|
|
||||||
pub fn shuffle(mut self) -> Deck {
|
pub fn shuffle(mut self) -> Deck {
|
||||||
let mut rng = rng();
|
let mut rng = rng();
|
||||||
self.deck.shuffle(&mut rng);
|
self.deck.shuffle(&mut rng);
|
||||||
|
|
Loading…
Add table
Reference in a new issue