replenishing played cards works

main
Elijah Voigt 2 years ago
parent c8b6ccf352
commit 7c737e5d72

@ -55,6 +55,7 @@ impl Deck {
let rs = RandomState::new();
let mut base = Self::cards();
let len = base.len();
(0..2).iter().for_each(|_| {
(1..len).into_iter().for_each(|i| {
let a = rs.hash_one(base[i]) % (len as u64);
let b = rs.hash_one(base[i - 1]) % (len as u64);
@ -62,6 +63,7 @@ impl Deck {
base.swap(a as usize, b as usize);
}
});
});
base
}

@ -20,7 +20,9 @@ impl Plugin for SetupPlugin {
/// Setup drawing our cards on the screen
pub(crate) fn setup_cards(mut commands: Commands, deck: Res<Deck>) {
Deck::iter_cards().enumerate().for_each(|(i, this_card)| {
Deck::iter_shuffled()
.enumerate()
.for_each(|(i, this_card)| {
let this = deck
.cards
.get(&this_card)

@ -1,9 +1,4 @@
TODO:
* Check for sets
* Capture valid sets
* Shuffle deck
* Serve out 12 cards
* Deal out additional cards after set captured
* Reset game (click new game button)
* Track score (number of sets)
* Make button(s) look pretty

Loading…
Cancel
Save