Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: About debugging HashTables implementation .

Author: Matthias Gemuh

Date: 10:30:28 04/08/02

Go up one level in this thread


On April 08, 2002 at 12:38:35, John Marountas wrote:

>Hello again !
>
>First of all, I want to thank those who replied at my question
>on Debugging the HashTables implementation.
>
>Obviously I had forgoten to mask the info about the side to move and
>the castle and ep rights into the HashKey. I fixed that by using the code below.
>I think  the code is correct.
>
>//************************************************
>int ZobristKey(int side) throws IOException{
>   int hashKey = 0;
>
>   for(int p=0;p<64;p++){
>      hashKey ^=zobrist[side][ brd.piece[p] ][p];
>      }
>
>      hashKey ^= side;   //Side to move
>      hashKey ^= ep_to;  //Ep rights
>      hashKey ^= castle; //Castle rights
>
>  return hashKey;
>}
>//************************************************
>
>Then I run Pyotr and setup the following position:
>
>[D] r1bqkbnr/pppp1ppp/2n5/4p3/3PP3/5N2/PPP2PPP/RNBQKB1R b KQkq d3 0 3
>
>
>
>When searching into the HashTable I keep a record of the returned
>Lows,Highs and Hash Collisions. Here are the results:
>
>Hash Collisions: 1000
>Hash High      :  173
>Hash Low       :    0
>
>Best Move : 3...Nxd4
>
>Why there are  so many collisions?
>
>Then I continue the position by playing 4.Nxd4 and got the following results.
>Hash Collisions: 2280
>Hash High      :   31
>Hash Low       :    1
>
>Best Move : 4...e5xd4
>
>Again notice the hight of the Hash Collisions and the low of the other two
>numbers.
>Does  any of these numbers has to do with my wrong implementation ?
>
>Thank in advance !
>Marountas John
>
>Pyotr's Website : http://www.digichess.gr/pyotr/




Your "side", "ep_to", and "castle" seem too simple, too many unset bits.
BTW, looks like Java. I hope "int" is 64-Bit. UNSIGN it !!

Regards,
Matthias.


















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.