Examples

Real-world examples of tactical pattern detection.

Knight Fork + Discovered Attack

A knight fork with check, combined with a discovered attack on the queen. Black's knight jumps to e2, forking the king and queen while uncovering the queen's diagonal to c3.

FEN: 6k1/5p1p/4p3/4q3/3n4/2Q3P1/PP1N1P1P/6K1 b - - 3 37

curl -X POST https://chessgrammar.com/api/v1/extract \
  -H "Content-Type: application/json" \
  -d '{"fen": "6k1/5p1p/4p3/4q3/3n4/2Q3P1/PP1N1P1P/6K1 b - - 3 37"}'

Try it in the Playground.


Fried Liver Attack

White sacrifices the knight on f7, forking the black king and rook in a classic Italian Game opening trap.

FEN: r1bqkb1r/pppp1ppp/2n2n2/4p1N1/2B1P3/8/PPPP1PPP/RNBQK2R w KQkq - 4 4

curl -X POST https://chessgrammar.com/api/v1/extract \
  -H "Content-Type: application/json" \
  -d '{"fen": "r1bqkb1r/pppp1ppp/2n2n2/4p1N1/2B1P3/8/PPPP1PPP/RNBQK2R w KQkq - 4 4"}'

Double Check

White's knight jumps to h7 with check, simultaneously revealing the queen's attack on the black king — a lethal double check that forces the king to move.

FEN: 5r2/5p2/5kpp/ppqp2N1/7Q/8/6PP/5N1K w - - 0 34

curl -X POST https://chessgrammar.com/api/v1/extract \
  -H "Content-Type: application/json" \
  -d '{"fen": "5r2/5p2/5kpp/ppqp2N1/7Q/8/6PP/5N1K w - - 0 34"}'

Deflection

White's rook captures the knight on f3, deflecting the black queen from its defense of the rook on e8. After the queen recaptures, e8 is left unprotected.

FEN: q3r1k1/5pp1/1p5p/1Qp5/8/1BP1Rn2/2P2P1P/6K1 w - - 0 23

curl -X POST https://chessgrammar.com/api/v1/extract \
  -H "Content-Type: application/json" \
  -d '{"fen": "q3r1k1/5pp1/1p5p/1Qp5/8/1BP1Rn2/2P2P1P/6K1 w - - 0 23"}'

Interference

Black's knight lands on d3, interposing itself on the line between the white queen on d2 and the knight on d4. With the queen's defense cut off, d4 can be captured.

FEN: 4k1nr/pp3ppp/1q2p3/4nb2/3N4/1B6/PP1Q1PPP/R3K2R b KQk - 1 16

curl -X POST https://chessgrammar.com/api/v1/extract \
  -H "Content-Type: application/json" \
  -d '{"fen": "4k1nr/pp3ppp/1q2p3/4nb2/3N4/1B6/PP1Q1PPP/R3K2R b KQk - 1 16"}'

Filtering by Pattern

Extract only forks from a position:

curl -X POST https://chessgrammar.com/api/v1/extract \
  -H "Content-Type: application/json" \
  -d '{"fen": "6k1/5p1p/4p3/4q3/3n4/2Q3P1/PP1N1P1P/6K1 b - - 3 37", "patterns": ["fork"]}'

Returns only the fork, ignoring other patterns like discovered attack.


Game Analysis — Byrne vs Fischer, 1956

Analyze a full game by sending PGN. This is the famous "Game of the Century" where 13-year-old Bobby Fischer produced one of the most brilliant games ever played.

curl -X POST https://chessgrammar.com/api/v1/extract \
  -H "Content-Type: application/json" \
  -d '{
    "pgn": "1. Nf3 Nf6 2. c4 g6 3. Nc3 Bg7 4. d4 O-O 5. Bf4 d5 6. Qb3 dxc4 7. Qxc4 c6 8. e4 Nbd7 9. Rd1 Nb6 10. Qc5 Bg4 11. Bg5 Na4 12. Qa3 Nxc3 13. bxc3 Nxe4 14. Bxe7 Qb6 15. Bc4 Nxc3 16. Bc5 Rfe8+ 17. Kf1 Be6 18. Bxb6 Bxc4+ 19. Kg1 Ne2+ 20. Kf1 Nxd4+ 21. Kg1 Ne2+ 22. Kf1 Nc3+ 23. Kg1 axb6 24. Qb4 Ra4 25. Qxb6 Nxd1 26. h3 Rxa2 27. Kh2 Nxf2 28. Re1 Rxe1 29. Qd8+ Bf8 30. Nxe1 Bd5 31. Nf3 Ne4 32. Qb8 b5 33. h4 h5 34. Ne5 Kg7 35. Kg1 Bc5+ 36. Kf1 Ng3+ 37. Ke1 Bb4+ 38. Kd1 Bb3+ 39. Kc1 Ne2+ 40. Kb1 Nc3+ 41. Kc1 Rc2#",
    "mode": "played"
  }'

Use "mode": "available" to see all tactical opportunities at every position, not just the ones that were played.


Game Analysis — Fried Liver Attack

A short tactical game with knight forks and discovered attacks throughout.

curl -X POST https://chessgrammar.com/api/v1/extract \
  -H "Content-Type: application/json" \
  -d '{
    "pgn": "1. e4 e5 2. Nf3 Nc6 3. Bc4 Nf6 4. Ng5 d5 5. exd5 Nxd5 6. Nxf7 Kxf7 7. Qf3+ Ke6 8. Nc3 Nb4 9. a3 Nxc2+ 10. Kd1 Nxa1",
    "mode": "played"
  }'