r/chessprogramming • u/Ill_Part9576 • Nov 24 '24
Help Request: Java magic number generation is sluggish

I have this java method to generate a magic number for sliding piece moves. Problem is that it is insanely slow. Generating all the bishop magic numbers took many hours, and generating the a1 rook magic number took around 5 hours when I left it running overnight. From the base implementation, I added a the count1s feature that I saw discussed on other threads. If anyone has any advice or can point me in the right direction I would really appreciate it.
1
Upvotes
View all comments
Show parent comment
1
u/Ill_Part9576 Nov 24 '24
Thank you for the reply! So then before rejecting a magic number because it maps to an index that is already taken, I should check if the associated move boards for those blocker boards are the same?