[board] Implement a PositionBuilder; refactor piece bitboards into a PieceBitBoards struct
This makes Position immutable, even if declared mut. I think this will also make it easier to build positions going forward. Moving to a PieceBitBoards struct also required a lot of places that return owned BitBoards to return refs. This is basically fine except for adding a few more & here and there. This was a huge refactoring project. All the move generators and a bunch of BitBoard stuff needed to be updated.
This commit is contained in:
parent
939fac80d7
commit
24cce95a88
17 changed files with 472 additions and 381 deletions
|
|
@ -165,13 +165,13 @@ impl MoveLibrary {
|
|||
}
|
||||
|
||||
#[inline]
|
||||
fn generate_ray(sq: BitBoard, shift: fn(BitBoard) -> BitBoard) -> BitBoard {
|
||||
fn generate_ray(sq: BitBoard, shift: fn(&BitBoard) -> BitBoard) -> BitBoard {
|
||||
let mut ray = BitBoard::empty();
|
||||
|
||||
let mut iter = shift(sq);
|
||||
let mut iter = shift(&sq);
|
||||
while !iter.is_empty() {
|
||||
ray |= iter;
|
||||
iter = shift(iter);
|
||||
iter = shift(&iter);
|
||||
}
|
||||
|
||||
ray
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue