Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: question about hash tables

Author: Miguel A. Ballicora

Date: 13:15:26 05/08/02

Go up one level in this thread


On May 08, 2002 at 16:07:54, martin fierz wrote:

>On May 08, 2002 at 16:02:10, Miguel A. Ballicora wrote:
>
>>On May 08, 2002 at 15:27:33, Uri Blass wrote:
>>
>>>On May 07, 2002 at 19:26:43, martin fierz wrote:
>>>
>>><snipped>
>>>>i used to use a two-table approach in my checkers program, with one table being
>>>>used for all nodes which were <N plies from the root, the other for >=N. in the
>>>>first table, i replaced with deeper draft only, in the second, i always
>>>>replaced. i changed it to a single table after finding no significant
>>>>difference; in the single table i have a hash bucket size of 2,
>>>
>>>I do not understand.
>>>
>>>What does a hash buket size of 2 means?
>>>Do you have 2 keys ( 2 64 bits integers) in the single table?
>>>
>>>Can you describe the structure of the single table?
>>>
>>>
>>>I understand based on bruce's site that the two table approach is to have 2
>>>tables of hash elemenets when every hash element has the following structure:
>>>
>>>typedef struct tagHASHE
>>>{
>>>  U64 key;
>>>  int depth;
>>>  int flags;
>>>  int value;
>>>  MOVE best;
>>>}
>>>HASHE;
>>>
>>>Note that I do not understand what is the reason for using 3 integers for
>>>depth,flags and value when it is possible to compress these 3 numbers to a
>>>single 32 bit integer in order to have more entries in the hash tables.
>>>
>>>The only reason that I see for doing it is that it is always better to start
>>>with something relatively simple with no bugs but in this case it is better also
>>>to start with one table and with using hash tables only for order of moves.
>>>
>>>Uri
>>
>>That is a website to teach, so the examples are in pseudocode or something
>>easy to read and understand. Anyway, to compress it you just need to add the
>>bitfield on the declaration and nothing else will change. You will have a very
>>good trade-off of memory and readability.
>>
>>I did not do it in that way, but maybe I should have. You have to be extremely
>>careful if you use bit operations like shifts ands and ors when you have many
>>fields, some that are suppose to signed and others unsigned.
>>
>>Regards,
>>Miguel
>
>in C, you have the easy option of defining a bitfield:
>
>struct
>   {
>   int i:10;
>   unsigned int j:10;
>   int k:12;
>   }
>
>will give you a structure with an integer i which can take 10 bits, an unsigned
>j wit 10 bits and another int k with 12 bits. C will take care of all the
>shifting here.
>
>aloha
>  martin

That is exactly what I meant, thanks for spelling it out!

Regards,
Miguel



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.