diff options
author | eug-vs <eugene@eug-vs.xyz> | 2023-01-21 20:00:30 +0300 |
---|---|---|
committer | eug-vs <eugene@eug-vs.xyz> | 2023-01-21 20:00:30 +0300 |
commit | 9bc19965e010314187d69f5d97fe8fffb9389eeb (patch) | |
tree | cfefa1330cbdee8696d8de4ad29dfebe0afd27b5 /src | |
parent | d0a67b462b492f136c5d07f4a75819d3516652d5 (diff) | |
download | chessnost-9bc19965e010314187d69f5d97fe8fffb9389eeb.tar.gz |
test: add visual prints
Diffstat (limited to 'src')
-rw-r--r-- | src/attacks.rs | 4 | ||||
-rw-r--r-- | src/bitboard.rs | 1 |
2 files changed, 3 insertions, 2 deletions
diff --git a/src/attacks.rs b/src/attacks.rs index 97e4f37..787f200 100644 --- a/src/attacks.rs +++ b/src/attacks.rs @@ -236,6 +236,7 @@ mod tests { assert_eq!(pop_count(attacks[Square::G1 as usize]), 3); assert_eq!(pop_count(attacks[Square::H8 as usize]), 2); + print(attacks[Square::E4 as usize]); } #[test] @@ -252,6 +253,7 @@ mod tests { assert_eq!(pop_count(attacks[Square::E8 as usize]), 5); assert_eq!(pop_count(attacks[Square::A4 as usize]), 5); assert_eq!(pop_count(attacks[Square::H4 as usize]), 5); + print(attacks[Square::E4 as usize]); } #[test] @@ -265,14 +267,12 @@ mod tests { assert_eq!(attacks[0b00010100][4], 0b11101100); assert_eq!(attacks[0b01010100][4], 0b01101100); assert_eq!(attacks[0b01010010][4], 0b01101110); - } #[test] fn test_ray_attacks() { let attacks = Attacks::precompute_ray_attacks(); let square = Square::E4 as usize; - let bitboard = attacks[0][square] | attacks[1][square] | diff --git a/src/bitboard.rs b/src/bitboard.rs index 646006c..f43d28e 100644 --- a/src/bitboard.rs +++ b/src/bitboard.rs @@ -5,6 +5,7 @@ pub type Bitboard = u64; /// (i.e the board is actually flipped along X) #[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 { |