Data Formats Reference
JSON schemas for positions, moves, and search/hint options—used consistently across the CLI (--state, --json, serve), WebAssembly/JS, Python, and C ABI.
Position (StateData)
A position keyed by group name. Each group is a list of piles, each pile a list of cards bottom first, written like "AS", "10H" or "~KC" (face down).
json { "piles": { "tableau": [["~5H", "KS"], ["QD"]], "foundation": [[], [], [], []] } }
Groups left out are empty.
| Field | Type | Default | Description |
|---|---|---|---|
aux | array | null | — | The counters of games with counter rules. Left out, they start at the game's initial values. |
base_rank | integer | null | — | |
piles (required) | Record<string, string[][]> | — | |
redeals_used | integer | — | |
seed | integer | — | Seed for shuffles during play (shuffling redeals). Part of the deal. |
Move / Action (Step)
One step of a solution, as a player would make it. Automatic actions (turning up exposed cards, refilling from a reserve) follow each step and aren't listed.
{ "type": ... }("deal") — Deal from the stock.{ "type": ... }("redeal") — Turn the waste back over to form a new stock.{ "count", "from", "to", "type": "move" }— Movecountcards from the top offromontoto.
| Field | Type | Default | Description |
|---|---|---|---|
count (required) | integer | — | |
from (required) | PileRef | — | |
to (required) | PileRef | — | |
type (required) | "move" | — |
{ "piles", "type": "remove" }— Remove the top cards of these piles.
| Field | Type | Default | Description |
|---|---|---|---|
piles (required) | PileRef[] | — | |
type (required) | "remove" | — |
{ "from", "index", "to", "type": "pick" }— Move the single card at positionindex(0 = bottom) offromontoto.
| Field | Type | Default | Description |
|---|---|---|---|
from (required) | PileRef | — | |
index (required) | integer | — | |
to (required) | PileRef | — | |
type (required) | "pick" | — |
{ "from", "to", "type": "deal_secondary" }— Deal one card from a secondary stockfromontoto.
| Field | Type | Default | Description |
|---|---|---|---|
from (required) | PileRef | — | |
to (required) | PileRef | — | |
type (required) | "deal_secondary" | — |
{ "from", "to", "type": "extract" }— Take the second card from the top offromand put it onto, leaving the top card.
| Field | Type | Default | Description |
|---|---|---|---|
from (required) | PileRef | — | |
to (required) | PileRef | — | |
type (required) | "extract" | — |
PileRef
A pile, named by its group and its index within the group (from 0).
| Field | Type | Default | Description |
|---|---|---|---|
group (required) | string | — | |
index (required) | integer | — |
Search Options (SolveOptions)
Search limits and knobs.
| Field | Type | Default | Description |
|---|---|---|---|
autoplay | boolean | true | Play provably safe foundation moves automatically (when the rules allow it). |
max_states | integer | 2000000 | Stop after visiting this many distinct positions. |
shorten | boolean | true | Shorten winning lines by cutting out detours (default true). |
strategy | Strategy | "auto" | |
timeout_ms | integer | null | — | Stop after this many milliseconds of wall-clock time (native targets only). |
Strategy
Search strategy.
"depth_first"— Depth-first, heuristic ordering. Can prove unsolvability."best_first"— Best-first by heuristic. Can also prove unsolvability, at a higher memory cost."auto"— Best-first for a share of the budget, then depth-first with the rest.
Hint Options (HintOptions)
Hint settings.
| Field | Type | Default | Description |
|---|---|---|---|
max_candidates | integer | 3 | Maximum ranked candidates returned by [hints] (default 3). |
samples | integer | 16 | Random guesses at the hidden cards (ignored when nothing is hidden). |
seed | integer | 0 | |
solve | SolveOptions | standard default | Search options for each guess. Its max_states is the budget for each guess. |
SolveOptions
Search limits and knobs.
| Field | Type | Default | Description |
|---|---|---|---|
autoplay | boolean | true | Play provably safe foundation moves automatically (when the rules allow it). |
max_states | integer | 2000000 | Stop after visiting this many distinct positions. |
shorten | boolean | true | Shorten winning lines by cutting out detours (default true). |
strategy | Strategy | "auto" | |
timeout_ms | integer | null | — | Stop after this many milliseconds of wall-clock time (native targets only). |
Strategy
Search strategy.
"depth_first"— Depth-first, heuristic ordering. Can prove unsolvability."best_first"— Best-first by heuristic. Can also prove unsolvability, at a higher memory cost."auto"— Best-first for a share of the budget, then depth-first with the rest.