No bishop magics with fixed shift 8

Discussion of chess software programming and technical issues.

Moderators: hgm, Harvey Williamson, bob

Forum rules
This textbox is used to restore diagrams posted with the [d] tag before the upgrade.
Post Reply
niklasf
Posts: 33
Joined: Sat May 16, 2015 9:41 pm

No bishop magics with fixed shift 8

Post by niklasf » Mon Apr 09, 2018 7:42 am

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.

ZirconiumX
Posts: 1327
Joined: Sun Jul 17, 2011 9:14 am

Re: No bishop magics with fixed shift 8

Post by ZirconiumX » Mon Apr 09, 2018 5:31 pm

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.

niklasf
Posts: 33
Joined: Sat May 16, 2015 9:41 pm

Re: No bishop magics with fixed shift 8

Post by niklasf » Mon Apr 09, 2018 5:35 pm

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

Post by ZirconiumX » Mon Apr 09, 2018 5:48 pm

ZirconiumX wrote:This line looks ripe for an OpenMP pragma, and the code looks to be thread-safe. You might find that helps.
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.

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.

Post Reply