How to calculate pawn hash

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

Moderator: Andres Valverde

Re: How to calculate pawn hash

Postby Tord Romstad » 18 Jul 2007, 16:15

joseph tadeusz wrote:
Tord Romstad wrote:With a single thread, skipping legality checking of the transposition table is in practise 100% safe when you use 64-bit hash keys. The probability of an illegal move from the transposition table is vanishingly small.


Isn't it quite large (~ 1/(2^32))? See the hashing remark in http://en.wikipedia.org/wiki/Birthday_paradox

Or am I interpreting it wrongly?

It is true that the probability of 2 out of 2^32 chess positions have the same 64-bit hash keys is 50%. But you also have to consider that the positions you search do not remain in the hash table forever: The hash table contains only a few million entries, which get overwritten all the time.

For an average chess program on modern hardware, searching 2^32 nodes takes about one hour, which is enough to ensure that almost all hash table entries have been overwritten many times.

Tord
User avatar
Tord Romstad
 
Posts: 639
Joined: 09 Oct 2004, 12:49
Location: Oslo, Norway

Re: How to calculate pawn hash

Postby H.G.Muller » 19 Jul 2007, 10:40

When I store only 32-bit signatures, this definitely is not true, and I should really check the hash move for not being one to crash the engine. In practice this means checking if the FromSqr is not empty (and some more for castlings). That a move is illegal (and not even pseudo-legal) in itself doesn't hurt.

It would of course be even better to have an engine that cannot crash on any move.
User avatar
H.G.Muller
 
Posts: 3453
Joined: 16 Nov 2005, 12:02
Location: Diemen, NL

Re: How to calculate pawn hash

Postby jswaff » 19 Jul 2007, 14:04

H.G.Muller wrote:When I store only 32-bit signatures, this definitely is not true, and I should really check the hash move for not being one to crash the engine. In practice this means checking if the FromSqr is not empty (and some more for castlings). That a move is illegal (and not even pseudo-legal) in itself doesn't hurt.

It would of course be even better to have an engine that cannot crash on any move.


I have a "GoodMove(pos,move)" function that I call before any hash move/killer move is played, just to make sure it's ok. Though I'm convinced that it should be perfectly ok to skip the check for hash moves since I'm using a 64 bit key, I just can't bring myself to do it.

1/(2^64) is sooooo small, but it's > 0, so not checking the move for validity is not "correct" IMO.

From time to time I do remove the check, but I always end up putting it back in after a while. It's a sickness. :)

--
James
jswaff
 
Posts: 7
Joined: 31 May 2006, 14:15
Location: Greenville NC USA

Re: How to calculate pawn hash

Postby H.G.Muller » 19 Jul 2007, 18:29

Working on micro-Max has completely cured me of such ailments. No matter how incorrect, if it doesn't bring in any Elo it goes out. I don't even take away the piece-square points of captured pieces there... But uMax cannot crash by a bad hash move.
User avatar
H.G.Muller
 
Posts: 3453
Joined: 16 Nov 2005, 12:02
Location: Diemen, NL

Previous

Return to Programming and Technical Discussions

Who is online

Users browsing this forum: No registered users and 26 guests