Depth extensions and effect on transposition queries

Discussion of chess software programming and technical issues.

Moderators: hgm, Rebel, chrisw

kdjones
Posts: 9
Joined: Mon Feb 08, 2016 7:06 pm
Location: Nova Scotia, Canada

Depth extensions and effect on transposition queries

Post by kdjones »

Question: if a chess engine uses extensions such as check extension, say

Code: Select all

if ( InCheck( sideToMove ) ) depth ++;
will this not mess up subsequent TT queries which use depth to decide whether the query is a hit or a miss?

If so, what can be done about it?
User avatar
hgm
Posts: 27788
Joined: Fri Mar 10, 2006 10:06 am
Location: Amsterdam
Full name: H G Muller

Re: Depth extensions and effect on transposition queries

Post by hgm »

As long as you store the depth to which you are comparing on a probe, (i.e. both before or after the extension) there is no problem. Whether you are in check or not isn't path dependent. I usually store unextended depth, so that I can probe before having determined whether I am in check. So I have to subtract the extension from the depth when storing in the TT. If the TT contains the info whether you are in check, it might be easier to give the extension as the first thing you do, and only then start comparing depths. Then you can store the depth unmodified.
PK
Posts: 893
Joined: Mon Jan 15, 2007 11:23 am
Location: Warsza

Re: Depth extensions and effect on transposition queries

Post by PK »

However, check extension can make search scores path-dependent. There is nothing to do about it. It does not harm, and anyway the effect is minor when compared to late move reduction.

Suppose Your engine played 1.d4 Nf6 2.c4 e6. Now 3.Nf3 Bb4+ 4.Nc3 and 3.Nc3 Bb4 4.Nf3 would be searched to different depth. When using transposition table, final score depends on which move will be searched first.
User avatar
hgm
Posts: 27788
Joined: Fri Mar 10, 2006 10:06 am
Location: Amsterdam
Full name: H G Muller

Re: Depth extensions and effect on transposition queries

Post by hgm »

When using TT you can sometimes get extra depth through grafting. That doesn't have anything to do with check extension per se; there are many cases where you can get grafting without any checks. E.g. from the start position 1.e3 null 2. e4 will hit upon the position after 1.e4 if the latter was searched before it, and gain an enormous depth (2 ply plus null reduction).
kdjones
Posts: 9
Joined: Mon Feb 08, 2016 7:06 pm
Location: Nova Scotia, Canada

Re: Depth extensions and effect on transposition queries

Post by kdjones »

Thank you, HGM and Pawel for your insights.

Ken