Hash Key

Programming Topics (Computer Chess) and technical aspects as test techniques, book building, program tuning etc

Moderator: Andres Valverde

Hash Key

Postby Mateusz Luksik » 02 Mar 2008, 21:15

Hi,
When should be updated next keys?

1. pawnKey after every pawn move and promotion and pawn was captured?
2. materialKey after every change of material, including pawns??
Regards,
Mateusz.
User avatar
Mateusz Luksik
 
Posts: 19
Joined: 11 Oct 2005, 17:53
Location: Poland

Re: Hash Key

Postby Harald Johnsen » 03 Mar 2008, 09:41

What do you have in your hask key ?

- pieces*squares signatures
- pawn*square signatures
- castling right
- en passant flag
- side to move

Obviously your transposition table key also contains the pawn key.
You need to update the parts of the key whenever they change.

HJ.
User avatar
Harald Johnsen
 
Posts: 43
Joined: 20 Aug 2007, 17:01
Location: France

Re: Hash Key

Postby Mateusz Luksik » 03 Mar 2008, 10:43

1.
keyMaterial
- pieces*squares signatures

keyPawn
- pawn*square signatures


- side to move ... I don't have it.
Regards,
Mateusz.
User avatar
Mateusz Luksik
 
Posts: 19
Joined: 11 Oct 2005, 17:53
Location: Poland

Re: Hash Key

Postby bob » 03 Mar 2008, 20:09

Mateusz Luksik wrote:1.
keyMaterial
- pieces*squares signatures

keyPawn
- pawn*square signatures


- side to move ... I don't have it.


You are headed for disaster then. lots of positions depend on side to move, particularly in endgames, but even in the middlegame, where with white to move, white can force mate, but with black to move, it is an equal position. Your scores, bounds, cutoffs, etc are going to be broken without wtm included.

normal hash signature is updated after every move is made, pawn hash signature is updated only after a pawn move or a pawn is captured or promoted.
User avatar
bob
 
Posts: 156
Joined: 10 May 2006, 17:59

Re: Hash Key

Postby Mateusz Luksik » 03 Mar 2008, 22:19

"normal hash signature is updated after every move is made"
I did this with side to move, ep, castling etc...

I was asking about pawn hash and I get good answer.
"pawn hash signature is updated only after a pawn move or a pawn is captured or promoted"

I still don't have answer on material hash. I think this signature should be updated after capture or promote, yes?
Regards,
Mateusz.
User avatar
Mateusz Luksik
 
Posts: 19
Joined: 11 Oct 2005, 17:53
Location: Poland

Re: Hash Key

Postby bob » 04 Mar 2008, 01:56

Mateusz Luksik wrote:"normal hash signature is updated after every move is made"
I did this with side to move, ep, castling etc...

I was asking about pawn hash and I get good answer.
"pawn hash signature is updated only after a pawn move or a pawn is captured or promoted"

I still don't have answer on material hash. I think this signature should be updated after capture or promote, yes?


I don't use such a thing, but if it is a hash that is based only on the pieces on the board, and not the squares they are on, then yes, anytime material changes the hash should be updated. On a capture, or on a promotion.
User avatar
bob
 
Posts: 156
Joined: 10 May 2006, 17:59


Return to Programming and Technical Discussions

Who is online

Users browsing this forum: No registered users and 38 guests