aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authoreug-vs <eugene@eug-vs.xyz>2023-01-23 03:45:06 +0300
committereug-vs <eugene@eug-vs.xyz>2023-01-23 03:45:17 +0300
commit19c847e9c8508991e1d9150ff360440a27fbf911 (patch)
tree8800f6c28ad182e9915e1a08b0b851590e65588f /src
parent973a8bf7a63cd185980fb7997da2ea8488c0070e (diff)
downloadchessnost-19c847e9c8508991e1d9150ff360440a27fbf911.tar.gz
feat: implement visual moves printing
Diffstat (limited to 'src')
-rw-r--r--src/moves.rs18
1 files changed, 12 insertions, 6 deletions
diff --git a/src/moves.rs b/src/moves.rs
index 0dd5353..97032e5 100644
--- a/src/moves.rs
+++ b/src/moves.rs
@@ -1,13 +1,19 @@
-use crate::board::Square;
+use crate::{board::Square, bitboard::print};
#[derive(Debug)]
pub struct Move {
- from: Square,
- to: Square,
+ pub from: u8,
+ pub to: u8,
}
-// TODO: think about the size
-type MoveList = [Move; 1024];
+impl Move {
+ pub fn print(&self) {
+ let bb = 1u64 << self.from | 1u64 << self.to;
+ print(bb, format!("{:?}", self).as_str());
+ }
+}
+
+
#[cfg(test)]
mod tests {
@@ -15,7 +21,7 @@ mod tests {
#[test]
fn mock() {
- let mov = Move { from: Square::E2, to: Square::E4 };
+ let mov = Move { from: Square::E2 as u8, to: Square::E4 as u8 };
println!("{:?}", mov);
}
}