From ab587f379fa7967bd71b2b7e22fd44879e08e894 Mon Sep 17 00:00:00 2001 From: Eryn Wells Date: Sat, 24 May 2025 17:54:46 -0700 Subject: [PATCH] [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. --- board/src/piece_sets.rs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/board/src/piece_sets.rs b/board/src/piece_sets.rs index d3d7fde..97ada5c 100644 --- a/board/src/piece_sets.rs +++ b/board/src/piece_sets.rs @@ -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 } }, )