[board] Fix a bug in PieceSet::opposing_occupancy

This method should compute occupancy of everything except the provided color. Instead
it was computing the inverse.
This commit is contained in:
Eryn Wells 2025-05-24 17:54:46 -07:00
parent 5466693c1b
commit ab587f379f

View file

@ -69,13 +69,15 @@ impl PieceSet {
}
pub fn opposing_occupancy(&self, color: Color) -> BitBoard {
let color_index = color as usize;
self.color_occupancy.iter().enumerate().fold(
BitBoard::default(),
|acc, (index, occupancy)| {
if index == color as usize {
acc | occupancy
} else {
if index == color_index {
acc
} else {
acc | occupancy
}
},
)