discovered check definition

Discussion of chess software programming and technical issues.

Moderators: hgm, Rebel, chrisw

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

discovered check definition

Post by Uri Blass »

I wonder if castling with check is considered as discovered check or as direct check.

Castling with check can only be with the rook and not with another piece
but castling is considered as move of the king.

I started to write a special move generator that write a flag for every checking move and for every move that give discovered check(also in order to have perft with information about checks similiar to smirf) and I want to use smirf numbers for debugging and I want to be sure that he considers castling as discovered check.
nczempin

Re: discovered check definition

Post by nczempin »

Uri Blass wrote:I wonder if castling with check is considered as discovered check or as direct check.

Castling with check can only be with the rook and not with another piece
but castling is considered as move of the king.

I started to write a special move generator that write a flag for every checking move and for every move that give discovered check(also in order to have perft with information about checks similiar to smirf) and I want to use smirf numbers for debugging and I want to be sure that he considers castling as discovered check.
According to François Labelle:
It's hard to find definitions of "discovered check" and "double check" written by someone who understands the fine details. Here are typical errors:

"a discovered check is a check given by one piece when another friendly piece moves out of the way". This excludes cases where the check happens because an enemy pawn gets captured en passant.

"a double check is a discovered check where the moving piece also gives check". This definition excludes cases where a king is under two discovered attacks. Also in general the expression "the moving piece" sounds awkward, because two pieces move during castling.
My definitions:

* direct check: When a piece which moved gives check.
* discovered check: When a piece which didn't move gives check.
* double check: When two pieces give check. Split into two categories: "direct and discovered check" and "double discovered check".
FIDE rules do not give a definition.
User avatar
hgm
Posts: 27790
Joined: Fri Mar 10, 2006 10:06 am
Location: Amsterdam
Full name: H G Muller

Re: discovered check definition

Post by hgm »

The SMIRF website did not give discovered checks, did it? I thought it gave just checks, double checks and checkmates.

I would not count castling checks, although there is one case where a castling check has the character of a discovered check, where you check with the Rook and attack something that was not attacked before with the King. This is for queen-side castling with an enemy Rook on b2. But there of course is no way to know what Reinhard counted, other than trying both cases and hope one matches.

My perft doesn't count checks. :(
nczempin

Re: discovered check definition

Post by nczempin »

hgm wrote:
I would not count castling checks, although there is one case where a castling check has the character of a discovered check, where you check with the Rook and attack something that was not attacked before with the King. This is for queen-side castling with an enemy Rook on b2.
The type you're describing is a subset of discovered checks; not all discovered checks use the "leaving" piece to attack something.
User avatar
hgm
Posts: 27790
Joined: Fri Mar 10, 2006 10:06 am
Location: Amsterdam
Full name: H G Muller

Re: discovered check definition

Post by hgm »

True, but discovered checks are only important enough to deserve a special distinction because they might do this. If the opponent can deliver a discovered check, you really have to be very careful where you go (unless you resolve it immediately, of course).

For checking castlings, this danger almost never exists.

Once you are checked, the difference becomes moot. The only thing of practical importance is then if it is a distant check, contact check or double check. That determines which classes of threat evasions can be used to resolve the check (interposing, capturing the checker, or withdrawal). For single checks it is only important who the checker is, not how he got to check you.

Btw, in the presence of Nightriders checks become even more diversified, as you can then also have triple checks.
Last edited by hgm on Wed Sep 12, 2007 4:29 pm, edited 1 time in total.
Uri Blass
Posts: 10281
Joined: Thu Mar 09, 2006 12:37 am
Location: Tel-Aviv Israel

Re: discovered check definition

Post by Uri Blass »

hgm wrote:The SMIRF website did not give discovered checks, did it? I thought it gave just checks, double checks and checkmates.

I would not count castling checks, although there is one case where a castling check has the character of a discovered check, where you check with the Rook and attack something that was not attacked before with the King. This is for queen-side castling with an enemy Rook on b2. But there of course is no way to know what Reinhard counted, other than trying both cases and hope one matches.

My perft doesn't count checks. :(
Yes
You are right that the smirf site gave only checks and double check that are clear concept.

Here is an old link from the winboard forum
http://wbforum.vpittlik.org/viewtopic.p ... 4&start=20

I may still use 2 bits(one for discovered check and one for direct check and I may have both flags as 1 for every double check even if it is not direct check).
User avatar
hgm
Posts: 27790
Joined: Fri Mar 10, 2006 10:06 am
Location: Amsterdam
Full name: H G Muller

Re: discovered check definition

Post by hgm »

Yes. Be careful, though, that some double checks are double discovered checks, without a direct checker (on e.p. capture). You would have to take care to set the proper flags in that case.

I guess the discovered checks are comparatively cheap to find, from your own sider list and the enemy King (similar to finding pinned pieces). In the (rather uncommon) case you find one, it is just a matter of counting all moves of that piece not along the checking ray. (For perfting, at least. In an engine, where you would really want to know for individual moves if they are checking or not, you might actually want to generate these moves in advance, to go in a separate move list of checks, and suppress the generation later. Because it is cumbersome to suppress generating part of the moves, I would suppress all moves by temporarily marking the piece as captured, and generate its non-checking moves for the normal move list in advance as well. Again, much similar to the way I treat pinned pieces. The main problem is that sometimes the piece that can reveal the check might itself be pinned. Depending on the order of things, you would either have to reclassify moves generated in advance for pinned pieces as checks (which is OK if they don't go into a separate list, but just get some flag set), or you would have to invalidate some of the generated checks.)

Direct checks are more expensive: you would have to test that on a move-by-move basis.
bob
Posts: 20943
Joined: Mon Feb 27, 2006 7:30 pm
Location: Birmingham, AL

Re: discovered check definition

Post by bob »

Uri Blass wrote:I wonder if castling with check is considered as discovered check or as direct check.

Castling with check can only be with the rook and not with another piece
but castling is considered as move of the king.

I started to write a special move generator that write a flag for every checking move and for every move that give discovered check(also in order to have perft with information about checks similiar to smirf) and I want to use smirf numbers for debugging and I want to be sure that he considers castling as discovered check.
direct check. Discovered check is when a piece moves, and the moving piece uncovers a sliding piece that does give check directly. A knight can move and uncover a check and check the king as well. That's still discovered check since the moving piece uncovers a check by a sliding piece behind it.
tvrzsky
Posts: 128
Joined: Sat Sep 23, 2006 7:10 pm
Location: Prague

Re: discovered check definition

Post by tvrzsky »

hgm wrote:The SMIRF website did not give discovered checks, did it? I thought it gave just checks, double checks and checkmates.

I would not count castling checks, although there is one case where a castling check has the character of a discovered check, where you check with the Rook and attack something that was not attacked before with the King. This is for queen-side castling with an enemy Rook on b2. But there of course is no way to know what Reinhard counted, other than trying both cases and hope one matches.

My perft doesn't count checks. :(
Please could you give a diagram of the position? I am not able to figure what do you mean. I would imagine rather such one:
[D]8/8/8/8/8/8/8/R3K1k1 w - - 0 1
(e. g. notorious Lasker-Thomas game).
Thanks
Filip
Uri Blass
Posts: 10281
Joined: Thu Mar 09, 2006 12:37 am
Location: Tel-Aviv Israel

Re: discovered check definition

Post by Uri Blass »

tvrzsky wrote:
hgm wrote:The SMIRF website did not give discovered checks, did it? I thought it gave just checks, double checks and checkmates.

I would not count castling checks, although there is one case where a castling check has the character of a discovered check, where you check with the Rook and attack something that was not attacked before with the King. This is for queen-side castling with an enemy Rook on b2. But there of course is no way to know what Reinhard counted, other than trying both cases and hope one matches.

My perft doesn't count checks. :(
Please could you give a diagram of the position? I am not able to figure what do you mean. I would imagine rather such one:
[D]8/8/8/8/8/8/8/R3K1k1 w - - 0 1
(e. g. notorious Lasker-Thomas game).
Thanks
Filip
No need for diagram
The idea is
Rd1 attacks king at d8 and King at c1 attacks rook at b2 at the same time.

Uri