Compare commits

3 Commits

Author SHA1 Message Date
e7f4a00f2a Drop unused import 2025-08-23 09:43:33 -05:00
bd324807e8 Fix visibility on items in card.rs 2025-08-23 09:42:37 -05:00
4a17666bba Card's methods take values, not references
I expect that we will not want to retain the original copy of a Card
after merging, cutting, rotating, etc. This function signature says that
the value moves into the method and goes away. If this becomes an
annoyance, then we change it.
2025-08-23 09:38:49 -05:00

View File

@@ -1,10 +1,8 @@
//! TODO: module doc :v
use std::ops::Deref;
/// Value for the "sub tiles" inside a room tile
#[derive(Clone, Copy, Debug, Default, PartialEq)]
enum Cell {
pub enum Cell {
#[default]
Empty,
NW,
@@ -15,7 +13,7 @@ enum Cell {
}
#[derive(Clone, Copy, Debug)]
enum CutLine {
pub enum CutLine {
VertLeft,
VertRight,
HorizUpper,
@@ -23,26 +21,26 @@ enum CutLine {
}
#[derive(Clone, Copy, Debug)]
enum FlipDir {
pub enum FlipDir {
Vertical,
Horizontal,
}
#[derive(Clone, Copy, Debug)]
enum TransposeIndex {
pub enum TransposeIndex {
First,
Second,
Third,
}
#[derive(Clone, Copy, Debug)]
enum TransposeSelection {
pub enum TransposeSelection {
Column(TransposeIndex),
Row(TransposeIndex),
}
#[derive(Clone, Copy, Debug)]
enum RotationDir {
pub enum RotationDir {
Clockwise,
CounterClockwise,
}
@@ -50,7 +48,7 @@ enum RotationDir {
/// An invidiual room, or "card" in the player's hand. The room may
/// *or may not* be valid, yet.
#[derive(Clone, Copy, Debug, Default, PartialEq)]
struct Card {
pub struct Card {
cells: [Cell; 9],
nw: bool,
n: bool,
@@ -115,19 +113,19 @@ impl Card {
}
/// Cuts this Card on the given line. Returns two cards
pub fn cut(&self, line: CutLine) -> (Self, Self) {
pub fn cut(self, line: CutLine) -> (Self, Self) {
todo!();
}
pub fn flip(&self, flip: FlipDir) -> (Self) {
pub fn flip(self, flip: FlipDir) -> Self {
todo!();
}
pub fn transpose(&self, other: &Self, selection: TransposeSelection) -> (Self, Self) {
pub fn transpose(self, other: Self, selection: TransposeSelection) -> (Self, Self) {
todo!();
}
pub fn rotate(&self, dir: RotationDir) {
pub fn rotate(self, dir: RotationDir) {
todo!();
}
}