Author: Pham Hong Nguyen
Date: 22:30:56 05/26/04
Go up one level in this thread
Bob, I think the code of your HashProbe is correct, corresponding with your
HashStore.
However, I see that you may allow duplications. Look at the code of your
HashStore:
htable = trans_ref + ((int) word2 & hash_mask);
draft = (int) htable->prefer.word1 >> 17 & 077777;
age = htable->prefer.word1 >> 61;
age = age && (age != transposition_id);
if (age || (depth >= draft)) {
if ((word1 ^ word2) != htable->prefer.word2) {
hwhich =
((int) (htable->prefer.word2 ^ htable->prefer.word1) >> log_hash) & 1;
htable->always[hwhich].word1 = htable->prefer.word1;
htable->always[hwhich].word2 = htable->prefer.word2;
}
htable->prefer.word1 = word1;
htable->prefer.word2 = word1 ^ word2;
} else {
hwhich = ((int) word2 >> log_hash) & 1;
htable->always[hwhich].word1 = word1;
htable->always[hwhich].word2 = word1 ^ word2;
}
I don't understand your code in all details but can guess that if the condition
of the line
if (age || (depth >= draft))
fails, you will store the new hash values to always table without checking
duplication (with prefer one). Is it right?
I think to avoid the duplication, the code should be:
if (newhashkey==preferkey || newhashkey==alwayskey) {
if (newdepth < storeddepth) return;
restore_newhashvalues;
}
if (age || (depth >= draft)) {
Pham
On May 24, 2004 at 15:11:23, Robert Hyatt wrote:
>On May 24, 2004 at 06:07:10, Pham Hong Nguyen wrote:
>
>>[snip]
>>>I don't even allow a duplicate into the always-store table, if there is an entry
>>>in the depth-preferred table with a matching signature. IE position X is in one
>>>or the other but not both...
>>
>>I have just taken a look at your code of HashProbe:
>>
>> /* Part 1 (first table?) */
>> if (word2 == temp_hashkey)
>> do {
>> if (...) break;
>> while(0);
>>
>> /* Part 2 (second table?) */
>> word2 =...;
>> if (word2 == temp_hashkey) {
>> }
>>
>>I don't understand the break and while in the part 1 - they may be ineffective.
>>If there is no duplicate of two tables, when the hash key matches the first, it
>>cannot match the second. Thus, exit the function (return) should be better than
>>continue to check the second table.
>>
>>Do I miss something?
>
>
>Let me study that tonight. I whacked that part of the code up extensively for
>the hash collision paper. It is possible that I left something in that was not
>needed. Or even vice-versa. :)
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.