summaryrefslogtreecommitdiff
path: root/model/src
diff options
context:
space:
mode:
authorMike White <botahamec@outlook.com>2021-09-15 20:49:13 -0400
committerMike White <botahamec@outlook.com>2021-09-15 20:49:13 -0400
commit01b456b4fef8ce4a002f870e5385424614a2a5fb (patch)
tree6f44e7d775a7a77d9b0d5dcf13e25b35a25e9737 /model/src
parentcbdd3f7be61f1040e84b757a5b8404378de3c46c (diff)
Added best move function
Diffstat (limited to 'model/src')
-rw-r--r--model/src/moves.rs14
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 {