remove_move and remove_mask truncate moves in the move generator:
fn main() {
let board = "8/8/5k2/8/3Pp3/8/2K5/8 b - d3 0 1".parse().unwrap();
let mut moves = chess::MoveGen::new_legal(&board);
let len = moves.len();
moves.remove_move("e4e3".parse().unwrap());
assert_eq!(moves.len(), len - 1); //Assertion fails with 0 != 8
}
fn main() {
let board = "8/8/5k2/8/3Pp3/8/2K5/8 b - d3 0 1".parse().unwrap();
let mut moves = chess::MoveGen::new_legal(&board);
let len = moves.len();
moves.remove_mask(chess::BitBoard::from_square(chess::Square::E3));
assert_eq!(moves.len(), len - 1); //Assertion fails with 0 != 8
}
remove_move
andremove_mask
truncate moves in the move generator:This is because
remove_move
andremove_mask
fail to uphold the invariant where no non-emptySquareAndBitBoard
s may come after an empty one. This invariant is mentioned here: https://github.com/jordanbray/chess/blob/ad138579074ca1b0a88514626016d8e0b72d4ed3/src/movegen/movegen.rs#L157-L160 This leads to the iterator methods ending early.