Hi to Roberto Mizzoni.
So far my thoughts and conversation have concentrated on index generation, and your posting seems to be on storing the tables that are to be indexed.
I'm new to this and haven't got anything working yet, so I hope people go easy on me if I say something stupid, but here goes ....
https://chessprogramming.wikispaces.com ... +BitboardsI believe the tables there are designed to be indexed by a
six-bit occupancy-index in the 0..63 range.
If the data is compressed into tables, I assume that they are managing to achieve the compression for either or both of two reasons.
A. Unused bits in some data can be used to store something else.
B. Several distinct cases with the same result can be stored in the same place.
Before someone else can take advantage of the same compression, then, some preconditions will be imposed on them.
a. That the unused bits will be masked off and only the useful data extracted, ie the data must be used in a fairly similar way.
b. That the distinct cases can find the same memory location.
Let me discuss {B,b}, as I think that might be relevant to you.
It appears to me that the Kindergarten Bitboards are extracting an UNHASHED index for bit occupancy.
My current understanding is that some different lines on a chess board with the same scattering of pieces along them would generate the same occupancy index with Kindergarten Bitboards. These different lines will then result in the same memory locations in the table being accessed, via this same index.
Now with magic index generation, the line occupancy is HASHED into a fairly random sequence of bits.
So I think you CANNOT use the Kindergarten Bitboards with your magic index generation.
The trick is to share one 4KByte table by three line-directions by re-using the mask for a final intersection.
Unless you somehow have magic hashing that creates the same index for one diagonal and another, etc, I don't see how you can use Kindergrten Bitboards, because of (B). I think you can use (A), eg store 8 lines of data in a 64 bits.
People's thoughts are welcome, as I haven't got to grips with this yet.
One reason I am initially going with my approach is that I don't like magics and hashing for a couple of reasons.
1. It makes my data difficult to verify and code harder to debug.
2. Tables cannot be shared unless things hash to the same values.
3. I cannot populate the tables without first defining the hash function.
4. If I change the index generation method, I need to regenerate the tables.
5. Generating magic numbers seems complex too.
I could add that it seems ill defined quite what magic numbers are.
Sometimes they seem to be used for casting out zeros, and sometimes for performing a mathematical function.
Furthermore, sometimes a precise result is expected eg for bitscanning and sometimes a hashed result is satistactory.
Does "magic" really just mean any unintelligable muliply and shift that does something useful?
It is of course possible that a pair of magic numbers, each designed to operate with its own particular bit mask, manipulate the bits in essentially the same way, and thus produce indicies that can reference the same lookup table. If one of the bitmasks is a multiple of the other for example, then the magic numbers could be the same multiple of each other and do essentially the same operation and giving identical results.
I think I'd better ask if this is making sense before saying any more.