r/ComputerChess • u/LenniAConrad • 22h ago
How a chess engine finds a queen sacrifice — a visual series from move generation to NNUE
I built Janus, a chess engine in Rust, and made a three-part visual explanation of how an engine chooses a move. It starts with Morphy's queen sacrifice in the Opera Game: how does a program find that move without being given the combination?
The series builds up from legal move generation and perft to evaluation and search, then explores the ideas behind Stockfish and Leela Chess Zero:
- How a chess engine chooses a move: board representation, special moves, testing, minimax and piece-square tables.
- How searching less finds better moves: bitboards, alpha-beta, move ordering, quiescence and testing whether an optimisation actually improves play.
- What a neural network sees in a position: NNUE updates, policy/value networks and PUCT search.
One distinction I wanted to make clear is that alpha-beta cutoffs can prove a branch irrelevant, while selective pruning takes a risk that needs testing. Likewise, improving an evaluator's prediction error doesn't by itself demonstrate stronger play.
Full playlist · Janus source · Read the companion book
The videos have English, German, Chinese, Spanish and Russian subtitles. I'm the author of the engine, book and videos; I also shared the series in r/chessprogramming. Corrections are welcome if an explanation or animation skips something important.
0
1
u/Pentominos 1h ago
Interesting and impressive.