diff options
author | Justin Worthe <justin@worthe-it.co.za> | 2019-05-21 13:27:25 +0200 |
---|---|---|
committer | Justin Worthe <justin@worthe-it.co.za> | 2019-05-21 13:27:25 +0200 |
commit | 63da94f7f1b25eddeb9ffd379f37c1a32e750fdb (patch) | |
tree | 83bd2670e948b16b37890e3ee9785f3672e0d32d /src/command.rs | |
parent | b93a9c643485c720a0711ddaf90872b7c6f006c8 (diff) |
More robust game logic and reasoning
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"), } |