With the help of Claude, we now have Crafty natively supporting the UCI protocol.
TL;DR
- Crafty — Dr. Robert Hyatt's classic engine — now speaks UCI, so it runs out of the box in Arena, Cute Chess, Nibbler, BanksiaGUI, ChessBase, etc.
- It still speaks WinBoard/xboard and its native console too — the protocol is auto-detected from the very first command, so nothing old breaks.
- This is a protocol adapter, not a rewrite: the search, evaluation, opening book, Syzygy tablebases, SMP, and pondering are unchanged Crafty 25.2. Full credit for the engine goes to Bob Hyatt.
- Three optimized 64-bit Windows builds (profile-guided, -O3) for different CPU levels; Linux/macOS build from source.
- Full UCI option set: Hash, Threads, Ponder, SyzygyPath, OwnBook/BookFile, Move Overhead — and complete info output including seldepth and currmove.
- Download: https://github.com/stevemaughan/Crafty- ... ag/v25.2.1
- Source: https://github.com/stevemaughan/Crafty-Chess
Crafty is one of the longest-lived open chess engines, but it only ever spoke the WinBoard/xboard protocol plus its own console command set. Most modern GUIs are UCI-first, which has made Crafty awkward to use without an adapter.
This release adds native UCI support to Crafty 25.2 (hence the version 25.2.1 — the ".1" denotes the UCI conversion). The guiding principle throughout was: UCI is added, nothing is removed. All UCI code is additive and mode-gated; WinBoard and native behavior are byte-for-byte the same as before.
This is an independent fork. All credit for the engine itself belongs to Dr. Robert Hyatt and the Crafty team.
Downloads
Pick the build that matches your CPU:
Code: Select all
Build CPU required Best for
crafty-25.2.1-win-x86-64-v3.exe AVX2 / BMI2 (Haswell 2013+, Zen) modern CPUs (fastest)
crafty-25.2.1-win-x86-64-v2.exe SSE4.2 / popcnt (2008+) older 64-bit CPUs
crafty-25.2.1-win-x86-64.exe any 64-bit x86 maximum compatibility
What you get
- Full UCI: position (startpos/FEN + moves), go (depth / movetime / wtime-btime-winc-binc-movestogo / infinite / ponder), stop, ponderhit, isready, ucinewgame, quit.
- Streaming info lines: depth, seldepth, score cp/mate, nodes, nps, time, pv, plus currmove/currmovenumber on longer searches.
- bestmove with a ponder move, correct UCI long-algebraic coordinates (incl. promotions and castling as king-move coordinates).
- Opening book (Crafty's own book.bin), Syzygy WDL+DTZ tablebases, SMP search, and pondering — all reachable from the GUI via standard UCI options.
- Hash (spin, MB) — transposition table size
- Threads (spin) — SMP threads
- Ponder (check) — permanent brain
- SyzygyPath (string) — tablebase directory
- OwnBook (check) + BookFile (string) — opening book toggle/path
- Move Overhead (spin, ms) — time buffer to absorb GUI/network lag
Under the hood
All UCI code lives in a single new module (uci.c) plus a couple of small, mode-gated hooks (first-token detection, and recognizing stop/ponderhit/isready/quit mid-search via Crafty's existing "move now"/"ponder hit" machinery). Output is reformatted to UCI; scores are centipawns from the side-to-move POV, mates as "mate N".
While wiring this up I did a review of the new UCI and time-handling code and fixed a handful of issues that affect UCI play:
- Time management: the Ponder default and the "first moves out of book" bonus were causing systematic over-spend per move in the common UCI time-control path — corrected.
- The FEN half-move clock is now honored, so the 50-move rule is tracked when starting from a mid-game FEN.
- go infinite / go ponder no longer emit a premature bestmove if the search resolves a forced mate before stop/ponderhit.
- The cross-thread abort flag is now volatile (clean stop under SMP).
- Output cleaned up to one PV line per depth (no duplicate end-of-iteration copy), and seldepth/currmove added.
- The engine no longer drops log.NNN / game.NNN files in the working directory (use "log on" to re-enable logging).
Build note: the "cutting-edge" build targets x86-64-v3 (AVX2/BMI2/popcnt) but caps vector width at 128 bits to avoid a Win64 256-bit AVX stack-alignment crash that PGO would otherwise trigger. Crafty has no 256-bit-beneficial loops, so this costs nothing.
Building from source
It's still a unity build (everything is #included through crafty.c).
Code: Select all
# Windows (MinGW-w64 gcc) - multi-threaded + Syzygy
cd source
gcc -O3 -DCPUS=8 -DSYZYGY -mpopcnt crafty.c -o crafty.exe -lwinmm
# Linux / macOS
cd source
make help # list targets
make unix-gcc # or: make unix-clang
Testing
- A UCI protocol transcript suite (handshake, position, search, info, time control, stop/ponderhit, options, seldepth/currmove, no-logfiles).
- perft verification (no move-gen regression).
- Self-play gauntlets via fastchess (stability + fast-TC stress).
- WinBoard and native-console regression checks.
Notes
- 32-bit build isn't bundled (the toolchain here is 64-bit only) — happy to add one if there's demand.
- Crafty is © Robert M. Hyatt and is free for personal use (see the source header); it is not under an OSI license. As required by that license, all changes in this fork are published in full on GitHub.
Bug reports, GUI compatibility notes, and suggestions are very welcome — please reply here or open an issue on GitHub. Thanks, and a huge thank-you to Bob Hyatt for Crafty.
