Rules Schema Reference
Looking for a guided walkthrough instead? Start with the Build a Custom Game tutorial.
This page is auto-generated from docs/schemas/rules.schema.json. Add "$schema" to the top of any game JSON file for live autocomplete and validation in VS Code or JetBrains:
{
"$schema": "https://raw.githubusercontent.com/samdobson/dealbreaker/main/docs/schemas/rules.schema.json",
"name": "My Game",
"groups": [ ... ]
}Top-Level Rules Object
A complete description of one solitaire game.
| Field | Type | Default | Description |
|---|---|---|---|
$schema | string | — | Optional JSON Schema URI for editor validation (ignored by the solver). |
auto_flip | boolean | — | Turn up a face-down card when it becomes the top of an uncovered pile. Default true. |
aux | AuxRules | null | — | Two general-purpose counters that rules can update on events and test in conditions (see [AuxRules]). Games that use them are never auto-played or talon-compressed. |
choose_base | ChooseBase | null | — | Opening choice of the foundation base rank: before a base rank is set, only a single-card move from this group to a foundation is legal, and its rank becomes the base rank. |
deal | DealStep[] | — | The opening deal, step by step. Cards come off a shuffled pack. |
deck_first | CardRef[] | — | Cards put on top of the shuffled pack before dealing, in the order they are dealt (Royal Marriage: the queen of hearts first). Only for seeded deals. |
deck_last | CardRef[] | — | Cards put at the bottom of the shuffled pack before dealing, in the order they are dealt (Royal Marriage: the king of hearts last). Only for seeded deals. |
deck_last_rank | integer | null | — | Move the first card of this rank in the shuffled pack to the bottom, so it is dealt last. Only for seeded deals. |
extract_second | ExtractSecond | null | — | A move that takes the second card from the top of a pile (see [ExtractSecond]). |
groups (required) | GroupRules[] | — | The piles on the table, in groups of identical piles. |
latch_group | string | null | — | A latch that a move from the stock pile resets: afterwards it is set if the stock is empty or no pile of this group is empty, and clear otherwise. Removals with needs_latch work only while it is set (Camelot: pairs come off only once the grid is full or the stock is out, and the latch stays set until the next card is played from the stock). |
name (required) | string | — | Human-readable name, e.g. "FreeCell". |
pack | Pack | — | |
redeal | RedealRules | null | — | Gathering the tableau and dealing it out again, as a player action (Cruel, La Belle Lucie, Montana). Can't be combined with stock. |
removal | RemovalRules[] | — | Card-removal mechanics, for games that discard cards instead of (or as well as) building. One object or a list. |
rounds | RoundRules | null | — | Rounds of cribbage play: hands discard to a crib, a starter is turned, and the points add up across rounds (see [RoundRules]). Needs stock rules. |
safe_autoplay | boolean | — | Let the solver play cards to foundations automatically when it can prove nothing could ever need to be built on them. Sound for in-suit foundations; default true. |
score | ScoreRules | null | — | Points for the position, for games played for a score (Poker Squares). |
search | SearchHints | — | Tuning for the solver's heuristic. Changes how fast a win is found, never whether a position is judged winnable. |
separate_decks | boolean | — | Shuffle each copy of the pack on its own, so one whole pack is dealt before the next (Microbe). Only for seeded deals. |
stock | StockRules | null | — | How the stock deals. Needs a group of kind stock. A stock without these rules only feeds refills (refill_from). |
win | WinRule | — |
Definitions
Pack
The cards in play.
| Field | Type | Default | Description |
|---|---|---|---|
copies | integer | — | Copies of each (suit, rank) card. Two-pack games use 2; one-suit Spider uses 8. |
jokers | integer | — | Jokers in play, in all (not per copy). Jokers are wild: see [GroupRules::wild], [RemovalKind] and [Hands] for what they stand for where. |
ranks | integer[] | — | Ranks in use, in sequence order: building goes from each rank to the next one in this list. Default [1..=13] (ace low). Aces high is [2, 3, …, 13, 1]; a stripped pack leaves ranks out. |
suits | Suit[] | — | Suits in use. Default: all four. |
Suit
A suit of the French pack.
"clubs""diamonds""hearts""spades"
Color
Red or black.
"red""black"
GroupRules
One group of identical piles.
| Field | Type | Default | Description |
|---|---|---|---|
accept_any_on_single | boolean | — | When the destination pile holds a single card, accept any single card regardless of build rules. |
accept_first_round_only | boolean | — | This group accepts cards only while redeals_used == 0. |
accept_on_face_down | boolean | — | A pile whose top card is face down takes any cards at all (Blind Patience). |
accept_only_when_empty | boolean | — | Accept cards only when the destination pile is empty (even if build is set for moving runs). |
accept_when_piles_full | PilesFull | null | — | Cards are accepted only while the listed piles of another group are all full. |
accept_when_same_index_empty | string | null | — | Pile i of this group accepts cards only while pile i of the named group is empty, except cards coming from that very pile (the groups must have the same pile count). |
accept_when_stock_empty | boolean | — | Accept cards only when the stock pile is empty. |
accept_when_waste_empty | boolean | — | Accept cards only when the waste pile is empty as well (with accept_when_stock_empty: Zodiac's foundations wait until the whole deal is played). |
accept_whole_from_group | boolean | — | Cards from piles of this same group are taken only as the whole pile (Dutchess). |
accepts_from | array | null | — | Only cards coming from these groups are accepted (default: any group). |
auto_foundation_rank | integer | null | — | Whenever the top card of a pile of this group is face up and of this rank (1 = ace), play it to the first foundation that takes it, whatever that foundation's other conditions (Strategy +: aces leave the talon by themselves). Rank 0 means any rank (Q.C.: every waste card that fits a foundation goes there). |
build | Build | null | — | What may be placed on a pile's top card. Default: foundations build up in suit; every other kind accepts nothing on a non-empty pile. |
clear_same_rank | boolean | — | With clear_when_full: clear only when every pile's bottom card has the same rank (Foursome's four reserves). |
clear_tops | ClearTops | null | — | See [ClearTops]. |
clear_when_full | string | null | — | As soon as every pile of this group holds a card, move all their cards to the first pile of the named group (Elevens' reserves going to the discard). |
color | Color | null | — | Piles accept only cards of this colour. |
compact | boolean | — | Keep the group packed: whenever a pile empties, the piles after it slide forward. |
compact_face_up | boolean | — | When a pile in this group becomes empty, shift the movable face-up run from the next pile into it, leaving any face-down cards behind. |
compact_when_stock_empty | boolean | — | With compact: close gaps only once the stock is empty; until then they are refilled from it (Quatorze). |
complete_runs | boolean | — | Foundation only accepts a whole suit sequence at once, moved together (Spider). |
count | integer | — | |
cyclic_ranks | boolean | — | The bottom cards of this group's piles must always have different ranks forming one run of consecutive ranks that may wrap round the pack (Triple Alliance's reserves). |
dropdown | boolean | — | With a covers layout: a pile covered by one pile only may take that whole pile at once even while it is covered, if the cards build on it (Interlock's drop-down move). |
empty | EmptyRule | null | — | What an empty pile accepts. Default: foundations take the pack's first rank; tableaux and cells take any card; reserves, stock and waste take none. |
empty_accepts_from | array | null | — | Only cards coming from these groups are accepted onto an empty pile (default: same as accepts_from). |
empty_match_suit_of | string | null | — | Empty pile i of this group accepts cards only while pile i % other.len() of the named group is non-empty and the incoming card's suit matches that pile's bottom card's suit. |
empty_max_accept | integer | null | — | Most cards that may be placed onto an empty pile in one move. Default: same as max_accept. |
empty_needs_first_full | boolean | — | Empty piles of this group take nothing until the group's first pile is full (The Plot's foundations after the first). |
empty_needs_group_empty | string | null | — | Empty piles take cards from the waste only while every pile of this named group is empty (Dutchess: an empty row takes a waste card once the reserves are gone). |
empty_open_after_bases | integer | null | — | With an empty rule of one rank: once this many piles of the group start with a card of that rank, empty piles accept any card (Scorpion Towers). |
empty_open_when_full | string | null | — | Empty piles take any card once the first pile of the named group is full (The Plot: once the first foundation holds a whole suit the empty rows are open). |
empty_requires_same_index_non_empty | string | null | — | Empty pile i of this group accepts cards only while pile i % other.len() of the named group is non-empty. |
empty_suit | Suit | null | — | Empty piles accept only cards of this suit (non-empty piles follow build as usual). |
even_segments | integer | null | — | In a grid of single-card piles, an empty cell accepts a card only if at least one of its eight neighbours is occupied, no two cards of rank >= separator_from are orthogonally adjacent, and every completed orthogonal run of cards with rank < separator_from (bounded by separators or grid edges, with no empty cells inside) has an even rank sum. |
exclude_suit | Suit | null | — | Piles accept no card of this suit, and nothing may be built on one. |
face_down_while_same_index_non_empty | string | null | — | The top card of pile i in this group is kept face down while pile i of the named group is non-empty, and face up otherwise (overrides no_flip). |
final_from_same_index | string | null | — | When a pile is one card shy of max_cards, its final card must come from the pile at the same index within this group (overriding accepts_from). |
first_round_bans | FirstRoundBan[] | — | While no redeal has happened yet, these bans apply. |
fission_shift | boolean | — | When a move empties pile i in this grid group, count contiguous non-empty piles directly above i (k piles) and shift the bottom k / 2 of them down by one row. |
flip_after_prev_empty | boolean | — | A face-down top card turns up only once the previous pile of this group is empty (the first pile always qualifies). |
flip_only_last | boolean | — | Only automatically turn a pile's face-down top card face up when it is the sole card left in the pile. |
flip_when_all_at_most | integer | null | — | Only turn a face-down top card up once every pile of this group holds at most this many cards (Striptease: the turned card waits until the reserves are down to two). |
flip_when_any_empty | string | null | — | A face-down top card turns up only while some pile of the named group is empty. |
flip_when_dealt_out | boolean | — | A face-down top card is turned up only once the stock and the waste are both empty (Last Chance's reserve). |
flip_when_same_index_full | string | null | — | Auto-flip the top card of pile i in this group once pile i of the named group reaches its max_cards capacity (overrides no_flip). |
flip_when_same_index_non_empty | string | null | — | Auto-flip the top card of pile i in this group once pile i of the named group is non-empty (overrides no_flip). |
flush_at_len | FlushAtLen | null | — | See [FlushAtLen]. |
freeze_when_built | boolean | — | A pile holding max_cards cards that all follow its build rule is closed: no card may be moved from it. |
from_pile_map | FromPileMap | null | — | See [FromPileMap]. |
from_pile_sets | FromPileSets | null | — | See [FromPileSets]. |
from_requires_left_empty | boolean | — | Only accept a card from a pile p in a grid group (with cols columns) when p % cols > 0 and pile p - 1 in that same source group is empty. |
joker_anywhere | boolean | — | A joker (or a unit starting with one) may be placed on any pile of this group, empty or not, whatever the build and empty rules say. Capacity limits still apply, and nothing else is let onto a joker by this. |
joker_bomb | boolean | — | Moving a joker off the top of a pile of this group sends every card left in that pile, face down, back to the stock, which is then reshuffled (deterministically from the game's seed). Needs a stock. |
joker_only | boolean | — | This group takes jokers only; no real card is ever admitted. |
kind (required) | PileKind | — | |
layout | Layout | null | — | For piles that overlap (Pyramid, TriPeaks): which piles cover which. |
lock_build_dir | boolean | — | When build.dir is either, the first two-card pile in this group locks the build direction (up or down) for every pile in the group. |
lock_pile_dir | boolean | — | When build.dir is either, each pile locks its own build direction (up or down) once it holds two cards. |
match_depth_suit | boolean | — | When placing a card onto pile dst at depth k = dst.len(), require its suit to match other[k] for every pile other in this group with other.len() > k. |
match_longest_rank | boolean | — | A pile with fewer cards than the longest pile in this group only accepts a card whose rank matches the card at the same index in the longest pile. |
max_accept | integer | null | — | Most cards the pile accepts in one move. Default: 1 for foundations (a whole suit for complete_runs), unlimited otherwise. |
max_cards | integer | null | — | Most cards the pile may hold. Default: 1 for cells, unlimited otherwise. |
max_same_rank | integer | null | — | Most consecutive face-up cards of the same rank allowed at the top of a pile. |
min_accept | integer | null | — | Fewest cards accepted in a single move onto a pile of this group. |
min_accept_len | integer | null | — | A pile in this group accepts cards only when it already holds at least n cards. |
min_cards | integer | null | — | Fewest cards that must remain on the pile (cards at or below this depth cannot leave). |
move_face_down_top | boolean | — | A face-down top card may be moved: it turns face up as it goes (Blind Patience, where the player turns a card over by hand and then plays it). |
move_from_frontier | Frontier | null | — | Cards may leave only the first or last non-empty pile of this group. |
move_runs_by | Build[] | — | With moves: run: cards leave a pile as a run only if each adjacent pair fits at least one of these builds, instead of the pile's own build (which then governs only what the pile accepts). Without jokers. |
moves | MoveUnit | null | — | Which cards may leave a pile. Default: one card for tableaux, cells, reserves and the waste; none for foundations and the stock. |
moves_when_any_empty | string | null | — | Cards may leave piles of this group only once at least one pile in the named group is empty. |
moves_when_group_cards_at_least | array | null | — | Cards in this group may only be moved out when the total number of cards across all piles of the named group is at least n. |
moves_when_same_index_empty | string | null | — | Cards may leave pile i of this group only once pile i of the named group is empty. |
moves_when_slice_empty | string | null | — | Cards may leave pile i of this group only once every pile of the i-th equal slice of the named group is empty (that group's pile count must be a multiple of this group's). |
moves_when_stock_empty | boolean | — | Cards may leave piles of this group only once the stock pile is empty. |
name (required) | string | — | Name used in deal steps, solutions and states, e.g. "tableau". |
no_build_single_while_stock | boolean | — | While the stock is non-empty, forbid building onto a single-card pile in this group and forbid moving a card from a single-card pile in this group onto another non-empty pile of this group. |
no_flip | boolean | — | Never automatically turn face-down cards in this group face up (cards may still be drawn face up by refill_from). |
no_jokers | boolean | — | This group rejects jokers (even on empty piles). |
non_empty_max_accept | integer | null | — | Maximum cards accepted in a single move onto a non-empty pile of this group. Defaults to max_accept. |
one_way_split | integer | null | — | Piles of this group from this index on take nothing from the piles of this group before it (Club: the three top rows never give to the lower eight). |
pair_flush | PairFlush[] | — | When a pile of this group holds exactly two cards whose bottom card has one of the listed ranks, both go at once to the pile of another group that belongs to the bottom card's suit. See [PairFlush]. |
piles | PileOverride[] | — | Different rules for particular piles of the group (Calculation's foundations, each building by a different step from a different base). |
push_off_bypasses_accept | boolean | — | With push_off_to: the pushed-off card is placed on its destination pile by the push-off itself, so the destination's own acceptance limits do not apply to it. The destination is still checked for its build rule, empty rule, capacity (max_cards) and availability, but not for accepts_from/empty_accepts_from membership or max_accept/empty_max_accept/ non_empty_max_accept. This lets a destination refuse direct moves from this group while still receiving pushed-off cards. |
push_off_to | string[] | — | Moving a single card onto a non-empty pile to of this group pushes to's top card to the first accepting pile among these groups (tried in order) before placing the moved card. |
rank_sequence | integer[] | — | Fixed sequence of ranks required at each pile depth (index 0 for the bottom card, index 1 for the second, etc.). Replaces the rank check of empty and build.dir; build.by, suit, empty_suit, color, and max_cards still apply. |
reach | array | null | — | A pile accepts cards only from piles of its own group exactly this many places after it (Accordion: 1 and 3). |
reach_both_ways | boolean | — | With reach: also accept from piles this many places before the destination pile. |
reach_grid | boolean | — | With reach on a grid layout: a distance of one place only counts within a row (so a pile does not reach round the end of a row). With distances of one and the row length the piles reached are the four neighbours (Rectangular Rovers). |
refill_count | integer | null | — | Cards moved per automatic refill from refill_from (default 1). |
refill_divert_ranks | integer[] | — | When a pile is refilled from another group, a card of these ranks that a foundation takes goes there instead, and the next card is taken (Intelligence's aces). |
refill_first_face_down | boolean | — | When refilling an emptied pile from the stock with refill_count > 1, deal the first card face down unless it is the last card in the stock, and the remaining cards face up. |
refill_from | string[] | — | When a pile in this group empties, refill it automatically with the top card of the first non-empty pile of these groups, tried in order (Canfield's tableau from its reserve; many games from the waste, then the stock). Stock cards are turned face up. Groups to try in order; a group name or a list. |
refill_group_on_leave | LeaveRefill | null | — | When a move takes the last card from a pile of this group, every empty pile of another group is refilled from the stock. See [LeaveRefill]. |
refill_largest | boolean | — | When refilling from a multi-pile group in refill_from, take from the pile with the most cards (ties broken by lowest index) rather than the first non-empty pile. |
refill_nearest | boolean | — | When refilling an emptied pile from refill_from, take from the pile at index i % m within the source group (where m is the source group's size), falling back to the nearest non-empty pile (+1, -1, +2, -2, ...). |
refill_on_empty | boolean | — | Refill a pile in this group only when a move just emptied it, rather than also filling pre-existing empty piles when a refill source later receives a card. |
refill_same_index | boolean | — | When refilling an emptied pile from refill_from, take from the pile at the same index within the source group rather than the first non-empty pile. |
refill_self_on_leave | boolean | — | Whenever cards leave a pile of this group, the pile is topped up at once with the stock's top card, face up (if the stock has any), even when cards are left in it. |
refill_when_empty | string | null | — | Refill emptied piles only while every pile of the named group is empty (Elevens Too: rows are refilled only when the reserves are empty). |
refill_when_stock_at_most | integer | null | — | Refill empty piles of this group only while the stock pile holds at most this many cards. |
repeat_rank | integer | null | — | A pile takes this many cards of one rank in a row, then goes on to the next rank of the pack, wrapping round (Four by Four). Use with build: any/any so nothing is ruled out before the pile itself is looked at. |
replace_on_drop | string | null | — | When a card is placed on a non-empty pile of this group, first move the destination pile's existing cards to this group's first pile. |
require_valid_base | boolean | — | Only allow building onto a non-empty pile if its bottom card satisfies the pile's empty rule. |
requires_prev_non_empty | boolean | — | Each pile after the first may only be started (while empty) once the previous pile in the group is non-empty. |
requires_rank_on_prev | boolean | — | Each pile after the first only accepts a card whose rank is already present on the previous pile in the group (when empty, it must match the previous pile's bottom card). |
requires_same_index_groups_non_empty | string[] | — | Pile i of this group accepts cards only while pile i % other.len() is non-empty in every listed group. |
requires_same_index_non_empty | string | null | — | Cards may be added to pile i of this group only once pile i of the named group is non-empty (the groups must have the same pile count). |
row_start | integer | null | — | For a win by rows on a group whose empty rule is not after_left: the rank each row starts with (Rectangular Rovers). |
run_len | integer | null | — | With complete_runs: how many cards make a complete run (default: the number of ranks). Simplex: four of a kind. |
run_must_fit_build | boolean | — | A run of several cards put on a pile of this group must also be a valid run under that pile's own build rule (a descending run cannot go on a pile that builds up). |
same_rank_group | boolean | — | Every non-empty pile in this group must have the same rank on its bottom card as the others (Tens' reserves). |
same_suit_group | boolean | — | Every non-empty pile in this group must have the same suit on its bottom card as the others (Suit Elevens' reserves). |
secondary_stock | SecondaryStock | null | — | For a single-pile source group: deals one card face up onto to[0] via a dedicated action. |
spill_when_hollow | boolean | — | When a move leaves a pile of this group holding exactly one card fewer than the group has piles, all of them face down, those cards are turned up one by one and each goes onto a different one of the other piles (in order). The pile is then dealt one face-down card per other pile from the stock, then one more face up, as far as the stock lasts. |
staged_empty | StagedEmpty | null | — | Empty piles open sequentially in suit-mirrored columns with lowest-rank and no-existing-build guards. See [StagedEmpty]. |
staging | Staging | null | — | A holding pile whose cards are cleared as a set once their total comes right (the reserve in games that discard card combinations). See [Staging]. |
suit | Suit | null | — | Piles accept only cards of this suit. |
sum_limit | SumLimit | null | — | Cards are added only while the pile's total stays within a target (Ladybug's rows). |
supermove_complete_run | boolean | — | With moves: supermove, also allow moving a complete suit-length built run regardless of empty cells and columns. |
swap_bases | SwapBases | null | — | When set, moving from one pile of this group onto another may swap the two piles instead of building. |
swap_on_waste_match | Adjacency | null | — | A card on a pile of this group may move only while it is the same card (suit and rank) as the face-up top card of the waste, and then it swaps places with another single-card pile of the group under this adjacency (a grid group). After a swap the stock acts as if the player had dealt, or turned the waste back if that is all it can do; if it can do nothing, the waste's top card is turned face down and no card can move again. Needs a waste-dealing stock; give the group moves: none and accepts_from: [] so the ordinary rules offer nothing. The piles are not interchangeable. |
tiered_set | TieredSet | null | — | Piles built in tiers on their first face-up card, one card at a time, and cleared once four cards are face up. See [TieredSet]. |
unique_ranks | boolean | — | No two non-empty piles in this group may share the same rank on their bottom card (Elevens' reserves). |
unique_suits | boolean | — | No two non-empty piles in this group may share the same suit on their bottom card. |
unrestricted_from | array | null | — | Cards coming from these groups are accepted onto empty or non-empty piles without checking build or empty rules (capacity limits still apply). |
wild | boolean | null | — | Jokers are wild on these piles: a joker stands for any card that would be legal where it lies. It may be placed wherever some card could be (by the build rule, or the empty rule on an empty pile), and a card may be built on it if it could be built on some card the joker could stand for, given the cards beneath it. The joker's stand-in is never fixed: it is whatever keeps the pile legal. Where jokers aren't wild, a joker can only go to an empty pile that takes any card, and nothing is built on it. Default: wild everywhere but foundations. |
wild_permissive | boolean | — | Permissive jokers: a joker may be placed onto any non-empty face-up pile in this group (even if the top card is in blocked_ranks), and any card or movable run may be placed onto a pile whose top card is a joker (ignoring build rank/suit/color constraints). |
PileKind
What a group of piles is for. The kind sets defaults and tells the solver how to treat it.
"tableau"— Main playing piles."foundation"— Where cards are built to win (or discarded to, in removal games)."cell"— Free cells: hold one card each by default."reserve"— Cards that may be played from but not onto."stock"— The face-down stock. At most one pile."waste"— Where the stock deals to. At most one pile.
Build
How cards are built on one another.
| Field | Type | Default | Description |
|---|---|---|---|
blocked_ranks | integer[] | — | Nothing may be built on cards of these ranks (Golf: kings). |
by (required) | BuildBy | — | |
dir | Dir | "down" | |
extra_over | any[][] | — | (under, over) rank pairs that also build, in that order only, whatever the direction (Napoleon's Tomb: a six goes on an ace). |
extra_pairs | any[][] | — | Pairs of ranks that also build on each other, in either order, whatever the direction (Striptease: jack and king). |
gap_ranks | integer[] | — | With a stripped pack: ranks that are not adjacent to the pack rank just below them (an ace-and-7-to-king pack: [7]). Applies to step 1 builds. |
not_over | any[][] | — | (under, over) rank pairs that never build, in that order, though the step would allow them (an ace never goes on a three in a step-2 build). |
step | integer | — | Ranks between consecutive cards (default 1). |
suit_cycle | Suit[] | — | With by: suit_cycle: the suits in the order they follow each other. |
suit_steps | any[][] | — | Per-suit override of step, keyed by the suit of the lower card (the build step of a suit-matched build differing by suit). Suits not listed use step. |
wrap | boolean | — | The sequence wraps: king to ace and ace to king. |
BuildBy
The suit or colour relation between a card and the card placed on it.
"none"— Nothing may be built."any"— Any suit."suit"— Same suit."alternate"— Alternate colours."same_color"— Same colour."other_suit"— Any suit but the same one."suit_or_rank"— The same suit or the same rank (Accordion; pair withdir: any)."suit_or_same_rank"— Same rank of any suit, or same suit followingdir."suit_cycle"— The suit that follows the one below inBuild::suit_cycle(Following: spades, hearts, clubs, diamonds, and round again)."rank_suit_color"— A card goes on another of the same suit that is one rank below it, on one of the same colour and another suit that is one rank above it, or on one of the same rank and the other colour; ranks wrap round the pack (Sticko).diris ignored."suit_chain"— A chain through every suit: a card goes on another of the same suit that is one rank below it, except that the first rank goes on the last rank of the suit before it inBuild::suit_cycle. Needsdir: upandwrap.
Dir
Rank direction from a card to the card placed on it.
"down"|"up""either"— Up or down."same"— Same rank."any"— Any rank at all (a pile that takes anything, subject toby)."up_any"— Any strictly higher rank in the pack's rank sequence (no wrap)."down_any"— Any strictly lower rank in the pack's rank sequence (no wrap)."down_or_same"— Same rank or one step down."double_up"— The card's position in the pack's ranks is double the one below it, plus one, modulo the number of ranks (Doublets: A 2 4 8 3 6 Q J 9 5 T 7 A)."mirror"— The card's position in the pack's ranks mirrors the one below it: the first on the last, the second on the second last, and so on (Eiffel Tower: A on K, 2 on Q, 7 on 7).
EmptyRule
What an empty pile accepts.
"none"— Nothing."any"— Any card (or any movable unit).{ "rank": ... }(integer) — Only a card of this rank (13 for "kings only").{ "ranks": ... }(integer[]) — Only a card whose rank is in this list (e.g.[1, 13]for Ace or King)."dealt_base"— Only a card of the rank turned up by the deal (Canfield). See [DealStep::set_base].{ "dealt_base_offset": ... }(integer) — Only the card this many places after the rank turned up by the deal, going round the pack's ranks:-1is the rank below the base (Penguin's columns, which take the card that would sit under the foundations' base). See [DealStep::set_base].{ "after_left": ... }(object) — In a grid: a card that could be built (by this pile's build rule) on the top card of the pile to the left; in the first column, a card of rankfirst(Montana's gaps).{ "after_neighbor": ... }(object) — In a grid: like [EmptyRule::AfterLeft], or a card that the top card of the pile to the right (if any) could be built on. Whenfirst == 0, column 0 has no fixed base rank and only accepts a card matching its right neighbour.{ "after_pile": ... }(object) — A card whose rank isoffsetplaces after the top card of the pile at the same index ingroup, wrapping around the pack's rank sequence."same_base"— Any card if every pile in this group is empty; otherwise only a card matching the bottom card's rank of the first non-empty pile in this group.{ "after_ring": ... }(object) — In a ring of piles (the group's last pile is followed by its first): a card that could be built on the top card of the pile before it, or a card that the top card of the pile after it could be built on (Maze).left_extralists(under, over)rank pairs, of any suit, that also let a card go after the pile before it (Maze: an ace after a queen).{ "after_pile_bottom": ... }(object) — A card whose rank isoffsetplaces after the bottom card ofgroup[pile], wrapping around the pack's rank sequence (rejects ifgroup[pile]is empty).{ "except_ranks": ... }(integer[]) — Any card whose rank is not in this list.
MoveUnit
Which cards may leave a pile together.
"none"— No card may leave."top"— The top card only."run"— Any built sequence (by this group's build rule) from the top."suit_run"— Any built sequence from the top whose cards are all one suit (Spider)."any_face_up"— Any number of face-up cards from the top, built or not (Yukon)."supermove"— A built sequence, as long as free cells and empty piles would allow moving it one card at a time (FreeCell's "supermove"): (empty cells + 1) × 2^(empty piles)."whole"— Only the whole pile, all face up."top_or_whole"— Either the top card alone, or the whole pile when all face up and built in sequence."alt_color_run"— Any built sequence from the top whose cards alternate in colour."same_color_run"— Any built sequence from the top whose cards are all one colour."suit_run_or_same_rank"— Any built same-suit sequence or any equal-rank run from the top."suit_sequence"— Any run of one suit whose ranks are consecutive, from the top (for piles that build more loosely than they move)."any_single"— Any single card of the pile, whatever its depth (a pile spread out so every card shows). Cards other than the top are moved by a pick step naming their position.
Layout
Overlapping piles: a pile is playable only once every pile covering it is empty.
{ "pyramid": ... }(object) — A triangle withrowsrows (row r has r + 1 piles); each pile is covered by the two below it. Group count must be rows × (rows + 1) / 2."tri_peaks"— Three peaks of 3 rows each over a base row of 10 (28 piles).{ "covers": ... }(object) — Explicit:covered_by[i]lists the piles (indices within the group) covering pile i.{ "grid": ... }(object) — Rows ofcolumnspiles, read left to right (gap games: Montana). Nothing covers anything; the layout gives each pile a left neighbour.{ "grid_vertical": ... }(object) — Grid ofcolumnspiles per row where pileiis blocked iff both its vertical neighbours (i - columnsandi + columns) are non-empty.{ "grid_bottom_open": ... }(object) — Grid ofcolumnspiles per row where pileiis movable iffi + columnsis out of bounds or empty, and accepts a card iffiis non-empty and vertically isolated.
PileOverride
Rules for some piles of a group that differ from the group's. Fields left out keep the group's value.
| Field | Type | Default | Description |
|---|---|---|---|
build | Build | null | — | |
color | Color | null | — | |
empty | EmptyRule | null | — | |
empty_max_accept | integer | null | — | |
empty_suit | Suit | null | — | |
max_accept | integer | null | — | |
max_cards | integer | null | — | |
min_cards | integer | null | — | |
moves | MoveUnit | null | — | |
non_empty_max_accept | integer | null | — | |
piles (required) | integer[] | — | Indices within the group. |
suit | Suit | null | — |
StockRules
How the stock deals.
| Field | Type | Default | Description |
|---|---|---|---|
auto | boolean | — | Deal by itself whenever the waste is empty (and the stock isn't). |
auto_for_empty | string | null | — | With auto: deal to the empty waste by itself only right after a move empties a pile of this named group, once, and let that pile (with a refill_on_empty refill from the waste) take the card if it stays (Q.C.: a card that fits a foundation goes there, and the row stays empty). |
bonus_redeals | BonusRedeals | null | — | Extra redeals earned dynamically from card counts in paired piles across groups. |
bookend | string | null | — | For a multi-pile target: bracket each deal with this group's first and last piles. A deal puts one card on the first pile, then one on each pile of to, then one on the last pile (cards permitting), except in the final round (after every redeal has been used), which deals to to alone. On redeal this group's piles are gathered (each from its top, in pile order) after the target's. |
count | integer | — | Cards per deal (or rounds per deal for multi-pile targets). |
count_per_round | integer[] | — | Cards per deal on each round (0-indexed by redeals used). When non-empty, overrides count; rounds past the end reuse the last entry. |
deal_after_play_to | string | null | — | For a waste-dealing stock: after a card goes from the waste onto a pile of this group, the stock acts by itself, as if the player had dealt (or turned the waste back, if that is all it can do). Does nothing if the stock can't act. |
deal_down_then_up | boolean | — | For a multi-pile target with count > 1: deal the first round face down and the remaining rounds face up. |
deal_empty_first | boolean | — | For a multi-pile target: if any target piles are empty, deal only to the empty piles; otherwise deal to every target pile. |
deal_per_pile | boolean | — | For a multi-pile target with count > 1: deal count cards to each pile in turn rather than count rounds of one card per pile. |
divert_ranks | integer[] | — | When dealing to a multi-pile target, divert cards of these ranks to the first accepting foundation and keep dealing until a non-diverted card lands on the current target pile. |
drop_to_before_deal | string | null | — | Before dealing to a multi-pile target, move the top card of each non-empty target pile i onto pile i of the named group. |
face_up | boolean | — | Keep the top card of the stock turned face up so it may be played or removed directly. |
fan_rows | string | null | — | Fan deal: to is a group of fan slots and this names a group of piles (one per rank, the ace's first). Counter 0 of [Rules::aux] (required, start it at -1) holds the open pile, or -1 for none. A deal first puts every fan card back on the open pile (slot by slot, each from its top). Then, with cards in the stock, it turns the stock's top card face up onto the first slot, opens the pile its rank names, and lays that pile's cards out on the other slots, bottom card on the second slot and so on up; a pile too tall for them sends its top cards to the last slot, the one before it and so on first. With the stock empty and redeals left, it instead gathers the piles of the named group face down into the stock (last pile first, each from its top) and deals them out again by the opening deal step that sets cards aside for that group, closing the open pile. Piles of the named group and the fan are not symmetric. |
fill_empty_or_reshuffle | boolean | — | For a multi-pile target: if the stock has cards and some target pile is empty, deal count cards face up to each empty pile in turn (the stock deals only to gaps); otherwise (no gap, or the stock is out) use up one of the redeals: gather every target pile back into the stock, face down, shuffle it, and deal count cards to each pile in turn (Forest Glade). |
fill_grid_holes_repeat | boolean | — | With fill_grid_holes_then_row: both phases repeat, and the hole fill works within the first n rows, where n is the most cards in any one column (at least 1). The deal adds a new row instead when the top row is full and every column holds the same number of cards. Phase 1 repeats passes that put a card directly above each column's first card, until none can. Phase 2 repeats passes that put a card in each column's first remaining hole, until none can or the stock runs out. |
fill_grid_holes_then_row | boolean | — | For a grid target group: deal either into a new row below when the grid is empty or all columns are full to the same height with a full top row, or run a two-phase hole fill within the occupied rows. |
final_also_to | string | null | — | When exactly as many cards are left as the target and this group have piles together, the deal also puts one card on each pile of this group (Baroness's last seven cards). |
final_piles | array | null | — | For a multi-pile target: when the remaining stock has at most final_piles.len() cards, deal one card to each of these piles of to (indices within the group) instead of piles. |
final_split_to | string | null | — | When set, dealing requires at least 2 cards in the stock. If dealing leaves (or starts with) exactly 2 cards in the stock, one card is dealt face up to this group's first pile and the last card remaining in the stock is turned face up. |
final_to | string | null | — | For a multi-pile target: when the remaining stock has at most as many cards as this group has piles, deal one card to each pile of this group instead of to. |
first_empty | boolean | — | For a multi-pile target: deal count cards into the first empty pile instead of one to every pile (Accordion). |
max_deals | integer | null | — | The most times the stock may deal (a limit on draws, not on turning a waste back). |
only_when_empty | boolean | — | Deal only when the target pile is empty: each card must be played before the next is turned (Calculation, Sir Tommy). |
only_when_empty_first_round | boolean | — | In round 1 (redeals_used == 0), dealing requires to to be empty; in later rounds, normal stock dealing is allowed even when to is non-empty. |
open_next_on_rank | integer | null | — | For a multi-pile target: deal one card at a time; if its rank equals this rank, deal it to the first empty target pile (falling back to the last non-empty pile, or the first pile if all are empty); otherwise deal it to the last non-empty target pile (or the first pile if all are empty). |
piles | array | null | — | Specific piles of to to deal to (indices within the group). Default: all piles. |
piles_per_round | integer[][] | — | Target pile indices within to for each round (0-indexed by redeals used). When non-empty, overrides piles; rounds past the end reuse the last entry. |
redeal_bottom_count_from | string | null | — | For a waste-dealing stock with redeals: an empty stock can only be redealt while the named group holds cards (and the waste holds at least as many). A redeal then moves that many of the waste's bottom-most cards back to the stock, face down, the waste's bottom card first (so the stock's top card is the one just above the bottom run), leaves the rest of the waste as it was, and deals one card as usual. |
redeal_deal_all_alternating | boolean | — | On a multi-pile stock redeal, deal all gathered cards back out in rows alternating face-up and face-down (ending face-up), honoring divert_ranks. |
redeal_flip_stock | boolean | — | When gathering a multi-pile target back into the stock on redeal, turn the gathered stock upside down, so the first card gathered is the first one dealt again. |
redeal_from_groups | string[] | — | Additional groups whose piles are swept (in reverse index order, top-to-bottom face-down) back into the stock on redeal after to. |
redeal_gather_only | boolean | — | On redeal only gather the target group back into the stock (nothing is dealt); the stock is played from its top (Puss in the Corner). |
redeal_redistribute_reverse | boolean | — | When the stock is empty and finite redeals remain, pick up to[count - 1 - redeals_used] face-down (top-to-bottom), deal its cards face-up rightward from that index wrapping around to[0..count], and increment redeals_used. |
redeal_reverse | boolean | — | When gathering a multi-pile target back into the stock on redeal, gather piles in reverse order. |
redeal_shuffle | boolean | — | When gathering a multi-pile target back into the stock on redeal, shuffle the gathered cards before dealing them out again. |
redeal_switch_to_auto_refill | string | null | — | On the first redeal (0 -> 1), deal 1 face-up card to to[0] and 1 to each pile of the named group; thereafter manual deals are disabled and any emptied pile of to[0] or the named group automatically refills 1 face-up card from stock. |
redeal_waste_onto_group | boolean | — | With redeal_from_groups and a waste target: on redeal, instead of turning the waste over as the bottom of the new stock, its top card is first put on the first pile of the first swept group, and the groups are then swept (last pile first, each pile from its top) into the stock. Any further waste cards stay where they are. |
redeals | integer | — | Times the waste may be turned back into the stock. |
require_group_empty | string | null | — | The stock may deal only while every pile of this named group is empty (The Lucky Number's reserves). |
require_no_empty | boolean | — | The stock may not deal while any pile of the target group is empty (Spider). |
require_no_empty_group | string | null | — | The stock may not deal while any pile of this named group is empty. |
reshuffle_at_counter | integer | null | — | For a multi-pile target: when counter 0 of [Rules::aux] (required) has reached this value, the next deal first uses up one of the redeals: every target pile is gathered back into the stock, face down, and the stock is shuffled. Then it deals as usual. Once the redeals are gone no deal is possible at that point. The aux updates are expected to count deals, and to reset the counter on that deal. |
skip_built_from | integer | null | — | A deal passes over every target pile that is a whole built run from this rank (1 = ace) down to its last card, face up (Churchill: finished king piles). Nothing deals when every pile is passed over. |
skip_empty | boolean | — | For a multi-pile target: deal only to non-empty piles (or to the first pile if all are empty). |
skip_run_with_rank | integer | null | — | A deal passes over every target pile whose top built run (face up, as far as the pile's build rule goes) includes a card of this rank (Fechter's Game: a king run on top). |
skip_when_same_index_full | string | null | — | When dealing one card per pile to a multi-pile target, skip pile i if other_group[i] is at its max_cards capacity. |
sweep_group_on_waste | string | null | — | For a waste-dealing stock: if to[0] is empty and stock non-empty, deals 1 to to[0]; otherwise sweeps grp in reverse pile order face-down to the bottom of stock, refills grp from to[0] then stock, and deals 1 to to[0] if stock remains. |
sweep_to_discard_round1 | string | null | — | Round 1 sweeps to face-down onto the named single-pile discard group before dealing 1 card to each pile of to; on redeal sweeps to to discard and turns discard back into stock; in round 2+ deals 1 card onto to[0] only. |
to (required) | string | — | Group the stock deals to. If it is a waste or foundation, count cards go onto its first pile. Otherwise (tableau, reserve, cell), count rounds of one card go to each pile in turn while cards remain. |
top_up_group_to | array | null | — | When dealing from a non-empty stock: if any pile in the named group has fewer than n cards, deal 1 face-up card at a time round-robin across short piles of that group until all have at least n cards or stock empties, instead of dealing to to. |
unlimited_redeals | boolean | — | The waste may be turned back any number of times (overrides redeals). |
wrap_mid_deal | boolean | — | For a waste target: every deal moves count (or count_per_round) cards to the waste, turning the waste face down onto the stock whenever the stock runs out mid-deal and counting at most one redeal per deal. Dealing is legal while the stock holds at least that many cards or a redeal remains. |
RedealRules
Gathering a group's cards and dealing them out again.
| Field | Type | Default | Description |
|---|---|---|---|
group (required) | string | — | The group gathered and redealt. |
how (required) | RedealHow | — | |
times | integer | — | How many redeals are allowed. |
unlimited | boolean | — | Any number of redeals (overrides times). |
RedealHow
How a redeal deals the gathered cards.
{ "regroup": ... }(object) — Keep the cards in order and deal them backper_pileat a time to each pile in turn, starting from the first pile's top cards (Cruel). Fewer piles may end up in use. If there are more cards thanper_pilefor every pile, the surplus is shared out: each pile gets an equal part and the first few one more.{ "shuffle": ... }(object) — Shuffle the gathered cards, then dealper_pileto each pile in turn (La Belle Lucie), sharing out any surplus as for [RedealHow::Regroup]."grid_shuffle"— Grid games: leave each row's built sequence in place, shuffle every other card, and deal them back leaving one gap straight after each sequence (Montana).{ "compact": ... }(object) — Close the gaps: slide the cards forward in reading order, then fill the empty places at the end fromrefill_from's top card, turned face up (Monte Carlo)."grid_shuffle_random_gaps"— Grid games: leave each row's built sequence in place, shuffle every other card, and deal them back leaving the gaps at random positions among the non-sequence slots."rotate_bottom"— Move each pile's bottom card to its top (Crescent)."deal_rows"— Gather piles left-to-right (reversing each pile) and deal all cards back row-by-row."redistribute_pile"— On redealk(0-indexed), pick up pilekand deal its cards one-by-one across the group starting at pilekand wrapping around."shuffle_redeal"— Gather all cards of the group, shuffle them, and replay the group's opening deal steps.{ "shuffle_top_up": ... }(object) — Asshuffle, but every card is dealt face down except the top card of a pile that gets at least two (Fascination Fan: the dealing goes round in three passes, the last face up)."grid_shuffle_end_gaps"— Grid games: leave each row's built sequence in place, shuffle every other card, and deal them back leaving one gap at the last column of each row."deal_staircase"— Gather asdeal_rows, then deal row by row where each row starts one pile further right than the last: the first row to every pile, the next to all but the first, and so on (Usk).{ "compact_columns": ... }(object) — Grid games: slide cards in each column upward to the topmost empty cells (preserving relative order), then fill remaining empty cells in row-major order (one face-up card each) fromrefill_from.{ "fill_empty": ... }(object) — Fill empty cells in row-major order (one face-up card each) fromrefill_fromwithout shifting existing cards.{ "shuffle_fill": ... }(object) — Gather the group's piles and thereservegroup into one stack, face down, and shuffle it. Then deal face up to each pile in turn until it holdsper_pilecards, setting aside on a foundation (when one takes it) every card of thedivert_ranksthat comes up. What is left goes back to the reserve, face down (Intelligence).
DealStep
One step of the opening deal.
Cards come off the shuffled pack in order. With count or counts, they are dealt in rows: one card to each selected pile, then the next row, as a person would deal them.
| Field | Type | Default | Description |
|---|---|---|---|
alternate_colors | boolean | — | With one_each: each card taken must be of the colour opposite to the one before (Colours: a 2 and a 4 of one colour, a 3 and a 5 of the other). |
auto_foundation | boolean | — | During this step, place any dealt card directly on the first foundation that accepts it. |
collect | array | null | — | After this step, take every card of these ranks off the table and put them on this step's group (Montana: deal all 52, then remove the aces to leave gaps). |
count | integer | null | — | Cards to each selected pile. |
counts | array | null | — | Cards to each selected pile, per pile. |
divert_ranks | array | null | — | During this step, divert dealt cards of these ranks to the first foundation that accepts them; with drain_foundations, restrict draining to these ranks. |
drain_foundations | boolean | — | After each dealt row, repeatedly move exposed top cards of the selected piles onto any accepting foundation (restricted to divert_ranks if set). |
face_up | boolean | — | Face up (default) or face down. |
kings_to_bottom | boolean | — | After dealing, move each pile's kings to its bottom, keeping their order (Baker's Dozen). |
limit | integer | null | — | With ranks (and no count): take at most this many matching cards in total instead of all of them. |
of_base | boolean | — | Take every remaining card of the dealt base rank out of the pack and put one on each selected pile in turn (requires an earlier step with set_base). |
one_each | boolean | — | With ranks: take only the first card of each listed rank, in the listed order (Calculation's A, 2, 3, 4). |
one_per_suit | boolean | — | Pull one card of each suit (in pack suit order) from the deck per round (repeated count times, default 1), placing them on the selected piles in turn. |
piles | array | null | — | Piles of the group to deal to (indices). Default: all. |
ranks | array | null | — | Take every card of these ranks out of the pack and put one on each selected pile in turn (Beleaguered Castle's aces). |
rest | boolean | — | Deal every remaining card, round-robin over the selected piles. |
retry_after_divert | boolean | — | With divert_ranks or auto_foundation: a card sent to a foundation does not use up its turn; the same pile gets the next card instead (Dieppe: cards go to the foundations until one does not fit, and that one goes to the row). |
route | DealRoute | null | — | With rest: send each card to the selected pile its rank or suit names instead of dealing round-robin (Lady of the Manor's reserves by rank, Four Colours' rows by suit). |
set_aside | SetAside | null | — | Deal count rounds of one card to each selected pile (face up), taking further cards off the pack and setting them aside, face down, as the rules say. The deal stops as soon as the pack runs out. The cards set aside go back on the pack's remaining cards, the last one set aside on top (the stock deals from there). |
set_base | boolean | — | The first card this step deals sets the base rank for [EmptyRule::DealtBase]. |
skip_ranks | integer[] | — | Cards of these ranks met while dealing this step are passed over and put at the bottom of the pack instead (Doublets' kings). |
split_after | boolean | — | With split_on_rank: advance to the next pile after placing a card of that rank (on any pile) instead of before placing it on a non-empty pile. |
split_on_rank | integer | null | — | With rest: deal sequentially into each selected pile, advancing to the next pile whenever a card of this rank is dealt to a non-empty pile. |
stop_when_out | boolean | — | The deal may run out of cards part-way through a round (the last round is short). |
to (required) | string | — | Target group. |
RemovalRules
Card-removal mechanics.
| Field | Type | Default | Description |
|---|---|---|---|
adjacent | Adjacency | null | — | Cards must be neighbours in their grid (all from one grid group). |
exclude_ranks | integer[] | — | Cards of these ranks never take part in a removal (Aces Square's aces). |
face_ten | boolean | — | Count J/Q/K as 10 in [RemovalKind::ContiguousSumMultiple]. |
from (required) | string[] | — | Groups whose playable top cards may be removed. |
kind (required) | RemovalKind | — | |
max_sum | integer | null | — | Maximum rank sum for [RemovalKind::ContiguousSumMultiple]. |
min_len | integer | null | — | Minimum number of consecutive piles for [RemovalKind::ContiguousSumMultiple] (default: 1). |
needs_latch | boolean | — | The removal works only while the rules' latch is set. |
to (required) | string | — | Group (its first pile) the removed cards go to. |
RemovalKind
Jokers are wild in removals: a joker pairs with any card (another joker too) and stands for any one rank of a set. lower_of_suit ignores them.
{ "pairs_sum": ... }(object) — Remove two playable cards whose ranks add up tototal(Pyramid: 13), or one card whose rank is listed inalone(Pyramid: kings)."lower_of_suit"— Remove a playable card when another playable card is of the same suit and higher in the pack's rank order (Aces Up)."same_rank"— Remove two playable cards of the same rank (Nestor, Simple Pairs).{ "rank_set": ... }(object) — Remove playable cards whose ranks are exactly this set, together (Elevens' J-Q-K).{ "reach_suit_or_rank": ... }(object) — Remove two playable cards in the same group whose pile indices differ by one ofdistances, when they match in suit or rank.{ "between_match": ... }(object) — Remove1..=max_lenconsecutive non-empty piles in a group when the piles immediately before and after the run match in suit or rank.{ "contiguous_sum_multiple": ... }(object) — Remove1..=max_len(ormin_len..=max_lenwhen [RemovalRules::min_len] is set) consecutive non-empty piles in a group when the sum of their ranks (with J/Q/K counting as 10 if [RemovalRules::face_ten] is set) is a multiple ofdivisor(and at most [RemovalRules::max_sum], if set).{ "same_rank_in": ... }(object) — Remove two playable cards of the same rank when that rank is listed inranks.{ "rank_distance": ... }(object) — Remove two playable cards whose ranks differ by one ofdistances(Cheops: 0 or 1, Neptune: 1), counting ace as 1 and king as 13 with no wrap.{ "pairs_sum_other_suit": ... }(object) — Remove two playable cards of different suits whose ranks add up tototal(Exit's queen and king)."same_suit"— Remove two playable cards of the same suit.{ "pairs_sum_same_suit": ... }(object) — Remove two playable cards of the same suit whose ranks add up tototal(Suit Elevens).
Adjacency
Which grid positions count as neighbours.
"eight"— Horizontally, vertically or diagonally next to each other (Monte Carlo)."four"— Horizontally or vertically next to each other."same_line"— Anywhere in the same row or the same column (Quatorze).
ScoreRules
How a position is scored.
| Field | Type | Default | Description |
|---|---|---|---|
group (required) | string | — | A grid group. Each of its rows and each of its columns is scored as a hand. |
hands (required) | Hands | — |
Hands
How a hand (the cards in one row or column) scores.
A joker in a hand counts as whichever card scores that hand best. Each hand is valued on its own, so a joker shared by a row and a column (or a joker starter) may stand for different cards in each.
{ "poker": ... }(PokerTable) — As a poker hand: its best five-card poker combination. Straights and flushes need five cards; pairs and sets count in a line of any length.{ "cribbage": ... }(CribbageRules) — As a cribbage hand, together with a shared starter card (Cribbage Squares).
PokerTable
Points for each poker hand: a named table or explicit points.
PokerScoring
"american"— Pair 2, two pair 5, three of a kind 10, straight 15, flush 20, full house 25, four of a kind 50, straight flush 75, royal flush 100."english"— Pair 1, two pair 3, three of a kind 6, straight 12, flush 5, full house 10, four of a kind 16, straight or royal flush 30.
PokerPoints
Points per poker hand. A hand counts as its highest-ranking combination (in the usual poker order), whatever the points.
| Field | Type | Default | Description |
|---|---|---|---|
flush | integer | 0 | |
four | integer | 0 | |
full_house | integer | 0 | |
pair | integer | 0 | |
royal_flush | integer | 0 | |
straight | integer | 0 | |
straight_flush | integer | 0 | |
three | integer | 0 | |
two_pair | integer | 0 |
CribbageRules
Cribbage scoring. Each line is a hand; once every pile of the grid holds a card, the starter joins every hand as a fifth card. Fifteens, pairs and runs count in a line of any length; a flush needs a full line of at least four cards.
| Field | Type | Default | Description |
|---|---|---|---|
points | CribbagePoints | — | |
starter | string | null | — | Group whose first pile's top card is the starter, read when the grid is full. Usually the waste: the card turned after the grid is filled. No starter if left out or empty. |
CribbagePoints
Points for each cribbage combination. Defaults are the standard values.
| Field | Type | Default | Description |
|---|---|---|---|
fifteen | integer | 2 | Each different set of cards adding up to 15 (court cards count 10, aces 1). |
flush | integer | 4 | A full line all of one suit. |
flush_starter | integer | 1 | More when the starter is that suit too. |
heels | integer | 2 | Once, if the starter is a jack ("two for his heels"). |
nobs | integer | 1 | For each hand holding the jack of the starter's suit ("one for his nob"). |
pair | integer | 2 | Each pair of cards of the same rank. |
run_card | integer | 1 | Each card of each run of three or more ranks in sequence (ace low), counted once per different set of cards making the run. |
WinRule
When the game is won.
"all_on_foundations"— Every card is on a foundation.{ "empty": ... }(string[]) — These groups are empty (Pyramid, Golf, TriPeaks: the tableau).{ "piles_empty": ... }(object) — These piles (indices withingroup) are empty and every group inemptyis empty (Camelot: the middle four cells and the stock).{ "count": ... }(object) — A group holds at least this many cards (Aces Up: 48 discarded).{ "count_and_empty": ... }(object) — A group holds at least this many cards and every group inemptyis empty.{ "count_and_spread": ... }(object) — A group holds at leastcardscards and every pile ofspreadholds at most one card.{ "at_most_piles": ... }(object) — At most this many piles of a group hold cards (Accordion: 1).{ "rows": ... }(object) — Every row of a grid group holds a built sequence from its first column,lengthcards long (default: one less than the row), starting with the rank its first column takes (Montana).{ "score": ... }(object) — The position scores at least this many points (see [Rules::score]).{ "round_score": ... }(object) — A round has been scored and the points of all rounds so far reach this many (see [Rules::rounds]).{ "all_full": ... }(object) — Every pile ingroupholdsmax_cardscards with a bottom card satisfying itsemptyrule.{ "each_row_score": ... }(object) — The grid of the score rules is full and every row scores at least this many points, each on its own (Maverick: every row a straight or better).{ "color_split": ... }(object) — The firstredpiles ofgrouphold only red cards and the rest only black ones (Fire and Ice).{ "rows_built": ... }(object) — Like [WinRule::Rows], but checks each row's ordered prefix usingbuildinstead of the group's build rule.{ "pack_order": ... }(object) — Every pile ofgroupholds exactly one card, the one the pack's order gives it: pileitakes suitpack.suits[i / n]and rankpack.ranks[i % n],nbeing the number of ranks (the group must have one pile per card of a single copy of the pack).{ "piles_built": ... }(object) — Every non-empty pile ofgroup(or the single pile atpile) satisfies optionallengthandbuildsequence checks, and every group inemptyis empty.{ "ring_runs": ... }(object) — The cards of a ring of single-card piles formrunsruns oflengthcards, each one suit from the first rank up, with no gap inside a run (Maze: four runs from ace to queen). Reading the cards round the ring, starting from the first ace, each run starts with an ace.{ "all_isolated": ... }(object) — Every group inemptyis empty and every non-empty pile ingroup(a grid group) is vertically isolated (no non-empty pile directly above or below it in the grid).{ "target_card": ... }(object) —discardholds at leastcardscards and the first pile ofgroupholds the target card chosen at deal time (stored as its face index inaux[0], chosen from the pack excluding cards initially on the firstexclude_pilespiles ofgroup).
SearchHints
Heuristic weights and search tuning. They change how fast the solver finds a win (or how soon it gives up), never whether a position is judged winnable. Every field has a neutral default.
| Field | Type | Default | Description |
|---|---|---|---|
blocker_weight | integer | 1 | Cost of a card resting on a card its foundation needs sooner (default 1). |
cell_weight | integer | 1 | Cost of each card in a free cell (default 1). |
disorder_weight | integer | 1 | Cost of each card out of sequence in a building pile, and of each such pile in use (default 1). |
down_weight | integer | 2 | Cost of each face-down card (default 2). |
fast_share | integer | 50 | Percent of the budget the default strategy spends on its fast, pruned best-first phase before the sound depth-first search (default 50). |
progress_weight | integer | 4 | Cost of each card still to go home, or each step still missing from the win (default 4). |
stock_weight | integer | 1 | Cost of each card still in a stock that deals to the tableau (default 1). |
AsideRule
One set-aside rule: it fires for a dealt card of one of ranks, or (with rank_matches_pile) whose rank is the position of the pile in the selection (the ace for the first, the two for the second, and so on).
| Field | Type | Default | Description |
|---|---|---|---|
count (required) | integer | — | |
rank_matches_pile | boolean | — | |
ranks | integer[] | — |
AuxCmp
A comparison.
"eq""ne""lt""le""gt""ge"
AuxCond
A test on the position (and, for moves, the cards moved).
{ "counter": ... }(object) — Counterslotcompared withvalue.{ "any_empty": ... }(object) — Some pile of the group is empty.{ "any_non_empty": ... }(object) — Some pile of the group holds a card.{ "rank_is_counter": ... }(object) — The first card moved has rankcounter + offset(a [AuxEvent::Transfer] only).{ "shares_set_with_source": ... }(object) — The counter holds a pile index, and it and the pile the cards come from (an index in its own group) lie together in one of thesets(a [AuxEvent::Transfer] only).{ "not": ... }(AuxCond){ "all": ... }(AuxCond[]){ "any": ... }(AuxCond[])
AuxEvent
Something that happens in play.
"deal"— The stock deals, or the waste is turned back into it, or the tableau is redealt. Test whether the stock is empty with a condition to tell the cases apart.{ "transfer": ... }(object) — A card (or run) moves from a pile of groupfromto a pile of groupto; a group left out matches any. Cards that go by themselves (refills, settling) are not moves.{ "refill": ... }(object) — A pile ofgroup(any group if left out) is about to be refilled automatically. Only usable in gates."extract"— The second card of a pile is drawn out ([Rules::extract_second]).
AuxGate
A condition on an event.
| Field | Type | Default | Description |
|---|---|---|---|
on (required) | AuxEvent | — | |
require (required) | AuxCond | — |
AuxOp
How a counter changes.
{ "set": ... }(integer) — Set to a value.{ "add": ... }(object) — Raise to at leastfloor(if given), addby, then reduce modulomodulo(if given)."source_pile"— Set to the index, within its group, of the pile the moved cards came from. A [AuxEvent::Transfer] only. Makes pile numbering matter, so piles are not symmetric.
AuxRules
Counter rules: two small signed counters kept with the position.
updates change a counter when an event happens (a stock deal, a move between two groups); gates forbid an event unless a condition holds. Conditions are tested on the position before the event. Counters are part of the position (hashed, and saved in position data).
| Field | Type | Default | Description |
|---|---|---|---|
gates | AuxGate[] | — | An event is allowed only if every gate for it holds. |
initial | integer[] | — | Starting values of the two counters. |
updates | AuxUpdate[] | — | Counter changes, applied in order for every matching event. |
AuxUpdate
A counter change.
| Field | Type | Default | Description |
|---|---|---|---|
on (required) | AuxEvent | — | |
op (required) | AuxOp | — | |
slot (required) | integer | — | Which counter: 0 or 1. |
when | AuxCond | null | — | Only when this holds (tested before the event). Default: always. |
BonusRedeals
Extra redeals earned dynamically from card counts in paired piles across groups.
Each group in groups must have the same even pile count n. For each index i, the pile counts across groups are summed, and consecutive sums (a, b) are paired: if a + b >= 2 * threshold, add 2 extra redeals; else if a >= threshold || b >= threshold, add 1. The total redeals (stock.redeals + bonus) is capped at max_redeals if set.
| Field | Type | Default | Description |
|---|---|---|---|
groups (required) | string[] | — | |
max_redeals | integer | null | — | |
threshold (required) | integer | — |
CardRef
A card named by suit and rank.
| Field | Type | Default | Description |
|---|---|---|---|
rank (required) | integer | — | 1 = ace, 13 = king. |
suit (required) | Suit | — |
ChooseBase
Rules for choosing the foundation base rank on the opening move.
| Field | Type | Default | Description |
|---|---|---|---|
also_from | string | null | — | A second group whose cards may also be played to a foundation to choose the base. |
deal_waste | boolean | false | Immediately deal one card from the stock to the waste after the choice. |
free_moves | boolean | false | Until the base is chosen, only foundation plays are restricted (to one card from from); every other move and the stock stay open (Nine Across). |
from (required) | string | — | Group whose cards may be played to a foundation to choose the base rank. |
lock_until_base | string[] | — | Groups whose cards cannot move (and, for the stock, cannot be dealt) until the base is chosen, even with free_moves. |
refill_from_stock | boolean | false | Immediately deal one card from the stock to the emptied source pile after the choice. |
ClearTops
When every pile of the group holds a card and the top cards' ranks (ace 1 ... king 13) add up to sum, each top card goes to the to group (Ninety-One).
| Field | Type | Default | Description |
|---|---|---|---|
sum (required) | integer | — | |
to (required) | string | — |
DealRoute
How a rest deal step picks each card's pile.
{ "rank": ... }(object) — Pileiof the selection takes the cards of rankfirst_rank + i(ranks are 1 = ace)."suit"— Pileiof the selection takes the cards of the pack'sith suit.{ "chain": ... }(object) — Each card ofrankstarts the next pile of groupto; every other card goes on the selected pile with the index of the latest such start (Xerxes: the nines start the foundations and the cards after each one go on the matching row).{ "split": ... }(object) — Each card ofrankstarts the next pile of groupto; every other card goes on the first selected pile, untillimitof them are down (Frog: aces to the foundations, thirteen other cards to the reserve).
ExtractSecond
A move that draws out the second card of a pile, leaving the top card where it is.
A pile of group from with at least two cards may send its second card to the first pile that accepts it, trying the groups of to in order (piles in order within a group, never the pile itself). Limit how often with [AuxEvent::Extract] gates and updates. Piles are not symmetric, since which pile is first matters.
| Field | Type | Default | Description |
|---|---|---|---|
from (required) | string | — | |
to (required) | string[] | — |
FirstRoundBan
Cards from some piles of a group may not go to some piles of this group until the stock or redeal has been used once (St. Helena's foundations).
| Field | Type | Default | Description |
|---|---|---|---|
from (required) | integer[] | — | Piles (indices within from_group) whose cards are refused. |
from_group (required) | string | — | Group the refused cards come from. |
to (required) | integer[] | — | Piles (indices within the group that holds this ban) that refuse the cards. |
FlushAtLen
When a pile reaches len cards, optionally pull one card from pull_from onto it, then flush all cards of the pile (bottom-to-top) onto to[0].
| Field | Type | Default | Description |
|---|---|---|---|
len (required) | integer | — | |
pull_from | string | null | — | |
to (required) | string | — |
FromPileMap
Which pile of this group a pile of group may send cards to (Rittenhouse's foundations).
| Field | Type | Default | Description |
|---|---|---|---|
except_ranks | integer[] | — | Cards whose rank is in this list bypass the pile restriction. |
group (required) | string | — | Group the cards come from. |
only_non_empty_dest | boolean | — | Apply this restriction only when the destination pile is non-empty. |
only_when_stock_non_empty | boolean | — | Apply this restriction only while the stock pile is non-empty. |
to (required) | integer[] | — | For each pile of that group, the only pile of this group it may send cards to, or -1 for any. |
FromPileSets
Which piles of this group each pile of group may send cards to.
| Field | Type | Default | Description |
|---|---|---|---|
group (required) | string | — | Group the cards come from. |
to (required) | integer[][] | — | For each pile of that group, the pile indices of this group it may send cards to. |
Frontier
Which pile of a group is the only one whose cards may move.
"last"— The last non-empty pile of the group."first"— The first non-empty pile of the group.
LeaveRefill
Part of [GroupRules::refill_group_on_leave]: one face-up card from the stock goes onto each empty pile of group, in order. If the stock runs out first and reshuffle_from still holds cards, they are turned over, shuffled into the stock, and the refilling goes on.
| Field | Type | Default | Description |
|---|---|---|---|
group (required) | string | — | Group whose empty piles are refilled. |
reshuffle_from | string | null | — | Group (its first pile) shuffled back into an exhausted stock. |
PairFlush
Part of [GroupRules::pair_flush]: a two-card pile whose bottom card has a rank in bottom_ranks is cleared into the pile of group to that belongs to the bottom card's suit (to has one pile per suit of the pack, in the pack's suit order).
| Field | Type | Default | Description |
|---|---|---|---|
bottom_ranks (required) | integer[] | — | Ranks of the bottom card that trigger this flush. |
first | integer | null | — | If set, the card of this rank ends up underneath the other whichever way round the pair lay; otherwise the pair keeps its order. |
to (required) | string | — | Group receiving the pair. |
PilesFull
A condition on piles of another group being full. A pile is full when it holds one card per rank of the pack, or its max_cards if that is lower.
| Field | Type | Default | Description |
|---|---|---|---|
group (required) | string | — | The group whose piles are checked. |
piles | integer[] | — | Pile indices within group; every pile of the group if empty. |
RoundRules
Rounds of cribbage play, scored one round at a time.
A round starts when the stock deals: crib_down cards go face down on the first piles of the crib, then one card on each of the first hand_size piles of the first hand. The player moves cards from a hand into the crib (a card leaves the hand only while no later hand has been dealt). When the crib is full and the first keep piles of every hand hold cards, the round is scored by itself: the crib is turned face up, the top card of the stock becomes the starter (on the starter pile), and the crib and each hand are scored as cribbage hands with that starter. The points, and heels if the starter is a jack, are added to a running total kept in counter 0. The stock deals again only once a round has been scored and the stock holds enough for another; that deal first sweeps the previous round to the discard pile (the last hand's piles last to first, then the first hand's, then the crib's, then the starter) and starts the next. Counter 0 of [Rules::aux] is the running total, so the position hashes it; don't combine with aux rules. Piles of these groups aren't symmetric.
| Field | Type | Default | Description |
|---|---|---|---|
crib (required) | string | — | The crib: a group of single-card piles. |
crib_down | integer | — | Cards dealt face down to the crib at the start of a round (default 0). |
discard (required) | string | — | A single-pile group the finished rounds are swept into. |
hand_size | integer | — | Cards dealt to each hand (default 6). |
hands (required) | string[] | — | The hands (one or two groups of single-card piles), in the order they are dealt. |
keep | integer | — | Piles of each hand that must hold a card for a round to be scored (default 4). |
next_hand_after | integer | — | With two hands: the second is dealt as soon as exactly this many of the crib's first piles hold cards and the others are empty. |
points | CribbagePoints | — | |
starter (required) | string | — | A single-pile group for the starter. |
SecondaryStock
Secondary stock rule for a single-pile source group that deals one card face up onto to[0].
| Field | Type | Default | Description |
|---|---|---|---|
stay_unlocked_below | integer | null | — | With unlock_when_to_empty: once this source pile holds fewer than n cards, allow dealing even when to[0] is non-empty. |
to (required) | string | — | Target group whose first pile receives dealt cards. |
unlock_when_to_empty | boolean | — | Only allow dealing while to[0] is empty (unless stay_unlocked_below applies). |
SetAside
Cards a [DealStep] sets aside while dealing.
| Field | Type | Default | Description |
|---|---|---|---|
per_round | integer | — | Cards set aside after each round. |
rules | AsideRule[] | — | After each card dealt to a pile, every matching rule sets aside its count. |
StagedEmpty
Part of [GroupRules::staged_empty]. Empty piles of the group open strictly in index order (i - 1 must be non-empty). The first stride piles must each take a distinct suit, and every pile i >= stride must match the suit of pile i - stride. In addition, a card may start an empty pile only when:
- no pile in
sourcehas a face-up top card of the same suit with a strictly lower rank, and - no non-empty pile in this group can currently accept the card under its build rule.
| Field | Type | Default | Description |
|---|---|---|---|
source (required) | string | — | |
stride (required) | integer | — |
Staging
Part of [GroupRules::staging]. Cards below court_from (rank 1 = ace) are pips and count for their rank; the rest are courts and count for nothing. A pile is cleared, all at once, into the first pile of group to when it holds exactly the court_set ranks (if given), or when its pips sum to pip_sum with pip_courts courts among its cards. The pile takes any card, subject to the optional limits below.
| Field | Type | Default | Description |
|---|---|---|---|
cap_pip_sum | boolean | — | A pip may be added only if the pip total stays within pip_sum. |
court_from (required) | integer | — | Lowest rank that is a court. |
court_set | integer[] | — | A pile holding exactly these ranks (one card each) clears whatever the pips. |
distinct_ranks | boolean | — | No two cards of one rank may sit on the pile. |
exact_at_pips | integer | null | — | The pip that would be the nth on the pile must bring the pip total to exactly pip_sum. |
max_courts | integer | null | — | At most this many courts may sit on the pile. |
pip_courts | integer | — | Courts the pile must hold alongside a clearing pip total. |
pip_sum (required) | integer | — | Pip total that clears the pile. |
to (required) | string | — | Group receiving a cleared pile. |
SumLimit
A limit on the total of a pile.
A card adds its values entry (ranks 1 to 13) to the pile's total. Cards of a lift_rank add nothing, but while the pile holds one, a total below target counts as target. A card may be added only if the total then stays at most target, and a pile that reaches max_cards must total exactly target.
| Field | Type | Default | Description |
|---|---|---|---|
lift_ranks | integer[] | — | Ranks that lift a low total to the target. |
target (required) | integer | — | |
values (required) | integer[] | — | What each rank adds, from ace to king (13 entries). |
SwapBases
When two piles in the same group may swap their contents on a move from one to the other.
"both_single"— Swap two single-card piles when each card satisfies the other pile'semptyrule."either_pile"— Swap two non-empty piles with differentemptyrules when their bottom cards differ in rank and at least one bottom card satisfies the other pile'semptyrule."crossing"— Swap two single-card piles of groups that both use this mode when the piles take different kinds of card, each card is one the other pile takes, and the second card is not one its own pile would take from the first's side (Hemispheres: a red card in the black half swaps with a black card in the red half).
TieredSet
Part of [GroupRules::tiered_set]. A card is worth its rank (ace 1 to king 13), a joker joker_value. The first face-up card of a pile is its base, and what a card needs depends on how many cards are face up on the pile:
- one: its value plus
bonusmust reach the base's value; - two: its value plus the value of the second card must reach the base's value; - three: it must be of the base's suit, or a joker.
Nothing goes onto an empty pile. As soon as four cards are face up, those four move to to and the card below them (if any) is turned up by the usual flipping. The group needs a build rule other than none (any is the natural choice); the tiers replace its other tests.
| Field | Type | Default | Description |
|---|---|---|---|
bonus (required) | integer | — | |
joker_value (required) | integer | — | |
to (required) | string | — |