Desdemona
A game of Reversi for the Mac, played with Dark and Light stones: place a stone so that it brackets a line of your opponent’s, and they turn over to your colour. You play against the computer, against another person at the same machine, or watch the computer play itself. It was built to try Tauri 2 as the shell of a Mac app with ClojureScript as the whole of its interface.

Getting it running
To play, download the disk image from the latest release, open it, and drag Desdemona to your Applications folder. It needs an Apple-silicon Mac with macOS 13.1 or later and nothing else, and it opens without a security warning, since the app is signed and notarised.
To run it from source, you need the same Mac, and:
- Node and npm (developed with Node 26.13 and npm 11.20);
- a JDK, 21 or later (developed with OpenJDK 27), and the Clojure CLI (1.12.7);
- Rust 1.92 or later through rustup (developed with 1.100.1), and Xcode or its command line tools.
git clone https://github.com/jonathanhuston/desdemona.git
cd desdemona
npm install
npm run dev # the app in its window, with hot reload
npm run build # src-tauri/target/release/bundle/macos/Desdemona.app
The first npm run dev or npm run build compiles Tauri’s Rust crates, which takes a minute or two and leaves a few gigabytes in src-tauri/target/. npm run web runs the same page in an ordinary browser at http://localhost:8280, without the native menu.
An app built without a signing identity is signed only for the Mac that built it. Releasing describes the signed build.
Playing
Dark moves first. A move must bracket at least one line of the opponent’s stones between the new stone and one already on the board, and every stone so bracketed turns over. A side with no move passes; the game ends when neither side can move, and the side with more stones wins.
- Click a square to play there. With Show Legal Moves on, as it is to begin with, a faint dot marks each square you may play. With it off nothing marks them, not even the pointer; a legal square still takes a click.
- The buttons under the board switch each side between Human and Computer and step the level through Easy, Medium and Hard. Both sides may be Computer.
- Easy searches two plies deep (a move and the reply), Medium four, and Hard as deep as it gets in a second.
- Undo goes back to your last move, taking back the computer’s reply with it, and interrupts the computer if it is still thinking. There is no redo, and no undo when both sides are Computer.
- A pass is announced for two seconds and then played for you.
- The last stone played carries a small mark; the stones it turns over follow one after another.
| Game menu | Keys |
|---|---|
| New Game | ⌘N or N |
| Undo | ⌘Z or U |
| Dark ▸ Human, Computer | |
| Light ▸ Human, Computer | |
| Level ▸ Easy, Medium, Hard | |
| Show Legal Moves | ⌘L or L |
The plain keys N, U and L work in the browser too. ⌘Q quits.
Who plays each side, the level and Show Legal Moves are remembered between launches. The game in progress and the window size are not.
How it is built
src/desdemona/rules.cljc |
the rules behind a small Rules protocol (start, legal moves, play, over, score), with the standard rules as its one implementation |
src/desdemona/search.cljc |
the computer: negamax with alpha-beta pruning, deepened one ply at a time, after the search in the Red version (see History) |
src/desdemona/logic.cljc |
everything the app does, as one pure function from a state and an event to a new state and a list of effects |
src/desdemona/view.cljs |
the page as a pure function of the state, rendered by Replicant |
src/desdemona/main.cljs |
with menu, one of the two impure parts of the page: the state, rendering, effects, keys, saved settings |
src/desdemona/menu.cljs |
the other impure part: the native menu, built from JavaScript when the page runs inside Tauri |
src/desdemona/worker.cljs |
a Web Worker that runs the search, so the window stays live while the computer thinks |
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 the pass notice to undo during a search, is tested as a plain function, with time driven by hand.
Tauri provides the window, the native menu (through its JavaScript API) and the bundle. There is no Rust beyond what tauri init generated. Settings are kept in the web view’s localStorage, which persists between launches of the packaged app. shadow-cljs compiles the page and the worker as two modules over a shared one, and serves the page in development.
Tests
npm test
This runs the tests of the rules, the search and the logic twice, on the JVM and under node, and the view’s tests under node. The page itself is checked in WebKit, the engine of the Mac window, by scripts that need npm run web running, and Playwright’s WebKit installed once with npx playwright install webkit:
npx playwright install webkit # once
npm run shots # pictures of scripted positions in docs/screenshots/
node dev/play.mjs # plays games by clicking, against the real search
node dev/polish.mjs # the flips, the keys and the saved settings
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:
APPLE_SIGNING_IDENTITY="Developer ID Application: <Your Name> (<TEAMID>)" npm run build
The identity’s full name is listed by security find-identity -v -p codesigning. Tauri signs the app with the hardened runtime and, with no Apple ID or API key variables set, skips notarising. Before signing it runs xattr -cr on the bundle, which needs the system’s /usr/bin/xattr: if another xattr comes first on your PATH (Anaconda installs one without -r), put PATH="/usr/bin:$PATH" in front of the command.
Notarising and the disk image are not yet automated. By hand, from src-tauri/target/release/bundle/macos/, with notary credentials stored once with xcrun notarytool store-credentials <profile>:
ditto -c -k --keepParent Desdemona.app Desdemona.zip
xcrun notarytool submit Desdemona.zip --keychain-profile <profile> --wait
xcrun stapler staple Desdemona.app
spctl -a -vv Desdemona.app # expect: Notarized Developer ID
Then the disk image, with the stapled app beside a link to /Applications:
mkdir <staging> && cp -R Desdemona.app <staging>/ && ln -s /Applications <staging>/Applications
hdiutil create -volname Desdemona -srcfolder <staging> -ov -format UDZO Desdemona.dmg
codesign --sign "<identity>" --timestamp Desdemona.dmg
xcrun notarytool submit Desdemona.dmg --keychain-profile <profile> --wait
xcrun stapler staple Desdemona.dmg
spctl -a -t open --context context:primary-signature -v Desdemona.dmg
The dmg is made by hand because Tauri’s own dmg step builds the app again and would lose the staple. Version 0.1.0 was released this way on 3 December 2026; the results are in docs/risk-check.md. The image is not in the repository: it is built into release/, which git ignores, and published on the releases page.
Things worth knowing before changing it
- Keep it runnable in a browser. Every Tauri call sits behind
isTauri(), sonpm run webis the fast loop and the one Playwright can drive. - The Mac window is WebKit. Check layout and animation in WebKit. Playwright’s WebKit
page.screenshotignoresbackface-visibilityand shows every stone Light side up;dev/shots.mjsuses screencast frames instead. - macOS 13.1 or later, because the stylesheet uses
color-mix. - A rules variant goes in as a second implementation of the
Rulesprotocol, registered inrules/by-id. The search’s evaluation would need thought for it; the view and the shell should not change. - A user
~/.clojure/deps.ednleaks into shadow-cljs, which runsclojurewithout-Srepro. Harmless here; the JVM tests use-Srepro. docs/risk-check.mdrecords these and everything else found out the hard way.
History and credits
Jonathan Huston first wrote the game in Red in 2019 (begun at the end of 2018), as othello.red, and rewrote it there in 2026 with a dark theme and a negamax opponent. Desdemona, written in 2026 using Claude, is the same game as an experiment in building a Mac app with Tauri and ClojureScript. Its search and its table of square weights come from the Red version.
The app is built on Tauri, ClojureScript, shadow-cljs and Replicant.
Licence
Desdemona is released under the MIT licence.