Author: Uri Blass
Date: 15:35:57 05/30/04
Go up one level in this thread
On May 30, 2004 at 18:20:15, Peter Fendrich wrote: >On May 30, 2004 at 18:09:49, Uri Blass wrote: > >>On May 30, 2004 at 17:51:13, Peter Fendrich wrote: >> >>>If zobrist is signed you will encounter problems when shifting it. >>>/Peter >> >>I think that my zobrist is unsigned. >> >> >>My function to generate "random" 64 bit numbers generate signed number but >>return it as unsigned number >> >>I have >>typedef unsigned __int64 BitBoard; >>static BitBoard rand64() >>{ >> __int64 r = rand(); >> r ^= (__int64)rand() << 15; >> r ^= (__int64)rand() << 30; >> r ^= (__int64)rand() << 45; >> r ^= (__int64)rand() << 60; >>return r; >>} >> >>BitBoard zobrist[6][2][64]; >> >>zobrist[fil][i][j]=rand64(); >> >>The problem is that when I do >> >>r1=(unsigned)zobrist[fil][i][j]&4294967295; >>r2=(unsigned)(zobrist[fil][i][j]>>32); >>r=r1 | (BitBoard) r2<<32; >> >>I get r!=zobrist[fil][i][j] >> >>Uri > > >What made me think you have a signed zobrist are the >rx=(unsigned)zobrist[fil][i][j].... statements. There is no reason to cast to >unsigned if it's already unsigned. >The statement: >r2=(unsigned)(zobrist[fil][i][j]>>32); >looks very strange to me because with parentheses you force the "(unsigned)" >cast to be made after the shift is done. It makes no sence to to me whether it's >signed or not. > >/Peter It seems that the problem is not the zobrist key but the fact that r1 and r2 were regular int I need to write the conversion to unsigned otherwise I get a warning of losing information in conversion from 'unsigned __int64' to 'unsigned int Now it seems that I needs different numbers. I used the following function to print 32 numbers into the screen and later copied them into the file. static BitBoard rand64() { __int64 r = rand(); r ^= (__int64)rand() << 15; r ^= (__int64)rand() << 30; r ^= (__int64)rand() << 45; r ^= (__int64)rand() << 60; printf(" %u ",r); printf(" %u ",r>>32); return r; } I think that I will print them into the screen not inside BitBoard rand64() but after I calculate the zob keys and I expect to get different numbers that I will be able to translate them to the zobrist keys. Uri
This page took 0 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.