Magic Move Generation

Discussion of chess software programming and technical issues.

Moderators: hgm, Rebel, chrisw

Aleks Peshkov
Posts: 892
Joined: Sun Nov 19, 2006 9:16 pm
Location: Russia

Re: Magic Move Generation

Post by Aleks Peshkov »

By the goal I meant perfect hashing (82*64 (41k) for bishops and 102400 (800kB) for rooks), where max pop count of masked significant bitboard bits is equal to hash bit size.
Pradu
Posts: 287
Joined: Sat Mar 11, 2006 3:19 am
Location: Atlanta, GA

Re: Magic Move Generation

Post by Pradu »

Aleks Peshkov wrote:By the goal I meant perfect hashing (82*64 (41k) for bishops and 102400 (800kB) for rooks), where max pop count of masked significant bitboard bits is equal to hash bit size.
This has already been compressed this much. Actually a bit more because multiple occupancies can hash to the same move bitboard. Eg say for rank attacks on the AFile would be the same for 01111110, 01011110, 01101110, 01100110...

You can do better than n-keybits to n-index bits because the move bitboards for all the occupancies above are the same. The search for the best possible "optimal" magics for all bishop and rook squares is what hasn't been completed yet.
grant
Posts: 67
Joined: Mon Aug 06, 2007 4:42 pm
Location: London, England

Re: Magic Move Generation

Post by grant »

Mine is already compressed to 4909 for bishops, 99768 for rooks and 20118 for castling

Grant
grant
Posts: 67
Joined: Mon Aug 06, 2007 4:42 pm
Location: London, England

Re: Magic Move Generation

Post by grant »

As an example, the rook on square B7, it should take long to find a 10-bit magic number for this square, and upon investigation, all 1024 elements are used. However if you then generate another 10-bit magic number you might discover that this number only requires 1023 elements such that the very last element is not used.
Continuing this process, in less than 1 minute, I found a magic number that only requires the first 896 elements. After about 15 minutes I get one that only needs 892.
Doing this for all the squares I reduced the total size of the table.

Grant