[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:
parent
5466693c1b
commit
ab587f379f
1 changed files with 5 additions and 3 deletions
|
@ -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
|
||||
}
|
||||
},
|
||||
)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue