1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
use super::point::Point;

pub enum Direction {
    Down,
    DownLeft,
    DownRight,
}

impl Direction {
    /// panics if point moves past zero (to the left)
    pub fn move_point(&self, p: &Point) -> Point {
        match self {
            Self::Down => Point { x: p.x, y: p.y + 1 },
            Self::DownLeft => Point {
                x: p.x - 1,
                y: p.y + 1,
            },
            Self::DownRight => Point {
                x: p.x + 1,
                y: p.y + 1,
            },
        }
    }
}