Re: Zobrist keys - measure of quality?
Posted: Tue Feb 24, 2015 3:02 pm
I use this to generate random numbers:
http://www.math.sci.hiroshima-u.ac.jp/~ ... T/emt.html
http://www.math.sci.hiroshima-u.ac.jp/~ ... T/emt.html
Why only one number for black ? Why not for white too?At program initialization, we generate an array of pseudorandom numbers [7] [8]:
One number for each piece at each square
One number to indicate the side to move is black
Four numbers to indicate the castling rights, though usually 16 (2^4) are used for speedEight numbers to indicate the file of a valid En passant square, if any
You only need one value to encode STM, so say if black's to move, you include the STM key (in fact, each time you make a move you simply xor with STM key unless it's a nullmove) - so if you build key from scratch,Daniel Anulliero wrote:Hi all
Excuse me , if I ask a question (a little bit of topic..) to the experts here?
I quote that from Zobrist hashing wiki :Why only one number for black ? Why not for white too?At program initialization, we generate an array of pseudorandom numbers [7] [8]:
One number for each piece at each square
One number to indicate the side to move is black
Four numbers to indicate the castling rights, though usually 16 (2^4) are used for speedEight numbers to indicate the file of a valid En passant square, if any
I have two numbers for white and black in my engine...
It seems There is something I misunderstood ...
Bests
Dany
Yes Mersenne Twister is pretty good, also has insane period. However each 624-th pseudo-random number takes much longer than the rest (this is no problem for offline processing),cdani wrote:I use this to generate random numbers:
http://www.math.sci.hiroshima-u.ac.jp/~ ... T/emt.html
Every position will have either white to move or black to move. You can use a Zobrist number for each, but the only thing that really matters is the XOR of those two numbers, because that's what's going to be different between black to move and white to move on the same position. So making one of them 0 doesn't change anything.Daniel Anulliero wrote:Hi all
Excuse me , if I ask a question (a little bit of topic..) to the experts here?
I quote that from Zobrist hashing wiki :Why only one number for black ? Why not for white too?At program initialization, we generate an array of pseudorandom numbers [7] [8]:
One number for each piece at each square
One number to indicate the side to move is black
Four numbers to indicate the castling rights, though usually 16 (2^4) are used for speedEight numbers to indicate the file of a valid En passant square, if any
I have two numbers for white and black in my engine...
It seems There is something I misunderstood ...
Bests
Dany
Thanks.mar wrote:Yes Mersenne Twister is pretty good, also has insane period. However each 624-th pseudo-random number takes much longer than the rest (this is no problem for offline processing),cdani wrote:I use this to generate random numbers:
http://www.math.sci.hiroshima-u.ac.jp/~ ... T/emt.html
but I prefer KISS-style PRNGs that are both simpler and faster and most importantly have stable running time.
Null move changes STM as well, so why "unless"?mar wrote:(in fact, each time you make a move you simply xor with STM key unless it's a nullmove)