card game stuff

This commit is contained in:
2026-05-15 07:35:31 -07:00
parent 1f820e4cad
commit 9dd379cb1b
2 changed files with 18 additions and 4 deletions
+5 -1
View File
@@ -85,7 +85,7 @@ impl Klondike {
}
impl Game for Klondike {
type Instruction = KlondikeInstruction;
fn enumerate_instructions(&self) -> impl Iterator<Item = Self::Instruction> {
fn possible_instructions(&self) -> impl Iterator<Item = Self::Instruction> {
vec![].into_iter()
}
fn validate_instruction(&self, instruction: Self::Instruction) -> bool {
@@ -95,4 +95,8 @@ impl Game for Klondike {
let card = self.state[instruction.src].pop().unwrap();
self.state[instruction.dst].push(card);
}
fn is_win(&self) -> bool {
// assuming only valid moves, tableau empty and stock empty means win
self.state.piles[0..9].iter().all(|pile| pile.is_empty())
}
}