How Koga decides
- An enemy piece is pinned to its king when it sits on a line (rank, file, or diagonal) directly between its own king and one of our long-range pieces — a rook, bishop, or queen.
- Because moving it would expose the king to check, the piece may not legally leave that line. It is effectively frozen.
- A pinned pawn is only flagged when one of our pieces is already attacking it — a pawn merely standing in front of its king is not worth calling out.
- We look along every line of each of our rooks, bishops, and queens.
- The first enemy piece on that line is the candidate pinned piece.
- If a MORE valuable enemy piece stands directly behind it on the same line, the front piece is pinned: moving it would hand us the bigger piece behind.
- If taking the rear piece would only be an even trade (it is defended and our piece is worth at least as much), we don't count it — there is nothing to actually win.
- Same pawn rule as the absolute pin: a pinned pawn counts only when we already attack it.
- Checker bypass — if the very piece that would do the pinning is also giving check right now, we ignore that pin. While the king is in check the defender's choices are dictated by the check, not the pin, and once the check is met the pin often vanishes.
- Quiet pawns — a pinned pawn is ignored unless it is already under attack.
- When we look — a pin is judged on the position AFTER the candidate move, and we also scan a few moves ahead in the engine's main line, so a pin that only appears later in a forcing sequence is still caught.
- New pin (motif) — the pin did not exist before the move; the move creates it.
- Pre-existing pin (enabling) — the pin was already on the board; the move makes use of the freeze it provides.
- Found deeper in the line (follow-up) — the pin appears a few moves into the engine's main line rather than immediately.
Test positions (the examples that guard against regressions)
Basic absolute pin
Our rook on e1 pins the black knight on e5 to the black king on e8. The knight cannot legally leave the e-file.
Relative pin while a different piece checks
The rook on a8 gives check to the king on e8. A SEPARATE piece — the bishop on c4 — pins the knight on d5 to the queen on e6. Because the pinner is not the checker, the pin is real.
Checker bypass — same piece checks and pins
The queen on e4 checks the king on h7 along one diagonal, and on the other diagonal it would line up d5 behind c6 (a relative pin). Because the checking piece IS the would-be pinner, the pin is bypassed and not reported.
Pin created by the move (motif)
A constructed counterpart to the enabling case. The rook starts on a1 with no pin; after Ra1–e1 a fresh absolute pin appears on the e5 knight against the e8 king. Since it did not exist before the move, it is tagged a motif.
Pre-existing pin (enabling)
A constructed position for role-tagging (White is up a rook, so this is not real best play). The e1–e5–e8 pin is already on the board, and the move we classify — the deliberately quiet, pin-irrelevant Kg1–f2 — has nothing to do with it. Because the pin existed before that move, Koga tags it enabling rather than motif.
Pin two moves deep in the line
Lichess 00yP0. After Qf6, the main line continues Qg7, Rg5 — and the rook on g5 pins the queen on g7 to the king on g8. The pin is not visible right after the first move; it emerges deeper in the forcing line.
Pin as the final point of the line
After Rxe6 dxe6 Bd4, the bishop on d4 pins the queen on f2 to the king on g1 along the long diagonal. The pin is the very last move of the line — the point of the whole sequence.
Pin prevents a mating defence
Lichess 00KhM. After Qxf7+ Rxf7, the bishop on c4 pins the rook on f7 to the king on g8. The rook can no longer step to f8 to block, so Rd8 is mate.
Pin on the opponent's defender
Lichess 00kDo. After Qb1+ Bf1, the queen on b1 pins the bishop on f1 to the king on g1 along the first rank. The pinned bishop is the only guard of a6, so it cannot stop Bxa6.
Golden puzzles — every real Lichess puzzle Koga is tested against for this tactic (8)
Lichess 00WG3
Lichess 00WG3 (rating 1044). Solution: Rxd1 Rxf7 Nd6+ Kc7 Nxf7. Koga intentionally does not flag Pin here — Koga reports the more specific pinned-defender motif, which subsumes the plain pin.
Lichess 00eWz
Lichess 00eWz (rating 1674). Solution: R5xe6 dxe6 Bd4.
Koga flags pin as a follow-up here — it fires later in the line, on Bd4, not on the move shown above.
Lichess 008LT
Lichess 008LT (rating 2066). Solution: Nf7+ Rxf7 Bxe6.
Koga flags pin as a follow-up here — it fires later in the line, on Bxe6, not on the move shown above.
Lichess 00RtC
Lichess 00RtC (rating 1948). Solution: Ne2+ Kh1 Qxf2 Qxg7+ Kxg7.
Lichess 01CvZ
Lichess 01CvZ (rating 1232). Solution: Ba6 Kd2 Bxb5.
Lichess 00cy1
Lichess 00cy1 (rating 1188). Solution: Qb6+ Nc7 dxc7+.
Koga flags pin as a follow-up here — it fires later in the line, on dxc7+, not on the move shown above.
Lichess 013Kj
Lichess 013Kj (rating 1920). Solution: Kh1 Qg6 Rg1 Kg7 Rxg6+.
Koga flags pin as a follow-up here — it fires later in the line, on Rg1, not on the move shown above.
Lichess 045gE
Lichess 045gE (rating 1449). Solution: Rxd5+ Qxd5 Rb5 Qxb5 axb5.
Koga flags pin as a follow-up here — it fires later in the line, on Rb5, not on the move shown above.