aboutsummaryrefslogtreecommitdiff
path: root/src/moves.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/moves.rs')
-rw-r--r--src/moves.rs8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/moves.rs b/src/moves.rs
index e27d74c..3cf9fd3 100644
--- a/src/moves.rs
+++ b/src/moves.rs
@@ -1,3 +1,5 @@
+use std::str::Chars;
+
use crate::{square::Square, bitboard::BitboardFns, board::piece::Piece};
#[derive(Debug, Clone, PartialEq, Eq, Copy)]
@@ -27,4 +29,10 @@ impl Move {
pub fn is_tactical(&self) -> bool {
matches!(self.kind, MoveKind::Capture | MoveKind::EnPassant)
}
+
+ pub fn from_notation(mut notation: Chars) -> Self {
+ let source = Square::from_notation(&mut notation).unwrap();
+ let target = Square::from_notation(&mut notation).unwrap();
+ Move { source, target, kind: MoveKind::Quiet }
+ }
}