A superhuman Quoridor engine — AlphaZero-style self-play training, a batched MCTS in Rust, and a browser UI to play against it. The walls close in; hence the name.
Strength: trained entirely from self-play (no human or external-engine data), it defeats the strongest publicly playable Quoridor AIs we could find, including Ka at full search and Zero-Ink at maximum thinking time.
Zero-install option: play it right now at claustrophobia.dev — the hosted engine, plus analysis tools for reviewing your games.
Prefer to run it locally? You need: a PC with a reasonably modern NVIDIA GPU (CPU works too, just slower), ~5 GB of disk.
- Rust — install from https://rustup.rs (accept defaults).
- Python 3.10–3.12 — from https://python.org or your package manager.
Then install PyTorch (the engine links against its libtorch under the hood):
pip install torch --index-url https://download.pytorch.org/whl/cu128
(CPU-only machine? Use pip install torch instead.)
git clone https://github.com/Plaaasma/Claustrophobia.git
cd Claustrophobia
Download champion.pt from the latest release and save it as:
webapp/champion.pt
set LIBTORCH_USE_PYTORCH=1 (Windows cmd; PowerShell: $env:LIBTORCH_USE_PYTORCH="1"; Linux/mac: export LIBTORCH_USE_PYTORCH=1)
cargo build --release --features nn
First build takes a few minutes. If the build can't find torch, make sure the pip install torch above went into the same Python that's first on your PATH.
Windows (PowerShell) — the torch DLLs must be on PATH:
$env:PATH = "$(python -c 'import torch,os;print(os.path.dirname(torch.__file__))')\lib;" + $env:PATH
$env:QUORIDOR_CHECKPOINT = "webapp\champion.pt"
$env:QUORIDOR_DEVICE = "gpu" # or "cpu"
.\target\release\webserve.exeLinux / macOS:
export LD_LIBRARY_PATH="$(python -c 'import torch,os;print(os.path.dirname(torch.__file__))')/lib:$LD_LIBRARY_PATH"
QUORIDOR_CHECKPOINT=webapp/champion.pt QUORIDOR_DEVICE=gpu ./target/release/webserveOpen http://127.0.0.1:8080 in your browser. Pick a side, pick a strength (the "Opponent lvl" presets go from intuition — instant, raw-network moves — to long — deep search), and play. Leave the sims box empty to use the presets; type a number there for an exact search budget.
That's it.
| Path | What it is |
|---|---|
src/ |
The engine: bitboard game rules, batched virtual-loss MCTS (tree reuse, FPU, MCTS-solver, transposition eval cache, Gumbel root search), self-play, SPRT gating, training orchestration (tch/libtorch), TensorRT inference backend |
src/bin/webserve.rs |
The HTTP/browser server you just ran |
src/bin/play.rs |
Terminal play + analysis CLI |
src/bin/train_loop.rs |
The full AlphaZero loop: self-play → train → gated promotion |
python/ |
Network definition, distributed pretraining (pretrain_ddp.py), Weights & Biases logging bridge, opening-book generator |
webapp/ |
Browser UI + optional WebSocket bridges to third-party engines (Ka, Titanium, Zero-Ink, Ishtar) for sparring |
configs/ |
Training run configurations (kv format, every key documented inline) |
ka/ |
Harness for benchmarking against the open-source Ka engine locally |
runs/openings/ |
Opening books (model-generated and human-frequency) |
The short version (see configs/production8.kv for every knob):
# 1. (optional) pretrain on existing self-play data across 2 nodes:
python python/pretrain_ddp.py # see the file header for env vars
# 2. run the full self-play loop (starts from scratch or from a checkpoint):
./target/release/train_loop configs/production8.kvThe loop plays games against itself, trains a challenger network, and promotes it only when it beats the champion under an SPRT gate plus win-rate floors against a pool of frozen anchor networks — a defense against the self-play Elo inflation that plagues naive gated setups. An external sentinel (games vs. a fixed third-party engine) keeps the whole curve honest.
Design notes worth reading if you're building something similar: the value target mixes bootstrapped root values with discounted game outcomes (q_mix, value_discount — the discount teaches the engine to win fast, which prevents late-game shuffling), and self-play openings are seeded from a book regenerated from the current champion after every promotion.
- Rust (stable), Python 3.10–3.12, PyTorch ≥ 2.x (
LIBTORCH_USE_PYTORCH=1makes the Rust side link against pip's torch) --features nnfor everything neural;--features nn-trtadds the TensorRT backend (NVIDIA only, used for the self-play farm)- No network weights are committed to the repo — grab them from Releases
- Ka (sugiyama2718) and Titanium (titaniummachine1) — open-source opponents used for benchmarking, via the included bridges
- The AlphaZero, KataGo and Leela Chess Zero papers/projects, whose training tricks are liberally borrowed throughout
MIT — see LICENSE.