https://www.chessprogramming.org/Lookin ... in_Randoms
I have a couple of questions about the code presented:
1) What is the purpose of the line
if(count_1s((mask * magic) & 0xFF00000000000000ULL) < 6) continue;
?
At first I thought it was to avoid the checking the magic in the lines below, because it would have too few bits to be useful when shifted down. But that is not the case. Some of the best magics found so far would not be found with that line in place. Also, there are magics where this count is zero but where the magic still works. Or I misunderstand something AND have bugs in my code (both not impossible )
2) Why have the RBits and BBits arrays? What is looked up there will always equal n in the line
n = count_1s(mask);
It's not an attempt to criticize the code (although it could be much more expressive without impacting performance), I just want to make sure I am not missing something.
Looking for magics - questions
Moderators: hgm, Rebel, chrisw