diff options
Diffstat (limited to 'src/command.rs')
-rw-r--r-- | src/command.rs | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/command.rs b/src/command.rs index bca0f38..81e3d67 100644 --- a/src/command.rs +++ b/src/command.rs @@ -1,10 +1,11 @@ use std::fmt; use crate::geometry::Direction; +use crate::geometry::Point2d; #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)] pub enum Command { - Move(i8, i8), - Dig(i8, i8), + Move(Point2d<i8>), + Dig(Point2d<i8>), Shoot(Direction), DoNothing, } @@ -13,8 +14,8 @@ impl fmt::Display for Command { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { use Command::*; match self { - Move(x, y) => write!(f, "move {} {}", x, y), - Dig(x, y) => write!(f, "dig {} {}", x, y), + Move(p) => write!(f, "move {} {}", p.x, p.y), + Dig(p) => write!(f, "dig {} {}", p.x, p.y), Shoot(dir) => write!(f, "shoot {}", dir), DoNothing => write!(f, "nothing"), } |