diff options
-rw-r--r-- | src/bitboard.rs | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/src/bitboard.rs b/src/bitboard.rs index f43d28e..199e6c7 100644 --- a/src/bitboard.rs +++ b/src/bitboard.rs @@ -6,13 +6,17 @@ pub type Bitboard = u64; #[allow(dead_code)] pub fn print(bb: Bitboard) { println!(); - for index in 0..64 { - print!("{}", if bb >> index & 1 == 1 { "1" } else { "." }); - if (index + 1) % 8 == 0 { - println!(); + for rank in (0..8).rev() { + print!("{}|", rank + 1); + for file in 0..8 { + let index = rank * 8 + file; + print!("{}", if bb >> index & 1 == 1 { "1" } else { "." }); + if file == 7 { + println!(); + } } } - return println!(); + return println!(" ABCDEFGH"); } /// Return bitboard cardinality, aka number of elements in the set |