Is a Check Extension Really a Win?

Discussion of chess software programming and technical issues.

Moderators: hgm, Rebel, chrisw

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

Re: Is a Check Extension Really a Win?

Post by hgm »

lucasart wrote:The qsearch should simply generate all legal check evasions when in check (rather than captures only).
That is the same as extending one ply.
User avatar
Evert
Posts: 2929
Joined: Sat Jan 22, 2011 12:42 am
Location: NL

Re: Is a Check Extension Really a Win?

Post by Evert »

Coincidentally I just ran a somewhat similar test in one of my engines: it had a simple "if (in check) depth++" style check extensions, which I replaced with a more sensible "if (move gives check and see>=0) extension=1".
It gained about 18 Elo in self-play. The game in question was not chess though (it was Makruk), so results may not be directly comparable.
jwes
Posts: 778
Joined: Sat Jul 01, 2006 7:11 am

Re: Is a Check Extension Really a Win?

Post by jwes »

hgm wrote:
lucasart wrote:The qsearch should simply generate all legal check evasions when in check (rather than captures only).
That is the same as extending one ply.
It is not quite the same. If you are already in qsearch, extending has no meaning.
User avatar
hgm
Posts: 27796
Joined: Fri Mar 10, 2006 10:06 am
Location: Amsterdam
Full name: H G Muller

Re: Is a Check Extension Really a Win?

Post by hgm »

If I am at depth = 0, then extending means depth 1...
User avatar
Bloodbane
Posts: 154
Joined: Thu Oct 03, 2013 4:17 pm

Re: Is a Check Extension Really a Win?

Post by Bloodbane »

This thread was actually a pretty fun coincidence, as I started a test on check extension on thursday morning. I was away for three days so I couldn't reply earlier, but here are my results. 2.569 has check extension, 2.570 doesn't. Games were at 15s+0.05s.

Code: Select all

Rank Name                  Elo    +    - games score oppo. draws
   1 Hakkapeliitta 2.570     3    2    3 39589   51%    -3   49%
   2 Hakkapeliitta 2.569    -3    3    2 39589   49%     3   49%
I don't prune or reduce checks of any kind so 2.570 still kinda has check extension, it's just not explicit.
Functional programming combines the flexibility and power of abstract mathematics with the intuitive clarity of abstract mathematics.
https://github.com/mAarnos
brtzsnr
Posts: 433
Joined: Fri Jan 16, 2015 4:02 pm

Re: Is a Check Extension Really a Win?

Post by brtzsnr »

Based on SEE>=0 suggestion I did the following since I haven't implemented SEE:

Code: Select all

if !pos.IsAttackedBy(move.To(), them) || pos.IsAttackedBy(move.To(), us) {
   // extend
}
In other words: do not extend if we can just take the piece and gain material.
This is nice 12-15 ELO improvement.
nionita
Posts: 175
Joined: Fri Oct 22, 2010 9:47 pm
Location: Austria

Re: Is a Check Extension Really a Win?

Post by nionita »

brtzsnr wrote:Based on SEE>=0 suggestion I did the following since I haven't implemented SEE:

Code: Select all

if !pos.IsAttackedBy(move.To(), them) || pos.IsAttackedBy(move.To(), us) {
   // extend
}
In other words: do not extend if we can just take the piece and gain material.
This is nice 12-15 ELO improvement.
Hi Alexandru, I don't see in your code any part checking that is "gaining material". Incorrect quotation or incorrect interpretation?
brtzsnr
Posts: 433
Joined: Fri Jan 16, 2015 4:02 pm

Re: Is a Check Extension Really a Win?

Post by brtzsnr »

The code says: if the checked side can attack but the side giving check (us) cannot defend then it's most likely we can just take the piece so despite the check it a material loss for the side checking.

It's very crude and omits capture but it works surprisingly well. SEE gives 15-18 ELO from somebody's else estimate so the difference is 2-3ELO.
nionita
Posts: 175
Joined: Fri Oct 22, 2010 9:47 pm
Location: Austria

Re: Is a Check Extension Really a Win?

Post by nionita »

brtzsnr wrote:The code says: if the checked side can attack but the side giving check (us) cannot defend then it's most likely we can just take the piece so despite the check it a material loss for the side checking.

It's very crude and omits capture but it works surprisingly well. SEE gives 15-18 ELO from somebody's else estimate so the difference is 2-3ELO.
Sorry, what I see here is:

"if they can't attack OR we can defend"

Which means, if we check for example with the queen, and they attack it with a pawn, but we defend it (with whatever), then you extend. But this is still material gain for "them". (Edited)

If you gain ELO it is ok, I just wanted to say that your initial interpretation was wrong.
brtzsnr
Posts: 433
Joined: Fri Jan 16, 2015 4:02 pm

Re: Is a Check Extension Really a Win?

Post by brtzsnr »

Code: Select all

        us := pos.SideToMove
	them := us.Opposite()
	eng.evaluation.DoMove(move)
	if pos.IsChecked(them) {
		// Extend the search when our move gives check.
		// However do not extend if we can just take the undefended piece.
		// TODO: This is a very crude form of SEE.
		// See discussion:
		// http://www.talkchess.com/forum/viewtopic.php?t=56361
		if !pos.IsAttackedBy(move.To(), them) || pos.IsAttackedBy(move.To(), us) {
			depth += CheckDepthExtension
		}
	}
Ok, I understand the confusion since I haven't provided the full context. `us` and `them` are computed before the move is made. `us` is the checking side. `them` is the checked side. So: if the checked side (them) doesn't defend or checking side (us) can continue the attack then extend.