aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoreug-vs <eugene@eug-vs.xyz>2023-01-21 22:03:56 +0300
committereug-vs <eugene@eug-vs.xyz>2023-01-21 22:03:56 +0300
commit8cf8f33ebc968d10bb949a82298a44ac4f6f176f (patch)
treed2a345ce7bb699e762ddab9a063bebcd8f18be00
parent9bc19965e010314187d69f5d97fe8fffb9389eeb (diff)
downloadchessnost-8cf8f33ebc968d10bb949a82298a44ac4f6f176f.tar.gz
feat: improve bitboard print
-rw-r--r--src/bitboard.rs14
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