Problem
The Horizon Effect
Main search depth 6 — queen "safe" at the leaf, captured in qsearch
Without qsearch: eval +300 at d6 (queen still on board). With qsearch: sees Q× and returns −700.
Material + piece-square tables look fine. Engine plays a move that hangs a piece — the capture happens just beyond the search horizon.
Extend with captures/checks until "quiet." Eval reflects the resolved tactical line. Prevents blunders from shallow trees.
Moves
What Gets Extended in Q-Search?
Always searched (often MVV-LVA ordered). Core of every qsearch implementation.
Pawn to queen (or underpromo) — treated as captures even on quiet squares.
Many engines extend checks in qsearch (or 1–2 ply of check evasions). Optional but helps mating nets.
Not generated in basic qsearch — that is main search's job. Keeps the q-tree narrow and fast.
Algorithm
Q-Search Loop
qsearch(α, β) instead of returning eval() immediately.−qsearch(−β, −α) → unmake. Track best score. Stop on β cutoff.Stand Pat Principle
You are not forced to capture. Static eval is a valid lower bound — if you're winning without moving, α starts at eval and only captures that beat it are searched.
Pruning
Keeping Q-Search Fast
Simulate capture sequence on one square. If SEE < 0, skip the move — it loses material on that square. Cheap filter before recursive qsearch.
If standPat + margin < α, skip captures — even winning the queen cannot raise score enough. Margin ≈ piece values (900 for queen, etc.).
Return mate bounds immediately. Check extensions help find mates; avoid searching qnodes when already mated or stalemated.
Cap qsearch plies (e.g. 16) or total q-nodes to avoid explosion in wild tactical positions. Some engines use selective extensions only.
Reference
Q-Search vs Main Search
| Aspect | Main search | Quiescence search |
|---|---|---|
| Entry | Root, depth > 0 | Leaf nodes, depth = 0 |
| Moves | All legal (ordered) | Captures, checks, promos only |
| Null move | Often enabled | Never (would miss captures) |
| Stand pat | N/A | Core — eval without moving |
| Depth limit | Iterative deepening | Until quiet or cap |
| TT usage | Heavy | Light or separate q-TT slot |
Implementation tips
- Order captures MVV-LVA (Most Valuable Victim, Least Valuable Aggressor) before SEE filtering
- Apply stand pat before generating moves — early beta cutoffs save huge q-subtrees
- Use SEE > 0 (or ≥ −margin) to drop hanging-capture noise
- Consider check extensions only if mate threats matter — they widen the q-tree
- Test with tactical WAC suites — qsearch quality shows up immediately in blunder rate
See the full search stack
Quiescence sits at the leaves of alpha-beta — explore iterative deepening, TT, and aspiration windows next.
Related: Search Algorithm · Transposition Table · Move Generation · All Blogs