Author: Uri Blass
Date: 07:40:39 05/30/04
Go up one level in this thread
On May 30, 2004 at 09:56:39, Tom Likens wrote:
>On May 30, 2004 at 06:44:55, Uri Blass wrote:
>
>>I have the following function to initialize my random numbers
>>
>>typedef unsigned __int64 BitBoard;
>>
>>BitBoard rand64()
>>{
>> __int64 r = rand();
>> r ^= (__int64)rand() << 15;
>> r ^= (__int64)rand() << 30;
>> r ^= (__int64)rand() << 45;
>> r ^= (__int64)rand() << 60;
>> return r;
>>}
>>
>>void initializezobarray()
>>{
>> //starting zobrist keys
>> char zobnum[128];
>> int fil,i,j;
>> srand(0);
>> for (fil=0;fil<6;fil++)
>> for (i=0;i<2;i++)
>> for (j=0;j<64;j++)
>> zobrist[fil][i][j]=rand64();
>>
>>
>>}
>>
>>My first question is if I can be sure that I will get the same random numbers in
>>every computer(I get the same in my computer but if I do not get the same in
>>every computer than I may consider to rewrite it because I plan to use hash keys
>>for my book and I do not want to have a problem that the program will not be
>>able to use my book in another computer).
>>
>>I also see that Crafty is using a table of random numbers from a book and does
>>not trust rand()
>>
>>My second question is if there is an advantage in doing it.
>>
>>Uri
>
>Hey Uri,
>
>The big advantage I've found from maintaining an internal table of random
>numbers is that I don't have to worry about the opening book (and now
>position and book learning) not working from compiler to compiler or even
>OS to OS. The program is able to read its opening book regardless if I'm
>running a Linux version, Windows version etc. It's just one less thing
>to worry about, which is always nice.
>
>And of course, if you want to start playing with the Hamming distance
>it's easy. Of course, there is no real consensus (as far as I can tell)
>on wheter numbers with a larger Hamming distance are better or not- so,
>as always you should experiment and see what works best for movei.
>
>regards,
>--tom
I think to add a file so people will be able to change this random number but I
have now a second question how to get btboard from 2 32 bits integers correctly.
I have the following code when everything is unsigned.
r1,r2 32 bits integers when r and zobrist[] 64 bit integers.
r1=(unsigned)zobrist[fil][i][j]&4294967295;
r2=(unsigned)zobrist[fil][i][j]>>32;
r=r1 | (BitBoard) (r2<<32);
I do not understand why
r!=zobrist[fil][i][j]
4294957295 is exactly 2^32-1
r>>32 is sometimes 0 and sometimes 4294967295
Uri
This page took 0.01 seconds to execute
Last modified: Thu, 15 Apr 21 08:11:13 -0700
Current Computer Chess Club Forums at Talkchess. This site by Sean Mintz.