Gerd Isenberg wrote:
It took me some time to regocnize the waste of cpu-ressources and to understand the simple natur of Kindergarten-Bitboards, multiplying masked file- and diagonal/rank-pattern to map the relevant bits to the top rank.
Hi Gerd,
It would be very helpful if some of you experts on magic could assemble a Wiki-page with all the nomenclature (Kindergarten, Kogge-fill). It's quite hard to learn everything by reading all the discussions.
I have been doing some very elementary exercises (mostly in Excel and by hand) with 16-bit integers in order to see what is going on.
1)If e.g. I have n scattered bits and want to form an n-bit index for the occupancy of those bits, I simply make an 16xn multiplication table. Every (i,j) entry has as value (i+j-(16-n)). This is just the fact that multiplication of powers of 2 is equal to addition of their exponents.
2)To find a magic, what I do is to look for a sequence of rows (out of the 16 available) in such a way that every number 0:n-1 occurs exactly once in the combined rows, and that every column has a unique number out of 0:n-1 on those selected row.
3) With carry effects, things are more subtle and I am trying to understand the patterns that happen then.
I am convinced that there are some simple (or at least simply to compute) conditions on the multiplication table that generate the magics. I think that parsing this very condensed table is all that is needed ("Sudoku-magic"). No random testing or looping over all 2^n possibilities. But perhaps I am too optimistic/naive
Rein