CLI Reference
Looking for task-oriented examples? See CLI & Scripting How-to.
Install via Cargo (cargo install dealbreaker-cli) or download a pre-built binary from GitHub Releases.
Usage & Flags (dealbreaker --help)
text
dealbreaker: solve patience (solitaire) games
USAGE:
dealbreaker list
dealbreaker rules <GAME>
dealbreaker validate <GAME> [--state FILE] [--json]
dealbreaker deal <GAME> [DEAL]
dealbreaker solve <GAME> [DEAL] [SEARCH] [--json]
dealbreaker hint <GAME> [DEAL] [SEARCH] [--samples N] [--json]
dealbreaker replay <GAME> [DEAL] --steps FILE [--legal] [--json]
dealbreaker best <GAME> [DEAL] [SEARCH] [--json]
dealbreaker grade <GAME> [DEAL | --seeds A..B [--microsoft]] [--playouts N] [--cutoffs E,M] [--jobs N] [SEARCH] [--json] [--verbose]
dealbreaker bench <GAME> --seeds A..B [--microsoft] [--best] [--jobs N] [SEARCH] [--json] [--verbose]
dealbreaker serve <GAME> [--search JSON]
dealbreaker --version
`validate` checks that a rules file (and optional `--state` JSON) is valid.
`replay` plays a list of steps (a JSON array, or `solve --json` output) from a deal and prints
the position after each one; `--legal` adds every legal step at each position.
`best` finds the highest score for games played for points; `bench --best` reports scores.
`serve` loads GAME once, reads one JSON request per line from stdin (`deal`, `solve`, `best`,
`hint`, `hints`, `grade`, `find_deal`, `safe_steps`, `autocomplete`, `describe_step`,
`describe_steps`, `last_winnable`, `legal_steps`, `play_step`, `validate`, `is_won`, `score`,
`rules`, `quit`), and writes one JSON response line per request to stdout.
GAME is a preset id (see `list`), a path to a rules JSON file, or `-` for stdin.
DEAL (default: --seed 1):
--seed N deal from a seed
--ms N Microsoft FreeCell deal number (FreeCell-layout games)
--state FILE a position as JSON (`deal` prints the format; `-` for stdin)
SEARCH:
--max-states N budget of distinct positions (default 2000000)
--timeout-ms N wall-clock time limit in milliseconds
--strategy S auto | dfs | best-first (default auto)
--no-autoplay don't play safe foundation moves automatically
--no-shorten don't shorten winning lines (faster when only solvability matters)
--search JSON override the game's search hints, e.g. '{"blocker_weight": 4}'
(speed only: verdicts never change)JSONL Stdio Server (dealbreaker serve)
dealbreaker serve <GAME> compiles the game once and processes one JSON request per line on stdin, writing one JSON response line per request to stdout (echoing any optional "id" field).
Command (cmd) | Request Fields | Response (ok: true) |
|---|---|---|
rules | — | rules |
deal | seed | ms | cards | state |
validate | state | — |
solve | state, options? | outcome, states, steps? |
best | state, options? | score, proven, states, steps |
hint | state, options? | hint (or null) |
legal_steps | state | steps |
play_step | state, step | state |
is_won | state | won |
score | state | score (or null) |
quit | — | closes stdin loop |
Errors return {"ok": false, "error": "..."}.