flok wrote:
Why? To avoid useful transposition hits and lower the effectiveness of the transposition table?
Because you need to know if a king is still allowed to do castling.
Ok, if it only and exactly takes care of castling rights then this is not really different (if at all) from normal Zobrist hashing.
Locking hash entries is a waste of time.
Won't that give interesting effects in a multithreaded search?
As long as your engine doesn't crash or gets confused upon a collision, any effects are a million times less noticeable than the effect of slowing down the search by locking (even if the slowdown effect would be small).
There is no need to make the hash key positive by and'ing with 0x7f...f.
If I don't do that, the module might return negative values. A long in java is always signed.
I suppose what you mean is that "hash % nTableElements" may be negative if hash is negative. That can be solved by setting nTableElements to a power of 2 and replacing the module by an and-operation. Ok, no big deal of course.
It is not efficient to have separate arrays for key / score / depth (/ move).
Java does not have structs. I could use class for it but that would only use more memory.
I guess you're right. Java doesn't have arrays of objects, only arrays of object references... Reminds me of one of the reasons I don't use Java - I don't want a language to artificially restrict me in making use of the machine's hardware.
I could sacrifice a couple of bits from the long (64b) value and use that to store the score/depth but that would increase the chance for hash collisions.
If Java had a 16-byte scalar type, the solution would be to use an array of those. Using two arrays of (8-byte) longs is possible, but still not very efficient.