Bad deck -> waste working-ish
Display looks alright, so that's good!
This commit is contained in:
@@ -171,7 +171,7 @@ impl Default for Deck {
|
||||
}
|
||||
}
|
||||
|
||||
enum Seed {
|
||||
pub enum Seed {
|
||||
Unseeded,
|
||||
SeedVal(u64),
|
||||
}
|
||||
@@ -188,7 +188,7 @@ impl Deck {
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
#[derive(Debug, Copy, Clone)]
|
||||
enum NumPassesThroughDeck {
|
||||
Unlimited,
|
||||
Limited(u64),
|
||||
@@ -196,15 +196,27 @@ enum NumPassesThroughDeck {
|
||||
|
||||
pub const NUM_PILES_KLONDIKE: usize = 7;
|
||||
|
||||
#[derive(Debug)]
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct Klondike {
|
||||
pub piles: [Vec<Card>; NUM_PILES_KLONDIKE],
|
||||
pub deck: Vec<Card>,
|
||||
pub deck: Vec<Card>, // this term is a bit overloaded
|
||||
pub waste: Vec<Card>,
|
||||
pub foundation: [Vec<Card>; 4], // 4 = len of num suits
|
||||
max_num_passes_through_deck: NumPassesThroughDeck,
|
||||
current_num_passes_through_deck: u64,
|
||||
num_cards_turned: u8,
|
||||
_max_num_passes_through_deck: NumPassesThroughDeck,
|
||||
_current_num_passes_through_deck: u64,
|
||||
_num_cards_turned: u8,
|
||||
}
|
||||
|
||||
impl Klondike {
|
||||
pub fn draw(self: &mut Self) {
|
||||
// completely temporary
|
||||
let c1 = self.deck.pop().unwrap();
|
||||
let c2 = self.deck.pop().unwrap();
|
||||
let c3 = self.deck.pop().unwrap();
|
||||
self.waste.push(c1);
|
||||
self.waste.push(c2);
|
||||
self.waste.push(c3);
|
||||
}
|
||||
}
|
||||
|
||||
impl Default for Klondike {
|
||||
@@ -226,9 +238,9 @@ impl Default for Klondike {
|
||||
deck: deck.cards,
|
||||
waste: Vec::new(),
|
||||
foundation: [Vec::new(), Vec::new(), Vec::new(), Vec::new()], // is this really the best way?
|
||||
max_num_passes_through_deck: NumPassesThroughDeck::Unlimited,
|
||||
current_num_passes_through_deck: 0,
|
||||
num_cards_turned: 3,
|
||||
_max_num_passes_through_deck: NumPassesThroughDeck::Unlimited,
|
||||
_current_num_passes_through_deck: 0,
|
||||
_num_cards_turned: 3,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user