So, I'm now about to implement magic boards into my engine. And I've been reading a lot about the different kind of magic board (some even fancier then the other, no pun intended). The main goal in optimizing bitboards seems to be having as small as possible hashes, thus smaller tables.
For some reason (which I haven't found out yet) the tables for the rook are much larger then the bishop tables. But that got me thinking, why not have two tables for the rook? One will have the vertical line(s) the other the horizontal lines. This would probably leave a very small hash and will result in two small tables. The obvious drawback is doing twice the work for a rook, two magic lookups.
Has anybody played with this idea before? Or is the idea flawed from the start?
You can mask like this:
rookVert:
0 0 0 0 0 0 0 0
0 0 1 0 0 0 0 0
0 0 X 0 0 0 0 0
0 0 1 0 0 0 0 0
0 0 1 0 0 0 0 0
0 0 1 0 0 0 0 0
0 0 1 0 0 0 0 0
0 0 0 0 0 0 0 0
rookHor:
0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0
0 1 X 1 1 1 1 0
0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0
It is one small step back in the space-time tradeoff, but if the tables are small enough I think it might be beneficial.
The tables could even be reused if you turn the occ mask-result 90 degrees, leaving just one small rook lookup table. But turning the board 90 degrees (and back) takes quite a lot of processing... and is probably not worth it.
I've seen only one table comparing the performance of different board implementations. I.e. different kinds of magic boards v.s. Kogge Stone v.s. classic methods. Are there more?