1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
use std::fmt;
pub mod bsp;
#[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord)]
pub enum Tile {
Floor,
Wall
}
impl fmt::Display for Tile {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
match self {
Tile::Floor => write!(f, "0"),
Tile::Wall => write!(f, "1")
}
}
}
#[derive(Clone, Copy, PartialEq, Eq, Debug, Hash)]
pub struct Point {
pub x : usize,
pub y : usize,
}
impl Point {
pub fn new(x : usize, y : usize) -> Self {
Point {
x,
y
}
}
}
impl fmt::Display for Point {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "x: {}, y: {}\n", self.x, self.y)?;
Ok(())
}
}