plattyaj wrote:The concept that needs to be preserved in any approach to hash keys is that you want to have a large Hamming distance between one key and another:
http://en.wikipedia.org/wiki/Hamming_distance
If you can generate a set of keys that have a good hamming distance it will work fine for the hash table.
Now, why you would write an assembler program and then add the overhead of reading unaligned words and shifting is another matter
Andy.
I thought this had been debunked? What matters is whether two *combinations* of various table entries can collide, not how close two individual table entries come to colliding. Hamming distance is not a very effective predictor of this. (IIRC its not hard to construct a set of keys with high hamming distance between all pairs, that still have high numbers of collisions. Searching old threads here will probably turn up some examples?)
[Edit: okay, say you have three entries for white pawns on C4,D5,E6. Choose two random numbers for C4 and D5. Then XOR those together and use the result for E6. Any two of those keys should have a decent hamming distance between them, and yet any position with those three pawns will have the same zobrist key as the equivalent position with them removed.]
Consider this: On any given square, at most one piece can be present at any time. So you have 12 different entries that represent a piece on that square, but no two of those entries are going to be combined at the same time into any zobrist key for a chess position. They need to be different, but the amount of independence between them is irrelevant. But if you consider the 64 entries for a given piece type+color, it is probably more relevant to minimize collisions of pairs or triples of those.
Also consider: a chess position may have as many as 8 pawns of a color, but it is unlikely to have more than 2 queens or 3 other pieces. So it may be more important to pick the 64 pawn entries for each color so that they are "hard" to get collisions among (when some combination of them are combined together) compared to picking the 64 entries for some other piece type.
But in practice, all of this is moot, because choosing good random numbers (using a good PRNG, not something stupid like srand!) gives great results. I don't recall anybody showing a systematic way of choosing zobrist table entries that actually gives noticably lower numbers of collisions than simply choosing random 64-bit values for each entry.