How robot1273/cpp-chess works
This repository is a C++ chess engine with terminal-play and UCI entry points. The main workflow is a player or chess GUI submitting a position and requesting a move; the runner updates the board, asks the searcher to choose a move, and returns it through the selected interface. Internally, board state and legal-move generation support search, which uses evaluation and a transposition table. The source excerpts show these core relationships; benchmark and perft modes are also present, but their full wiring is only partly sampled.
Main entry points: search.cpp Move search · run.cpp UCI adapter · board.hpp Board state · board_movegen.cpp Legal move generation
Components 14
Interfaces and modes
- Process entry
src/main.cpp - Game runner
src/run.cpp - UCI adapter
src/run.cpp - Terminal play
src/run.cpp - Benchmark and perft
src/run.cpp
Chess rules and state
- Board state
src/board/board.hpp - State and play
src/board/board_state_and_play.cpp - Legal move generation
src/board/board_movegen.cpp
Search engine
- Move search
src/bot/search.cpp - Position evaluation
src/bot/evaluation.cpp
Engine internals
- Transposition table
src/bot/search.hpp - Attack tables
src/board/board_precalculation.cpp
Other components
- Player
- UCI GUI
Connections 19
- Player → Terminal play: plays moves
- UCI GUI → UCI adapter: sends commands
- Process entry → Game runner: dispatches mode
- Game runner → Terminal play: runs play
- Game runner → UCI adapter: runs UCI
- Game runner → Benchmark and perft: runs analysis mode
- Terminal play → Board state: updates position
- Terminal play → Move search: requests move
- UCI adapter → Board state: loads position
- UCI adapter → Move search: requests move
- UCI adapter → UCI GUI: returns move
- Move search → Legal move generation: generates legal moves
- Move search → Board state: simulates moves
- Move search → Position evaluation: scores positions
- Move search → Transposition table: probes and stores
- Board state → State and play: updates state
- Legal move generation → Attack tables: reads attack tables
- Benchmark and perft → Board state: loads test positions
- Benchmark and perft → Move search: measures search