This repository now contains a full starter chess engine in C, plus scripts to validate move legality and estimate Elo from matches.
src/engine.c: UCI-compatible chess engineMakefile: build and utility targetsscripts/perft_check.sh: legality regression using known perft valuesscripts/run_match.py: run matches throughcutechess-cliand estimate Elo differencescripts/gauntlet_stockfish.sh: run a multi-level Stockfish gauntlet
- Alpha-beta search with iterative deepening
- Principal variation search (PVS)
- Aspiration windows
- Quiescence search
- Late move reductions (LMR)
- Transposition table with Zobrist hashing
- Killer and history move ordering
- Static exchange evaluation (SEE) pruning
- Null-move pruning
- Repetition draw detection
- Evaluation terms for mobility, pawn structure, rook files, bishop pair, and king shelter
- UCI
setoption name Clear Hashsupport
makeBinary output:
build/purec_chess
Run perft from the starting position:
./build/purec_chess perft 4Show per-move perft breakdown (divide):
./build/purec_chess perftdiv 3 "r3k2r/p1ppqpb1/bn2pnp1/3PN3/1p2P3/2N2Q1p/PPPBBPPP/R3K2R w KQkq - 0 1"Run regression checks (start position + Kiwipete):
./scripts/perft_check.shRun a UCI smoke test manually:
printf "uci\nisready\nposition startpos\ngo depth 4\nquit\n" | ./build/purec_chess- Build your engine.
- Play a statistically meaningful number of games (at least 100, ideally 200+).
- Estimate Elo difference from score.
./scripts/run_match.py \
--engine ./build/purec_chess \
--engine-name PureC \
--opponent stockfish \
--opponent-name SF1500 \
--opponent-option UCI_LimitStrength=true \
--opponent-option UCI_Elo=1500 \
--reference-elo 1500 \
--games 200 \
--tc 5+0.05 \
--pgn-out results/purec-vs-sf1500.pgnThe script prints:
- wins/losses/draws
- score percentage
- Elo difference vs opponent
- 95% confidence interval
- optional absolute Elo estimate if
--reference-elois provided
./scripts/gauntlet_stockfish.sh ./build/purec_chess stockfish 80This runs at multiple UCI_Elo levels and writes one JSON report per level under results/.
- Elo error bars are wide with few games. Use more games for tighter confidence.
- Fix hash/threads/book/time control when comparing versions.
- Compare against several opponents around your current level, not only one engine.
- Add check extensions and singular extensions
- Add tapered evaluation with game-phase interpolation
- Add a compact opening book and move-overhead tuning
- Add opening book and endgame tablebase probing