more on transposition table

Discussion of chess software programming and technical issues.

Moderators: hgm, Dann Corbit, Harvey Williamson

lauriet
Posts: 199
Joined: Sun Nov 03, 2013 9:32 am

more on transposition table

Post by lauriet »

Hey folks,

Up until now I have not checked that the TT move is a legal move. I have assumed that with a 64 bit key that all hits would be valid. I do check that the TT key is correct after the search, and have had some errors.
Obviously I was incorrect.

So should I always check that a TT move is valid before I use it, or is there another problem here ?

Regards
Laurie.
User avatar
Evert
Posts: 2929
Joined: Sat Jan 22, 2011 12:42 am
Location: NL

Re: more on transposition table

Post by Evert »

lauriet wrote: Up until now I have not checked that the TT move is a legal move. I have assumed that with a 64 bit key that all hits would be valid.
The vast majority are, but not all.
So should I always check that a TT move is valid before I use it,
Yes, unless your engine can handle illegal moves gracefully (ie, without crashing or screwing up the board if the illegal move is unmade). Even then I would validate the TT move though.
Sven
Posts: 4052
Joined: Thu May 15, 2008 9:57 pm
Location: Berlin, Germany
Full name: Sven Schüle

Re: more on transposition table

Post by Sven »

lauriet wrote:Hey folks,

Up until now I have not checked that the TT move is a legal move. I have assumed that with a 64 bit key that all hits would be valid. I do check that the TT key is correct after the search, and have had some errors.
Obviously I was incorrect.

So should I always check that a TT move is valid before I use it, or is there another problem here ?

Regards
Laurie.
You can compute the probability that two different positions map to the same 64-bit hash key causing a hash collision, considering that there are more than 2^64 different chess positions. The probability is very, very low, but not zero. So it *will* hit you every X nodes on average, with a considerably high X, and you'd better be prepared for getting a hash move that belongs to a different position. If that move is pseudo-legal (or legal, which depends on your overall concept of legality checking during search) then you can accept it, otherwise simply ignore the hash move in that rare case.
flok

Re: more on transposition table

Post by flok »

So if the move is not valid, ignore the whole TT entry? Including scores etc?
(probably best I think?)