Skip to content

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

1 Commit

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PureC Chess Engine (UCI)

This repository now contains a full starter chess engine in C, plus scripts to validate move legality and estimate Elo from matches.

What is included

  • src/engine.c: UCI-compatible chess engine
  • Makefile: build and utility targets
  • scripts/perft_check.sh: legality regression using known perft values
  • scripts/run_match.py: run matches through cutechess-cli and estimate Elo difference
  • scripts/gauntlet_stockfish.sh: run a multi-level Stockfish gauntlet

Current search features

  • 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 Hash support

Build

make

Binary output:

  • build/purec_chess

Quick engine checks

Run perft from the starting position:

./build/purec_chess perft 4

Show 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.sh

Run a UCI smoke test manually:

printf "uci\nisready\nposition startpos\ngo depth 4\nquit\n" | ./build/purec_chess

Match and Elo workflow

  1. Build your engine.
  2. Play a statistically meaningful number of games (at least 100, ideally 200+).
  3. Estimate Elo difference from score.

Single match example

./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.pgn

The script prints:

  • wins/losses/draws
  • score percentage
  • Elo difference vs opponent
  • 95% confidence interval
  • optional absolute Elo estimate if --reference-elo is provided

Multi-level gauntlet

./scripts/gauntlet_stockfish.sh ./build/purec_chess stockfish 80

This runs at multiple UCI_Elo levels and writes one JSON report per level under results/.

Notes on Elo quality

  • 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.

Suggested next improvements

  • 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

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages