card game stuff

This commit is contained in:
2026-05-15 07:57:01 -07:00
parent 9dd379cb1b
commit 4ffd2a338f
2 changed files with 19 additions and 14 deletions
+8
View File
@@ -66,6 +66,7 @@ impl Card {
}
}
#[derive(Hash)]
pub struct Stack(Vec<Card>);
impl Stack {
pub fn new() -> Self {
@@ -99,6 +100,7 @@ impl std::ops::DerefMut for Stack {
}
}
#[derive(Hash)]
pub struct Pile {
face_down: Stack,
face_up: Stack,
@@ -134,6 +136,12 @@ impl Pile {
pub fn push(&mut self, card: Card) {
self.face_up.push(card);
}
pub fn face_up(&self) -> &[Card] {
&self.face_up
}
pub fn face_down(&self) -> &[Card] {
&self.face_down
}
}
pub struct Session<G: Game> {