1
0
Fork 0

update move generation for pinned pieces

This commit is contained in:
Paul-Nicolas Madelaine 2025-11-05 23:47:00 +01:00
parent 2426a0cdb3
commit d500f525f7
2 changed files with 33 additions and 12 deletions

View file

@ -136,6 +136,22 @@ static LINES: BySquare<BySquare<Bitboard>> = by_square!(a, BySquare([Bitboard(0)
})
});
static BISHOP_LINES: BySquare<Bitboard> = by_square!(sq, Bitboard(0), {
let mut res = 0;
loop_bishop_directions!(d, {
res |= RAYS.get(sq).get(d).0;
});
Bitboard(res)
});
static ROOK_LINES: BySquare<Bitboard> = by_square!(sq, Bitboard(0), {
let mut res = 0;
loop_rook_directions!(d, {
res |= RAYS.get(sq).get(d).0;
});
Bitboard(res)
});
static SEGMENTS: BySquare<BySquare<Bitboard>> = by_square!(a, BySquare([Bitboard(0); 64]), {
by_square!(b, Bitboard(0), {
let mut res = 0;
@ -240,6 +256,14 @@ pub(crate) fn line(a: Square, b: Square) -> Bitboard {
*LINES.get(a).get(b)
}
#[inline]
pub(crate) fn bishop_lines(square: Square) -> Bitboard {
*BISHOP_LINES.get(square)
}
#[inline]
pub(crate) fn rook_lines(square: Square) -> Bitboard {
*ROOK_LINES.get(square)
}
#[inline]
pub(crate) fn segment(a: Square, b: Square) -> Bitboard {
*SEGMENTS.get(a).get(b)
}