equal
deleted
inserted
replaced
5 #[derive(PartialEq, Eq, Hash, Clone, Copy, Debug)] |
5 #[derive(PartialEq, Eq, Hash, Clone, Copy, Debug)] |
6 pub enum Tile { |
6 pub enum Tile { |
7 Empty, |
7 Empty, |
8 Outside, |
8 Outside, |
9 Numbered(usize), |
9 Numbered(usize), |
10 } |
|
11 |
|
12 impl Tile { |
|
13 fn is(&self, i: usize) -> bool { |
|
14 *self == Tile::Numbered(i) |
|
15 } |
|
16 |
|
17 fn is_empty(&self) -> bool { |
|
18 match self { |
|
19 Tile::Empty => true, |
|
20 Tile::Outside => true, |
|
21 _ => false, |
|
22 } |
|
23 } |
|
24 |
|
25 fn is_empty_or(&self, i: usize) -> bool { |
|
26 match self { |
|
27 Tile::Numbered(n) => *n == i, |
|
28 Tile::Empty => true, |
|
29 _ => false, |
|
30 } |
|
31 } |
|
32 |
|
33 fn is_void_or(&self, i: usize) -> bool { |
|
34 match self { |
|
35 Tile::Numbered(n) => *n == i, |
|
36 _ => true, |
|
37 } |
|
38 } |
|
39 } |
10 } |
40 |
11 |
41 impl Default for Tile { |
12 impl Default for Tile { |
42 fn default() -> Self { |
13 fn default() -> Self { |
43 Tile::Outside |
14 Tile::Outside |