Used FNV hash function for computing 64 bit key. Don't know yet if that is an improvement compared to my 8 x 64 bit key. For now I also need to check if hash move is a valid move. Looks like my engine does not crash (very often) though I don't trust these 64 bit keys.
After you have a tt-hit, count how often it was a valid hit (e.g. the move returned is in the current list of valid moves) and which were not.
That way you can verify if your hashing alg. is sufficient or not.
With a tt of 4GB and using md5-chain for randoms I have a false hit percentage of on average 0.011% (5 games played in auto-mode).
Looks like my engine is twice as slow as before. Don't know yet why. Perhaps creating 64 bit hash key costs too much. In previous key implementation I only had to copy 8 x 64 bits (these bit boards).
Henk wrote:Looks like my engine is twice as slow as before. Don't know yet why. Perhaps creating 64 bit hash key costs too much. In previous key implementation I only had to copy 8 x 64 bits (these bit boards).
You are doing something badly wrong.
To make a move you simply need to do TWO XOR operations, one to remove the from square, one to add the to square. A capture adds a third XOR to remove the captured piece.
To unmake, you simply restore the original hash signature that you should have saved before updating it...
I can't even measure the cost of this in my engine it is so small.
flok wrote:After you have a tt-hit, count how often it was a valid hit (e.g. the move returned is in the current list of valid moves) and which were not.
That way you can verify if your hashing alg. is sufficient or not.
With a tt of 4GB and using md5-chain for randoms I have a false hit percentage of on average 0.011% (5 games played in auto-mode).
That seems extraordinarily high. I just ran a test and had 1 false hit in a week.
Henk wrote:Looks like my engine is twice as slow as before. Don't know yet why. Perhaps creating 64 bit hash key costs too much. In previous key implementation I only had to copy 8 x 64 bits (these bit boards).
You are doing something badly wrong.
To make a move you simply need to do TWO XOR operations, one to remove the from square, one to add the to square. A capture adds a third XOR to remove the captured piece.
To unmake, you simply restore the original hash signature that you should have saved before updating it...
I can't even measure the cost of this in my engine it is so small.
Henk wrote:Looks like my engine is twice as slow as before. Don't know yet why. Perhaps creating 64 bit hash key costs too much. In previous key implementation I only had to copy 8 x 64 bits (these bit boards).
You are doing something badly wrong.
To make a move you simply need to do TWO XOR operations, one to remove the from square, one to add the to square. A capture adds a third XOR to remove the captured piece.
To unmake, you simply restore the original hash signature that you should have saved before updating it...
I can't even measure the cost of this in my engine it is so small.
There is also an XOR for side to move.
I don't do that in Make/Unmake. I do that at the time I use the signature to probe or store. You don't want to xor in side to move at ply=1, then xor it in again at ply=3, as you just undid the xor.
Henk wrote:Looks like my engine is twice as slow as before. Don't know yet why. Perhaps creating 64 bit hash key costs too much. In previous key implementation I only had to copy 8 x 64 bits (these bit boards).
You are doing something badly wrong.
To make a move you simply need to do TWO XOR operations, one to remove the from square, one to add the to square. A capture adds a third XOR to remove the captured piece.
To unmake, you simply restore the original hash signature that you should have saved before updating it...
I can't even measure the cost of this in my engine it is so small.
There is also an XOR for side to move.
I don't do that in Make/Unmake. I do that at the time I use the signature to probe or store. You don't want to xor in side to move at ply=1, then xor it in again at ply=3, as you just undid the xor.
In case of a collision there is a possibility of very stupid blunders like incorrect queen sacrifice. Making an engine very foolish.