cleckers

Checkers for the Mac, built with Clojure and Humble UI

View on GitHub

Cleckers

A game of checkers for the Mac and Linux, in Dark and Light pieces on a board of black and gold. You play American checkers (English draughts) against the computer. It was built to try Humble UI, a desktop UI library for Clojure that draws everything itself with Skia: the board, the pieces and the buttons are all Humble UI components, and nothing is drawn by hand.

The Cleckers window in the middle of a game: brown and cream pieces on a black and gold board, two of them kings with crowns, one brown piece outlined in blue with a blue dot on the square it can move to, the piece counts above and the buttons below

Getting it running

To play, download the zip from the latest release, open it, and drag Cleckers to your Applications folder. It needs an Apple-silicon Mac and nothing else, since Java is inside the app, and it opens without a security warning, since the app is signed and notarised. It was built and tested on macOS 27.2; earlier versions are untested.

On Linux, download Cleckers-<version>-linux-x64.tar.gz from the same release, unpack it, and run Cleckers/install.sh. That copies the app to ~/.local/share/cleckers and adds Cleckers to the desktop’s applications, with no root access; install.sh --uninstall removes it again, and Cleckers/bin/Cleckers runs it where it is. It needs an x64 machine with X11 or XWayland and nothing else, since Java is inside. It was built and tested on Fedora 45 with GNOME; other distributions are untested.

To run it from source, you need a JDK (developed with OpenJDK 27) and the Clojure CLI (1.12.7). It was developed on an Apple-silicon Mac and also runs on Linux (x64, under X11 or XWayland), where the window’s contents are zoomed to fit the window; packaging works on both. Humble UI runs on Windows too, which has not been tried.

git clone https://github.com/jonathanhuston/cleckers.git
cd cleckers
clojure -Srepro -M:run               # the game in its window
clojure -Srepro -T:build package     # Mac: target/dist/Cleckers.app; Linux: target/dist/Cleckers/ and a tar.gz of it

The first run fetches Humble UI from GitHub at a pinned commit, and Skia’s native libraries from Maven. -Srepro keeps a user-level deps.edn out of it.

An app built this way is signed only for the Mac that built it. Releasing describes the signed build.

Playing

Dark moves first, and you play Dark unless you choose otherwise. Your side is at the bottom of the board.

Move a piece either way: drag it to the square you want and let go, or click it to pick it up and then click the square. Clicking the piece in hand again, or anywhere it cannot go, puts it down; a piece dropped somewhere it cannot go returns to its square, still in hand. A dragged piece lands at once; a clicked one slides. A multiple jump is made one hop at a time, each hop dragged or clicked: after each hop the piece waits for the next.

  Keys
New Game N or ⌘N
Undo U or ⌘Z
Show moves M

The level, your side and Show moves are remembered between launches. The game in progress and the window size are not. There is no menu bar of its own: Humble UI’s window library has none.

How it is built

   
src/cleckers/rules.clj the rules behind a small Rules protocol (start, legal moves, play, result, and the board between the hops of a jump), with American checkers as its one implementation
src/cleckers/search.clj the computer: negamax with alpha-beta pruning, deepened one ply at a time, never stopping to judge a position in the middle of an exchange
src/cleckers/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/cleckers/view.clj the window as a pure function of the state, in Humble UI components
src/cleckers/main.clj the only impure part: the state, the effects, the clock that slides a piece, saved settings, the window

A move is a path, not a square: where a piece starts, the squares it lands on, and the pieces it jumps. The rules decide what the board looks like between the hops of a multiple jump, so the rest of the program never has to know when a jumped piece leaves the board or when a crown appears.

Effects are data: start a search, cancel it, save the settings, send an event after so many milliseconds. main carries them out, so every rule of play, from a multiple jump entered hop by hop to undo during a search, is tested as a plain function, with time driven by hand. The search runs on a thread of its own, and an answer that arrives after an undo or a new game is dropped. Every change to the state is made on the window’s thread, because Humble UI’s signals are not safe to change from any other.

The board is a ui/grid of 64 squares, each a ui/mouse-listener that says when the mouse goes down on it and keeps track of which square the pointer is over. A piece is a stack of rounded ui/rects with an SVG crown for a king. A piece in motion is lifted out of the grid onto a layer above it and placed with ui/translate: a sliding piece follows a signal that a timer advances, and a dragged one follows a signal that ui/draggable sets to how far the mouse has moved. Only that one component is drawn again on each tick or movement. docs/humble-ui-notes.md says how Humble UI was to work with, and how it compares with the stacks tried before it.

Tests

clojure -Srepro -M:test

This tests the rules (including the number of positions reachable from the opening, to six plies, against the published figures), the search, the logic and the view. Humble UI can draw into a picture and take mouse events with no window, so the view’s tests draw every screen, click and drag on the real squares and buttons, and play whole games against the real search both ways.

clojure -Srepro -M:dev -m cleckers.shots     # pictures of scripted positions in docs/screenshots/
clojure -Srepro -M:dev -m cleckers.play      # whole games: clicked, dragged, and twenty computer against itself
clojure -Srepro -M:dev -m cleckers.bench     # how fast the search is
clojure -Srepro -M:dev -m cleckers.frames    # how smoothly a piece slides and drags, in the real window
clojure -Srepro -M:dev -m cleckers.dev --port 5555   # the window with a socket REPL; (cleckers.dev/reload)

Releasing

To open on other Macs without a warning, the app has to be signed with a 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 two native libraries inside its jar, sends it to Apple, staples the ticket that comes back, and leaves target/dist/Cleckers-<version>-mac-arm64.zip. That zip is what a release carries.

On Linux, package leaves target/dist/Cleckers-<version>-linux-x64.tar.gz: unpack it anywhere and run Cleckers/bin/Cleckers, or run Cleckers/install.sh, which copies the folder to ~/.local/share/cleckers and adds Cleckers to the desktop’s applications (install.sh --uninstall removes both). Java is inside it, and nothing is signed.

Things worth knowing before changing it

History and credits

Cleckers was written in December 2026 by Jonathan Huston, using Claude. It is one of a series of small board games written to try a way of building a Mac app, and this one runs on Linux too: Cléchecs (chess, with cljfx and JavaFX), Desdemona (Reversi, with Tauri and ClojureScript) and Iago (Reversi, in Racket) came before it. The colours are from his Qirkat.

The app is built on Clojure and Humble UI by Nikita Prokopov, which draws with Skija in a window from JWM. The search follows Desdemona’s.

Licence

Released under the MIT licence.