fix shift
This commit is contained in:
@@ -3,6 +3,7 @@ use super::{
|
||||
coords::{CoordPair, CoordPairInner},
|
||||
CoordAxis,
|
||||
};
|
||||
use num::PrimInt;
|
||||
use static_assertions::const_assert;
|
||||
|
||||
#[cfg(not(feature = "bitvec"))]
|
||||
@@ -45,7 +46,7 @@ impl BitBoard {
|
||||
|
||||
// Directional shifts with edge masking (prevents wrapping)
|
||||
pub const fn east(&self) -> Self {
|
||||
let mask = !Self::col_mask(Board::BOARD_SIZE).0; // Mask to block column 7 bits
|
||||
let mask = !Self::col_mask(Board::BOARD_SIZE - 1).0; // Mask to block column 7 bits
|
||||
Self((self.0 & mask) << 1)
|
||||
}
|
||||
|
||||
@@ -100,7 +101,7 @@ impl BitBoard {
|
||||
}
|
||||
|
||||
pub fn intersects(self, other: Self) -> bool {
|
||||
(self & other).count() > 0
|
||||
(self.0 & other.0) > 0
|
||||
}
|
||||
|
||||
pub fn union(self, other: Self) -> Self {
|
||||
|
||||
@@ -271,9 +271,8 @@ impl Board {
|
||||
/// DO NOT USE THIS ALONE, this should be called as a part of
|
||||
/// [`Board::place`] or [`Board::place_and_prop_unchecked`]
|
||||
fn propegate_from_dry(&self, coords: CoordPair, starting_color: Piece) -> BitBoard {
|
||||
let opponent_color = starting_color.flip();
|
||||
let player_board = *self.board(starting_color);
|
||||
let opponent_board = *self.board(opponent_color);
|
||||
let opponent_board = *self.board(starting_color.flip());
|
||||
|
||||
let mut flip_mask = BitBoard::new();
|
||||
let seed = BitBoard::from_coord(coords);
|
||||
@@ -300,12 +299,12 @@ impl Board {
|
||||
if current.count() == 0 || !current.intersects(opponent_board) {
|
||||
break;
|
||||
}
|
||||
temp_flips = temp_flips.union(current);
|
||||
temp_flips |= current;
|
||||
}
|
||||
|
||||
// If terminated on a player piece, keep the flips
|
||||
if current.intersects(player_board) {
|
||||
flip_mask = flip_mask.union(temp_flips);
|
||||
flip_mask |= temp_flips;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user