Crafty UCI...

Discussion of anything and everything relating to chess playing software and machines.

Moderator: Ras

User avatar
Steve Maughan
Posts: 1347
Joined: Wed Mar 08, 2006 8:28 pm
Location: Florida, USA

Crafty UCI...

Post by Steve Maughan »

Crafty 25.2.1 — now with UCI support

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
Background
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
All three are 64-bit Windows, compiled with -O3 + profile-guided optimization, with Syzygy support and multi-threading (up to 64 threads). If you're unsure, try v3 first; if it won't launch, drop to v2, then the base build. Linux/macOS users can build from source (see below).

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.
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
(MultiPV is deliberately not advertised — Crafty has no multi-PV search.)

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).
The core search and evaluation are untouched — this is not a strength patch to Crafty's engine.

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
A reproducible script that builds all three PGO tiers is included (scripts/build-releases.sh).

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.
Loaded and played in Arena, Cute Chess, and Nibbler.

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.
Feedback
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.
http://www.chessprogramming.net - Juggernaut & Maverick Chess Engine
Joerg Oster
Posts: 996
Joined: Fri Mar 10, 2006 4:29 pm
Location: Germany
Full name: Jörg Oster

Re: Crafty UCI...

Post by Joerg Oster »

Oh oh, I seem to recall Bob saying Crafty going UCI would never ever happen ...
Jörg Oster
User avatar
PHILOCHESS
Posts: 22
Joined: Tue Mar 24, 2020 8:56 am
Location: Lima, Peru
Full name: Robert M. Cuadros

Re: Crafty UCI...

Post by PHILOCHESS »

Hi Steve,

Thank you for creating this UCI version of Crafty. It is good to see such a classic engine becoming easier to use in modern GUIs.

Full credit, of course, to Dr. Robert Hyatt and the Crafty team for the original engine and its long history. Your work here helps keep that legacy practical and accessible for current users and testers.

Best regards,
Robert
Eternal happiness does not exist. Only happy moments do.
Frank Quisinsky
Posts: 7495
Joined: Wed Nov 18, 2009 7:16 pm
Location: Gutweiler, Germany
Full name: Frank Quisinsky

Re: Crafty UCI...

Post by Frank Quisinsky »

I think a lot of crafty folks will be happy about this. Whether Bob likes it is another question. He was never a fan of the UCI protocol, as far as I recall his comments correctly. Back then, Bob wasn’t the only one who thought the Winboard protocol was the better one. But it’s more cryptic, and the UCI was a relief, so it went its own way.

In general, I'm not a big fan of updating older chess programs in this way, whether through in protocol questions or by adding a neural network. Great things from the past should never be artificially updated, but should remain part of history exactly as they are and as they were.

Be that as it may, I'm sure some of the Crafty fans will be happy about this. That's why I've added the link to my Engine Overview.
Damas Clásicas
Posts: 30
Joined: Thu Aug 22, 2019 6:11 am
Full name: Herson P. Guier

Re: Crafty UCI...

Post by Damas Clásicas »

Many thanks for this!!!

It's truly wonderful to finally see Crafty running under UCI. It's one of those classic engines that every chess enthusiast wants to have in their collection, and having it available as a UCI engine makes it even better! 8-)

A fantastic achievement by you and Claude. Thank you once again for all the work you've put into this.

My very best wishes.


Steve Maughan wrote: Sat Jun 20, 2026 7:32 am Crafty 25.2.1 — now with UCI support

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
Background
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
All three are 64-bit Windows, compiled with -O3 + profile-guided optimization, with Syzygy support and multi-threading (up to 64 threads). If you're unsure, try v3 first; if it won't launch, drop to v2, then the base build. Linux/macOS users can build from source (see below).

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.
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
(MultiPV is deliberately not advertised — Crafty has no multi-PV search.)

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).
The core search and evaluation are untouched — this is not a strength patch to Crafty's engine.

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
A reproducible script that builds all three PGO tiers is included (scripts/build-releases.sh).

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.
Loaded and played in Arena, Cute Chess, and Nibbler.

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.
Feedback
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.
syzygy
Posts: 6030
Joined: Tue Feb 28, 2012 11:56 pm

Re: Crafty UCI...

Post by syzygy »

Joerg Oster wrote: Sat Jun 20, 2026 9:48 am Oh oh, I seem to recall Bob saying Crafty going UCI would never ever happen ...
I always thought the non-open source license did not allow this, but it turns out I am wrong (see my comment below).
Last edited by syzygy on Sun Jun 21, 2026 2:21 pm, edited 2 times in total.
syzygy
Posts: 6030
Joined: Tue Feb 28, 2012 11:56 pm

Re: Crafty UCI...

Post by syzygy »

Steve Maughan wrote: Sat Jun 20, 2026 7:32 amCrafty 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.
Ok, let me check that license. Maybe I am wrong.

Code: Select all

 *  Copies of the source must contain the original copyright notice intact.    *
 *                                                                             *
 *  Any changes made to this software must also be made public to comply with  *
 *  the original intent of this software distribution project.  These          *
 *  restrictions apply whether the distribution is being done for free or as   *
 *  part or all of a commercial product.  The authors retain sole ownership    *
 *  and copyright on this program except for 'personal use' explained below.   *
So yes, I am wrong. Sorry!
User avatar
chrisw
Posts: 5033
Joined: Tue Apr 03, 2012 4:28 pm
Location: Digital Nomad. Anywhere but the Western Empire
Full name: Christopher Whittington

Re: Crafty UCI...

Post by chrisw »

syzygy wrote: Sun Jun 21, 2026 2:04 pm
Steve Maughan wrote: Sat Jun 20, 2026 7:32 amCrafty 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.
Ok, let me check that license. Maybe I am wrong.

Code: Select all

 *  Copies of the source must contain the original copyright notice intact.    *
 *                                                                             *
 *  Any changes made to this software must also be made public to comply with  *
 *  the original intent of this software distribution project.  These          *
 *  restrictions apply whether the distribution is being done for free or as   *
 *  part or all of a commercial product.  The authors retain sole ownership    *
 *  and copyright on this program except for 'personal use' explained below.   *
So yes, I am wrong. Sorry!
If vibe coding with Claude (as in this case) or any other Ai, the AI is a joint author and it’s going to bitch if it reads the licence (it will) and the vibe coder appears to or requests to do something to put the session in breach.
syzygy
Posts: 6030
Joined: Tue Feb 28, 2012 11:56 pm

Re: Crafty UCI...

Post by syzygy »

chrisw wrote: Sun Jun 21, 2026 3:30 pm
syzygy wrote: Sun Jun 21, 2026 2:04 pm
Steve Maughan wrote: Sat Jun 20, 2026 7:32 amCrafty 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.
Ok, let me check that license. Maybe I am wrong.

Code: Select all

 *  Copies of the source must contain the original copyright notice intact.    *
 *                                                                             *
 *  Any changes made to this software must also be made public to comply with  *
 *  the original intent of this software distribution project.  These          *
 *  restrictions apply whether the distribution is being done for free or as   *
 *  part or all of a commercial product.  The authors retain sole ownership    *
 *  and copyright on this program except for 'personal use' explained below.   *
So yes, I am wrong. Sorry!
If vibe coding with Claude (as in this case) or any other Ai, the AI is a joint author and it’s going to bitch if it reads the licence (it will) and the vibe coder appears to or requests to do something to put the session in breach.
That last sentence of the license is a bit weird since someone making a less than trivial change to the code will typically have copyright on the portion he edited, whether he/she wants it or not (it would be possible to assign the copyright to Bob, but that needs more than a sentence in a license text).

However, copyright can originate only from human beings, so if Claude did all the coding, everything seems to be fine.
And even if Steve did the coding, given the license it seems reasonable to assume that Bob is fine with this type of change. (In my memory the license was a lot more restrictive.)
Peter Berger
Posts: 838
Joined: Thu Mar 09, 2006 2:56 pm

Re: Crafty UCI...

Post by Peter Berger »

syzygy wrote: Sun Jun 21, 2026 9:34 pm And even if Steve did the coding, given the license it seems reasonable to assume that Bob is fine with this type of change. (In my memory the license was a lot more restrictive.)
My understanding of the intent of Crafty's license always was: keep Crafty open source, and don't turn it into a competing engine for official competitions without permission.