|
|
@ -35,11 +35,11 @@ impl Hand {
|
|
|
|
pub fn complete(&mut self, deck: &mut RngDeck) -> Result<(), EmptyDeckError> {
|
|
|
|
pub fn complete(&mut self, deck: &mut RngDeck) -> Result<(), EmptyDeckError> {
|
|
|
|
for _ in 0..self.count_missing_operators() {
|
|
|
|
for _ in 0..self.count_missing_operators() {
|
|
|
|
self.tiles
|
|
|
|
self.tiles
|
|
|
|
.push(Tile::Operator(deck.rand_operator().ok_or(EmptyDeckError.into())?));
|
|
|
|
.push(Tile::Operator(deck.rand_operator().ok_or(EmptyDeckError)?));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
for _ in 0..self.count_missing_numbers() {
|
|
|
|
for _ in 0..self.count_missing_numbers() {
|
|
|
|
self.tiles
|
|
|
|
self.tiles
|
|
|
|
.push(Tile::Digit(Digit::new(deck.rand_digit().ok_or(EmptyDeckError.into())?)));
|
|
|
|
.push(Tile::Digit(Digit::new(deck.rand_digit().ok_or(EmptyDeckError)?)));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
Ok(())
|
|
|
|
Ok(())
|
|
|
|
}
|
|
|
|
}
|
|
|
|