Movement with only starting cards is mostly good

This commit is contained in:
2025-06-28 00:23:13 +01:00
parent 7786cac7f5
commit 16be88c703
2 changed files with 75 additions and 11 deletions

View File

@@ -376,6 +376,18 @@ impl Klondike {
CardPosition::TopWaste | CardPosition::Foundation(_) => false
}
}
pub fn lowest_visible_card_in_pile_from_index(self, pile: usize, index: usize) -> usize {
if self.piles[pile].len() == 0 {
return 0;
}
for (i, card) in self.piles[pile].iter().skip(index).enumerate() {
if card.visible {
return i;
}
}
panic!("Pile with only facedown cards - this is wrong")
}
}
impl CardPosition {