Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: how large should a pawn hashtable be?

Author: Dann Corbit

Date: 14:25:06 02/11/04

Go up one level in this thread


On February 11, 2004 at 17:11:57, Dann Corbit wrote:

>On February 11, 2004 at 16:43:06, martin fierz wrote:
>
>>on my long todo list for my program, the item "pawn hashing" has slowly but
>>steadily floated upwards. now it's on top. so: how large is your pawn hashtable
>>(in # of entries)? how large are your entries? i'm using bitboards, and it seems
>>to me that my entries will be huge, e.g. if i want to save some simple stuff
>>like
>>
>>- passers
>>- connected passers
>>- isolated pawns
>>- doubled pawns
>>- backward pawns
>>- blocked pawns
>>
>>that would be 6x8 = 48 bytes; perhaps times 2 for each side (or i could pop
>>black and white pawns in the same bitboard, and & it with the black/white
>>bitboard to save space). still, that's already 48 bytes and i guess i could save
>>some more stuff if i thought about it a bit longer :-)
>>is that a reasonable size for a pawn hash entry?
>
>The pawn hash table only holds a hash of [the pawn positions, colors, e.p. flag
>and (usually) the king position.]  So one 64 bit number gets stored as the
>position in the array and the key {of 64 - address bits.}
>
>The key is used to know that your hash does not collide.
>You also store the overall pawn score (most people use a signed short between
>+32766 and -32767).  You add up all of the terms above into a single value for
>this score.

Suppose that you have a board position like this:
[D]2r1kq2/2r5/7p/1pPp2pP/pP1PppP1/P3P3/2Q2N2/1B2K3 w - -

Your pawn hash deals only with this:
[D]4k3/8/7p/1pPp2pP/pP1PppP1/P3P3/8/4K3 w - -

The hash will be some number like 1909174647730783536 which is 1A7EC03A142CC530
in hex.

Suppose (for instance) that you have 65536 entries in your hash table (16 bits
in length)
Then you would use the first 16 bits (actually it does not matter which bits you
choose as long as your hash is fairly random) of the hash for your address into
the hash table.
1A7E = 6782 is the address in the hash table.

Then the remaining 48 bits becomes a key, so you know for sure that ther is no
collision.  (Some forgo this step, but I like to keep it.  Memory is cheap).

key = C03A142CC530 = 211355679114544

And then you store also a score like -15 centipawns.




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.