[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 {
|
pub fn opposing_occupancy(&self, color: Color) -> BitBoard {
|
||||||
|
let color_index = color as usize;
|
||||||
|
|
||||||
self.color_occupancy.iter().enumerate().fold(
|
self.color_occupancy.iter().enumerate().fold(
|
||||||
BitBoard::default(),
|
BitBoard::default(),
|
||||||
|acc, (index, occupancy)| {
|
|acc, (index, occupancy)| {
|
||||||
if index == color as usize {
|
if index == color_index {
|
||||||
acc | occupancy
|
|
||||||
} else {
|
|
||||||
acc
|
acc
|
||||||
|
} else {
|
||||||
|
acc | occupancy
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue