Implement more efficient magics generator
authorH.G.Muller <hgm@hgm-xboard.(none)>
Fri, 9 Jan 2026 10:42:42 +0000 (11:42 +0100)
committerH.G.Muller <hgm@hgm-xboard.(none)>
Fri, 9 Jan 2026 10:42:42 +0000 (11:42 +0100)
commit96a9f2c4b676da53a33c88967c3a0b65793e6476
treeef1cfe5cdd4e7f0c90b150ab71909b1cd13b3788
parent15268d82d4d3f59d9b81751321d4511489932001
Implement more efficient magics generator

Instead of randomly trying magics until a suitable one is found,
a routine is added that finds the magic through purposeful backtracking.
It also does not have to generate attacks to test for collisions; it
guarantees there will be none by preventing harmful collisions between
mask bits when these are placed in the index. That makes it very fast.
Verification of the generated magic is still done, but since the magic
should already be correct the loop for retrying is gone.
src/bitboard.cpp