1
0
Fork 0

vocabulary update

This commit is contained in:
Paul-Nicolas Madelaine 2025-11-05 23:37:02 +01:00
parent d17fae4fce
commit 5d1fa02280
3 changed files with 133 additions and 84 deletions

View file

@ -127,7 +127,7 @@ static LINES: BySquare<BySquare<Bitboard>> = by_square!(a, BySquare([Bitboard(0)
by_square!(b, Bitboard(0), {
let mut res = Bitboard(0);
loop_all_directions!(d, {
let r = *RAYS.get_const(a).get_const(d);
let r = *RAYS.get(a).get(d);
if r.contains(b) {
res = r;
}
@ -140,9 +140,9 @@ static SEGMENTS: BySquare<BySquare<Bitboard>> = by_square!(a, BySquare([Bitboard
by_square!(b, Bitboard(0), {
let mut res = 0;
loop_all_directions!(d, {
let r = *RAYS.get_const(a).get_const(d);
let r = *RAYS.get(a).get(d);
if r.contains(b) {
res = r.0 & !RAYS.get_const(b).get_const(d).0;
res = r.0 & !RAYS.get(b).get(d).0;
}
});
Bitboard(res | b.bitboard().0)
@ -218,7 +218,7 @@ static PAWN_ATTACKS: ByColor<BySquare<Bitboard>> = {
};
const fn blocked_ray(square: Square, direction: Direction, blockers: Bitboard) -> Bitboard {
let ray = *RAYS.get_const(square).get_const(direction);
let ray = *RAYS.get(square).get(direction);
let blockers = Bitboard(blockers.0 & ray.0);
let square = if (direction as u8) < 4 {
Bitboard::first(&blockers)
@ -227,7 +227,7 @@ const fn blocked_ray(square: Square, direction: Direction, blockers: Bitboard) -
};
match square {
None => ray,
Some(square) => Bitboard(ray.0 & !RAYS.get_const(square).get_const(direction).0),
Some(square) => Bitboard(ray.0 & !RAYS.get(square).get(direction).0),
}
}
@ -259,7 +259,7 @@ pub(crate) fn pawn_attack(color: Color, square: Square) -> Bitboard {
const fn bishop_premask(square: Square) -> Bitboard {
let mut premask = 0;
loop_bishop_directions!(direction, {
premask |= RAYS.get_const(square).get_const(direction).0;
premask |= RAYS.get(square).get(direction).0;
});
premask &= !Rank::First.bitboard().0;
premask &= !Rank::Eighth.bitboard().0;
@ -269,12 +269,12 @@ const fn bishop_premask(square: Square) -> Bitboard {
}
const fn rook_premask(square: Square) -> Bitboard {
let rays = RAYS.get_const(square);
let rays = RAYS.get(square);
let mut premask = 0;
premask |= rays.get_const(Direction::East).0 & !File::H.bitboard().0;
premask |= rays.get_const(Direction::North).0 & !Rank::Eighth.bitboard().0;
premask |= rays.get_const(Direction::West).0 & !File::A.bitboard().0;
premask |= rays.get_const(Direction::South).0 & !Rank::First.bitboard().0;
premask |= rays.get(Direction::East).0 & !File::H.bitboard().0;
premask |= rays.get(Direction::North).0 & !Rank::Eighth.bitboard().0;
premask |= rays.get(Direction::West).0 & !File::A.bitboard().0;
premask |= rays.get(Direction::South).0 & !Rank::First.bitboard().0;
Bitboard(premask)
}
@ -360,7 +360,7 @@ static MAGIC_TABLE: [Bitboard; MAGICS.2] = {
premask,
factor,
offset,
} = *MAGICS.0.get_const(square);
} = *MAGICS.0.get(square);
let premask = !premask.0;
loop_subsets!(premask, blockers, {
let index = (hash(BISHOP_SHR, factor, Bitboard(blockers | !premask)) as isize + offset)
@ -378,7 +378,7 @@ static MAGIC_TABLE: [Bitboard; MAGICS.2] = {
premask,
factor,
offset,
} = *MAGICS.1.get_const(square);
} = *MAGICS.1.get(square);
let premask = !premask.0;
loop_subsets!(premask, blockers, {
let index =