How official-stockfish/stockfish works
Stockfish is a UCI chess engine: a client supplies a position and search request, and the engine analyzes it and returns a best move. The graph follows that runtime path and includes chess-position and move-generation logic, search support, NNUE evaluation, and Syzygy tablebase probing. Edges are limited to relationships shown by the README or SOURCE INDEX references; the sampled excerpts do not expose all runtime call sites, so some internal links are omitted.
Main entry points: search.cpp Tree search · position.cpp Position state · network.cpp NNUE network · engine.cpp Engine control
Components 23
UCI and engine
- Program entry
src/main.cpp - UCI protocol
src/uci.cpp - Engine control
src/engine.cpp
Chess state
- Position state
src/position.cpp - Bitboard operations
src/bitboard.h - Attack queries
src/attacks.h - Move generation
src/movegen.cpp
Search and support
- Tree search
src/search.cpp - Move ordering
src/movepick.cpp - Search histories
src/history.h - Search threads
src/thread.cpp - Transposition table
src/tt.cpp - Time management
src/timeman.cpp - Syzygy probing
src/syzygy/tbprobe.cpp - Shared utilities
src/misc.h - Memory support
src/memory.h
Evaluation
- Evaluation interface
src/evaluate.cpp - NNUE network
src/nnue/network.cpp - NNUE accumulator
src/nnue/nnue_accumulator.cpp - Feature transformer
src/nnue/nnue_feature_transformer.h - NNUE architecture
src/nnue/nnue_architecture.h - Chess feature sets
src/nnue/features
Other components
- UCI client
Connections 26
- UCI client → UCI protocol: sends commands
README.md - Program entry → UCI protocol: starts protocol
src/main.cpp - UCI protocol → Engine control: dispatches requests
- Engine control → Position state: sets position
src/engine.cpp - Engine control → Search threads: starts search
src/engine.cpp - Engine control → NNUE network: loads network
src/engine.cpp - Position state → Move generation: uses move generation
src/position.cpp - Position state → Bitboard operations: uses bitboards
src/position.cpp - Position state → Attack queries: uses attack queries
- Search threads → Tree search: runs search
src/search.cpp - Tree search → Position state: searches positions
src/search.cpp - Tree search → Move generation: generates moves
src/search.cpp - Tree search → Move ordering: orders moves
src/search.cpp - Tree search → Search histories: updates histories
src/search.cpp - Tree search → Transposition table: uses transpositions
src/search.cpp - Tree search → Time management: checks time limits
src/search.cpp - Tree search → Evaluation interface: evaluates positions
src/search.cpp - Tree search → Syzygy probing: probes endgames
src/search.cpp - Evaluation interface → NNUE network: uses NNUE
src/nnue/network.cpp - NNUE network → NNUE accumulator: uses accumulators
- NNUE network → NNUE architecture: propagates network
src/nnue/network.cpp - NNUE accumulator → Feature transformer: updates features
src/nnue/nnue_accumulator.cpp - NNUE architecture → Chess feature sets: configures inputs
src/nnue/nnue_architecture.h - Feature transformer → Position state: reads chess state
src/nnue/nnue_feature_transformer.h - Tree search → Shared utilities: uses utilities
src/search.cpp - NNUE network → Memory support: uses allocation support