Cléchecs
A chess program for the Mac, written in Clojure with cljfx and JavaFX. The pieces are hand-drawn, and stand on a 3D board like cardboard cutouts. You play against the computer, against another person at the same machine, or watch the computer play itself.

What it does
- The rules of chess: castling, en passant, promotion to any piece, check, checkmate and stalemate. Draws by threefold repetition, the fifty-move rule and insufficient material are declared automatically.
- A computer opponent at five strengths: Terrible, Novice, Decent, Strong and Fierce. The top level thinks for about four seconds a move and searches about eleven plies deep in the first of them.
- Four ways to play: White against the computer, Black against the computer, two people at one machine, or the computer against itself.
- A board you can look around: drag to orbit, scroll to zoom, flip it to play from the other side. The pieces turn to face you.
- Undo and redo, hints, a move list in algebraic notation, and trays of captured pieces.
- PGN and FEN: save and open games as PGN, copy and paste positions as FEN.
- A plain board, if you prefer one: Show Highlights can be switched off for a board with no markings and no hints, and Touch-Move enforces the over-the-board rule.
Getting it running
To play, download the app from the latest release, unzip it, and drag Cléchecs to your Applications folder. It needs an Apple-silicon Mac and nothing else: no Java, and no security warning, since the app is signed and notarised.
To run it from source, you need an Apple-silicon Mac, a JDK (it is developed with OpenJDK 27, which includes jpackage) and the Clojure CLI.
git clone https://github.com/jonathanhuston/clechecs.git
cd clechecs
clojure -Srepro -M:run
-Srepro keeps a user-level ~/.clojure/deps.edn out of the project’s classpath.
To build a double-clickable app that needs no Java installed:
clojure -Srepro -T:build package
This makes target/dist/Cléchecs.app, about 91 MB with a trimmed Java runtime inside. An app built this way is signed only for the Mac that built it: on another Mac its first launch has to be allowed in System Settings → Privacy & Security. Releasing describes how to make one that opens anywhere.
Playing
- Drag a piece to move it, or click it and then click the square it should go to. A piece dropped where it cannot go returns to its square.
- When a pawn reaches the last rank, choose the piece it should become. Escape puts the pawn back.
- Drag on an empty part of the window to turn the board, and scroll to zoom. View → Reset View (⌘0) puts the camera back.
- The title bar says whose turn it is, the level, and the last move, or how the game ended. At the end of the game the loser’s king falls over; in a draw, both do.
- The side panel shows the pieces each side has lost and the moves so far.
The menus
| Game | |
|---|---|
| White vs. Computer | ⇧⌘W |
| Computer vs. Black | ⇧⌘B |
| Human vs. Human | ⇧⌘H |
| Computer vs. Computer | ⇧⌘M |
| Undo, Redo | ⌘Z, ⇧⌘Z |
| Hint | ⌘T |
| Show Highlights | |
| Touch-Move | |
| Open PGN…, Save PGN… | ⌘O, ⌘S |
| Copy FEN, Paste FEN | ⇧⌘C, ⇧⌘V |
| Level | |
|---|---|
| Terrible, Novice, Decent, Strong, Fierce | ⌘1 to ⌘5 |
| View | |
|---|---|
| Flip Board | ⇧⌘F |
| Reset View | ⌘0 |
Choosing one of the four ways to play starts a new game. Against the computer, Undo takes back its reply together with your move, and interrupts it if it is still thinking. In Computer vs. Computer both sides play at the selected level, and any new game stops it.
The level, the way to play, the two toggles and the window size are remembered between launches.
Show Highlights and Touch-Move
With Show Highlights on, as it is to begin with, the board marks where a picked-up piece may go, the last move, a king in check, and the move a hint suggests.

Switched off, the board is plain, like a physical one: no markings, and no hints. A piece you click rises a little, so you can see what you are holding.
Touch-Move is off to begin with. Switched on, it applies the rule of over-the-board chess: once you take hold of one of your pieces that can move, you must move that piece. You may put it down again, but you cannot pick up another.
The computer opponent
The engine is an alpha-beta search with iterative deepening, a transposition table, quiescence search, null-move pruning, late-move reductions and check extensions, over a board held in primitive arrays. On an Apple M4 it searches a little over a million positions a second. docs/engine-notes.md has the details and the measurements.
The three easy levels are named after the levels of Diamond Chess and tuned to play about as strongly as they did: in self-play against an imitation of Diamond Chess’s engine, each scored between 44 and 50 per cent over 200 games. Each level beats the one below it at least nine games in ten.
clojure -Srepro -M:dev -m clechecs.bench # search speed
clojure -Srepro -M:dev -m clechecs.ladder # the self-play ladder
How it is put together
src/clechecs/engine/ |
the board, move generation, evaluation, search, the opening book and the five levels |
src/clechecs/engine.clj |
the one door into the engine: legal moves, making a move, searching |
src/clechecs/position.clj, game.clj, notation.clj |
positions and FEN, the state of a game, algebraic notation and PGN |
src/clechecs/ui/logic.clj |
everything the app does, as one pure function from a state and an event to a new state and a list of effects |
src/clechecs/ui/board3d.clj, geometry.clj, cutout.clj |
the 3D board, its maths, and the code that cuts each drawing into a slab |
src/clechecs/ui/app.clj |
the window, the menus and the side panel |
src/clechecs/prefs.clj, main.clj |
saved settings and the entry point |
resources/clechecs/ |
the piece drawings, the opening book and the stylesheet |
dev/ |
the speed test, the self-play ladder and scripted scenarios that drive the board and the app and take pictures |
test/ |
the tests |
build.clj, package/ |
packaging and the app icon |
docs/ |
notes on the engine, what was learned while building it, the design and the plans it was built from, and screenshots |
Each piece is a single drawing. The program traces its outline, builds a slab of that shape, and puts the drawing on both faces. The white pieces are shown with the black pieces’ drawings, colours swapped, because those have the heavier lines.
Tests
clojure -Srepro -M:test -e :slow # about fifteen seconds
clojure -Srepro -M:test # everything
The tests cover:
- move generation, by perft: counting the legal move sequences from six reference positions and comparing the counts with published figures;
- the search, on mates in one, two and three, won endings, repetition, time limits and cancellation;
- the rules of a game, notation, FEN, and PGN as other programs write it;
- the app’s behaviour, event by event, since it is a pure function;
- the cutouts: that every drawing becomes a closed slab of the right shape.
The 3D board and the window have no unit tests. They are checked by scripted scenarios, which write pictures:
clojure -Srepro -M:dev -m clechecs.demo all /tmp/shots
clojure -Srepro -M:dev -m clechecs.demo app /tmp/shots
The scenario names are listed at the top of dev/clechecs/demo.clj.
Releasing
To make an app that opens on other Macs without a warning, it has to be signed with an Apple Developer ID and notarised by Apple. With a “Developer ID Application” certificate in the keychain, and notary credentials stored once with xcrun notarytool store-credentials <profile>:
clojure -Srepro -T:build release \
:identity '"Developer ID Application: Your Name (TEAMID)"' \
:notary-profile '"<profile>"'
This signs the app and the JavaFX libraries inside its jar, sends it to Apple, staples the ticket that comes back, and leaves target/dist/Clechecs-<version>-mac-arm64.zip ready to publish.
Things worth knowing before changing it
- Two JVM flags. Any JVM showing the board needs
--enable-native-access=ALL-UNNAMED, because JavaFX loads native libraries, and-Dprism.order=es2, because JavaFX 27’s default Metal pipeline on the Mac paints far pieces over near ones. The aliases and the packaged app pass both, andclechecs.mainchooses ES2 itself if the flag is missing. - The accent. The app is called Cléchecs, but every file inside the bundle has a plain name. With the accent inside, macOS fails to verify the bundle’s signature and shows a generic icon. The build makes
Clechecs.appand renames it. docs/risk-check.mdrecords these and the other things found out the hard way.
History and credits
Cléchecs was written in 2026 by Jonathan Huston, using Claude. It is the third of his chess programs to use the same pieces:
- Diamond Chess, written in Swift in 2021 for the iPad and the Mac. Cléchecs takes its ways of playing, its level names, its falling kings and its plain manner from it.
- chess, written in Icon: first in 2005 as a program that knew the rules and moved at random, and given a brain and a window in 2026.
The pieces were designed by Ella Huston for Diamond Chess, in 2021.
The evaluation uses the PeSTO piece values and piece-square tables by Ronald Friederich. The app is built on Clojure, cljfx and OpenJFX.
Licence
The code is released under the MIT licence.
The piece artwork in resources/clechecs/pieces/, the app icon made from it in package/, and the pictures in docs/ that show it are not covered by that licence: they are copyright 2021 Ella Huston, all rights reserved.