How Koga decides
- 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.
- 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.
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.
Lichess 04zhG
Lichess 04zhG (rating 1021). Solution: hxg6#.
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.
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.
Lichess 0B4Lr
Lichess 0B4Lr (rating 1600). Solution: Nh6+ Kh8 Qxe7.
Lichess 04fMB
Lichess 04fMB (rating 1318). Solution: Nh3+ Kh1 Qg1+ Rxg1 Nf2#.
Lichess 0BSZ7
Lichess 0BSZ7 (rating 2122). Solution: Ne2+ Kh1 Qg1+ Rxg1 Nf2#.
Lichess 04KbJ
Lichess 04KbJ (rating 800). Solution: Ng3+ Kh2 Rh1#.
Lichess 0BmTF
Lichess 0BmTF (rating 1962). Solution: Bf7+ Kxf7 Qxf4+.
Lichess 05CzU
Lichess 05CzU (rating 1844). Solution: Rf8#.