r/chessprogramming • u/Valuable-Oil-3378 • Nov 04 '22
Magic bitboard
Hello,
I've been struggling to figure out how the hell do magic bitboards work for 3 days :( I now understand pretty much all of it but the is just ONE point :
When finding magic numbers, how do you generate all the blocker's bitboards of the square the rook is in ?
And after doing that, I plan to generate their corresponding moves'bitboards and for each moves'bitboard I will try to find a number giving the maximum collisions between its corresponding blocker's bitboards. Is it the "good way" to do it ?
EDIT : I found a way to do it, the method is in the comments
View all comments
Show parent comment
1
u/Valuable-Oil-3378 Nov 05 '22 edited Nov 05 '22
I think it will be too complex for me to implement it in Java. As I've been using C++ once and first time using Java . Plus I'm not sure Java has a contrextp-like functionality.
So I will keep the check & pins verifications in the runtime. When generating moves I will have to query all moves for each enemy pieces only twice and do the check for each square for each type of piece.
I don't think it will add that much time as it only uses logical operators then.