summaryrefslogtreecommitdiff
path: root/src/command.rs
diff options
context:
space:
mode:
authorJustin Worthe <justin@worthe-it.co.za>2019-04-22 21:50:00 +0200
committerJustin Worthe <justin@worthe-it.co.za>2019-04-22 21:50:00 +0200
commit88430f31c73f469086b68f2b77d1e1ba5f9178e7 (patch)
tree292a0aceba92e4d0c38679ed919b9b463c82152b /src/command.rs
parent3e54b01003aa9d27de8f4ca13c9240fe785ec0e1 (diff)
More minimal game state
I'd prefer to start with just the state that I need, and progressively readd the bits that I've skipped as I find I need them, or as the competition evolves.
Diffstat (limited to 'src/command.rs')
-rw-r--r--src/command.rs41
1 files changed, 1 insertions, 40 deletions
diff --git a/src/command.rs b/src/command.rs
index 06dd400..99de608 100644
--- a/src/command.rs
+++ b/src/command.rs
@@ -1,4 +1,5 @@
use std::fmt;
+use crate::geometry::Direction;
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum Command {
@@ -19,43 +20,3 @@ impl fmt::Display for Command {
}
}
}
-
-#[derive(Clone, Copy, Debug, PartialEq, Eq)]
-pub enum Direction {
- North,
- NorthEast,
- East,
- SouthEast,
- South,
- SouthWest,
- West,
- NorthWest,
-}
-
-impl fmt::Display for Direction {
- fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
- use Direction::*;
- let s = match self {
- North => "N",
- NorthEast => "NE",
- East => "E",
- SouthEast => "SE",
- South => "S",
- SouthWest => "SW",
- West => "W",
- NorthWest => "NW",
- };
- f.write_str(s)
- }
-}
-
-impl Direction {
- pub fn is_diagonal(&self) -> bool {
- use Direction::*;
-
- match self {
- NorthEast | SouthEast | SouthWest | NorthWest => true,
- _ => false,
- }
- }
-}