Hello Robert,
Thanks for your reply.
what i want is to use the following:
to have a rotation right filled with zeros.
Shifts bits to the right (divide by 2 for each shift). Zeros emerging on the right are lost, while zeros are inserted to the left.
At this time i used unsigned for u64.
i suspect to have a bug in my rookAttack and bishopAttack.
Code: Select all
u64 bishopAttacks(int sq) {
int idx_down = (int) (pieces_45 >> DIA_DOWN_SHIFT[sq]) & 63;
int idx_up = (int) (pieces_315 >> DIA_UP_SHIFT[sq]) & 63;
return DIA_UP_SLIDES[(sq<<6) | idx_up] | DIA_DOWN_SLIDES[(sq<<6) | idx_down];
}
/* Returns rook-style attacks bitboard from a given square.*/
u64 rookAttacks(int sq) {
int idx_0 = (int) (pieces >> ((sq & 0x38) | 1)) & 63;
int idx_90 = (int) (pieces_90 >> FILE_SHIFT[sq]) & 63;
return FILE_SLIDES[(sq << 6) | idx_90] | RANK_SLIDES[(sq << 6) | idx_0];
}
with this position
R2KR2R/PP1Q2NP/2PPnN2/3P1B2/3p4/2N4q/ppp2ppp/r3rk2 w - - 0 1
my result is the following for level one depth.
1 : The white king on d8 move to c8
2 : The white pawn on d5 capture the black knight at e6
3 : The white queen on d7 capture the black knight at e6
4 : The white knight on g7 capture the black knight at e6
5 : The white rook on a8 capture the black knight at e6
6 : The white rook on e8 capture the black knight at e6
so a bug for rook and a bug for king move.
but i will continue to debug and see if my precomputed table are not wrong.
Thanks
Best Regards
Yves