mirror of
https://codeberg.org/JasterV/gofish_bot.git
synced 2026-04-26 18:10:09 +00:00
deck fix
This commit is contained in:
parent
262906a5c1
commit
8f46ae8c84
1 changed files with 9 additions and 2 deletions
|
|
@ -31,7 +31,14 @@ impl Deck {
|
|||
}
|
||||
|
||||
pub fn draw_n(&mut self, n: usize) -> Vec<u8> {
|
||||
let len = self.cards.len();
|
||||
self.cards.drain((len - n)..).collect()
|
||||
let mut result = vec![];
|
||||
for _ in 0..n {
|
||||
let elem = self.cards.pop();
|
||||
if let None = elem {
|
||||
break;
|
||||
}
|
||||
result.push(elem.unwrap());
|
||||
}
|
||||
result
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue