Made use of the max turns thing
Unsure I'll ever use it... eh
This commit is contained in:
@@ -189,7 +189,7 @@ impl Deck {
|
||||
}
|
||||
|
||||
#[derive(Debug, Copy, Clone)]
|
||||
enum NumPassesThroughDeck {
|
||||
pub enum NumPassesThroughDeck {
|
||||
Unlimited,
|
||||
Limited(u64),
|
||||
}
|
||||
@@ -202,7 +202,7 @@ pub struct Klondike {
|
||||
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,
|
||||
max_num_passes_through_deck: NumPassesThroughDeck,
|
||||
pub current_num_passes_through_deck: u64,
|
||||
pub num_cards_turned: u8,
|
||||
}
|
||||
@@ -217,7 +217,15 @@ impl Klondike {
|
||||
}
|
||||
}
|
||||
}
|
||||
// TODO return some sort of error
|
||||
pub fn waste_to_deck(self: &mut Self) {
|
||||
match self.max_num_passes_through_deck {
|
||||
NumPassesThroughDeck::Unlimited => (),
|
||||
NumPassesThroughDeck::Limited(n) => if n >= self.current_num_passes_through_deck {
|
||||
// no!
|
||||
return
|
||||
},
|
||||
}
|
||||
if self.deck.len() != 0 {
|
||||
// no!
|
||||
} else {
|
||||
@@ -247,7 +255,7 @@ 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,
|
||||
max_num_passes_through_deck: NumPassesThroughDeck::Unlimited,
|
||||
current_num_passes_through_deck: 0,
|
||||
num_cards_turned: 3,
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user