transposition table pseudocode

Discussion of chess software programming and technical issues.

Moderators: hgm, Rebel, chrisw

zenpawn
Posts: 349
Joined: Sat Aug 06, 2016 8:31 pm
Location: United States

Re: transposition table pseudocode

Post by zenpawn »

Thank you all for your validations and suggestions. It helped me to stop focusing on these parts and find the silly bug in code not shown here.

Hopefully the initial pseudocode, with the followup correction and your tweaks, will serve as a good starting place for the next intrepid chess programmer adding a transposition table to their engine.
Sven
Posts: 4052
Joined: Thu May 15, 2008 9:57 pm
Location: Berlin, Germany
Full name: Sven Schüle

Re: transposition table pseudocode

Post by Sven »

zenpawn wrote:Thank you all for your validations and suggestions. It helped me to stop focusing on these parts and find the silly bug in code not shown here.

Hopefully the initial pseudocode, with the followup correction and your tweaks, will serve as a good starting place for the next intrepid chess programmer adding a transposition table to their engine.
Nice to read that. So was the bug related to transposition table handling or not? You seemed to have excluded that it wasn't.
zenpawn
Posts: 349
Joined: Sat Aug 06, 2016 8:31 pm
Location: United States

Re: transposition table pseudocode

Post by zenpawn »

Sven Schüle wrote: Nice to read that. So was the bug related to transposition table handling or not? You seemed to have excluded that it wasn't.
Yes, related. It's a bit embarrassing, but here goes... At some point, I decided it was clever to use the fact a move was the only one available to save its eval before the alpha-beta checks in the pseudocode above as, get this, an Exact type. It didn't hurt too badly until I added TT to the qsearch, which has many more "only" moves. However, it was wrong it both cases.
Henk
Posts: 7216
Joined: Mon May 27, 2013 10:31 am

Re: transposition table pseudocode

Post by Henk »

PK wrote:popular source of transposition table bugs is saving score after a search has run out of time.

Code: Select all

        public void Store( ... )
        {
            if (Position.Expired) return;

              ..
        }
Henk
Posts: 7216
Joined: Mon May 27, 2013 10:31 am

Re: transposition table pseudocode

Post by Henk »

I'd better call it Search.Expired