Random numbers for magics
Random numbers for magics
I'm having problems with random numbers with respect to magics. My code in C# starts well but after a while a I just keep getting duplicate 'magic candidate' numbers generated by my instance of random. Anybody had similar experience and if so how did you overcome it? How difficult is it to actually find magics for rooks?
The largest no of unique indexes I've obtained is about 400 (target 2048 for rook on C1 square) before a duplicate appears.
Thanks
Daz
The largest no of unique indexes I've obtained is about 400 (target 2048 for rook on C1 square) before a duplicate appears.
Thanks
Daz
-
- Posts: 1242
- Joined: Thu Jun 10, 2010 2:13 am
- Real Name: Bob Hyatt (Robert M. Hyatt)
- Location: University of Alabama at Birmingham
- Contact:
Re: Random numbers for magics
Are you describing a problem in the sequence your PRNG is producing? If so, I'd immediately try another PRNG...
Re: Random numbers for magics
I tried a large array of random instances, which produces candidate magics for a while but even that approach starts producing duplicate random numbers every time after a while. Does this happen in Java, C etc?
Daz
Daz
-
- Posts: 1242
- Joined: Thu Jun 10, 2010 2:13 am
- Real Name: Bob Hyatt (Robert M. Hyatt)
- Location: University of Alabama at Birmingham
- Contact:
Re: Random numbers for magics
Not with a good PRNG. You obviously want a 64 bit PRNG and they rarely run into this kind of short-cycle stuff, which is what it sounds like you are describing (i.e. the PRNG keeps producing the same number, or the same fairly short sequence of numbers, over and over. Some C's have a 16 bit PRNG that is hopeless since there are only 65536 possible random values...
Re: Random numbers for magics
How long can it take to find a magic? I reckon I've tried a few hundred thousand randoms so far and still no luck! Someone told me they went through millions until they found magic numbers.
Daz
Daz
-
- Posts: 1242
- Joined: Thu Jun 10, 2010 2:13 am
- Real Name: Bob Hyatt (Robert M. Hyatt)
- Location: University of Alabama at Birmingham
- Contact:
Re: Random numbers for magics
Some have gone through tens of billions. Out of 2^64 that is a small fraction. You'd have to try 'em all to find the best possible case.
-
- Posts: 68
- Joined: Tue Jun 02, 2015 11:02 pm
- Real Name: Vince
Re: Random numbers for magics
how good are the random numbers used for the Polyglot opening book hash?
i've been using those numbers in my program mainly so i don't have to duplicate effort. any position hash can immediately be used to access a polyglot opening book.
i've been using those numbers in my program mainly so i don't have to duplicate effort. any position hash can immediately be used to access a polyglot opening book.
"An Engine's strength flows from the Search. But beware, pruning, extensions, reductions; the dark side of the Search are they. Once you start down the dark path, it will dominate and consume you, as it has to so many developers before.” -- Yoda
-
- Posts: 1242
- Joined: Thu Jun 10, 2010 2:13 am
- Real Name: Bob Hyatt (Robert M. Hyatt)
- Location: University of Alabama at Birmingham
- Contact:
Re: Random numbers for magics
Question is, how many of those are there? Does polyglot have a static array of random values or does it generate them on the fly???
If it has a static array, that won't be enough...
If it has a static array, that won't be enough...
-
- Posts: 68
- Joined: Tue Jun 02, 2015 11:02 pm
- Real Name: Vince
Re: Random numbers for magics
what do you mean by "that won't be enough".
oh, i think i slightly changed the topic. i'm not using bitmaps, my move generator is based on a board of 64 using pre-calculated arrays for move generation., so i'm only using the hash for TT.
oh, i think i slightly changed the topic. i'm not using bitmaps, my move generator is based on a board of 64 using pre-calculated arrays for move generation., so i'm only using the hash for TT.
"An Engine's strength flows from the Search. But beware, pruning, extensions, reductions; the dark side of the Search are they. Once you start down the dark path, it will dominate and consume you, as it has to so many developers before.” -- Yoda