diff options
Diffstat (limited to 'model/src/moves.rs')
| -rw-r--r-- | model/src/moves.rs | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/model/src/moves.rs b/model/src/moves.rs index 720e11a..f6b1fce 100644 --- a/model/src/moves.rs +++ b/model/src/moves.rs @@ -1,4 +1,5 @@ -use crate::CheckersBitBoard; +use crate::{CheckersBitBoard, SquareCoordinate}; +use std::fmt::{Display, Formatter}; #[derive(Copy, Clone, Debug, Eq, PartialEq, Hash)] pub enum MoveDirection { @@ -122,6 +123,17 @@ impl Move { } } +impl Display for Move { + fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result { + write!( + f, + "{}-{}", + SquareCoordinate::from_value(self.start as usize), + SquareCoordinate::from_value(self.end_position()) + ) + } +} + #[cfg(test)] mod tests { |
