Give the Card an associated fn new()

So that we don't have to keep doing the `{ cells: ... ..default() }`
thing.
This commit is contained in:
2025-08-27 12:49:55 -05:00
parent 37cb394bf5
commit c0ed58e890

View File

@@ -82,6 +82,21 @@ pub struct Card {
}
impl Card {
/// Create a new card from the given Cell array
pub const fn new(cells: [Cell; 9]) -> Self {
Self {
cells,
nw: false,
n: false,
ne: false,
w: false,
e: false,
sw: false,
s: false,
se: false,
}
}
/// Produces a new card by stacking another on top of this one.
pub fn merge(self, top: Self) -> (Self, Option<Self>) {
let mut new_card = Self::default();