aboutsummaryrefslogtreecommitdiff
path: root/src/attacks.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/attacks.rs')
-rw-r--r--src/attacks.rs19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/attacks.rs b/src/attacks.rs
index 6cf2a66..4562f25 100644
--- a/src/attacks.rs
+++ b/src/attacks.rs
@@ -265,6 +265,10 @@ impl Attacks {
self.kindergarten_attacks_file(occupancy, vertical, square) | self.kindergarten_attacks_base(occupancy, horizontal, square)
}
+
+ fn queen(&self, occupancy: Bitboard, square: u8) -> Bitboard {
+ self.rook(occupancy, square) | self.bishop(occupancy, square)
+ }
}
#[cfg(test)]
@@ -393,4 +397,19 @@ mod tests {
print(bb);
}
+
+ #[test]
+ fn test_queen_attacks() {
+ let attacks = Attacks::new();
+ let square = Square::E4 as u8;
+ let occupancy =
+ 1 << Square::B7 as usize |
+ 1 << Square::B1 as usize |
+ 1 << Square::C2 as usize |
+ 1 << Square::E3 as usize |
+ 1 << Square::F3 as usize;
+ let bb = attacks.queen(occupancy, square);
+ print(occupancy);
+ print(bb);
+ }
}