Plain rook(resp. bishop) magics in 64 K each (and less)
Posted: 11 Oct 2011, 22:33
I know about the recent topic by crystal (http://www.open-aurec.com/wbforum/viewtopic.php?f=4&t=51996) witch the very beginning seems to start with the same approach as me (I found it when looking if there was something similar to my approach), but then it diverges so I decided to start this new topic.
I came up with the idea of dividing into two magic attack tables when I noticed the corner squares to be problematic regarding table size. So I divided the rook attack sets into two left/right and up/down cases respectively, and by using the standar magic techniques I could reduce the rook magics to two [64][64] magic tables, or just 64 K. The same goes for the bishops with little differences.
I'm using (n * magic) >> (64 - 6) as the hashing scheme, but it can be halved for the rook up/down case, that is, I can use (n * magic) >> (64 - 5) and reduce the table size by two for that case (I didn't test this for the bishop).
Of course all of this comes at the cost of some code duplication as compared with the standard plain magics, with the the simplicity of Plain magics and the total size advantage.
I can provide code for this if you think it's worth.
Has this approach been considered before?
I came up with the idea of dividing into two magic attack tables when I noticed the corner squares to be problematic regarding table size. So I divided the rook attack sets into two left/right and up/down cases respectively, and by using the standar magic techniques I could reduce the rook magics to two [64][64] magic tables, or just 64 K. The same goes for the bishops with little differences.
I'm using (n * magic) >> (64 - 6) as the hashing scheme, but it can be halved for the rook up/down case, that is, I can use (n * magic) >> (64 - 5) and reduce the table size by two for that case (I didn't test this for the bishop).
Of course all of this comes at the cost of some code duplication as compared with the standard plain magics, with the the simplicity of Plain magics and the total size advantage.
I can provide code for this if you think it's worth.
Has this approach been considered before?