Check extension

Discussion of chess software programming and technical issues.

Moderator: Ras

User avatar
hgm
Posts: 28440
Joined: Fri Mar 10, 2006 10:06 am
Location: Amsterdam
Full name: H G Muller

Check extension

Post by hgm »

Why do we use a check extension? If it is mainly to prevent that spite checks are used as delaying tactics to posh trouble over the horizon, we could only award the extension to checks that actually fail high. If a check fails low at nominal depth, it could not have pushed anything over the horizon. Nul-move pruning solves most of the horizon effect anyway, as the search of the check would be extended by two ply (compared to the null-move search) anyway, even without check extension.

Especially checks that are refuted by capturing the checker, or interposing a defended Pawn or lower-valued slider that bites back along the check ray seem good candidates to not extend when they fail low. I can imagine there is some justification for extending checks that are resolved by King withdrawal, to make sure that the King is safe enough in its new location.

I am becoming painfully aware of the detrimental effects of pointless checks on search depth through the Xiangqi engine I am building: in XQ it is quite usual that the losing side has a perpetual against the winning side, but perpetual checking is forbidden, and thus would lose anyway. But the PV then always postpones the unavoidable as long as possible by interjecting as many checks as is legal, which usually means 2 pointless checks + 2 evasions after every real move. Now even with check extension, this basicaly reduces the search depth by a factor of two. (Six ply, but two are checks and thus extended, so they count as 4, but play only progresses by 2 ply, as the other 4 cancel aech other.) So the branchess that skip the pointless checking all look bad if there is trouble, as they are the only one that can see it coming, but are then simply not chosen, and the nearly blind branches with all the checks in it are favored.

So for checks that fail high, I really need to extend two ply per check to not erode the reliability of the search. But this leads to a search explosion if there are multiple checks or (more commonly) evasions.

Would it be possible to prevent the search explosion by clever move ordering, e.g. search checks last? Then a branch after 4 ply of checking and evading (repeating the position) would get sufficient-depth TT hits even when it is fully extended, and bootstrap it depth that way to the required extended depth without extra search effort. Perhaps I should make a check that allows the evasion to repeat the position fail low in the first place, although it formally is not a violation of any rule.
Uri Blass
Posts: 11142
Joined: Thu Mar 09, 2006 12:37 am
Location: Tel-Aviv Israel

Re: Check extension

Post by Uri Blass »

The main reason that we use check extensions is that check reduce the number of moves of the opponent so it is easier to search deeper.

It may be better to replace check extensions by extending more positions with a lower perft(1) so you also extend in other cases like in transition to pawn endgames.

Uri
bob
Posts: 20943
Joined: Mon Feb 27, 2006 7:30 pm
Location: Birmingham, AL

Re: Check extension

Post by bob »

Uri Blass wrote:The main reason that we use check extensions is that check reduce the number of moves of the opponent so it is easier to search deeper.

It may be better to replace check extensions by extending more positions with a lower perft(1) so you also extend in other cases like in transition to pawn endgames.

Uri
Nope. HG was correct. The main reason for this (or any extension) is to prevent horizon effects. You have a flaw in your position, but if you check me a couple of times you burned 4 plies and you might hide it from your search. By extending on moves that are typically delaying moves, you extend the horizon. Check extensions are not for finding mate, although they certainly help. They are to avoid being too short-sighted when one side is in trouble and introduces a delaying tactic to hide that fact...
User avatar
hgm
Posts: 28440
Joined: Fri Mar 10, 2006 10:06 am
Location: Amsterdam
Full name: H G Muller

Re: Check extension

Post by hgm »

So what do you think of the logic that there is no need to extend them if they already fail low at nominal depth?
bob
Posts: 20943
Joined: Mon Feb 27, 2006 7:30 pm
Location: Birmingham, AL

Re: Check extension

Post by bob »

hgm wrote:So what do you think of the logic that there is no need to extend them if they already fail low at nominal depth?
I think it is worth testing. However, don't forget, you might be down in material, and pick it back up with a deep enough search. This is sort of in line with some of the LMR options I have tried, but so far nothing has worked better than what I did originally.

Are you familiar with ETC (extended transposition cutoffs)??? It is somewhat akin to the MVV/LVA capturing ordering we discussed a while back. You really don't need to search the "best" move at any position except for PV nodes. At the rest what you want is a "good enough move" where "good enough" means (a) it will cause a cutoff; (b) it does so with minimal effort. If your idea doesn't hurt, it may well help. Or it might just be additional code that does nothing to overall strength. Heaven knows I've written enough of those over the past month of LMR testing...
User avatar
michiguel
Posts: 6401
Joined: Thu Mar 09, 2006 8:30 pm
Location: Chicago, Illinois, USA

Re: Check extension

Post by michiguel »

hgm wrote:So what do you think of the logic that there is no need to extend them if they already fail low at nominal depth?
In general, I think It is good to extend when it fails and there is a good chance that it could fail low, and vice versa. The former is what you say, but I believe that there are cases of the latter. For instance, you are down in material, but your opponent has a bad king safety. So, giving checks in this situation can end up in a variation that brings the score above beta. Finding perpetual check draws in a losing situation is another. Maybe extending checks is good as long as it fails low OR the opponent has a bad king safety situation. Deciding on extensions (or reductions) based on king safety is in my super-long to-do list.

Miguel
Daniel Shawul
Posts: 4186
Joined: Tue Mar 14, 2006 11:34 am
Location: Ethiopia

Re: Check extension

Post by Daniel Shawul »

Bruce moreland seem to agree with you
Check extension

The idea here is that if you check, the opponent probably has very few replies, so extend all of them. It is easy to see this as an example of a win-seeking extension, since checking is related to checkmate. However, chess programs are great spite-checkers when they are losing, so it's important to know if that's what is going on. So this is more of a neutral extension.

My guess is that this is the oldest extension in computer chess. It seems to be a good idea. I've never figured out a way to constrain it, but I have heard that others have done this with success.
I think that check extensions could only heart in the endgame when the
the number of checks could be high. Single reply extensions are also cheap in the same analogy. But mate threats aren't because you could have many moves even though null move says there is a threat.

Daniel
Uri Blass
Posts: 11142
Joined: Thu Mar 09, 2006 12:37 am
Location: Tel-Aviv Israel

Re: Check extension

Post by Uri Blass »

bob wrote:
Uri Blass wrote:The main reason that we use check extensions is that check reduce the number of moves of the opponent so it is easier to search deeper.

It may be better to replace check extensions by extending more positions with a lower perft(1) so you also extend in other cases like in transition to pawn endgames.

Uri
Nope. HG was correct. The main reason for this (or any extension) is to prevent horizon effects. You have a flaw in your position, but if you check me a couple of times you burned 4 plies and you might hide it from your search. By extending on moves that are typically delaying moves, you extend the horizon. Check extensions are not for finding mate, although they certainly help. They are to avoid being too short-sighted when one side is in trouble and introduces a delaying tactic to hide that fact...
I disagree about the main reason.
In case that the reason was horizon effect then you could extend also other threats.

You do not extend threats against the queen but you extend threats against the king.

The reason is simple
threats against the king do not allow many options so they are good candidates for extensions.

Uri
bob
Posts: 20943
Joined: Mon Feb 27, 2006 7:30 pm
Location: Birmingham, AL

Re: Check extension

Post by bob »

Uri Blass wrote:
bob wrote:
Uri Blass wrote:The main reason that we use check extensions is that check reduce the number of moves of the opponent so it is easier to search deeper.

It may be better to replace check extensions by extending more positions with a lower perft(1) so you also extend in other cases like in transition to pawn endgames.

Uri
Nope. HG was correct. The main reason for this (or any extension) is to prevent horizon effects. You have a flaw in your position, but if you check me a couple of times you burned 4 plies and you might hide it from your search. By extending on moves that are typically delaying moves, you extend the horizon. Check extensions are not for finding mate, although they certainly help. They are to avoid being too short-sighted when one side is in trouble and introduces a delaying tactic to hide that fact...
I disagree about the main reason.
In case that the reason was horizon effect then you could extend also other threats.

You do not extend threats against the queen but you extend threats against the king.

The reason is simple
threats against the king do not allow many options so they are good candidates for extensions.

Uri
Threats against the queen don't push things off like a check does. With a check, your response is forced, and it is a good way of delaying things. I threaten mate, you threaten my queen, I checkmate you... I threaten mate, you check me, I have no choice but to take time out and reply.

Winning material or the game as a result of a check is a rare occurrence, compared to non-checking moves. But delaying things and giving them to the q-search is an effective way of hiding many tactical issues. This is just a defense to that, which we still have to deal with even with today's depths.

A capture is an effective way to play a move that has few options for a reply, but extending those doesn't work very well.
Uri Blass
Posts: 11142
Joined: Thu Mar 09, 2006 12:37 am
Location: Tel-Aviv Israel

Re: Check extension

Post by Uri Blass »

A capture does not reduce the options of the opponent significantly like checks so it does not worth extensions.

Sometimes a capture even increase the number of options of the opponent because it open files.

capture has also another property that is a reason not to extend it.
unlike other moves you can be almost sure if it fail high or fail low so it is uninterest to extend it.

I think that it may be a good idea to have some function that predict some estimate for probability of fail high and fail low and it is better to extend moves that the probability is closer to 1/2(I am talking about moves that are not first move to search).

This is the reason that killers are better candidates to extend(you do not extend them but simply not prune them by late move reductions but it is the same idea and every pruning can be described as extension).

Uri