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.
more on transposition table
Moderators: hgm, Dann Corbit, Harvey Williamson
-
Evert
- Posts: 2929
- Joined: Sat Jan 22, 2011 12:42 am
- Location: NL
Re: more on transposition table
The vast majority are, but not all.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.
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.So should I always check that a TT move is valid before I use it,
-
Sven
- Posts: 4052
- Joined: Thu May 15, 2008 9:57 pm
- Location: Berlin, Germany
- Full name: Sven Schüle
Re: more on transposition table
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.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.
-
flok
Re: more on transposition table
So if the move is not valid, ignore the whole TT entry? Including scores etc?
(probably best I think?)
(probably best I think?)