domino_lib/utils/
types.rs1#[derive(Debug, Clone, Copy, Hash, Eq)]
2pub struct Tile(pub i32, pub i32);
3
4impl PartialEq for Tile {
5 fn eq(&self, other: &Self) -> bool {
6 self.0 == other.0 && self.1 == other.1 || self.0 == other.1 && self.1 == other.0
7 }
8}
9
10impl From<(i32, i32)> for Tile {
11 fn from(value: (i32, i32)) -> Self {
12 Tile(value.0, value.1)
13 }
14}
15
16impl Tile {
17 pub fn flip(self) -> Self {
18 Tile(self.1, self.0)
19 }
20}
21
22pub type Solution = Vec<Tile>;
23
24pub type Puzzle = Vec<Option<Tile>>;