Here's an iterim result of my search for magic factors, that may be interesting: There is no magic factor with shift 8 for the bishop square d5. Therefore fixed shift magics will always have to use shift 9.
Using the trick from http://www.talkchess.com/forum/viewtopic.php?t=65187 I had to test only 2^50 candidates instead of all 2^64. This yielded a list of 364854 magics with shift 9: https://raw.githubusercontent.com/nikla ... hop-d5.txt
None of them works for shift 8 and the index range is from 0 to 511 for all of them.
Here's the program I used for this search: https://github.com/niklasf/magics/blob/ ... c/magics.c. It uses one more trick I haven't seen before: Try to order the relevant occupancies so that candidates are refuted as quickly as possible. Any other ideas for speeding this up are most welcome. Moving on to rooks now, after this warmup.
No bishop magics with fixed shift 8
Moderators: hgm, Harvey Williamson, bob
Forum rules
This textbox is used to restore diagrams posted with the [d] tag before the upgrade.
This textbox is used to restore diagrams posted with the [d] tag before the upgrade.
-
ZirconiumX
- Posts: 1327
- Joined: Sun Jul 17, 2011 9:14 am
Re: No bishop magics with fixed shift 8
This line looks ripe for an OpenMP pragma, and the code looks to be thread-safe. You might find that helps.
Some believe in the almighty dollar.
I believe in the almighty printf statement.
I believe in the almighty printf statement.
Re: No bishop magics with fixed shift 8
Yes, thanks. So far I've split the range into chunks and used GNU parallel, which requires a bit of bookkeeping.
-
ZirconiumX
- Posts: 1327
- Joined: Sun Jul 17, 2011 9:14 am
Re: No bishop magics with fixed shift 8
I think I spoke too soon; `refs` and `magic` are shared, and some bookkeeping that seems irrelevant is done. Still, your method of GNU Parallel works fine.ZirconiumX wrote:This line looks ripe for an OpenMP pragma, and the code looks to be thread-safe. You might find that helps.
EDIT: you could add `-flto -fwhole-program` to CFLAGS, for optimisation purposes.
Some believe in the almighty dollar.
I believe in the almighty printf statement.
I believe in the almighty printf statement.