How official-pikafish/pikafish works
Pikafish is a UCI Xiangqi engine: a GUI or other UCI client supplies a position and search command, and the engine returns analysis and a best move. Its runtime spans protocol handling, position and move processing, search, and NNUE evaluation, with thread and transposition-table support. The README documents the UCI product and NNUE network; the source index supports several internal calls, but some protocol and network-loading connections remain unsampled and are therefore shown as unverified.
Main entry points: search.cpp Search · network.cpp NNUE network · engine.cpp Engine control · position.cpp Position state
Components 21
UCI interface
- Program entry
src/main.cpp - UCI protocol
src/uci.cpp - Engine control
src/engine.cpp
Xiangqi model
- Position state
src/position.cpp - Move generation
src/movegen.cpp - Attack tables
src/attacks.cpp - Bitboard operations
src/bitboard.cpp
Search and evaluation
- Search
src/search.cpp - Position evaluation
src/evaluate.cpp - Move ordering
src/movepick.cpp - NNUE network
src/nnue/network.cpp - NNUE features
src/nnue/features/half_ka_v2_hm.cpp - Threat features
src/nnue/features/full_threats.cpp - NNUE accumulator
src/nnue/nnue_accumulator.cpp - SIMD kernels
src/nnue/simd.h
Runtime support
- Worker threads
src/thread.cpp - Transposition table
src/tt.cpp - Time management
src/timeman.cpp - Zstandard decompression
src/external/decompress - Zstandard primitives
src/external/common
Other components
- UCI client / GUI
Connections 23
- UCI client / GUI → UCI protocol: sends UCI commands
README.md - Program entry → UCI protocol: starts protocol
src/main.cpp - UCI protocol → Engine control: dispatches commands
- Engine control → Position state: sets position
src/engine.cpp - Engine control → Search: starts search
src/engine.cpp - Engine control → NNUE network: loads network
src/engine.cpp - Position state → Attack tables: uses attacks
- Position state → Bitboard operations: uses bitboards
- Search → Position state: searches position
src/search.cpp - Search → Move generation: generates moves
src/search.cpp - Search → Move ordering: orders moves
src/search.cpp - Search → Position evaluation: evaluates positions
src/search.cpp - Search → NNUE network: queries network
src/search.cpp - Search → NNUE accumulator: uses accumulator
src/search.cpp - Search → Worker threads: dispatches work
- Search → Transposition table: probes table
- Search → Time management: checks limits
src/search.cpp - NNUE network → NNUE features: uses features
- NNUE network → NNUE accumulator: uses accumulator
- NNUE features → Threat features: uses threat features
src/nnue/features/full_threats.cpp - NNUE accumulator → SIMD kernels: uses kernels
src/nnue/nnue_accumulator.cpp - Zstandard decompression → Zstandard primitives: uses primitives
src/external/decompress/zstd_decompress.cpp - NNUE network → Zstandard decompression: may decompress weights