How Koga decides

Definition Two checks at once
  • It is a double check when the king of the side to move is attacked by two (or more) enemy pieces at the same time.
  • A double check is uniquely forcing: there is no way to block both lines with a single interposition, and capturing one checker still leaves the other one giving check. The king itself must move.
  • We simply count how many enemy pieces attack the king's square. Two or more, and we flag a double check.
When we look Where the double check is judged
  • The position is read after the move being classified, looking at the side that has just been put on move.
  • We also follow the engine's main line a few moves ahead, so a double check that only arises later in a forcing sequence is still caught.
  • There are no extra conditions or exceptions — purely the count of attackers on the king.

Test positions (the examples that guard against regressions)

Rook and knight check together

A constructed position. The black king on e8 is attacked at the same time by the white rook on e1 down the e-file and the white knight on d6. Two pieces check at once, so neither can be blocked or captured to escape both — only the king can move.

✓ detectedtest_detects_double_check
. . . . k . . .
. . . . . . . .
. . . N . . . .
. . . . . . . .
. . . . . . . .
. . . . . . . .
. . . . . . . .
. . . . R . K .
Piece giving check
King

Golden puzzles — every real Lichess puzzle Koga is tested against for this tactic (10)

Lichess 05LLQ

Lichess 05LLQ (rating 1697). Solution: Rxa1+ Kb2 Nc4#.

Koga flags double check as a follow-up here — it fires later in the line, on Nc4#, not on the move shown above.

✓ detectedrating 1697♟ Lichess 05LLQ
. . . . k . . r
. . . . p p b p
. . P p . . p .
. B . . n . . .
. p . . . . . .
. P . . . P . .
. K P Q . . P P
r . . R . . . R

Lichess 04zhG

Lichess 04zhG (rating 1021). Solution: hxg6#.

✓ detectedrating 1021♟ Lichess 04zhG
r . b . . r . .
p p p . N p b k
. . . p . n p .
. . . . . . B P
. . . p q P . .
. . . . P . . R
P P P . Q . . .
R . . . K . N .

Lichess 0AaUW

Lichess 0AaUW (rating 1752). Solution: Qxg7+ Kxg7 Be5+ Kh7 Rh8#.

Koga flags double check as a follow-up here — it fires later in the line, on Be5+, not on the move shown above.

✓ detectedrating 1752♟ Lichess 0AaUW
. . R . . . . .
p . . . . p k .
. b . . r . . .
. . . . . r . p
. . . p . . . .
P . . . . P B q
. P . . . P R P
. . . . . K . .

Lichess 02fS6

Lichess 02fS6 (rating 1842). Solution: a5+ Ka3 Bc5+ b4 axb4#.

Koga flags double check as a follow-up here — it fires later in the line, on axb4#, not on the move shown above.

✓ detectedrating 1842♟ Lichess 02fS6
r . b . . r k .
. p p p . p p p
. . . . . . . .
p . b . . . . .
. P B . P . . .
K . . Q . . N .
P . q . . . . P
R . B . . . . R

Lichess 0B4Lr

Lichess 0B4Lr (rating 1600). Solution: Nh6+ Kh8 Qxe7.

✓ detectedrating 1600♟ Lichess 0B4Lr
. . . . . r k .
p b . . q N b p
. p . . Q . p .
. . . . . . . n
. P r . . P . .
. . P . . . . .
P . . . . . P P
. . B . . R K .

Lichess 04fMB

Lichess 04fMB (rating 1318). Solution: Nh3+ Kh1 Qg1+ Rxg1 Nf2#.

✓ detectedrating 1318♟ Lichess 04fMB
. . r . . r k .
. . . Q . p p p
p q . . p . . .
. p . . N . . .
. P . . . P . .
P . P . . . . .
. . . . . n P P
R N B . . R K .

Lichess 0BSZ7

Lichess 0BSZ7 (rating 2122). Solution: Ne2+ Kh1 Qg1+ Rxg1 Nf2#.

✓ detectedrating 2122♟ Lichess 0BSZ7
r . . . k . . r
. p . . p p b p
p q . p . . p .
. . . N . . . .
. . . n P P n .
. . . B . . . .
P P P Q . . P P
R . B . . R K .

Lichess 04KbJ

Lichess 04KbJ (rating 800). Solution: Ng3+ Kh2 Rh1#.

✓ detectedrating 800♟ Lichess 04KbJ
. . . . . . . .
p R . . . . . .
. . . . . p p k
. . . . . . . .
. . P . . . . p
. P . . . P . P
P . . . . B P .
. . . . r n . K

Lichess 0BmTF

Lichess 0BmTF (rating 1962). Solution: Bf7+ Kxf7 Qxf4+.

✓ detectedrating 1962♟ Lichess 0BmTF
. . . . . r k .
. . . p . . . p
. . p P . . B .
. r . . . . . .
p . . . . q . P
P b . . . . Q .
. P . . . . . K
. . R . . . . .

Lichess 05CzU

Lichess 05CzU (rating 1844). Solution: Rf8#.

✓ detectedrating 1844♟ Lichess 05CzU
r . . . . . k .
p b . p . R . p
. p . . . . p B
. P . . . . . .
. . B b q . . .
. . . . . . . .
P . . . . . P P
. . R . . . . K