aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/main.rs19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/main.rs b/src/main.rs
index e7a11a9..822f773 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -1,3 +1,22 @@
+use std::fmt;
+
+struct Bitboard(u64);
+
+impl fmt::Display for Bitboard {
+ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
+ for index in (0..64) {
+ f.write_str(if (&self.0 >> index & 1 == 1) { "1" } else { "." });
+ if ((index + 1) % 8 == 0) {
+ f.write_str("\n");
+ }
+ }
+ return write!(f, "\n")
+ }
+}
+
fn main() {
+ const bb:Bitboard = Bitboard(33);
println!("Hello, world!");
+ println!("{}", bb);
+ println!("{}", bb.0);
}