use std::fmt; use crate::geometry::Direction; #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)] pub enum Command { Move(i8, i8), Dig(i8, i8), Shoot(Direction), DoNothing, } 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), Shoot(dir) => write!(f, "shoot {}", dir), DoNothing => write!(f, "nothing"), } } }