# Turny.gg Docs
> Documentation for Turny.gg: custom rulesets, calculators, card search, tournaments and the deck builder.
---
url: https://docs.turny.gg/
description: "Documentation for Turny.gg, the multi-game tournament platform. Custom rulesets, calculators, card search, tournaments and the deck builder."
---
# Turny.gg Docs
Documentation for Turny.gg, the multi-game tournament platform. Custom rulesets, calculators, card search, tournaments and the deck builder.
- [Custom rulesets](https://docs.turny.gg/guide/rulesets): Write deck and deck-set rules in JavaScript and run them on every registration.
- [Calculators](https://docs.turny.gg/guide/calculators): Turn any deck into odds, curves and stats with the no-code builder or a script.
- [Script reference](https://docs.turny.gg/reference/scripting/rulesets): Every argument, return value and sandbox rule your ruleset and calculator scripts can use.
- [Tournaments](https://docs.turny.gg/guide/tournaments): Formats, pairings, standings and tiebreakers, with worked examples checked against the engine.
- [Deck builder](https://docs.turny.gg/guide/deck-builder): Deck codes and list formats for every game, piles, deck sets and templates.
- [Card search](https://docs.turny.gg/reference/search/lor): Find exactly the cards you want with each game's fields, operators and shortcuts.
Every page in plain text
Add `.md` to any page's URL for a plain markdown copy, handy for reading offline or pasting into another tool. The whole site is also bundled as one text file.
---
url: https://docs.turny.gg/guide/
description: "Step-by-step guides for Turny.gg's custom rulesets, calculators, playtest, tournaments, series, communities and deck builder."
---
# Guides
Guides walk through a feature from start to finish. For the exact shape of every script argument and card field, see the [reference](https://docs.turny.gg/reference/).
- [Custom rulesets](https://docs.turny.gg/guide/rulesets): write deck and deck-set rules in JavaScript.
- [Calculators](https://docs.turny.gg/guide/calculators): build deck stats with the no-code builder or a script.
- [Playtest](https://docs.turny.gg/guide/playtest): play a deck out on a virtual table, and write and share the rules that set it up.
- [Tournaments](https://docs.turny.gg/guide/tournaments): formats, pairings, standings, tiebreakers and recurring events.
- [Series](https://docs.turny.gg/guide/series): seasons of tournaments with a running points table, for players and organizers.
- [Communities](https://docs.turny.gg/guide/communities): one page for a store, play group or team, its staff, and the events it hosts.
- [Deck builder](https://docs.turny.gg/guide/deck-builder): deck codes, imports, piles and templates.
---
url: https://docs.turny.gg/guide/rulesets
description: "Write a custom ruleset: card, deck and deck set rules in JavaScript, from a first ban list to pool filters, sharing and troubleshooting."
---
# Custom rulesets
A custom ruleset is a short JavaScript function that decides whether a card, a deck or a whole lineup is legal. Turny.gg runs it in the deck builder while players build, and again on the server when a deck is submitted to a tournament. If your community plays a format the built-in rules don't cover, a ruleset is how you enforce it.
This guide explains when to use each kind of rule, walks through writing your first one, and covers sharing and troubleshooting. You need a Turny.gg account and a little JavaScript. For the exact contract (every argument, return value and limit), see the [ruleset script API](https://docs.turny.gg/reference/scripting/rulesets) and the [script sandbox](https://docs.turny.gg/reference/scripting/sandbox).
## What a ruleset is
Every ruleset has a **scope**, which decides what it looks at and when it runs:
| Scope | Runs | Use it for |
| ------------- | -------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------- |
| Card rule | Once per card | Which cards are legal at all: sets, formats, rarities, a ban list. In the deck builder it also hides illegal cards. |
| Deck rule | Once per deck | Anything about a single deck: deck size, copy limits, champion limits, bans that depend on how many copies. |
| Deck set rule | Once per lineup, with every deck the player brings | Anything that compares decks: no shared champions, no repeated region pairs, one deck per archetype. |
Pick the smallest scope that can answer the question. "Is this card allowed?" is a card rule. "Is this deck allowed?" is a deck rule. Only reach for a deck set rule when the answer depends on more than one deck.
A tournament always uses exactly one rule of each scope, and so does the deck builder. Each game ships built-in rules (for Legends of Runeterra, for example: the Standard and Eternal card rules, the Riot constructed deck rule and the Riot lock deck set rule).
::: warning Your rule replaces the built-in one
Choosing a custom rule for a scope replaces the built-in rule for that scope; it does not add to it. If your deck rule doesn't check deck size, nothing does. The quickest start is often to **Duplicate** a built-in ruleset and edit the copy.
:::
::: tip Just banning cards?
Every card rule has a **Direct bans** picker, in every game. Pick cards from a list and they are banned on top of whatever the script allows, no code needed.
:::
## Create a ruleset and use it
Rulesets belong to a game, so create them on that game's site: [Legends of Runeterra](https://lor.turny.gg/settings/custom-rulesets), [Pokémon TCG](https://pokemon.turny.gg/settings/custom-rulesets) or [Riftbound](https://riftbound.turny.gg/settings/custom-rulesets).
1. Open **Settings → Custom rulesets** and click **New ruleset**.
2. Enter a **Ruleset name** and pick a **Rule scope**. The **Source code** editor fills in a starter function for that scope.
3. Write your rule, then click **Create**. The script is checked for [unsafe code](https://docs.turny.gg/reference/scripting/sandbox) when you save, and an unsafe script cannot be saved.
The list shows your rulesets next to the built-in ones. Built-in and downloaded rulesets are read-only, but you can **View code** or **Duplicate** them. The switch next to each ruleset hides it from every rule picker and legality check without deleting it. **Script API** opens the [ruleset script API](https://docs.turny.gg/reference/scripting/rulesets) reference in a new tab, and the **Card fields** link under each code editor opens the card data reference for the current game.
Your enabled rulesets then show up wherever rules are chosen:
- **Deck builder:** deck rules in the rules dropdown above the deck, card rules in the **Card ruleset** filter, and deck set rules in **Multi Pile** mode.
- **Tournament create:** the **Deck settings** section has one dropdown per scope (**Deck sets**, **Decks**, **Cards**). **View Decks code** (and its siblings) shows the selected script, read-only.
::: info Tournaments keep a copy
When you save a tournament, it stores a copy of each selected script. Editing the ruleset later does not change tournaments that already use it. To move a tournament to your latest version, open it (**Administration → Edit tournament**) and save it again: the form reloads the current code of every saved ruleset it uses.
:::
## Tutorial: your first ruleset
This tutorial builds a small Legends of Runeterra format called **Two-of Standard**: at most two copies of any card, two banned cards, and no champion shared between a player's decks. Every step works the same way in the other games; only the card fields change (see the card data pages for [Cyberpunk TCG](https://docs.turny.gg/reference/card-data/cyberpunk), [Flesh and Blood](https://docs.turny.gg/reference/card-data/fab), [Hearthstone](https://docs.turny.gg/reference/card-data/hs), [Legends of Runeterra](https://docs.turny.gg/reference/card-data/lor), [Palworld TCG](https://docs.turny.gg/reference/card-data/palworld), [Pokémon](https://docs.turny.gg/reference/card-data/pokemon) and [Riftbound](https://docs.turny.gg/reference/card-data/riftbound)).
### 1. Write a deck rule
Go to [**Settings → Custom rulesets**](https://lor.turny.gg/settings/custom-rulesets), click **New ruleset**, name it `Two-of Standard`, set **Rule scope** to **Deck rule**, and replace the starter code with:
```js
// Deck rule: "Two-of Standard".
const BANNED = ["01IO049", "01SI001"]; // Deny, Vengeance
const MAX_COPIES = 2;
const DECK_SIZE = 40;
export default function validateDeck(deck, cardsById) {
const issues = [];
let total = 0;
for (const [ref, copies] of Object.entries(deck)) {
const name = cardsById[ref]?.name ?? ref;
total += copies;
if (BANNED.includes(ref)) {
issues.push({ code: "banned_card", message: `${name} is banned.` });
}
if (copies > MAX_COPIES) {
issues.push({
code: "copy_limit",
message: `${name}: at most ${MAX_COPIES} copies (found ${copies}).`,
});
}
}
if (total !== DECK_SIZE) {
issues.push({
code: "deck_size",
message: `Decks need exactly ${DECK_SIZE} cards (found ${total}).`,
});
}
return { valid: issues.length === 0, issues };
}
```
What it does:
- `deck` maps each card's ref to its number of copies (`{ "01IO009": 3 }`). For Legends of Runeterra the ref is the card code.
- `cardsById` holds the catalog entry for every card in the deck, so `cardsById[ref].name` is the card's name. The `?.` guards against a ref the catalog doesn't know.
- It collects **every** problem instead of stopping at the first, then returns `valid` plus the list.
- It checks the deck size because this rule replaces the built-in deck rule, which used to check it.
Click **Create**.
### 2. Try it in the deck builder
Open the [**Deck Builder**](https://lor.turny.gg/deck-builder) and pick **Two-of Standard** in the rules dropdown above the deck. Paste this deck code into **Import deck code** and click **Import**:
```text
CEAQCAICBEAREAICAUDAQDAQCEJBKFY2DMOCIJRKFQYTEAIBAEBDI
```
It is 40 Ionia cards with three copies of Zed and two copies of Deny. A warning icon appears next to the card count; hover it to see your messages:
- Zed: at most 2 copies (found 3).
- Deny is banned.
The deck uses cards that are no longer in Standard, so the builder's default **Standard** card rule adds "Only Standard-legal cards can be submitted" lines too. Switch the **Card ruleset** filter to **Eternal** to see only your rule's issues.
### 3. Add a deck set rule
Formats with several decks per player usually need a rule across the lineup. Create a second ruleset named `No shared champions`, with **Rule scope** set to **Deck set rule**:
```js
// Deck set rule: "No shared champions".
export default function validateDeckset(decks, cardsById) {
const firstDeckByChampion = new Map();
const issues = [];
decks.forEach((deck, index) => {
const deckNumber = index + 1;
for (const ref of Object.keys(deck)) {
const card = cardsById[ref];
if (card?.game?.supertypeRef !== "Champion") {
continue;
}
const firstDeck = firstDeckByChampion.get(ref);
if (firstDeck === undefined) {
firstDeckByChampion.set(ref, deckNumber);
} else {
issues.push({
code: "shared_champion",
message: `${card.name} is in deck ${firstDeck} and deck ${deckNumber}.`,
});
}
}
});
return { valid: issues.length === 0, issues };
}
```
`decks` is an array with one deck per entry, in the same shape as the deck rule's `deck`. Champions are found through `card.game.supertypeRef`, which is `"Champion"` in every language (the plain `supertype` is translated, so don't compare against it).
To try it, click **Multi Pile** in the deck builder, pick **No shared champions** in the deck set dropdown, click **Add deck** for a second deck, and import one of these codes into each deck (both run two copies of Zed):
```text
CEAACFABAICQMCAJBQIBCEQVC4NBWHBEEYVCYMRUGUAA
CEAAEAIBAIERGAIEAEBAGBAFAYDQUDANBYHRAEISCMKBKFYA
```
The lineup warning reads "Zed is in deck 1 and deck 2."
This rule replaces the built-in Riot lock deck set rule, so the lineup is no longer checked for repeated region pairs. Add that check here if your format needs it. The number of decks a player brings is a stage setting (**Decks to bring**), not part of the ruleset.
### 4. Attach it to a tournament
1. Go to [**Tournaments → Create tournament**](https://lor.turny.gg/tournaments/create) and fill in the basics.
2. In **Deck settings**, set **Deck sets** to `No shared champions`, **Decks** to `Two-of Standard` and **Cards** to `Eternal`.
3. Click **Save as draft** (or create the tournament).
The tournament's **Rules** tab now lists both scripts under **Deck rules**, marked **Unverified code** because they are yours rather than built in. Its **Deck Builder** button opens the builder with exactly this tournament's rules, which is the fastest way to check a deck against them. When players submit decks, the server runs the same three rules again and rejects a lineup that fails any of them.
## Reporting good errors
Players only see what your rule returns, so the messages are the user interface of your format.
- **Return every issue, with a `message`.** The message is shown to the player as written. `code` is a stable, machine-readable id (`copy_limit`, `banned_card`); it is shown only when there is no message, with underscores turned into spaces.
- **Name the card and the numbers.** "Zed: at most 2 copies (found 3)." tells the player exactly what to change; "Deck is illegal." does not.
- **Don't return a bare `false`.** It fails with a generic fallback ("Saved deck rule rejected this deck.") that doesn't say why.
- **Don't number decks in a deck rule.** On submission the server already prefixes each issue with where it came from (`Deck 2: …`, `Lineup: …`, `Card : …`). A deck set rule, which sees every deck at once, should name the decks itself, as the tutorial does.
- **Don't throw.** A thrown error is shown as an error instead of your issues, and the script can't create an `Error` object anyway. Return `{ valid: false, issues }` instead.
A deck rule written this way reads like a checklist:
```js
// Every problem at once, each with a code and a message.
export default function validateDeck(deck, cardsById) {
const issues = [];
const refs = Object.keys(deck);
if (refs.length < 10) {
issues.push({
code: "too_few_cards",
message: `Use at least 10 different cards (found ${refs.length}).`,
});
}
for (const ref of refs) {
if (!cardsById[ref]) {
issues.push({ code: "unknown_card", message: `Unknown card ${ref}.` });
}
}
return { valid: issues.length === 0, issues };
}
```
The full list of accepted return values is on the [ruleset script API](https://docs.turny.gg/reference/scripting/rulesets#return-values) page.
## Pool filters
A deck rule can also help players build: an optional `resolvePoolFilters` export sets the deck builder's card filters for the deck being edited. The Riftbound built-in rules use it to show only the domains of the Legend you picked. It never runs on submission and never changes whether a deck is legal.
Add this below `validateDeck` in the tutorial's deck rule. Once the deck has cards from exactly two regions, the builder's card pool narrows to those two regions:
```js
// Builder only: once the deck has two regions, filter the pool to them.
export function resolvePoolFilters(input) {
const pile = input.lineup.find(
(entry) => entry.pileId === input.activePileId,
);
if (!pile) {
return null;
}
const regions = new Set();
for (const ref of Object.keys(pile.cards)) {
for (const region of input.cardsById[ref]?.game?.regionRefs ?? []) {
// Skip Runeterra champion codes such as "06RU006".
if (!/^\d/.test(region)) {
regions.add(region);
}
}
}
return regions.size === 2 ? { regionRefs: [...regions] } : null;
}
```
Import the second deck code from step 3 (Zed plus Piltover & Zaun cards) with this rule selected and the card pool switches to Ionia and Piltover & Zaun.
How the builder treats the answer:
- **It suggests, it doesn't lock.** The player can change the filters afterwards. The builder only reapplies your suggestion when it changes (a card changes the deck's regions) or when the player switches to another deck.
- **Return only the filters you mean to set.** A key you leave out keeps the player's current value. `[]` clears that filter. `null` changes nothing.
- **Use the game's filter keys and values.** A key the builder doesn't know is dropped silently, so a typo does nothing. The list filters are:
| Game | Keys |
| -------------------- | ---------------------------------------------------------------------- |
| Legends of Runeterra | `regionRefs`, `typeRefs`, `rarityRefs`, `setCodes`, `keywordVocabRefs` |
| Pokémon TCG | `cardTypes`, `types`, `stages`, `rarities`, `setCodes` |
| Riftbound | `cardTypes`, `domains`, `rarities`, `sets`, `supertypes`, `tags` |
Values are the same refs the cards carry: `"Ionia"` and `"PiltoverZaun"` for regions, lowercase `"unit"` for a Riftbound card type.
- **It sees the whole lineup.** `input.lineup` has every deck (pile) in the builder, so a rule can read another pile, such as the Legend pile in Riftbound. Only deck rules are asked; card and deck set rules never are.
- **Watch for extra refs.** In Legends of Runeterra some cards also list a Runeterra champion's card code (such as `"06RU006"`) in `regionRefs`, next to their real region. That is why the example skips refs that start with a digit.
The input fields are listed under [`resolvePoolFilters`](https://docs.turny.gg/reference/scripting/rulesets#resolvepoolfilters) in the reference.
## Sharing rulesets
### Public and private
New rulesets are private: only you can see them. Tick **Make public** in the create or edit dialog to share one. A public ruleset appears on the **Rulesets** tab of your profile, grouped into deck set, deck and card rules, where anyone can read its code. Untick it to take it off your profile; copies other players already saved keep working.
### Saving someone else's ruleset
There are two places to pick up another player's ruleset:
- **A profile's Rulesets tab:** **Save to my account** adds a copy to your custom rulesets, and **Open in deck builder** tries it without saving.
- **A tournament's Rules tab:** **Add to saved rulesets** next to each custom rule adds a copy of the exact version that tournament uses.
A saved copy is marked **Downloaded**. It is read-only: you can view its code, **Duplicate** it into an editable ruleset of your own, or **Remove** it from your account, which leaves the original untouched.
::: warning Read before you save
Custom rules are code written by other players, and Turny.gg does not review it (the Rules tab labels it **Unverified code**). The [sandbox](https://docs.turny.gg/reference/scripting/sandbox) keeps a script away from your account and the page, but a rule can still be wrong or unfair. Read it first.
:::
### Pinned copies and updates
A downloaded copy is pinned to the version you saved. When the author edits their ruleset, your copy keeps running the code you saved; nothing changes until you choose to update. That way a rule can't change under a tournament or a deck you already checked.
When a copy saved from a tournament's Rules tab falls behind the author's latest version, it shows **Update available** in your custom rulesets. Click **Update** to switch it to the latest version; the copy also takes the author's current name. Copies saved from a profile don't show updates yet: save the ruleset again from the author's profile to get the newest version.
## Troubleshooting
### "This ruleset script uses APIs or syntax that are not allowed."
The safety check rejected the script when you saved it. The message doesn't say which line, so look for the usual causes:
| You wrote | Write instead |
| ----------------------------------- | ------------------------------------------------------------- |
| `var total = 0` | `let total = 0` or `const` |
| `console.log(…)` | Remove it, or report the value as an issue while debugging |
| `throw new Error("…")` | `return { valid: false, issues: ["…"] }` |
| `parseInt(x)` | `Number.parseInt(x, 10)` |
| `async` / `await`, classes, `this` | Plain synchronous functions |
| `import …` or a second named export | One default export (plus `resolvePoolFilters` in a deck rule) |
| `delete obj.key` | Build a new object without the key |
```js
// Rejected: variable_kind_unsupported, unsafe_global.
export default function validateDeck(deck) {
var total = 0;
console.log(deck);
return total === 0;
}
```
The [script sandbox](https://docs.turny.gg/reference/scripting/sandbox) lists everything the check allows and every issue code.
### Every deck fails with "Saved deck rule rejected this deck."
Your function returned something that isn't a pass: `false`, `undefined` (a missing `return`), or a result object with no `valid: true`. Return `true` or `{ valid: true }` for a legal deck. See [return values](https://docs.turny.gg/reference/scripting/rulesets#return-values).
### The builder shows an error instead of issues
The script threw while it ran. The most common cause is reading a field of a card that isn't there, like `cardsById[ref].game.cost` when the ref is unknown. Guard with `?.` and `??`. Writing to the arguments throws too, since they are frozen: build new objects (`{ ...deck }`) instead of changing `deck`.
### It's slow, or stops with a timeout
Each check has a time limit (see [time limits](https://docs.turny.gg/reference/scripting/sandbox#time-limits)). A card rule runs once for every card in the catalog when the builder filters the pool, so keep per-card work small and avoid loops inside loops over the whole deck.
### My ruleset isn't in the dropdown
Check that it is switched on in **Settings → Custom rulesets** ([Legends of Runeterra](https://lor.turny.gg/settings/custom-rulesets), [Pokémon TCG](https://pokemon.turny.gg/settings/custom-rulesets), [Riftbound](https://riftbound.turny.gg/settings/custom-rulesets)), that it has the scope that dropdown asks for, and that you're on the site of the game you created it for.
### A tournament still runs my old code
Tournaments keep the version they were saved with. Edit the tournament and save it to pick up your latest version (see [Create a ruleset and use it](#create-a-ruleset-and-use-it)).
### "Run rules without the sandbox…"
Your browser couldn't start the sandbox that runs rule scripts, so the builder can't check legality and saving is disabled. The builder then offers to run deck rules directly in the page instead, with no isolation. It is an explicit opt-in: it applies only to that browser, expires after 30 days, and never affects the server, which always checks submissions in its own sandbox. Only accept it if you trust the rules you use.
---
url: https://docs.turny.gg/guide/calculators
description: "Build deck calculators with the no-code builder or a compute script, and share them."
---
# Calculators
A calculator turns a deck into a small stats dashboard: a curve, a type breakdown, opening-hand odds, whatever numbers you care about. Every launched game ships with a ready-made one, and you can build your own in two ways:
- **The no-code builder.** Pick widgets from a palette, choose what they measure from your game's card fields, and watch a live preview.
- **Code.** Every builder calculator is a short JavaScript function underneath. Open it as code to go past what the builder can do, or write one from scratch.
This guide walks through both. For the exact shape of every argument and widget field, see the [calculator script API](https://docs.turny.gg/reference/scripting/calculators).
## Where calculators show up
Look for the **Calculators** button (a calculator icon) on any deck:
- in the deck builder, next to the deck's other actions,
- on a deck page and in the deck preview dialog,
- in the action menu of your saved decks.
It opens a dialog with a **Calculator** picker at the top. The picker has two groups: **Defaults** (the calculators Turny.gg ships for the game) and **Your calculators** (the ones you made or saved). Pick one and it runs over the deck in front of you. A deck set is counted as one combined deck. Side deck and maybeboard piles are left out; where a deck page offers an **Include sideboard** switch, it adds the sideboard back.
In Riftbound, a calculator with a **Draw odds** widget runs over the cards you draw from: the Chosen Champion starts in its own zone, so a 40-card Main Deck gives odds over 39 cards. Runes, the Legend and Battlefields are passed in too, so check `card.game.type` (`rune`, `legend`, `battlefield`) to leave them out of main-deck counts.
You manage calculators in **Settings → Calculators** on each game's site: [Legends of Runeterra](https://lor.turny.gg/settings/custom-calculators), [Pokémon TCG](https://pokemon.turny.gg/settings/custom-calculators) or [Riftbound](https://riftbound.turny.gg/settings/custom-calculators). Calculators belong to one game, so the list shows only that game's calculators. From there you can:
- switch any calculator on or off; a switched-off calculator is hidden from the picker (it says "Hidden from deck views"),
- **View code** of any calculator, including the defaults,
- **Duplicate** any calculator into an editable copy of your own,
- **Edit** or **Delete** calculators you made.
Default calculators are read-only. To change one, duplicate it and edit the copy.
## The default dashboards
Every launched game has one default calculator, called **Deck breakdown**. It is on for everyone until you switch it off.
| Game | What Deck breakdown shows |
| -------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Legends of Runeterra | Mana curve, card types (champions, followers, spells, landmarks, equipment), rarity, regions, average cost, and a units to spells ratio. |
| Pokémon TCG | Pokémon / Trainer / Energy breakdown, energy types, mulligan chance, an **Opening Hand Starters** table (the odds each Basic Pokémon starts, and the odds it is your only Basic), retreat cost, and regulation marks. |
| Riftbound | Energy curve, domains, card types, average energy, and a unit / spell / gear split. |
The defaults are ordinary calculator scripts, and their full source is on the [calculator script API](https://docs.turny.gg/reference/scripting/calculators#examples-the-default-calculators) page. They make good starting points: **Duplicate** one and edit the copy.
## Tutorial: build a dashboard without code
This tutorial builds a Pokémon TCG calculator called **Starter check** with two widgets: a retreat cost curve for your Pokémon, and a table of opening-hand starter odds for every Basic Pokémon. The same steps work in every game; only the field names change.
### 1. Start a new calculator
1. Go to [pokemon.turny.gg](https://pokemon.turny.gg) and sign in.
2. Open [**Settings → Calculators**](https://pokemon.turny.gg/settings/custom-calculators) and click **New calculator**.
3. Type `Starter check` in **Calculator name**.
The dialog has three parts:
- **Sample deck** at the top: the deck the preview runs on. It starts as a popular deck for the game. Click **Change deck** and paste a deck code or deck list to preview against your own deck instead; **Reset to sample** switches back.
- **Add a widget**: the palette, with one button per widget type.
- **Live preview** on the right, which reruns as you edit.
The palette names are friendlier than the widget types in the script API:
| Palette button | Widget type | Shows |
| -------------- | ---------------- | ------------------------------------------------------------- |
| Stat | `stat` | One number, like an average or a count. |
| Curve | `histogram` | Bars over a number range, like a mana or energy curve. |
| Donut | `donut` | A ring split by category. |
| Gauge | `gauge` | A bar split by category. |
| Table | `table` | Rows and columns: a grouped count, or one row per card. |
| Draw odds | `hypergeometric` | The chance of drawing at least one (or exactly N) of a group. |
| Ratio | `ratio` | One count divided by another. |
### 2. Add a retreat cost curve
1. Click **Curve**. A widget card appears and the preview shows a curve right away.
2. Set **Title** to `Retreat cost`.
3. Set **Number field** to **Retreat cost**. Leave **Bucket size** at `1`, **Min** at `0` and **Max** empty (empty means the curve stretches to the highest value in the deck).
4. Under **Filter**, click **Add condition**, then set the condition to **Card type** · **is** · **Pokémon**.
The preview now shows one bar per retreat cost, counting only Pokémon.
Two settings appear on every widget:
- **Count**: **Card copies** counts a 3-of three times; **Distinct cards** counts it once.
- **Filter**: which cards the widget looks at. With no conditions, every card counts. With two or more conditions, choose whether a card must **Match all** or **any** of them. Categorical fields (card type, stage, energy type, regulation mark) offer a dropdown of values; others take free text, and **is one of** takes a comma-separated list.
### 3. Add an opening-hand starter table
1. Click **Table**.
2. Set **Title** to `Opening hand starters`.
3. Set **Group by** to **Per card**. The table switches to one row per distinct card, and it comes preset with three columns: **Card** (the card name), **Possible starter** and **Forced starter**, each over **Cards drawn** `7`.
4. Under **Filter**, click **Add condition**, then set it to **Stage** · **is** · **Basic**.
The preview now lists each Basic Pokémon with two odds:
- **Possible starter**: the chance at least one copy is in your opening 7 cards.
- **Forced starter**: the chance it is your _only_ Basic in those 7 cards, so it has to start. The filter defines what counts as "a Basic": every other card that matches the filter competes with it.
Use **Stage**, not **Subtype**, for this filter. Basic Energy cards carry a "Basic" subtype too; **Stage** only applies to Pokémon, so energy stays out.
Use the arrows on a widget card to reorder widgets and × to remove one.
### 4. Save it
Leave **Make public** unchecked for now and click **Create**. **Starter check** appears in your list, switched on and marked **Custom** and **Private**. Open any Pokémon deck, click the Calculators button, and pick **Starter check** under **Your calculators**.
To change it later, click **Edit**: a calculator made in the builder reopens in the builder with all its widgets.
::: tip Peek at the code
**View compiled script** under the widgets shows the JavaScript the builder generated. You don't need it, but it is the bridge to the next tutorial.
:::
## Tutorial: switch to code and add your own widget
The builder covers a lot, but not everything. This tutorial adds a **Mulligan chance** stat to Starter check: the chance your opening 7 cards hold no Basic Pokémon at all. The builder can show the chance of drawing at least one Basic, but it can't show "1 minus that" as a percentage, so this is a job for code.
### 1. Open the builder's code
1. In [**Settings → Calculators**](https://pokemon.turny.gg/settings/custom-calculators), click **Edit** on Starter check.
2. Click **Drop to code** under the widgets.
The widget form is replaced by a code editor holding the generated script, with the live preview beside it. The script looks like this, shortened:
```text
// @calculator-spec:v1 {"widgets":[{"kind":"histogram","label":"Retreat cost",...}]}
//
// Generated by the Turny.gg calculator builder. ...
export default function compute(pile, cardsById) {
// One row per distinct card in the deck: `quantity` copies of `card`.
const rows = Object.keys(pile).map((ref) => ({ ... }));
// ---- Shared helpers ----
const toNumber = (value) => { ... };
const filterRows = (test) => rows.filter(test);
const totalWeight = (selection, weightOf) => ...;
const containsValue = (haystack, needle) => { ... };
const roundTo = (value, places) => { ... };
// ...more helpers...
const widgets = [];
// Widget 1: "Retreat cost" (curve histogram)
{ ... widgets.push({ kind: "histogram", ... }); }
// Widget 2: "Opening hand starters" (distinct-card table)
{ ... widgets.push({ kind: "table", ... }); }
return { widgets: widgets };
}
```
What you get to work with:
- `rows`: one entry per distinct card in the deck, with `row.quantity` (copies) and `row.card` (the full card, or `undefined` if the catalog doesn't know it).
- The shared helpers, such as `filterRows(test)` (the rows that pass a test), `totalWeight(rows, weightOf)` (add up a number per row), `containsValue(list, value)` and `roundTo(number, places)`.
- `widgets`: the array every widget block pushes into. The function ends by returning it.
The card fields under `row.card.game` are different in every game; see the card data reference for [Cyberpunk TCG](https://docs.turny.gg/reference/card-data/cyberpunk), [Flesh and Blood](https://docs.turny.gg/reference/card-data/fab), [Hearthstone](https://docs.turny.gg/reference/card-data/hs), [Legends of Runeterra](https://docs.turny.gg/reference/card-data/lor), [Palworld TCG](https://docs.turny.gg/reference/card-data/palworld), [Pokémon TCG](https://docs.turny.gg/reference/card-data/pokemon) and [Riftbound](https://docs.turny.gg/reference/card-data/riftbound).
### 2. Add the widget
Put the cursor at the start of the line `return { widgets: widgets };` near the end of the script and paste this block above it:
```js
// Mulligan chance (hand-written)
{
const deckSize = totalWeight(rows, (row) => row.quantity);
const basics = totalWeight(
filterRows(
(row) =>
row.card?.game?.supertype === "Pokemon" &&
containsValue(row.card?.game?.subtypes, "Basic"),
),
(row) => row.quantity,
);
let chance = 0;
if (deckSize >= 7 && deckSize - basics >= 7) {
chance = 1;
for (let i = 0; i < 7; i = i + 1) {
chance = (chance * (deckSize - basics - i)) / (deckSize - i);
}
}
widgets.push({
kind: "stat",
label: "Mulligan chance",
value: roundTo(chance * 100, 1),
unit: "%",
});
}
```
The chance of no Basic in 7 cards is the chance that each draw in turn is a non-Basic: `(non-Basics / deck) × (non-Basics − 1) / (deck − 1) × ...`, seven times. If there are fewer than 7 non-Basics, a Basic can't be avoided and the chance is 0. The card type check reads `"Pokemon"` without the accent, which is how the catalog spells it.
The preview shows a third widget, **Mulligan chance**, under the other two.
### 3. Delete the marker line, then save
Look at the first line of the script, the one starting with `// @calculator-spec:v1`. That is the **marker**: the builder's own settings for the calculator, saved as a comment. It has no effect on how the script runs. The builder reads it to reopen the calculator:
- While the code is still exactly what the builder generates from the marker, **Back to builder** above the editor works, and you lose nothing by switching back.
- As soon as you change the code, **Back to builder** turns off with the note "This script has been edited by hand, so it can no longer open in the builder." Undo your edits and it turns back on.
::: warning Delete the marker when you edit by hand
If you save hand-edited code with the marker still in it, the next **Edit** opens the calculator in the builder, rebuilt from the marker. Saving from there replaces your code with the builder's version and your hand edits are lost.
So once you edit the code, **delete the whole first line** (the `// @calculator-spec:v1 ...` line) before you click **Save changes**. A script without a marker always opens in the code editor.
:::
Delete the marker line and click **Save changes**. Starter check now has three widgets and opens in the code editor from now on. To get back to the builder, make a new calculator.
### Starting from scratch
You don't have to start from builder output. **New calculator** → **Drop to code** with no widgets gives you an empty generated script to fill in, and **Duplicate** on a default gives you a hand-written script to adapt. The smallest calculator that works is:
```js
export default function compute(pile) {
let total = 0;
Object.keys(pile).forEach((ref) => {
total += pile[ref];
});
return {
widgets: [
{ kind: "stat", label: "Deck size", value: total, unit: "cards" },
],
};
}
```
`compute` gets two arguments: `pile`, which maps each card ref in the deck to its number of copies, and `cardsById`, which maps each of those refs to its card. The [calculator script API](https://docs.turny.gg/reference/scripting/calculators) also documents a third, `ctx`, with the catalog's globals. Calculators opened on Turny.gg today are called without it, so don't rely on it.
## Widget cookbook
One small, complete calculator per widget type, each reading real card fields. Paste one into the code editor to try it, or copy the part you need. Every field of every widget is listed in the [widget reference](https://docs.turny.gg/reference/scripting/calculators#widget-reference), and the [script API page](https://docs.turny.gg/reference/scripting/calculators#widget-examples) has a game-neutral example of each.
::: code-group
```js [stat]
// Legends of Runeterra: champion copies in the deck.
export default function compute(pile, cardsById) {
let champions = 0;
Object.keys(pile).forEach((ref) => {
const card = cardsById[ref];
if (card && card.game && card.game.supertypeRef === "Champion") {
champions += pile[ref];
}
});
return {
widgets: [
{ kind: "stat", label: "Champions", value: champions, unit: "copies" },
],
};
}
```
```js [histogram]
// Riftbound: energy curve, with 7 and up in the last bar.
export default function compute(pile, cardsById) {
const labels = ["0", "1", "2", "3", "4", "5", "6", "7+"];
const buckets = [0, 0, 0, 0, 0, 0, 0, 0];
Object.keys(pile).forEach((ref) => {
const card = cardsById[ref];
const energy = card && card.game ? card.game.energy : undefined;
if (typeof energy === "number") {
buckets[Math.min(Math.max(energy, 0), 7)] += pile[ref];
}
});
return {
widgets: [
{
kind: "histogram",
label: "Energy curve",
buckets: buckets,
labels: labels,
},
],
};
}
```
```js [donut]
// Legends of Runeterra: copies per region.
export default function compute(pile, cardsById) {
const counts = new Map();
Object.keys(pile).forEach((ref) => {
const card = cardsById[ref];
const regions =
card && card.game && Array.isArray(card.game.regionRefs)
? card.game.regionRefs
: [];
regions.forEach((region) => {
counts.set(region, (counts.get(region) || 0) + pile[ref]);
});
});
const segments = [];
counts.forEach((value, region) => {
segments.push({ key: region, label: region, value: value, color: "" });
});
return { widgets: [{ kind: "donut", label: "Regions", segments: segments }] };
}
```
```js [gauge]
// Pokémon TCG: Pokémon / Trainer / Energy split as one bar.
export default function compute(pile, cardsById) {
let pokemon = 0;
let trainers = 0;
let energy = 0;
Object.keys(pile).forEach((ref) => {
const card = cardsById[ref];
const supertype = card && card.game ? card.game.supertype : undefined;
if (supertype === "Pokemon" || supertype === "Pokémon") {
pokemon += pile[ref];
} else if (supertype === "Trainer") {
trainers += pile[ref];
} else if (supertype === "Energy") {
energy += pile[ref];
}
});
return {
widgets: [
{
kind: "gauge",
label: "Deck split",
segments: [
{ key: "pokemon", label: "Pokémon", value: pokemon, color: "" },
{ key: "trainer", label: "Trainer", value: trainers, color: "" },
{ key: "energy", label: "Energy", value: energy, color: "" },
],
},
],
};
}
```
```js [bars]
// Riftbound: copies per domain, most first.
export default function compute(pile, cardsById) {
const counts = new Map();
Object.keys(pile).forEach((ref) => {
const card = cardsById[ref];
const domains =
card && card.game && Array.isArray(card.game.domains)
? card.game.domains
: [];
domains.forEach((domain) => {
counts.set(domain, (counts.get(domain) || 0) + pile[ref]);
});
});
const segments = [];
counts.forEach((value, domain) => {
segments.push({ key: domain, label: domain, value: value, color: "" });
});
segments.sort((left, right) => right.value - left.value);
return { widgets: [{ kind: "bars", label: "Domains", segments: segments }] };
}
```
```js [table]
// Riftbound: units sorted by might.
export default function compute(pile, cardsById) {
const rows = [];
Object.keys(pile).forEach((ref) => {
const card = cardsById[ref];
if (card && card.game && card.game.type === "unit") {
const might = typeof card.game.might === "number" ? card.game.might : 0;
rows.push([card.name, might, pile[ref]]);
}
});
rows.sort((left, right) => right[1] - left[1]);
return {
widgets: [
{
kind: "table",
label: "Units by might",
columns: ["Unit", "Might", "Copies"],
rows: rows,
},
],
};
}
```
```js [hypergeometric]
// Pokémon TCG: odds of at least one Basic Pokémon in the opening 7.
export default function compute(pile, cardsById) {
let deckSize = 0;
let basics = 0;
Object.keys(pile).forEach((ref) => {
const card = cardsById[ref];
const game = card && card.game ? card.game : {};
deckSize += pile[ref];
if (
game.supertype === "Pokemon" &&
Array.isArray(game.subtypes) &&
game.subtypes.indexOf("Basic") !== -1
) {
basics += pile[ref];
}
});
return {
widgets: [
{
kind: "hypergeometric",
label: "Basic Pokémon in opening hand",
population: deckSize,
successCount: basics,
draws: 7,
exactCounts: [1, 2],
},
],
};
}
```
```js [ratio]
// Legends of Runeterra: units per spell.
export default function compute(pile, cardsById) {
let units = 0;
let spells = 0;
Object.keys(pile).forEach((ref) => {
const card = cardsById[ref];
const type = card && card.game ? card.game.typeRef : undefined;
if (type === "Unit") {
units += pile[ref];
} else if (type === "Spell") {
spells += pile[ref];
}
});
return {
widgets: [
{
kind: "ratio",
label: "Units : Spells",
numerator: units,
denominator: spells,
format: "ratio",
},
],
};
}
```
:::
A few things these examples do on purpose:
- **Guard every card.** `cardsById[ref]` can be `undefined` when the catalog doesn't know a card, so each example checks `card && card.game` before reading fields.
- **Use the English `...Ref` fields in Legends of Runeterra.** `typeRef`, `supertypeRef` and `regionRefs` are the same in every language; `type` and `supertype` follow the viewer's language.
- **Leave `color` empty** (`""`) to let Turny.gg pick segment colors, or set a CSS color like `"#3a78e8"`.
- **Return data, never markup.** Labels and values are drawn as plain text, so HTML in a label shows up as literal text.
## Sharing on your profile
Check **Make public** in the calculator dialog (on create or edit) and save. The calculator's badge changes from **Private** to **Public**, and it appears on the **Calculators** tab of your profile (`/users//calculators`), on the game site it belongs to.
On your profile, each public calculator shows its name, game and last update. **Show source** expands its full code so other players can read it. A signed-in player can click **Save to my calculators** to add a private copy to their own calculators, marked **Downloaded**. The copy keeps the version they saved: your later edits never change it. Once a player has saved it, the button reads **View in my calculators** (on your own profile it always does). The profile's Calculators tab only appears to other players once you have at least one public calculator.
Things to know:
- A **duplicate** always starts private, even when you duplicate a public calculator.
- Uncheck **Make public** and save to take a calculator off your profile.
- Public means the code is public. Don't put anything in a comment or label you wouldn't want others to read.
## Troubleshooting
### The preview or the calculator shows an error
The live preview shows the error instead of the dashboard. On a deck, a calculator that fails shows "This calculator could not run. Its script may have an error." Common causes:
| Message | Cause |
| ---------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------ |
| Calculator script source is empty. | The editor is empty. |
| Calculator script did not export a compute function. | No `export default function compute(...)`, no `export default` function, and no top-level `function compute(...)`. |
| A JavaScript error such as `Cannot read properties of undefined` | The script read a field on a missing card or missing field. Guard with `card && card.game` (or `?.`) first. |
### "This calculator script uses APIs or syntax that are not allowed."
Calculators run in the same locked-down sandbox as custom rulesets, and a safety check reads every script before it runs or saves. When it rejects a script, **Save** refuses with this message, and the preview shows the same message followed by what the check found. The usual suspects:
- `var` (use `let` or `const`),
- globals that aren't on the allowed list, such as `fetch`, `window`, `globalThis` or `eval`,
- `async`, `await` and generator functions,
- `class`, `this`, `delete` and `import`,
- `new` on anything other than `Date`, `Map`, `RegExp` or `Set`,
- property names such as `constructor`, `prototype` and `__proto__`,
- assigning to a variable you didn't declare.
The full rules, with every allowed global and every rejection code, are on the [script sandbox](https://docs.turny.gg/reference/scripting/sandbox) page.
### It runs forever, then fails
A calculator that runs longer than **5 seconds** is stopped. On a deck it shows the error message; in the editor the live preview says "This calculator ran for more than 5 seconds and was stopped. Check for a loop that never ends." That almost always means a loop that never ends, such as a `while` whose condition never turns false. The preview runs in the same sandbox with the same limit, so an endless loop can't freeze the page: fix the loop and the preview runs again. Calculators only ever see one deck, so a script that finishes quickly on the sample deck will finish quickly everywhere.
### Some of my output is missing
Nothing a calculator returns is drawn as-is. It is checked first, and anything that doesn't fit is repaired or dropped instead of breaking the dashboard:
- A widget with an unknown `kind` is dropped; the rest still draw.
- Numbers that aren't numbers become `0`.
- A widget with nothing to show (no rows, no positive values, a zero denominator) draws "No data".
- Output past the caps is cut off: at most 50 widgets, 100 segments per donut or gauge, 200 histogram bars, 200 table rows, 20 table columns, and 200 characters per label or table cell.
The exact rules are under [How bad output is handled](https://docs.turny.gg/reference/scripting/calculators#how-bad-output-is-handled) and [Limits](https://docs.turny.gg/reference/scripting/calculators#limits).
### My code edits disappeared
The calculator still had its `// @calculator-spec:v1` marker when you saved, so the next **Edit** reopened it in the builder, and saving from the builder wrote the builder's version back. See [Delete the marker line, then save](#_3-delete-the-marker-line-then-save). If you still have your edited code, paste it back, delete the marker line and save.
### The builder offers the wrong fields
The fields in the builder come from the game site you are on: Pokémon fields on [pokemon.turny.gg](https://pokemon.turny.gg/settings/custom-calculators), Runeterra fields on [lor.turny.gg](https://lor.turny.gg/settings/custom-calculators), and so on. Calculators are per game, so open Settings on the site for the game you are building for.
---
url: https://docs.turny.gg/guide/playtest
description: "Goldfish a deck on a virtual table, solo or against a mirrored opponent, and write, share and fix the playtest rules scripts that set the table up."
---
# Playtest
Playtest puts a deck on a virtual table so you can play it out by hand: draw, play cards, tap them, count damage, take turns. You can play **solo** or against a **mirrored opponent** that you also control. Nothing checks the rules of the game; you move the cards, and every move can be undone.
What the table looks like comes from a **playtest rules script**. It lists the piles (zones), where they sit, who can see them, what you can do to cards and piles, and which keys do it. Every launched game with a playtest table ships a default script, and you can fork it, change it and share your version.
This guide covers playing first, then writing and sharing rules. For the exact shape of everything a script can return, see the [playtest rules script API](https://docs.turny.gg/reference/scripting/playtest).
## Using Playtest {#using-playtest}
### Where to find it
Look for the **Playtest** button (a game controller icon) on any deck:
- on a deck page and in the deck preview dialog,
- in the deck builder, next to the deck's other actions,
- in the action menu of your saved decks.
**Playtest** is also its own item in the side navigation, near the bottom, on every game that has playtest rules. Opening it from there starts with no deck picked.
### Pick the rules and a deck
Setting up a game takes three steps, and you can go back and **Change** any of them before you start.
1. **Rules.** When only one set of rules is switched on for the game, it is used without asking. With more than one, pick a set; tick **Don't ask again** to always use the last set you picked. You can switch rules on and off in [Settings](#manage-your-rules).
2. **Deck.** The deck you launched Playtest from is already filled in. Otherwise pick one of **Your saved decks** (when signed in) or **Paste a deck code** (anyone can).
3. **Mode.** **Solo** sets up only your side of the table. **Versus** adds a mirrored opponent board that you also control; there is no computer opponent. The opponent plays **the same deck as yours** unless you choose **Use a different deck**.
Press **Start** and the table deals itself: the rules' setup runs for each side (usually a shuffle and an opening hand).
### Playing the table
The rules decide what each input does, but the inputs are always the same:
| Input | What it does |
| ------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **Click** a card | Runs the card's click action if the rules give it one; otherwise selects it (click again to deselect). |
| **Ctrl-click**, **Cmd-click** or **Shift-click** a card | Adds the card to the selection, or takes it out. Actions on "the selection" then run on every selected card. |
| **Double-click** a card | Runs the card's double-click action, such as playing it or taking a prize. |
| **Click** a pile | Runs the pile's main action, such as drawing from the deck. |
| **Right-click** (or **long-press**) a card or pile | Opens a menu of every action that applies to it. A pile's menu also has **View cards** and **Look at top cards**. |
| **View card** in a card's menu | Shows everything stacked on the card, such as attached energy and tools and earlier evolutions. Pick any of them and **Move** them, as in **View cards**: a moved card takes its attachments along, a lone attachment comes off. |
| **Drag** a card onto a pile | Moves it there (a dragged card that is part of the selection moves the whole selection). Some rules run an action instead. |
| **Drag** a card onto another card | Runs the dragged card's drop action if it has one, such as attaching an energy or evolving a Pokémon. |
On a touch screen, tap a card to select it and tap it again to run its main action. In your hand, drag a card upward to pick it up; elsewhere, press and hold, then move. Release a held card without moving to open its menu instead.
Some actions create cards that weren't in your deck, such as copies, level-ups and tokens. Created cards carry a small badge. When an action can create more than one kind of card, a picker asks which.
The toolbar above the table has **New game**, **Undo** and **Redo**, an **Actions** menu (everything that applies to a side or the whole table, for both sides), the **Turn** button, a **−** and **+** for each tracker such as life or mana, the **Action log** and **Keyboard shortcuts**. In Versus it also has **Reveal opponent hand**, which shows the opponent's private cards to you, and **Flip board**, which swaps which side sits at the bottom.
**Turn** shows the current turn, starting at 1. When the rules name a turn action (usually **New turn**), clicking **Turn** runs it, exactly as picking it from the **Actions** menu does, and it undoes the same way; that action's shortcut (`N` in the default rules) does the same as the click. **In Versus the sides take turns**: each click starts the next turn for the other side, start-of-turn draw included, and the button names whose turn it is (**Turn 3 · Opponent**). Rules whose turn action advances the whole table at once, as Legends of Runeterra's does, count **Rounds** instead. Rules without a turn action show the count only.
In Versus the **Actions** menu lists your actions and the opponent's under separate headings (**Game · You**, **Game · Opponent**), and the opponent's shortcuts show with Alt.
**View cards** opens with **Move to** set to your hand, the usual place to take a card from a deck or discard pile.
A pile or a card that refuses a move (a full Bench, a card the zone doesn't accept) keeps the card where it was, and the log says so.
### Acting for the opponent: hold Alt {#alt-for-the-opponent}
In Versus, **every input with Alt held acts on the opponent's side instead of yours.** With Legends of Runeterra's default rules, `D` draws for you and `Alt+D` draws for the opponent, and Alt-clicking your deck draws for the opponent too. Actions on cards always act for the card's owner, so Alt matters for piles and for side-wide actions.
On a Mac, Alt is the Option key. Because Alt is reserved for this, no rules script can put Alt in a shortcut.
### Undo, redo and rewind {#undo-redo-and-rewind}
**Every change to the table can be undone**, including a drag and drop and New game.
- **Undo** with `Mod+Z` (Cmd+Z on a Mac, Ctrl+Z elsewhere) or the toolbar button. **Redo** with `Mod+Shift+Z` or `Mod+Y`.
- **One action is one undo step.** A compound action such as **New turn** (untap everything, then draw) undoes as a whole.
- **Doing something new clears the redo list**, as in a text editor.
- **Shuffles repeat exactly.** The table's randomness comes from a seed saved with the game, so undoing a shuffle and redoing it gives the same order. To really re-roll, open **Actions** and pick **New random seed**.
- **Rewind from the log.** The **Action log** lists every action in order. Click an entry to **Rewind to this point**; the later actions stay in the redo list until you do something new.
Selecting cards, hovering and opening a viewer are not changes to the table, so they are never undone.
### Keyboard shortcuts {#keyboard-shortcuts}
Press `?` at any time to see every shortcut the current rules define, grouped as the rules group them. When the rules describe an action, the description under its name says what it does and which card to select or point at.
- A shortcut for a **card action** runs on the selected cards, or on the card under the pointer when nothing is selected.
- A shortcut that **attaches** cards (an energy, a tool, an evolution) runs on the selected cards and attaches them to the card under the pointer, as long as that card is not selected itself. Right-clicking that card offers the same attach actions in its menu.
- A shortcut for a **pile action** runs on the pile under the pointer, or on the pile the action belongs to.
- A shortcut for a **side or table action** runs for you (hold Alt for the opponent).
- `Escape` clears the selection.
Shortcuts match the key you press, not the letter it types, so they work the same on every keyboard layout.
### Your game is saved in this browser
The game in progress, including its undo history, is saved automatically in this browser as you play, so a reload doesn't lose it. It is not saved to your account: another browser or device starts fresh, and clearing the site's data deletes it.
## The default rules {#the-default-rules}
Each game's default rules are plain playtest scripts. Read their source to see a complete, real table, or fork one as the starting point for your own:
| Game | Rules | Source |
| --- | --- | --- |
| Cyberpunk TCG | Standard | [Read the script](https://cyberpunk.turny.gg/playtest-rules/019a6a4c-7c50-7a01-9c2e-4f1d8b3e7c50) |
| Flesh and Blood | Standard | [Read the script](https://fab.turny.gg/playtest-rules/01926f3a-2067-7000-8000-000000000001) |
| Hearthstone | Standard | [Read the script](https://hs.turny.gg/playtest-rules/01926f3a-1118-7000-8000-000000000001) |
| Legends of Runeterra | Standard | [Read the script](https://lor.turny.gg/playtest-rules/01926f3a-1019-7000-8000-000000000001) |
| Magic: The Gathering | Standard | [Read the script](https://mtg.turny.gg/playtest-rules/019a2b40-1022-7a01-8c3e-5d2f7b9e1022) |
| Magic: The Gathering | Commander | [Read the script](https://mtg.turny.gg/playtest-rules/019a2b40-1022-7a02-8c3e-5d2f7b9e1022) |
| Palworld TCG | Standard game | [Read the script](https://palworld.turny.gg/playtest-rules/01926f3a-9a1d-7000-8000-000000000001) |
| Pokémon TCG | Standard | [Read the script](https://pokemon.turny.gg/playtest-rules/019a1f6e-5c3d-7a41-9b2e-6f0d4c8a1020) |
| Riftbound | Standard | [Read the script](https://riftbound.turny.gg/playtest-rules/01926f3a-1021-7000-8000-000000000001) |
## Writing playtest rules {#writing-playtest-rules}
A playtest rules script is a JavaScript function that runs once when a game starts. It returns plain data describing the table, and the table does the rest. It never runs again during the game, so it cannot react to clicks: instead it declares actions as lists of simple **steps** (move, draw, shuffle, tap, add a counter, ...) that the table runs for you.
### Manage your rules {#manage-your-rules}
Playtest rules belong to one game. Manage them in **Settings → Playtest rules** on that game's site, for example [Legends of Runeterra](https://lor.turny.gg/settings/playtest-rules) or [Pokémon TCG](https://pokemon.turny.gg/settings/playtest-rules). The list shows the game's system defaults and your own rules. From there you can:
- **switch** any set on or off; a switched-off set is hidden from the rules picker ("Hidden from the rules picker"),
- **Try it** to open Playtest with those rules and a sample deck,
- **View code** of a system default or a saved copy,
- **Fork** any set into a new, editable set of your own,
- **Edit**, **Delete** and share the sets you made (see [Sharing](#sharing)).
System defaults are read-only. To change one, fork it.
### Tutorial: a three-zone table
This tutorial builds a small table from scratch: a deck, a hand and a board. Then it adds actions and shortcuts.
#### 1. Start a new set of rules
1. Open **Settings → Playtest rules** and click **New rules**.
2. Type `My first table` in **Name**.
3. Replace the **Rules script** with the script below.
The **Validation** panel beside the editor re-checks the script as you type, over a sample deck for the game. It lists any problem with its code (see [Troubleshooting](#troubleshooting)), or counts the zones, actions and shortcuts and lists every shortcut.
```js
export default function playtest(deck) {
// One entry per copy: a 3-of appears three times.
const cards = [];
Object.keys(deck.main).forEach((code) => {
for (let copy = 0; copy < deck.main[code]; copy += 1) {
cards.push(code);
}
});
return {
version: 1,
// Each side is 6 columns by 2 rows. Row 0 is nearest the middle.
table: { columns: 6, rows: 2 },
zones: [
{
id: "board",
label: "Board",
owner: "side",
visibility: "public",
layout: "row",
area: { row: 0, col: 0, colSpan: 5 },
ordered: true,
defaultFaceDown: false,
},
{
id: "deck",
label: "Deck",
owner: "side",
visibility: "hidden",
layout: "pile",
area: { row: 0, col: 5 },
ordered: true,
defaultFaceDown: true,
},
{
id: "hand",
label: "Hand",
owner: "side",
visibility: "private",
layout: "fan",
area: { row: 1, col: 0, colSpan: 6 },
ordered: true,
defaultFaceDown: false,
},
],
trackers: [],
markers: [],
actions: [],
setup: [],
initialZones: { deck: cards },
};
}
```
What each part does:
- **`deck`** is the deck being played: `deck.main` maps each card code to its number of copies. The script turns it into a list with one entry per copy.
- **`table`** is the grid each side is drawn on. Row 0 borders the middle of the table, so the board sits nearest the opponent and the hand nearest you.
- **`zones`** are the piles. `owner: "side"` gives each player their own copy. `visibility` says who sees card faces: nobody (`"hidden"`), only the owner (`"private"`) or everyone (`"public"`). `layout` is how the cards are drawn: a `"pile"`, a `"fan"`, a `"row"`, and more.
- **`initialZones`** says where the cards start: the whole deck, face down, in `deck`.
Even with no actions, this table already works: drag cards between the three zones, and undo any move.
#### 2. Add actions
An action is a named list of steps, plus what it runs on (`target`) and how you trigger it. Replace `actions: [],` in the script with:
```js
actions: [
// Click the deck to draw a card.
{
id: "draw",
label: "Draw",
target: "zone",
zones: ["deck"],
triggers: ["click"],
steps: [{ kind: "draw", from: "deck", to: "hand" }],
},
// Double-click a card in hand to play it.
{
id: "play",
label: "Play",
target: "selection",
zones: ["hand"],
triggers: ["doubleClick"],
steps: [{ kind: "move", to: "board" }],
},
// Double-click a card on the board to tap or untap it.
{
id: "tap",
label: "Tap / untap",
target: "selection",
zones: ["board"],
triggers: ["doubleClick"],
steps: [{ kind: "rotate" }],
},
],
```
- `target: "zone"` with `zones: ["deck"]` makes **Draw** an action of the deck. `triggers: ["click"]` runs it when you click the deck.
- `target: "selection"` runs on every selected card, or on the card you double-clicked. `zones: ["hand"]` limits **Play** to cards in your hand.
- A `rotate` step with no `to` turns each card between upright and tapped.
- Every action also appears in the right-click menu of whatever it applies to. Add `menu: false` to leave one out.
#### 3. Add shortcuts and a setup
Give each action a `shortcut`, add a **Next turn** action that untaps and draws, and a `setup` that shuffles and deals an opening hand. This is the finished script:
```js
export default function playtest(deck) {
const cards = [];
Object.keys(deck.main).forEach((code) => {
for (let copy = 0; copy < deck.main[code]; copy += 1) {
cards.push(code);
}
});
return {
version: 1,
table: { columns: 6, rows: 2 },
zones: [
{
id: "board",
label: "Board",
owner: "side",
visibility: "public",
layout: "row",
area: { row: 0, col: 0, colSpan: 5 },
ordered: true,
defaultFaceDown: false,
},
{
id: "deck",
label: "Deck",
owner: "side",
visibility: "hidden",
layout: "pile",
area: { row: 0, col: 5 },
ordered: true,
defaultFaceDown: true,
primaryActionId: "draw",
},
{
id: "hand",
label: "Hand",
owner: "side",
visibility: "private",
layout: "fan",
area: { row: 1, col: 0, colSpan: 6 },
ordered: true,
defaultFaceDown: false,
},
],
trackers: [],
markers: [],
actions: [
{
id: "draw",
label: "Draw",
target: "zone",
zones: ["deck"],
shortcut: "d",
steps: [{ kind: "draw", from: "deck", to: "hand" }],
},
{
id: "play",
label: "Play",
target: "selection",
zones: ["hand"],
triggers: ["doubleClick"],
shortcut: "p",
steps: [{ kind: "move", to: "board" }],
},
{
id: "tap",
label: "Tap / untap",
target: "selection",
zones: ["board"],
triggers: ["doubleClick"],
shortcut: "t",
steps: [{ kind: "rotate" }],
},
{
id: "nextTurn",
label: "Next turn",
target: "side",
shortcut: "n",
steps: [
{ kind: "readyAll", zones: ["board"] },
{ kind: "turn" },
{ kind: "draw", from: "deck", to: "hand" },
],
},
],
setup: [
{ kind: "shuffle", zone: "deck" },
{ kind: "draw", from: "deck", to: "hand", count: 5 },
],
initialZones: { deck: cards },
};
}
```
What changed:
- **Shortcuts.** Press `D` to draw, `P` to play the selected (or hovered) card, `T` to tap it and `N` for the next turn. `Alt+D` draws for the opponent in Versus, with no extra code. Letters are matched case-insensitively; `shift+` and `mod+` (Cmd on a Mac, Ctrl elsewhere) are allowed, `alt+` is not. The full grammar is in the [shortcut reference](https://docs.turny.gg/reference/scripting/playtest#shortcuts).
- **`primaryActionId: "draw"`** makes a click on the deck run **Draw**, instead of the `triggers: ["click"]` from step 2.
- **Next turn** is a `side` action: it runs for your side (or the opponent's with Alt), readies every card on the board, adds 1 to the turn counter and draws, all as **one undo step**. The toolbar's **Turn** button shows the turn counter; to make it run an action, name it in `roundActionId` as in [Next round for both sides](#recipe-next-round). Add a `description` to any action to explain it under its name in the shortcut sheet (`?`) and as its tooltip in menus.
- **`setup`** runs for each side when a game starts, after the cards are placed: shuffle the deck, then draw 5.
#### 4. Save and try it
Click **Save**. **My first table** appears in your list, switched on. Click **Try it** to open Playtest with it and a sample deck, or start Playtest from any deck and pick **My first table**.
### Tips for writing rules
- **Build card tags from `cardsById`.** Steps and zones can't read card fields directly. Compute tags (such as `"unit"` or `"energy"`) from each card's fields once, return them in `cardTags`, and test them with `{ kind: "tag", tag: "energy" }`. See [Card tags from `cardsById`](#card-tags-from-cardsbyid).
- **Relate cards with `associatedCards`.** Level-ups, tokens and cards that create other cards come from each card's `game.associatedCardRefs`. Return them in `associatedCards` and let a `card` param pick one. See [Level up via an associated card](#recipe-level-up).
- **Guard every card.** `cardsById[code]` can be missing when the catalog doesn't know a card, so check `card && card.game` before reading fields.
- **Keep ids short and stable.** Zone, action, tracker and marker ids are how steps refer to each other; labels are only what the player reads.
- **Let the table do the bookkeeping.** A zone's `enterState` can untap, turn face up or clear counters on every card that enters it, so each action doesn't have to.
## Cookbook {#cookbook}
Small, complete scripts, one per technique. Paste one into the editor to try it, or copy the parts you need. The [default rules](#the-default-rules) use all of them at full size.
Each script starts with the same small `cardList` helper, which lists one entry per copy in the deck.
### A hidden prize grid {#recipe-prize-grid}
Six face-down Prizes nobody can see, set aside from the top of the deck at setup. Double-click a prize to take it, or press `Shift+P` for a random one.
```js
function cardList(deck) {
const cards = [];
Object.keys(deck.main).forEach((code) => {
for (let copy = 0; copy < deck.main[code]; copy += 1) cards.push(code);
});
return cards;
}
export default function playtest(deck) {
return {
version: 1,
table: { columns: 4, rows: 2 },
zones: [
{
id: "prizes",
label: "Prizes",
owner: "side",
visibility: "hidden",
layout: "grid",
area: { row: 0, col: 0, rowSpan: 2 },
ordered: false,
defaultFaceDown: true,
showCount: true,
},
{
id: "deck",
label: "Deck",
owner: "side",
visibility: "hidden",
layout: "pile",
area: { row: 0, col: 3 },
ordered: true,
defaultFaceDown: true,
},
{
id: "hand",
label: "Hand",
owner: "side",
visibility: "private",
layout: "fan",
area: { row: 1, col: 1, colSpan: 3 },
ordered: true,
defaultFaceDown: false,
enterState: { faceDown: false },
},
],
trackers: [],
markers: [],
actions: [
{
id: "takePrize",
label: "Take this prize",
target: "card",
zones: ["prizes"],
triggers: ["doubleClick"],
steps: [{ kind: "move", to: "hand" }],
},
{
id: "takeRandomPrize",
label: "Take a random prize",
target: "side",
shortcut: "shift+p",
steps: [
{
kind: "move",
cards: { zone: "prizes", count: 1, pick: "random" },
to: "hand",
},
],
},
],
setup: [
{ kind: "shuffle", zone: "deck" },
{
kind: "move",
cards: { zone: "deck", count: 6 },
to: "prizes",
faceDown: true,
},
],
initialZones: { deck: cardList(deck) },
};
}
```
`visibility: "hidden"` hides the faces from both players, you included. `pick: "random"` uses the game's seeded randomness, so undo and redo take the same prize.
### An attach-under energy drop {#recipe-attach-energy}
Drag an Energy card onto a Pokémon and it tucks underneath it, then moves with it from zone to zone. Or use the keyboard: select the Energy, hover the Pokémon and press `Q`. **Detach** on the Pokémon returns everything under it to your hand.
```js
function cardList(deck) {
const cards = [];
Object.keys(deck.main).forEach((code) => {
for (let copy = 0; copy < deck.main[code]; copy += 1) cards.push(code);
});
return cards;
}
export default function playtest(deck, cardsById) {
const cardTags = {};
Object.keys(cardsById).forEach((code) => {
const card = cardsById[code];
const supertype = card && card.game ? card.game.supertype : "";
if (supertype === "Energy") {
cardTags[code] = ["energy"];
}
});
return {
version: 1,
table: { columns: 5, rows: 2 },
zones: [
{
id: "active",
label: "Active",
owner: "side",
visibility: "public",
layout: "slots",
area: { row: 0, col: 0, colSpan: 4 },
capacity: 4,
ordered: true,
defaultFaceDown: false,
},
{
id: "deck",
label: "Deck",
owner: "side",
visibility: "hidden",
layout: "pile",
area: { row: 0, col: 4 },
ordered: true,
defaultFaceDown: true,
},
{
id: "hand",
label: "Hand",
owner: "side",
visibility: "private",
layout: "fan",
area: { row: 1, col: 0, colSpan: 5 },
ordered: true,
defaultFaceDown: false,
},
],
trackers: [],
markers: [],
actions: [
{
id: "attach",
label: "Attach",
target: "selection",
when: { kind: "tag", tag: "energy" },
triggers: ["drop"],
shortcut: "q",
steps: [{ kind: "attach", mode: "under" }],
},
{
id: "detach",
label: "Detach",
target: "card",
zones: ["active"],
steps: [{ kind: "detach", to: "hand" }],
},
],
setup: [
{ kind: "shuffle", zone: "deck" },
{ kind: "draw", from: "deck", to: "hand", count: 7 },
],
initialZones: { deck: cardList(deck) },
cardTags: cardTags,
};
}
```
`triggers: ["drop"]` runs the action when the selected cards are dropped **onto a card**, which becomes the host. `shortcut: "q"` runs it from the keyboard: the selected cards attach to the card under the pointer, which becomes the host the same way (with nothing hovered, the last selected card is the host). `mode: "under"` keeps the host as the visible card; `mode: "over"` puts the new card on top, like an evolution. `when` hides the action unless every target card (here, every dragged or selected card) is tagged `energy`; the host is never tested. Attached cards skip the host zone's `accepts` and `capacity`.
### A compound "Next turn" {#recipe-next-turn}
One key that untaps everything, advances the turn and draws, as a single undo step.
```js
function cardList(deck) {
const cards = [];
Object.keys(deck.main).forEach((code) => {
for (let copy = 0; copy < deck.main[code]; copy += 1) cards.push(code);
});
return cards;
}
export default function playtest(deck) {
return {
version: 1,
table: { columns: 6, rows: 2 },
zones: [
{
id: "board",
label: "Board",
owner: "side",
visibility: "public",
layout: "row",
area: { row: 0, col: 0, colSpan: 5 },
ordered: true,
defaultFaceDown: false,
},
{
id: "deck",
label: "Deck",
owner: "side",
visibility: "hidden",
layout: "pile",
area: { row: 0, col: 5 },
ordered: true,
defaultFaceDown: true,
primaryActionId: "draw",
},
{
id: "hand",
label: "Hand",
owner: "side",
visibility: "private",
layout: "fan",
area: { row: 1, col: 0, colSpan: 6 },
ordered: true,
defaultFaceDown: false,
},
],
trackers: [],
markers: [],
actions: [
{
id: "draw",
label: "Draw",
target: "zone",
zones: ["deck"],
steps: [{ kind: "draw", from: "deck", to: "hand" }],
},
{
id: "tap",
label: "Tap / untap",
target: "selection",
zones: ["board"],
triggers: ["doubleClick"],
shortcut: "t",
steps: [{ kind: "rotate" }],
},
{
id: "nextTurn",
label: "Next turn",
target: "side",
group: "Turn",
shortcut: "n",
steps: [
{ kind: "readyAll", zones: ["board"] },
{ kind: "turn" },
{ kind: "draw", from: "deck", to: "hand" },
{ kind: "log", message: "Untapped and drew for the turn." },
],
},
],
setup: [
{ kind: "shuffle", zone: "deck" },
{ kind: "draw", from: "deck", to: "hand", count: 7 },
],
initialZones: { deck: cardList(deck) },
};
}
```
A `side` action runs for one side: yours, or the opponent's with Alt. `readyAll` turns every card in the listed zones upright; its optional `skipFlag` leaves cards with that [flag](#recipe-next-round) tapped. `group` puts the action under a heading in menus and the shortcut sheet.
### Draw N with the digit keys {#recipe-draw-n}
Hover the deck and press `1` to `9` to draw that many cards. From the deck's menu, **Draw N** asks how many.
```js
function cardList(deck) {
const cards = [];
Object.keys(deck.main).forEach((code) => {
for (let copy = 0; copy < deck.main[code]; copy += 1) cards.push(code);
});
return cards;
}
export default function playtest(deck) {
return {
version: 1,
table: { columns: 6, rows: 1 },
zones: [
{
id: "deck",
label: "Deck",
owner: "side",
visibility: "hidden",
layout: "pile",
area: { row: 0, col: 0 },
ordered: true,
defaultFaceDown: true,
primaryActionId: "draw",
},
{
id: "hand",
label: "Hand",
owner: "side",
visibility: "private",
layout: "fan",
area: { row: 0, col: 1, colSpan: 5 },
ordered: true,
defaultFaceDown: false,
},
],
trackers: [],
markers: [],
actions: [
{
id: "draw",
label: "Draw",
target: "zone",
zones: ["deck"],
steps: [{ kind: "draw", from: "deck", to: "hand" }],
},
{
id: "drawN",
label: "Draw N",
target: "zone",
zones: ["deck"],
shortcut: "1-9",
params: [
{ id: "count", label: "Cards", kind: "number", min: 1, max: 60 },
],
steps: [
{ kind: "draw", from: "deck", to: "hand", count: { param: "count" } },
],
},
],
setup: [{ kind: "shuffle", zone: "deck" }],
initialZones: { deck: cardList(deck) },
};
}
```
The shortcut `"1-9"` binds every digit and passes the digit you pressed as the action's first `number` param. `{ param: "count" }` reads that value in a step. From a menu, an action with params always asks for them first; a click or shortcut asks only for params that have no `default`.
### A shared zone {#recipe-shared-zone}
A single Stadium for the whole table, between the two halves. Either player can put a Stadium there, but it holds only one card.
```js
function cardList(deck) {
const cards = [];
Object.keys(deck.main).forEach((code) => {
for (let copy = 0; copy < deck.main[code]; copy += 1) cards.push(code);
});
return cards;
}
export default function playtest(deck) {
return {
version: 1,
table: { columns: 5, rows: 2, sharedRows: 1 },
zones: [
{
id: "stadium",
label: "Stadium",
owner: "shared",
visibility: "public",
layout: "slots",
area: { row: 0, col: 2 },
capacity: 1,
ordered: false,
defaultFaceDown: false,
},
{
id: "deck",
label: "Deck",
owner: "side",
visibility: "hidden",
layout: "pile",
area: { row: 0, col: 4 },
ordered: true,
defaultFaceDown: true,
},
{
id: "discard",
label: "Discard",
owner: "side",
visibility: "public",
layout: "pile",
area: { row: 0, col: 3 },
ordered: true,
defaultFaceDown: false,
},
{
id: "hand",
label: "Hand",
owner: "side",
visibility: "private",
layout: "fan",
area: { row: 1, col: 0, colSpan: 5 },
ordered: true,
defaultFaceDown: false,
},
],
trackers: [],
markers: [],
actions: [
{
id: "playStadium",
label: "Play as Stadium",
target: "card",
zones: ["hand"],
shortcut: "g",
steps: [{ kind: "move", to: "stadium" }],
},
{
id: "discardStadium",
label: "Discard Stadium",
target: "card",
zones: ["stadium"],
steps: [{ kind: "move", to: "discard" }],
},
],
setup: [
{ kind: "shuffle", zone: "deck" },
{ kind: "draw", from: "deck", to: "hand", count: 7 },
],
initialZones: { deck: cardList(deck) },
};
}
```
A shared zone's `area` is a cell of the strip between the halves, which has `table.sharedRows` rows and the same columns as each side. Card actions always run for the card's owner, so **Discard Stadium** sends the card to its owner's discard pile, whichever side it came from.
To place a shared zone inside your half instead, next to your own zones (such as a Stadium left of the Active Pokémon), add `sharedPlacement: "playerGrid"`. Its `area` is then a cell of the side grid (`table.columns` by `table.rows`) and must not cover any side zone; the opponent's mirrored half leaves that cell empty. It is still one zone for the whole table, and either side can play into it. `sharedPlacement` is only allowed on shared zones and defaults to `"strip"`.
### Card tags from `cardsById` {#card-tags-from-cardsbyid}
Tag each card from its catalog fields, then let zones and actions test the tags. Here, from Legends of Runeterra's card types: only units may enter the board, and **Cast** only shows up on spells.
```js
function cardList(deck) {
const cards = [];
Object.keys(deck.main).forEach((code) => {
for (let copy = 0; copy < deck.main[code]; copy += 1) cards.push(code);
});
return cards;
}
export default function playtest(deck, cardsById) {
const cardTags = {};
// Tag every card the table can show, the opponent's deck included.
Object.keys(cardsById).forEach((code) => {
const card = cardsById[code];
const type = card && card.game ? card.game.typeRef : undefined;
if (type === "Unit") {
cardTags[code] = ["unit"];
} else if (type === "Spell") {
cardTags[code] = ["spell"];
}
});
return {
version: 1,
table: { columns: 6, rows: 2 },
zones: [
{
id: "board",
label: "Board",
owner: "side",
visibility: "public",
layout: "row",
area: { row: 0, col: 0, colSpan: 4 },
ordered: true,
defaultFaceDown: false,
accepts: { kind: "tag", tag: "unit" },
},
{
id: "graveyard",
label: "Graveyard",
owner: "side",
visibility: "public",
layout: "pile",
area: { row: 0, col: 4 },
ordered: true,
defaultFaceDown: false,
},
{
id: "deck",
label: "Deck",
owner: "side",
visibility: "hidden",
layout: "pile",
area: { row: 0, col: 5 },
ordered: true,
defaultFaceDown: true,
},
{
id: "hand",
label: "Hand",
owner: "side",
visibility: "private",
layout: "fan",
area: { row: 1, col: 0, colSpan: 6 },
ordered: true,
defaultFaceDown: false,
},
],
trackers: [],
markers: [],
actions: [
{
id: "cast",
label: "Cast",
target: "selection",
zones: ["hand"],
when: { kind: "tag", tag: "spell" },
shortcut: "c",
steps: [{ kind: "move", to: "graveyard" }],
},
],
setup: [
{ kind: "shuffle", zone: "deck" },
{ kind: "draw", from: "deck", to: "hand", count: 4 },
],
initialZones: { deck: cardList(deck) },
cardTags: cardTags,
};
}
```
`cardTags` maps a card code to its tags. Tag every code in `cardsById`, not only the ones in `deck`: in Versus with a different opponent deck, `cardsById` covers both decks. A spell dragged onto the board is refused and stays in hand. The card fields differ per game; see the card data reference for [Cyberpunk TCG](https://docs.turny.gg/reference/card-data/cyberpunk), [Flesh and Blood](https://docs.turny.gg/reference/card-data/fab), [Hearthstone](https://docs.turny.gg/reference/card-data/hs), [Legends of Runeterra](https://docs.turny.gg/reference/card-data/lor), [Palworld TCG](https://docs.turny.gg/reference/card-data/palworld), [Pokémon TCG](https://docs.turny.gg/reference/card-data/pokemon) and [Riftbound](https://docs.turny.gg/reference/card-data/riftbound).
### Next round for both sides {#recipe-next-round}
A table-wide **Next round**, run by the toolbar's **Turn** button (which reads **Round** for a `game` action), that advances the round once, then refills mana, clears "Stunned" and draws for every side in play. It shows the round action, trackers, tracker values, flags and the `forEachSide` block.
```js
function cardList(deck) {
const cards = [];
Object.keys(deck.main).forEach((code) => {
for (let copy = 0; copy < deck.main[code]; copy += 1) cards.push(code);
});
return cards;
}
export default function playtest(deck) {
return {
version: 1,
table: { columns: 6, rows: 2 },
zones: [
{
id: "board",
label: "Board",
owner: "side",
visibility: "public",
layout: "row",
area: { row: 0, col: 0, colSpan: 5 },
ordered: true,
defaultFaceDown: false,
enterState: { resetFlags: true },
},
{
id: "deck",
label: "Deck",
owner: "side",
visibility: "hidden",
layout: "pile",
area: { row: 0, col: 5 },
ordered: true,
defaultFaceDown: true,
},
{
id: "hand",
label: "Hand",
owner: "side",
visibility: "private",
layout: "fan",
area: { row: 1, col: 0, colSpan: 6 },
ordered: true,
defaultFaceDown: false,
},
],
trackers: [
{
id: "manaGems",
label: "Mana gems",
initial: 0,
min: 0,
max: 10,
owner: "side",
},
{ id: "mana", label: "Mana", initial: 0, min: 0, max: 10, owner: "side" },
],
markers: [],
flags: [{ id: "stunned", label: "Stunned" }],
actions: [
{
id: "stun",
label: "Stun",
target: "selection",
zones: ["board"],
shortcut: "s",
steps: [{ kind: "flag", flag: "stunned", mode: "toggle" }],
},
{
id: "nextRound",
label: "Next round",
target: "game",
shortcut: "n",
steps: [
{ kind: "turn" },
{
kind: "forEachSide",
steps: [
{ kind: "tracker", tracker: "manaGems", delta: 1 },
{
kind: "tracker",
tracker: "mana",
set: { tracker: "manaGems" },
},
{ kind: "clearFlag", flag: "stunned", zones: ["board"] },
{ kind: "draw", from: "deck", to: "hand" },
],
},
],
},
],
roundActionId: "nextRound",
setup: [
{ kind: "shuffle", zone: "deck" },
{ kind: "draw", from: "deck", to: "hand", count: 4 },
],
initialZones: { deck: cardList(deck) },
};
}
```
- `roundActionId` names the action the toolbar's **Turn** button runs; it must be a `game` or `side` action. A `game` action, as here, counts **rounds** that advance the whole table at once, so the button reads **Round**. A `side` action counts **turns**: in Versus each click starts the next turn for the other side. Either way the `turn` step advances the table's turn counter once, **outside** the block, so there is no separate round tracker.
- A `game` action runs once for the whole table.
- `forEachSide` runs its steps once per side in play (you first), each time as that side. Block steps can't be nested, and `setup` can't use `forEachSide` because it already runs once per side.
- `{ tracker: "manaGems" }` in a number field reads that tracker's current value when the step runs: here, mana refills to the number of gems.
- Flags are on/off marks on cards, declared in `flags` so the table can label them. `enterState: { resetFlags: true }` clears them when a card enters the board.
### Redraw until a condition holds {#recipe-redraw-until}
A Pokémon-style opening hand: draw 7, and while the hand has no Basic Pokémon, shuffle it back and draw 7 again.
```js
function cardList(deck) {
const cards = [];
Object.keys(deck.main).forEach((code) => {
for (let copy = 0; copy < deck.main[code]; copy += 1) cards.push(code);
});
return cards;
}
export default function playtest(deck, cardsById) {
const cardTags = {};
Object.keys(cardsById).forEach((code) => {
const game = cardsById[code] && cardsById[code].game;
const supertype = game ? String(game.supertype).replace("é", "e") : "";
const subtypes = game && Array.isArray(game.subtypes) ? game.subtypes : [];
if (supertype === "Pokemon" && subtypes.indexOf("Basic") !== -1) {
cardTags[code] = ["basic"];
}
});
const hasBasic = {
kind: "zoneHas",
zone: "hand",
where: { kind: "tag", tag: "basic" },
};
const redraw = [
{ kind: "move", cards: { zone: "hand" }, to: "deck" },
{ kind: "shuffle", zone: "deck" },
{ kind: "draw", from: "deck", to: "hand", count: 7 },
];
return {
version: 1,
table: { columns: 6, rows: 1 },
zones: [
{
id: "deck",
label: "Deck",
owner: "side",
visibility: "hidden",
layout: "pile",
area: { row: 0, col: 0 },
ordered: true,
defaultFaceDown: true,
enterState: { faceDown: true },
},
{
id: "hand",
label: "Hand",
owner: "side",
visibility: "private",
layout: "fan",
area: { row: 0, col: 1, colSpan: 5 },
ordered: true,
defaultFaceDown: false,
},
],
trackers: [],
markers: [],
actions: [
{
id: "mulligan",
label: "Mulligan",
target: "side",
shortcut: "shift+m",
steps: redraw.concat([
{
kind: "repeatUntil",
until: hasBasic,
steps: redraw,
maxIterations: 20,
},
]),
},
],
setup: [
{ kind: "shuffle", zone: "deck" },
{ kind: "draw", from: "deck", to: "hand", count: 7 },
{
kind: "repeatUntil",
until: hasBasic,
steps: redraw,
maxIterations: 20,
},
],
initialZones: { deck: cardList(deck) },
cardTags: cardTags,
};
}
```
`repeatUntil` checks `until` **before** each pass, so a hand that already has a Basic Pokémon is kept as it is. `maxIterations` caps the passes (at most 20), which stops a deck with no Basic Pokémon at all from looping forever. `until` can only test zones, with `zoneHas` (combined with `all`, `any` and `not` if needed), because there is no single card to test. Every pass is logged, and the whole redraw is still one undo step.
### Create a copy {#recipe-create-copy}
Put a copy of a card on the table that was never in the deck, as some cards do in Legends of Runeterra. It shows the `create` and `remove` steps.
```js
function cardList(deck) {
const cards = [];
Object.keys(deck.main).forEach((code) => {
for (let copy = 0; copy < deck.main[code]; copy += 1) cards.push(code);
});
return cards;
}
export default function playtest(deck) {
return {
version: 1,
table: { columns: 6, rows: 2 },
zones: [
{
id: "board",
label: "Board",
owner: "side",
visibility: "public",
layout: "row",
area: { row: 0, col: 0, colSpan: 5 },
ordered: true,
defaultFaceDown: false,
},
{
id: "deck",
label: "Deck",
owner: "side",
visibility: "hidden",
layout: "pile",
area: { row: 0, col: 5 },
ordered: true,
defaultFaceDown: true,
},
{
id: "hand",
label: "Hand",
owner: "side",
visibility: "private",
layout: "fan",
area: { row: 1, col: 0, colSpan: 6 },
ordered: true,
defaultFaceDown: false,
},
],
trackers: [],
markers: [],
actions: [
{
id: "copy",
label: "Create a copy",
target: "card",
zones: ["board"],
shortcut: "c",
steps: [{ kind: "create", card: "target" }],
},
{
id: "copyToHand",
label: "Create a copy in hand",
target: "card",
zones: ["board"],
steps: [{ kind: "create", card: "target", to: "hand" }],
},
{
id: "removeCopy",
label: "Remove from game",
target: "selection",
zones: ["board", "hand"],
// Only offered on created cards.
when: { kind: "created" },
steps: [{ kind: "remove" }],
},
],
setup: [
{ kind: "shuffle", zone: "deck" },
{ kind: "draw", from: "deck", to: "hand", count: 4 },
],
initialZones: { deck: cardList(deck) },
};
}
```
- `card: "target"` copies the card the action runs on. Without `to`, the copy goes into the target's own zone; with `to`, into that zone. `count` makes several copies at once (at most 20).
- The copy is a new card marked as **created**. It takes the destination's `defaultFaceDown` and `enterState` like any card moving in, and a full zone refuses it (the log says so).
- `remove` takes created cards out of the game. Cards from the deck are never removed: the step skips them and says so in the log. Cards attached to a removed card stay in its zone.
- The `created` predicate is true only for created cards, so `when: { kind: "created" }` keeps **Remove from game** off deck cards. A `tag` can't tell them apart: a copy has the same card code as its original.
- Undo takes the copy away again, and redo brings it back with the same id.
### Level up via an associated card {#recipe-level-up}
A champion levels up by turning into its level 2 card. Catalog cards list their related cards (level-ups, tokens, cards they create) in `card.game.associatedCardRefs`, and the table includes those cards in `cardsById`. Return them in `associatedCards`, and a `card` param picks one of them.
```js
function cardList(deck) {
const cards = [];
Object.keys(deck.main).forEach((code) => {
for (let copy = 0; copy < deck.main[code]; copy += 1) cards.push(code);
});
return cards;
}
export default function playtest(deck, cardsById) {
const cardTags = {};
const associatedCards = {};
Object.keys(cardsById).forEach((code) => {
const card = cardsById[code];
const game = card && card.game ? card.game : {};
if (game.supertypeRef === "Champion") cardTags[code] = ["champion"];
if (Array.isArray(game.associatedCardRefs)) {
associatedCards[code] = game.associatedCardRefs;
}
});
return {
version: 1,
table: { columns: 6, rows: 2 },
zones: [
{
id: "board",
label: "Board",
owner: "side",
visibility: "public",
layout: "row",
area: { row: 0, col: 0, colSpan: 5 },
ordered: true,
defaultFaceDown: false,
},
{
id: "deck",
label: "Deck",
owner: "side",
visibility: "hidden",
layout: "pile",
area: { row: 0, col: 5 },
ordered: true,
defaultFaceDown: true,
},
{
id: "hand",
label: "Hand",
owner: "side",
visibility: "private",
layout: "fan",
area: { row: 1, col: 0, colSpan: 6 },
ordered: true,
defaultFaceDown: false,
},
],
trackers: [],
markers: [{ id: "damage", label: "Damage", step: 1 }],
actions: [
{
id: "levelUp",
label: "Level up",
target: "card",
zones: ["board"],
when: { kind: "tag", tag: "champion" },
shortcut: "l",
params: [
{
id: "into",
label: "Level up into",
kind: "card",
cardSource: {
kind: "associated",
where: { kind: "tag", tag: "champion" },
},
},
],
steps: [{ kind: "transform", card: { param: "into" } }],
},
],
setup: [
{ kind: "shuffle", zone: "deck" },
{ kind: "draw", from: "deck", to: "hand", count: 4 },
],
initialZones: { deck: cardList(deck) },
cardTags: cardTags,
associatedCards: associatedCards,
};
}
```
- A `card` param's `cardSource` says where its choices come from. `kind: "associated"` lists the target card's `associatedCards`; `where` narrows them by tag. `where` can only test tags (with `all`, `any` and `not`), because the choices are card codes, not cards on the table.
- When exactly one card qualifies, Playtest picks it without asking. Here a level 1 champion's associated cards include the spell it creates, so `where` keeps only the champion card.
- `transform` changes the card's code in place. It stays where it is, with its damage, flags, rotation and attached cards, so levelling up keeps the board as it was.
- A `card` param can also feed `create`: `{ kind: "create", card: { param: "into" }, to: "board" }` puts a new copy of the picked card on the board.
### Tokens that vanish off the battlefield {#recipe-vanishing-tokens}
In Magic: The Gathering, a token that leaves the battlefield stops existing. Mark the zones it can't survive in with `removesCreated: true`, and the table takes created cards out of the game when they enter.
```js
function cardList(deck) {
const cards = [];
Object.keys(deck.main).forEach((code) => {
for (let copy = 0; copy < deck.main[code]; copy += 1) cards.push(code);
});
return cards;
}
export default function playtest(deck, cardsById) {
const cardTags = {};
const associatedCards = {};
Object.keys(cardsById).forEach((code) => {
const card = cardsById[code];
const game = card && card.game ? card.game : {};
if (game.layout === "token") cardTags[code] = ["token"];
if (Array.isArray(game.associatedCardRefs)) {
associatedCards[code] = game.associatedCardRefs;
}
});
return {
version: 1,
table: { columns: 6, rows: 2 },
zones: [
{
id: "battlefield",
label: "Battlefield",
owner: "side",
visibility: "public",
layout: "row",
area: { row: 0, col: 0, colSpan: 4 },
ordered: true,
defaultFaceDown: false,
},
{
id: "graveyard",
label: "Graveyard",
owner: "side",
visibility: "public",
layout: "pile",
area: { row: 0, col: 4 },
ordered: true,
defaultFaceDown: false,
removesCreated: true,
},
{
id: "library",
label: "Library",
owner: "side",
visibility: "hidden",
layout: "pile",
area: { row: 0, col: 5 },
ordered: true,
defaultFaceDown: true,
removesCreated: true,
},
{
id: "hand",
label: "Hand",
owner: "side",
visibility: "private",
layout: "fan",
area: { row: 1, col: 0, colSpan: 6 },
ordered: true,
defaultFaceDown: false,
removesCreated: true,
},
],
trackers: [],
markers: [],
actions: [
{
id: "makeToken",
label: "Create a token",
target: "card",
zones: ["battlefield"],
shortcut: "k",
params: [
{
id: "token",
label: "Token",
kind: "card",
cardSource: {
kind: "associated",
where: { kind: "tag", tag: "token" },
},
},
],
steps: [
{ kind: "create", card: { param: "token" }, to: "battlefield" },
],
},
{
id: "destroy",
label: "Destroy",
target: "selection",
zones: ["battlefield"],
shortcut: "x",
steps: [{ kind: "move", to: "graveyard" }],
},
],
setup: [
{ kind: "shuffle", zone: "library" },
{ kind: "draw", from: "library", to: "hand", count: 7 },
],
initialZones: { library: cardList(deck) },
cardTags: cardTags,
associatedCards: associatedCards,
};
}
```
- `removesCreated` applies however a created card gets there: a step, a drag and drop, or a draw. Cards from the deck move in as usual.
- A token attached to a deck card leaves with it too: destroying the host sends the host to the graveyard and takes the token out of the game.
- The table doesn't know which cards are tokens. The script decides, here from the catalog's `game.layout`; the card data reference for your game lists its fields.
## Sharing {#sharing}
Every set of rules you make is **private** until you share it.
- **Make public** (a button in **Settings → Playtest rules**, or the **Make public** box in the editor) lists the rules on the **Playtest rules** tab of your profile and lets anyone with the link open them. **Make private** takes them down again.
- **Copy link** (public rules only) copies the rules' page link, `/playtest-rules/` on the game's site. Links always show the latest saved version.
The rules' page shows their name, owner, version and last update, and **Show source** expands the full script. From there anyone can:
- **Playtest with these rules**, which opens Playtest with them already picked,
- **Save to account** (when signed in), which adds a **Downloaded** copy to their own Settings list. A saved copy stays on the version it was saved from and never changes by itself.
- **Update**, when the owner has saved a newer version since, to move their copy to the latest version. In Settings the copy shows **Update available** and has the same **Update** button.
A downloaded copy can be switched on and off, viewed, forked and removed, but not edited. **Fork** it to make changes, which creates a private set of your own.
Things to know:
- A fork always starts private, even when you fork public rules.
- Public means the code is public. Don't put anything in a comment or label you wouldn't want others to read.
## Troubleshooting {#troubleshooting}
The **Validation** panel in the editor, and Playtest itself when a game can't start, show each problem the table found with the rules. Every problem has a code, listed below with its fix. Most also name the place in the definition, such as `actions[2].shortcut` (the third action's shortcut). The same codes are in the [issue code reference](https://docs.turny.gg/reference/scripting/playtest#issue-codes).
### The script doesn't run
#### `script_unsafe` {#script_unsafe}
"The rules script uses code that isn't allowed." Playtest rules run in the same locked-down sandbox as custom rulesets and calculators, and a safety check reads every script before it runs or saves. The usual suspects are `var` (use `let` or `const`), globals that aren't on the allowed list (such as `fetch`, `window` or `eval`), `async` / `await`, `class`, `this` and `import`. The full rules are on the [script sandbox](https://docs.turny.gg/reference/scripting/sandbox) page.
#### `script_error` {#script_error}
"The rules script failed to run." The script threw an error, or it doesn't export a function. Check that it has `export default function playtest(deck, cardsById, ctx)` (or a top-level `function playtest`), and read the message for the error: `Cannot read properties of undefined` usually means a missing card. Guard with `card && card.game` before reading card fields.
#### `script_timeout` {#script_timeout}
"The rules script took too long to run." A script that runs longer than 5 seconds is stopped. That almost always means a loop that never ends, such as a `while` whose condition never turns false.
#### `worker_failed` {#worker_failed}
"The rules script could not be run." The background worker that runs scripts crashed or never started. This is not a problem with your script: reload the page.
### The shape is wrong
#### `invalid_shape` {#invalid_shape}
A field is missing, has the wrong type, or holds a value that isn't allowed, such as `layout: "stack"` or `owner: "player"`. The message names the field. Compare it with the [definition reference](https://docs.turny.gg/reference/scripting/playtest#the-table-definition); every allowed string is listed under [Enums](https://docs.turny.gg/reference/scripting/playtest#enums). Remember that the script must return the definition, not just build it.
#### `unsupported_version` {#unsupported_version}
The definition's `version` must be `1`.
#### `over_cap` {#over_cap}
Something is over its limit: too many zones or actions, too many steps in one action, a label that is too long, and so on. The message names the limit. Every limit is listed under [Limits](https://docs.turny.gg/reference/scripting/playtest#limits).
#### `invalid_id` {#invalid_id}
Ids must start with a letter and use only letters, digits, `_`, `.`, `:` and `-`, and can't be names like `constructor` or `toString`. The same goes for the keys of `initialZones` and `cardTags`.
#### `duplicate_zone_id` {#duplicate_zone_id}
Two zones have the same `id`. Every zone needs its own.
#### `duplicate_action_id` {#duplicate_action_id}
Two actions have the same `id`. When you build actions in a loop, make the id include the loop value (for example `"damage" + n`).
#### `duplicate_tracker_id` {#duplicate_tracker_id}
Two trackers have the same `id`.
#### `duplicate_marker_id` {#duplicate_marker_id}
Two markers have the same `id`.
#### `duplicate_param_id` {#duplicate_param_id}
Two params of the same action have the same `id`.
#### `duplicate_flag_id` {#duplicate_flag_id}
Two flags have the same `id`.
### Something refers to a thing that doesn't exist
#### `unknown_zone` {#unknown_zone}
A step, predicate, action `zones` list or `initialZones` key names a zone that isn't in `zones`. Check the spelling: ids are case-sensitive.
#### `unknown_action` {#unknown_action}
A zone's `primaryActionId` or `dropActionId`, or the definition's `roundActionId`, names an action that isn't in `actions`.
#### `invalid_round_action` {#invalid_round_action}
"The Turn button action must act on a side or the whole game." `roundActionId` names a `card`, `selection` or `zone` action, which the toolbar's **Turn** button has nothing to run on. Point it at a `side` or `game` action, usually your **New turn**.
#### `unknown_tracker` {#unknown_tracker}
A `tracker` step, or a `{ tracker: "..." }` value, names a tracker that isn't in `trackers`.
#### `unknown_marker` {#unknown_marker}
A `counter` step or a `counterAtLeast` predicate names a marker that isn't in `markers`.
#### `unknown_flag` {#unknown_flag}
A `flag` or `clearFlag` step, a `readyAll` `skipFlag`, or a `flag` predicate names a flag that isn't in `flags`. Declare every flag you use.
#### `unknown_param` {#unknown_param}
A `{ param: "..." }` value names a param the action doesn't declare in its `params`. `setup` has no params, so it can't use `{ param }` at all.
#### `param_kind_mismatch` {#param_kind_mismatch}
A `{ param }` value is used where its param can't supply the right kind of value, such as a `choice` param of zone names used as a card count. Use a `number` param for numbers, and a `card` param (or a `choice` param of card codes) for the card of a `create` or `transform` step.
#### `invalid_tracker_ref` {#invalid_tracker_ref}
A `{ tracker, side }` value names a side that doesn't fit the tracker. A shared tracker (`owner: "shared"`) takes no side or `side: "shared"`; a per-side tracker takes `side: "self"` or `side: "other"`.
#### `invalid_tracker_toggle` {#invalid_tracker_toggle}
A `tracker` step with `toggle: true` needs a tracker that runs from 0 to 1: declare it with `min: 0, max: 1`.
### Steps are combined in a way that can't work
#### `nested_block_step` {#nested_block_step}
A `forEachSide` or `repeatUntil` step sits inside another one. Block steps hold one level of plain steps only; move the inner block out, or split the action.
#### `for_each_side_in_setup` {#for_each_side_in_setup}
`setup` already runs once for each side, so it can't use `forEachSide`. List the steps directly.
#### `condition_needs_zone_has` {#condition_needs_zone_has}
A `repeatUntil` condition tests a card (with `tag`, `flag`, `faceDown` and so on), but there is no card to test. Wrap the card test in a `zoneHas` predicate, as in [Redraw until a condition holds](#recipe-redraw-until).
### The table layout doesn't fit
#### `zone_outside_table` {#zone_outside_table}
A zone's `area` reaches past the edge of its grid. Side zones, and shared zones with `sharedPlacement: "playerGrid"`, must fit in `table.columns` by `table.rows`; other shared zones must fit in the shared strip (`table.sharedRows` rows). Remember that rows and columns start at 0, so the last column is `columns - 1`.
#### `zone_overlap` {#zone_overlap}
Two zones in the same grid cover the same cell. Move one, or shrink its `rowSpan` / `colSpan`. A side zone and a shared strip zone never overlap, because they sit in different grids, but a `"playerGrid"` shared zone sits in the side grid and must fit around the side zones.
### A card option or created card can't work
#### `card_param_needs_source` {#card_param_needs_source}
"Card option needs a cardSource to pick cards from." A param with `kind: "card"` needs a `cardSource`, such as `{ kind: "associated" }`, so the table knows which cards to offer. See [Level up via an associated card](#recipe-level-up).
#### `card_source_needs_tag` {#card_source_needs_tag}
A `cardSource`'s `where` tests something other than tags, such as `zone` or `faceDown`. Its choices are card codes, not cards on the table, so it can only use `tag` (combined with `all`, `any` and `not`). Tag the cards from `cardsById` and filter on the tag.
#### `create_needs_card_target` {#create_needs_card_target}
A `create` step has no `to`, or copies `card: "target"`, but its action doesn't run on a card. Only `card` and `selection` actions have a target card to copy or to put the new card beside; `setup` and `side`, `game` and `zone` actions don't. Name a destination zone with `to` and a card code (or a `{ param }`) with `card`.
### A shortcut can't be used
#### `invalid_shortcut` {#invalid_shortcut}
The shortcut doesn't follow the grammar `[mod+][shift+]`. Write `mod` instead of `ctrl` or `cmd`, and use a key from the [list of keys](https://docs.turny.gg/reference/scripting/playtest#grammar). A `"1-9"` shortcut also needs the action to have a `number` param to receive the digit.
#### `shortcut_uses_alt` {#shortcut_uses_alt}
The shortcut uses Alt (or Option). Alt is reserved: the table adds an Alt version of every shortcut that acts for the opponent. Pick another key; you get the opponent version for free.
#### `shortcut_reserved` {#shortcut_reserved}
The shortcut is one the table itself uses: `Mod+Z` (undo), `Mod+Shift+Z` and `Mod+Y` (redo), `?` (the shortcut sheet) or `Escape` (clear the selection). Pick another key.
#### `shortcut_conflict` {#shortcut_conflict}
Two actions that can apply to the same thing share a key. Two card actions (or two zone actions) may share a key only when their `zones` lists don't overlap, and every side and game action needs its own key. Change one of the keys, or narrow the actions' `zones`.
---
url: https://docs.turny.gg/guide/tournaments
description: "How Turny.gg runs tournaments: the formats each game offers, multi-stage events and top cuts, Swiss pairings, byes, late entry, tiebreakers, CSV exports, free-for-all scoring, Riftbound multi-deck lineups, waitlists, your personal calendar, recurring events, venue addresses and map pins, the TV display, printing round sheets, announcements, and judges, penalties and deck checks."
---
# Tournaments
A Turny.gg tournament is one or more **stages** played in order. Each stage has a format (Swiss, single elimination, and so on) and its own settings, and **advancement rules** decide who moves from one stage to the next. This page describes exactly what the tournament engine does with those settings, so you can predict pairings and standings before your event starts.
## Formats
### What each game offers
The create form offers these formats and starts every new stage from these defaults. Everything except the match-win % formula and the two floors can be changed per stage, under the stage's **Advanced settings**.
| Setting | Cyberpunk TCG | Flesh and Blood | Hearthstone | Legends of Runeterra | Magic: The Gathering | Palworld TCG | Pokémon TCG | Riftbound |
| --- | --- | --- | --- | --- | --- | --- | --- | --- |
| Formats | Single elimination, Double elimination, Round robin, Swiss | Single elimination, Double elimination, Round robin, Swiss | Single elimination, Double elimination, Round robin, Swiss | Single elimination, Double elimination, Round robin, Swiss | Single elimination, Double elimination, Round robin, Swiss, Cumulative Points (Free-for-All), Threshold Win (Free-for-All) | Single elimination, Double elimination, Round robin, Swiss | Single elimination, Double elimination, Round robin, Swiss | Single elimination, Double elimination, Round robin, Swiss, Cumulative Points (Free-for-All), Threshold Win (Free-for-All) |
| Swiss: number of rounds | 5, with a recommendation by player count | 5, with a recommendation by player count | 5, with a recommendation by player count | 5, with a recommendation by player count | 5, with a recommendation by player count | 5, with a recommendation by player count | 5, with a recommendation by player count | 5, with a recommendation by player count |
| Swiss: points for a win / draw / loss | 3 / 1 / 0 | 3 / 0 / 0 | 3 / 0 / 0 | 3 / 0 / 0 | 3 / 1 / 0 | 3 / 0 / 0 | 3 / 1 / 0 | 3 / 1 / 0 |
| Swiss: allow draws | Yes | Yes | No | No | Yes | No | Yes | Yes |
| Swiss: bye handling | Award full points (3) | Award full points (3) | Award full points (3) | No byes | Award full points (3) | Award full points (3) | Award full points (3) | Award full points (3) |
| Swiss: pairing style | Random within score groups | Random within score groups | Random within score groups | Random within score groups | Random within score groups | Random within score groups | Random within score groups | Random within score groups |
| Swiss: prevent repeat matchups | Yes | Yes | Yes | Yes | Yes | Yes | Yes | Yes |
| Swiss: tiebreakers | Opponent match win percentage, then Game win percentage, then Opponent game win percentage | Cumulative match points, then Match loss percentage (lower is better), then Opponent match loss percentage (lower is better), then Opponent cumulative match points, then Random | Opponent match win percentage, then Game win percentage, then Opponent game win percentage | Buchholz | Opponent match win percentage, then Game win percentage, then Opponent game win percentage | Opponent match win percentage, then Opponent-opponent match win percentage | Opponent match win percentage, then Opponent-opponent match win percentage | Opponent match win percentage, then Game win percentage, then Opponent game win percentage |
| Swiss: match-win % formula | Match points | Match points | Not set | Not set | Match points | Match points | Wins over rounds | Match points |
| Swiss: opponent match-win floor | 33% | None | 30% | None | 33% | 33% | 25% | 33% |
| Swiss: game-win floor | 33% | None | None | None | 33% | 33% | None | 33% |
| Round robin: points for a win / draw / loss | 3 / 1 / 0 | 3 / 0 / 0 | 3 / 0 / 0 | 3 / 0 / 0 | 3 / 1 / 0 | 3 / 0 / 0 | 3 / 1 / 0 | 3 / 1 / 0 |
| Round robin: tiebreakers | Head-to-head, then Score difference | Head-to-head, then Score difference | Head-to-head, then Score difference | Head-to-head, then Score difference | Head-to-head, then Score difference | Head-to-head, then Score difference | Head-to-head, then Score difference | Head-to-head, then Score difference |
### When to use each
- **Swiss**: the default choice for open events. Every player plays every round, paired against players on the same record, for a fixed number of rounds. Pair it with a top cut when you need a single winner. See [Swiss](#swiss).
- **Single elimination**: one loss and you are out. Fast and easy to follow, which makes it the usual top cut after Swiss.
- **Double elimination**: a player is out after their second loss, dropping to the losers bracket after the first. It takes about twice as many rounds as single elimination, in exchange for one bad match not ending anyone's day. **Grand finals** is either a **Single set**, or a **Bracket reset**: if the losers-bracket player wins the first set, a second set decides the title, since both players then have one loss. **Play both brackets at the same time** (on for new stages) starts each round as soon as all its players are known, so the winners and losers brackets play side by side instead of the whole stage moving one round at a time. When you finalize and publish rounds yourself, you choose which of the ready rounds to finalize or publish each time.
- **Round robin**: everyone plays everyone, once or twice (**Round robin cycles**). The fairest format for small groups, but the number of rounds grows with the field. For a big field, split it with **Grouping** (a number of groups, or players per group) under the stage's **Advanced settings**, which every one-on-one format offers.
- **Free-for-all** (Magic: The Gathering, Riftbound and Teamfight Tactics; Teamfight Tactics offers only free-for-all): three or more players per game, scored by finishing position. See [Free-for-all scoring](#free-for-all-scoring).
For single elimination, **Allow byes** is off by default. With it off, the stage only starts when the player count fills the bracket exactly (4, 8, 16 and so on); turn it on to give the top seeds byes into round two. **Hold third-place match** adds a match between the two semifinal losers.
The **Seeding method** of an elimination stage (and the **First-round seeding** of a Swiss stage) is one of **Manual**, **Random**, **Rating** or **Prior stage results**. A tournament's first stage defaults to **Random**; any later stage defaults to **Prior stage results**, so the best finishers of the previous stage get the best seeds.
## Multi-stage events and top cut
Add a second stage and an advancement rule to turn a Swiss stage into "Swiss plus a top 8". Each rule reads:
- **From stage**: the stage whose results it uses.
- **Condition**: a **Placement range** (for example 1 to 8) or a **Points range** (for example 9 points or more).
- **Action**: **Advance** to a later stage, or **Eliminate**.
A classic top cut is one rule: from the Swiss stage, placements 1 to 8, **Advance** to a single-elimination stage seeded by **Prior stage results**. Swiss 1st then plays 8th, 2nd plays 7th, and so on. Advancement uses the earlier stage's final standings, so it happens once that stage is complete.
**Cut tiebreaker** decides what happens when players tied on points and on every tiebreaker straddle the cut line (for example 8th and 9th are exactly equal):
- **Better initial seed advances** (the default): the cut stays at exactly the size you set.
- **Draw lots**: a random draw picks who advances; the cut stays the same size.
- **Advance the whole tie**: everyone in the tie advances, so the next stage can get more players than planned. Give it room, for example single elimination with **Allow byes** on.
Two options only appear when they apply:
- **Allow early cutoff** (a single or double elimination stage, with a placement range starting at 1): the stage stops as soon as the players in the range are decided, instead of playing on to a single winner. Use it for a day-one bracket that only needs to find a top 8.
- **Advance mode: Continue brackets** (double elimination into double elimination): the next stage carries on the same bracket where the first one stopped, so every player keeps their winners or losers bracket position. **Reset bracket** (the default) starts a fresh bracket.
A tournament is either all one-on-one stages or all free-for-all stages; the two cannot be mixed in one event.
## Swiss
### Pairing
Round 1 orders players by the stage's **First-round seeding**, then pairs them by the **Pairing style**. From round 2 on, the engine:
1. Orders players by the current standings: points, then the stage's tiebreakers, then initial seed.
2. Splits them into score groups: everyone on the same points.
3. Pairs each score group from the top. If a group has an odd number of players, its lowest-ranked player drops down and is paired in the next group.
**Pairing style** decides who meets whom inside a score group:
- **Random within score groups** (the default): random pairings within the group, as in most trading card game events.
- **Fold (top half vs bottom half)**: the top half of the group plays the bottom half, 1st against the first player of the bottom half, and so on, as in chess.
- **Adjacent standings order**: 1st plays 2nd, 3rd plays 4th, and so on.
With **Prevent repeat matchups** on (the default), a pairing that would repeat an earlier match is replaced by the rematch-free pairing that keeps players closest to their own score group. If no rematch-free pairing exists at all, the next round cannot be generated and the organizer sees an error; turn **Prevent repeat matchups** off for that stage, or change its pairing style, both of which stay editable while the stage runs. In a very large, late round the search can give up, and then the engine uses the plain pairing even if it contains a rematch.
A Swiss stage ends after its **Number of rounds**.
### Choosing a round count
The engine never picks the round count for you: the stage plays exactly the **Number of rounds** you set (default 5). For Magic: The Gathering and Pokémon TCG, the create form also suggests a count for your **Maximum participants**, with an **Apply** button: the Magic Tournament Rules' count for Magic, and the Play! Pokémon handbook's for Pokémon.
As a rule of thumb, with no draws, `n` rounds leave at most one undefeated player out of `2^n`. That count finds a clear winner without a top cut. With a top cut, you can often stop a round or two sooner, since the cut decides the winner.
| Players | Rounds for one undefeated player | Cyberpunk TCG recommendation | Flesh and Blood recommendation | Hearthstone recommendation | Legends of Runeterra recommendation | Magic: The Gathering recommendation | Palworld TCG recommendation | Pokémon TCG recommendation | Riftbound recommendation |
| --- | --- | --- | --- | --- | --- | --- | --- | --- | --- |
| 4 | 2 | 3 | 3 | 3 | 3 | 4 | 3 | 3 | 3 |
| 5 to 8 | 3 | 3 | 3 | 3 | 3 | 4 | 3 | 3 | 3 |
| 9 to 12 | 4 | 4 | 5 | 4 | 4 | 4 | 4 | 4 | 4 |
| 13 to 16 | 4 | 4 | 5 | 4 | 4 | 4 | 4 | 5 | 4 |
| 17 to 32 | 5 | 5 | 5 | 5 | 5 | 5 | 5 | 5 | 5 |
| 33 to 64 | 6 | 6 | 6 | 6 | 6 | 6 | 6 | 6 | 6 |
| 65 to 128 | 7 | 7 | 7 | 7 | 7 | 7 | 7 | 7 | 7 |
| 129 to 224 | 8 | 8 | 8 | 8 | 8 | 8 | 8 | 8 | 8 |
| 225 to 226 | 8 | 8 | 9 | 8 | 8 | 8 | 8 | 8 | 8 |
| 227 to 256 | 8 | 8 | 9 | 8 | 8 | 9 | 8 | 9 | 8 |
| 257 to 384 | 9 | 9 | 9 | 9 | 9 | 9 | 9 | 9 | 9 |
| 385 to 409 | 9 | 9 | 10 | 9 | 9 | 9 | 9 | 9 | 9 |
| 410 to 512 | 9 | 9 | 10 | 9 | 9 | 10 | 9 | 10 | 9 |
| 513 to 1024 | 10 | 10 | 10 | 10 | 10 | 10 | 10 | 10 | 10 |
### Byes
With an odd number of players, one player sits out each round. It is the lowest-ranked player who has not had a bye yet; a player only gets a second bye once everyone has had one. Byes are not opponents: they never count toward Buchholz, opponent win percentages or any other opponent-based tiebreaker.
**Bye handling** decides what sitting out is worth:
- **Award full points**: the bye counts as a match win worth **Points per bye**.
- **Award zero points** or **No byes**: the player still sits out, but gets nothing: no points, and the round is not added to their record.
### Late registrants
With **Late entry** on (Swiss only), players can still join an event that has started, up to and including the round set in **Allow late entry through round**. Every round already completed when they join counts as a loss for them: they get the points for a loss (0 by default) and the loss appears in their record, but with no opponent, so it adds nothing to anyone's tiebreakers. It is not a bye, so they can still receive a bye later. They are paired from the next round on, like anyone else on their points.
## Tiebreakers
Standings rank players by points first. Players on the same points are compared by each applied tiebreaker in order (the **Applied in order** list in the stage's tiebreaker settings), and if they are still equal, the better initial seed ranks higher. Players equal on points and on every tiebreaker share a placement. Percentages are rounded to four decimal places (0.01%) before they are compared.
| Tiebreaker | Value | Available in | How it is computed |
| --- | --- | --- | --- |
| **Head-to-head** | `head_to_head` | Round robin, Swiss | Among players tied on points, the points each one earned in matches against the others in that tie. A player with no one else on their points total scores 0. |
| **Score difference** | `score_difference` | Round robin, Swiss | Games won minus games lost, summed over every match played. |
| **Game win percentage** | `game_win_percentage` | Round robin, Swiss | Games won divided by games played. In Swiss, a game-win floor set by the game raises any lower value to the floor. A player with no games played scores 0 (or the floor). |
| **Points scored** | `points_scored` | Round robin, Swiss | Total games won, summed over every match played. |
| **Buchholz** | `buchholz` | Swiss | The sum of the current points of every opponent played. Byes add nothing. |
| **Median Buchholz** | `median_buchholz` | Swiss | Buchholz without the single highest and single lowest opponent. With two or fewer opponents nothing is dropped, so it equals Buchholz. |
| **Sonneborn-Berger** | `sonneborn_berger` | Swiss | The current points of every opponent the player beat, plus half the points of every opponent they drew with. Losses add nothing. |
| **Opponent match win percentage** | `opponent_match_win_percentage` | Swiss | The average of each opponent's match-win percentage (OMW%). Each opponent's value comes from the stage's win-percentage formula and is raised to the game's floor first, if it has one. Byes are not opponents. |
| **Opponent-opponent match win percentage** | `opponent_opponent_match_win_percentage` | Swiss | The average OMW% of the player's opponents (OOMW%), weighted by how many opponents each of them has played. That is the average match-win percentage of the opponents' opponents. |
| **Opponent game win percentage** | `opponent_game_win_percentage` | Swiss | The average of each opponent's game-win percentage (OGW%), each raised to the game-win floor first, if the game has one. Byes are not opponents. |
| **Cumulative match points** | `cumulative_match_points` | Swiss | Cumulative match points (CMP), higher is better: a value from 0 to 1 that weights each round's win (a bye counts as a win) by 2^R - 2^(r-1), where R is the number of completed rounds and r the round, over the sum of those weights. An early win is worth more than a late one, so the earlier a loss, the lower the CMP (Flesh and Blood Tournament Rules and Policy, Appendix A.4). |
| **Match loss percentage (lower is better)** | `match_loss_percentage` | Swiss | Match-loss percentage (MLP), lower is better: losses divided by rounds played. A bye is not a round played and a draw is not a loss. A player with no rounds played scores 0. |
| **Opponent match loss percentage (lower is better)** | `opponent_match_loss_percentage` | Swiss | The average match-loss percentage of the player's opponents, lower is better. Byes are not opponents; a player with no opponents scores 0. |
| **Opponent cumulative match points** | `opponent_cumulative_match_points` | Swiss | The average cumulative match points of the player's opponents, higher is better. Byes are not opponents; a player with no opponents scores 0. |
| **Random** | `random` | Swiss | A random order fixed per stage, so it is the same on every read of the stage and for every viewer. Use it last: it breaks any remaining tie. |
### Worked example
Five players play a three-round Swiss with 3 points for a win, 1 for a draw and 0 for a loss, byes worth full points, and best-of-three matches. Scores are games won.
| Round | Player | Score | Opponent |
| ----- | ------ | ----- | -------- |
| 1 | Ana | 2-0 | Ben |
| 1 | Cam | 2-1 | Dee |
| 1 | Eli | Bye | |
| 2 | Ana | 2-1 | Cam |
| 2 | Eli | 2-0 | Ben |
| 2 | Dee | Bye | |
| 3 | Ana | 1-1 | Dee |
| 3 | Cam | 2-0 | Eli |
| 3 | Ben | Bye | |
The final standings, with every tiebreaker computed and Head-to-head applied first. Records are wins, losses and draws, and a bye counts as a win.
| Rank | Player | Record | Points | Head-to-head | Score difference | Game win % | Points scored |
| ---- | ------ | ------ | ------ | ------------ | ---------------- | ---------- | ------------- |
| 1 | Ana | 2-0-1 | 7 | 0 | +3 | 71.43% | 5 |
| 2 | Cam | 2-1-0 | 6 | 3 | +2 | 62.5% | 5 |
| 3 | Eli | 2-1-0 | 6 | 0 | 0 | 50% | 2 |
| 4 | Dee | 1-1-1 | 4 | 0 | -1 | 40% | 2 |
| 5 | Ben | 1-2-0 | 3 | 0 | -4 | 0% | 0 |
| Player | Buchholz | Median Buchholz | Sonneborn-Berger | OMW% | OOMW% | OGW% |
| ------ | -------- | --------------- | ---------------- | ------ | ------ | ------ |
| Ana | 13 | 4 | 11 | 50% | 71.43% | 34.17% |
| Cam | 17 | 6 | 10 | 66.67% | 57.14% | 53.81% |
| Eli | 9 | 9 | 3 | 50% | 70% | 31.25% |
| Dee | 13 | 13 | 3.5 | 75% | 58.33% | 66.96% |
| Ben | 13 | 13 | 0 | 75% | 50% | 60.71% |
The opponent percentages above use no win-percentage formula and no floors (the Legends of Runeterra defaults). Working a few of them through:
- **Head-to-head**: Cam and Eli are tied on 6 points and met in round 3, which Cam won. Cam scores the 3 points from that match and Eli scores 0, so Cam ranks above Eli. Ana is alone on 7 points and scores 0.
- **Score difference**: Ana won 2-0, 2-1 and drew 1-1: 5 games won, 2 lost, so +3.
- **Game win %**: Ana won 5 of her 7 games: 71.43%. Eli won 2 of 4 (the bye adds no games): 50%.
- **Points scored**: Ana won 2 + 2 + 1 = 5 games, and so did Cam (2 + 1 + 2).
- **Buchholz**: Cam played Dee (4 points), Ana (7) and Eli (6): 4 + 7 + 6 = 17. Eli played only Ben (3) and Cam (6), since the bye is not an opponent: 9.
- **Median Buchholz**: Cam drops his best opponent (Ana, 7) and his worst (Dee, 4), leaving Eli's 6. Eli has only two opponents, so nothing is dropped and he keeps 9. In a small event with byes this can favor the players who had one.
- **Sonneborn-Berger**: Ana beat Ben (3) and Cam (6) and drew with Dee (half of 4 is 2): 3 + 6 + 2 = 11. Dee's only result that counts is his draw with Ana: half of 7 is 3.5.
- **OMW%**: with no formula set, a match-win % is wins plus half of draws over matches, with a full-points bye counting as a won match. Ben (1-2-0) has 33.33%, Cam (2-1-0) 66.67% and Dee (1-1-1) 50%, so Ana's OMW% is (33.33% + 66.67% + 50%) / 3 = 50%.
- **OOMW%**: Ana's opponents have OMW% of 75% (Ben, 2 opponents), 66.67% (Cam, 3 opponents) and 75% (Dee, 2 opponents). Weighted by opponents played: (75% × 2 + 66.67% × 3 + 75% × 2) / 7 = 71.43%.
- **OGW%**: Ana's opponents won 0% (Ben), 62.5% (Cam) and 40% (Dee) of their games: (0% + 62.5% + 40%) / 3 = 34.17%.
### Match-win formulas and floors
OMW% and OOMW% average the opponents' **match-win percentages**, and how a match-win % is worked out from a record is set per game:
| Formula | Value | How it is computed | Default for |
| --- | --- | --- | --- |
| **Not set** | | Wins plus half of draws, divided by matches played. A bye that awards full points counts as a won match. | Hearthstone, Legends of Runeterra |
| **Match points** | `match_points` | Match points divided by the points for a win times the matches played (Magic Tournament Rules, Appendix C). With 3 points for a win and 1 for a draw, a draw is worth a third of a win. A bye that awards full points counts as a won match. | Cyberpunk TCG, Flesh and Blood, Magic: The Gathering, Palworld TCG, Riftbound |
| **Wins over rounds** | `wins_over_rounds` | Wins divided by rounds played (Play! Pokémon Tournament Rules Handbook, section 5.3.3.1). A draw counts as zero wins, and a bye counts as neither a win nor a round played. | Pokémon TCG |
Each player's own match-win % in the worked example, under each formula:
| Player | Not set | Match points | Wins over rounds |
| ------ | ------- | ------------ | ---------------- |
| Ana | 83.33% | 77.78% | 66.67% |
| Ben | 33.33% | 33.33% | 0% |
| Cam | 66.67% | 66.67% | 66.67% |
| Dee | 50% | 44.44% | 0% |
| Eli | 66.67% | 66.67% | 50% |
The formulas disagree most about byes and draws. Under wins over rounds, Ben's only win was his bye, so he has won 0 of his 2 rounds played; Dee drew and lost his two rounds, also 0%.
A **floor** raises any opponent's match-win % below it to the floor before averaging, so a player is not punished too hard for opponents who lost every match or dropped early. The game-win floor does the same for Game win % and OGW%. Pokémon TCG uses a 25% opponent floor, and Magic: The Gathering and Riftbound use 33% for both. With each game's defaults, the OMW% in the worked example becomes (Magic: The Gathering has the same defaults as Riftbound):
| Player | Pokémon TCG | Riftbound |
| ------ | ----------- | --------- |
| Ana | 38.89% | 48.15% |
| Cam | 47.22% | 62.96% |
| Eli | 45.83% | 50% |
| Dee | 66.67% | 72.22% |
| Ben | 58.33% | 72.22% |
For Ana under the Pokémon TCG defaults, Ben and Dee both have 0% and are raised to 25%, so her OMW% is (25% + 66.67% + 25%) / 3 = 38.89%. Without the floor it would be 22.22%.
## Stats win rates {#stats-win-rates}
The win rates on stats pages (the meta page and a tournament's **Stats** tab) measure how decks do against each other. They count individual games wherever the results record them, and matches where they don't: many imported events only list match results. The count column next to the win rate says which it counts, **Games** or **Matches**, and an archetype's detail tabs show both.
A stats win rate is wins plus a share of draws, over everything played. The share depends on the game:
| Game | A draw counts as |
| -------------------------------------------------- | ------------------------------------------------------ |
| Pokémon TCG, Riftbound, Lorcana, Palworld | Half a win |
| Magic: The Gathering, Cyberpunk | A third of a win |
| Legends of Runeterra, Hearthstone, Flesh and Blood | No win, though it still counts toward the games played |
In Lorcana, Pokémon TCG, Riftbound and Palworld this differs from Swiss. With 3 points for a win and 1 for a draw, a drawn match gives each player a third of a win's points, and the match-win % above follows those points because standings decide who ranks higher. A stats win rate treats the draw as an even result between the two decks: each side gets half, every match adds up to one win between them, and the field as a whole averages 50%. An archetype above 50% is then beating the field.
## Exports
Organizers can download an event's data as CSV files, for prize payouts, a store's own records or an official results submission. Open the event's **Administration** tab and choose **Export** in the console. Exports are open to the event's owner, admins and operators; referees don't see the button.
| Export | What's in it | Choose |
| ---------------- | ------------------------------------------------------------------------------------------------------------------------------- | --------------------------- |
| **Participants** | Every registered player: seed, linked game account, status, approval, check-in and registration times, and registration answers | Nothing |
| **Standings** | One stage's rankings: points, wins, losses, draws, byes and each of the stage's tiebreakers | A started stage |
| **Pairings** | Every match: stage, round, table, players, scores, winner and result | One round, or all rounds |
| **Decklists** | Each player's submitted deck codes for one stage, with when they submitted and its validation status | A stage that collects decks |
Each file is named after the event and what it holds, for example `friday-night-swiss-standings-stage-1.csv`. The files are UTF-8, so accented player names open correctly in Excel, Google Sheets and Numbers. An export reflects the event at the moment you download it: during a live event, download again after the last round for final standings.
## Free-for-all scoring
Magic: The Gathering and Riftbound offer two free-for-all formats. Players are split into **lobbies** (pods), and every match awards **Placement points** by finishing position in the lobby.
- **Cumulative Points**: every lobby plays a fixed **Number of matches**, and final standings are total points. Players on the same total share a placement.
- **Threshold Win**: matches continue until a player reaches **Points to win** _and_ finishes at the **Required finish** or better in the match where they get there. If several players qualify in the same match, the one with the most points wins. Set **Maximum matches** to cap the stage; if no one has won by then, **If no one wins** decides it (**Highest points wins**).
These are the defaults for a new free-for-all stage:
| Setting | Magic: The Gathering | Riftbound | Teamfight Tactics |
| --- | --- | --- | --- |
| Players per lobby | 4 | 4 | 8 |
| Placement points | 1st: 8, 2nd: 7, 3rd: 6, 4th: 5, 5th: 4, 6th: 3, 7th: 2, 8th: 1 | 1st: 3, 2nd: 2, 3rd: 1, 4th: 0 | 1st: 8, 2nd: 7, 3rd: 6, 4th: 5, 5th: 4, 6th: 3, 7th: 2, 8th: 1 |
| Tie scoring | Competition | Competition | Competition |
| Cumulative Points (Free-for-All): number of games | 3 | 3 | 3 |
| Threshold Win (Free-for-All): points to win | 20 | 6 | 20 |
| Threshold Win (Free-for-All): required finish | 1st or better | 1st or better | 1st or better |
With the Riftbound defaults, a win is worth 3 points and the threshold is 6, so a player needs at least two wins to take the stage. In this four-player pod, Ana reaches 7 points in match 3 but finishes 2nd, so she has not won yet. Ben wins match 4 with 9 points; Ana also has 9, but finished 2nd, so Ben takes the stage.
| Match | Ana | Ben | Cam | Dee | Result |
| ----- | --- | --- | --- | --- | ------------- |
| 1 | 1st | 2nd | 3rd | 4th | No winner yet |
| 2 | 2nd | 1st | 3rd | 4th | No winner yet |
| 3 | 2nd | 3rd | 1st | 4th | No winner yet |
| 4 | 2nd | 1st | 3rd | 4th | Ben wins |
**Tie scoring** decides what tied players in a lobby earn. **Competition** (the default) gives each of them the points for the tied place: two players tied for 2nd both get 2nd-place points. **Split** shares the points of the places the tie covers: two players tied for 2nd each get the average of the 2nd- and 3rd-place points. **Elimination points**, if set, add points for each opponent a player eliminates.
Lobbies are formed by **Lobby seeding** (initial seed, current standings or random) and **Lobby distribution** (snake by default), and **Reshuffle lobbies** decides whether they are redrawn between matches.
## Riftbound lineups
Riftbound has no official format for bringing more than one deck, so Turny has its own. When a stage's **Decks to bring** is 2 or more, the create form switches the deck set rule to **Riftbound lineup**. The single-deck rules are refused for these events: **Riftbound deck set** treats every deck as a pile of one deck, and **Single deck** allows exactly one deck, so both would reject every lineup.
Each deck must still pass the deck rule (**Riftbound constructed**) on its own. On top of that, **Riftbound lineup** checks the lineup as a whole:
- **One deck per Legend**: no two decks can share a Legend.
- **3 copies across the lineup**: no more than 3 copies of a card across every deck's main deck and sideboard combined. Runes and Battlefields don't count, so each deck can run its own 12 Runes and reuse Battlefields.
The rule never checks how many decks you bring. That comes from the stage's **Decks to bring**.
## Waitlists {#waitlists}
When an event with a player cap fills up, players can join a **waitlist** instead of being turned away. The first player in line gets the next seat that opens before the event starts.
### Turn it on or off {#waitlists-setup}
The waitlist is on for every event with a **Max participants** cap. To turn it off, clear **Open a waitlist when the event is full** under **Waitlist** in the admissions section of the create or edit form. Without a cap there is nothing to wait for, so the setting doesn't show. Turning it off keeps anyone already in line, and they still move up as seats open, but no one new can join.
### Joining and leaving {#waitlists-players}
Once every seat is taken, the event page shows **Full** beside the player count, and the register button reads **Join waitlist**. A player who joins sees their place in line, such as **You're #3 on the waitlist**, and a **Leave waitlist** button. Leaving gives up their place; joining again puts them at the back of the line.
The line is private. The event page never shows how many players are waiting, and waiting players don't appear on the roster.
### When a seat opens {#waitlists-promotion}
A seat opens when a registered player withdraws or is removed. The first player in line takes it straight away and gets a notification (and an email, unless they turned those off under **Waitlist updates** in their notification settings). If they have the event open, the page updates to say a seat opened for them. Under manual approval, the promoted player still waits for your approval, like any other registrant.
If you raise the cap, the new seats go to the players in line before anyone new can register.
When the event starts, the waitlist closes: anyone still in line is taken off it and told no seat opened. Late entry has no waitlist.
### Managing the line {#waitlists-manage}
Operators, admins and the owner see a **Waitlist** section on the **Players** tab of a capped event before it starts. It lists the line in order, with when each player joined:
- **Promote** gives that player a seat now, out of line order, even when the event is full.
- **Remove** takes them off the waitlist. Like a removal from the roster, they can't sign up again on their own.
Referees don't see the section.
## Your calendar {#calendar}
**Calendar** in the menu (shown once you're signed in) puts every event you care about on one calendar, across every game:
- events you registered for, including ones where you're on the waitlist;
- events you created or help run as staff;
- public events from communities you follow;
- public events from recurring events you follow (see [Follow a schedule](#recurring-follow)).
**Month** is the landing view. **Week** shows the next seven days, then a **Later** list for about four weeks after that. **Today** and the arrows move the calendar; times show in your own time zone, so a late-night event can land on the next day.
Events are coloured by your part in them: **Playing** is gold, **Organizing** is teal, and **Following** is a muted blue. When you have more than one kind, chips with those names at the top hide or show each kind, and your choice stays when you switch between Month and Week. A few rows also carry a word: **Waitlisted**, **Staff** when you help run someone else's event, and **Playing** when you also play in an event you organize.
Click an event for its status, start time, player count and a link to the tournament. Events from another game show that game's icon and open on its own site. Past events are dimmed and cancelled ones are struck through.
A recurring event's dates further out than it [publishes](#recurring-setup) still show, with a dashed outline and the word **Planned**. They follow the schedule's skipped and moved dates. Click one and **Open schedule** takes you to the run's **Schedule** tab; the event itself, and registration for it, open closer to the day.
## Recurring events {#recurring-events}
A weekly store night or a monthly championship doesn't need to be created by hand every time. Set an event to repeat and Turny copies it for each date on the **schedule**, publishing every copy a few weeks before it starts so players can find it and register.
### Set up a schedule {#recurring-setup}
There are two ways in:
- **When you create an event**: turn on **Repeat this event** under the scheduled start. After you create the event, its **Schedule** tab opens in setup mode, filled in from the event's day, start time and name.
- **From an event you already run**: open its **Schedule** tab and choose **Set up a schedule**. Only the event's owner and admins see this tab on an event that doesn't repeat yet.
Setup has two parts:
- **How it repeats**: **Weekly**, **Every few weeks** (every 2, 3 or 4 weeks) or **Monthly** (the first, second, third, fourth or last given weekday of the month), plus the day, the start time and the time zone.
- **Names, publishing and series**:
- **Publish each event**: 1 to 8 weeks before it starts (4 by default). Registration still opens and closes the way the original event's does.
- **Event name**: the name each new event gets. **Add event number** inserts `#{n}`, which counts up from **Next number**, so a run can continue an existing count (for example from #13). **Add date** inserts the event's date.
- **Add each event to a series**: each new event joins that series' current season as its own stop. See [Series](https://docs.turny.gg/guide/series).
The calendar beside the form previews the next dates before anything is saved. Choose **Start schedule** to begin: the event you set it up from is the first event of the run, and the next ones are published as they come into the publish window.
Every new event copies the original event's settings: format, stages, rules, caps and registration times. Start times follow the schedule's own time zone, so an event at 7:00 PM stays at 7:00 PM local when the clocks change. The calendar marks the day the clocks change.
### The Schedule tab {#recurring-schedule-tab}
Every event in a run has a **Schedule** tab, and the event page shows previous and next buttons beside the date, with a calendar button that opens the tab. The tab shows:
- A month calendar with each date marked **Played**, **Published**, **Publishing now**, **Planned**, **On hold**, **Skipped** or **Moved**. A moved date shows on its new day, with a dashed marker on the day it left.
- A panel for the selected date, with its start time in the schedule's time zone and in yours when they differ.
- **Coming up**: the next dates, with when each one is published.
Players see the same calendar, read only: published and planned dates, skips and moves, but not your notes or dates on hold while a schedule is paused.
### Follow a schedule {#recurring-follow}
Once a run has a public event, its Schedule tab shows a **Follow schedule** button in the header. Follow it and every public event in the run shows up on [your calendar](#calendar), including the ones published later, without registering for each one. Press **Following** to unfollow. You need to be signed in; signed out, the button takes you to sign in first.
### Change a date or the schedule {#recurring-edits}
Select a date on the calendar to change it:
- **Change date or time**: move this date to another day or start time.
- **Skip**: take the date out of the run, with a note for yourself (a holiday, a closed venue). Skipped dates don't use up an event number.
- **Change how it repeats**: change the day, start time or cadence.
Each change asks which dates it applies to, the way a calendar app does:
- **This event only**: a one-off change to that date. Moves and skips can be undone from the same panel with **Undo move** or **Bring back**.
- **This and following events**: the change applies from that date on. A skip with this choice ends the schedule before that date.
Before you save, the choice shows how many dates change and how many published events and registered players it reaches, and the calendar outlines the dates that move. Published events that move keep their registrations, and registered players are told about the new date. Skipping a published date cancels that event, and so can changing how often it repeats when the new dates leave too few slots for the published events. Admins can move dates, but only the schedule's owner can make a change that cancels a published event.
### Change one event's settings {#recurring-event-settings}
Editing an event in a run with the regular edit form asks the same question when you save:
- **This event only**: only this event changes. It is marked **Changed for this event only** on the calendar, and later changes to the following events skip it.
- **This and following events**: later published events get the same settings (they keep their registrations), and events created later copy this one.
### Pause, settings and delete {#recurring-manage}
The Schedule tab's header has:
- **Pause** and **Resume**: while a schedule is paused, no new events are published. Events already published still run. Dates that pass while it is paused are not created later.
- **Settings**: the schedule's name, how far ahead events are published, the event name pattern, the next number and the series. None of these move a date.
- **Delete**: the schedule stops. Events already published stay as normal tournaments, and planned dates go with the schedule.
My Tournaments lists your schedules under **Schedules**, with their next dates and a **Pause** or **Resume** button. **Manage** opens the Schedule tab.
## Venue address and map pin {#venue-location}
An in-person event takes place at one of your saved venues. Create and edit venues under **Settings > Venues**, then pick one when you set up the event.
- **Address**: start typing the street address or the store's name and pick the right suggestion. A suggestion fills in the address, city, region and country, and places the map pin for you. When nothing matches, type the address yourself and drop the pin by hand.
- **Address line 2**: the floor, suite or room, so players find the door.
- **Map pin**: the venue's exact spot. **Adjust pin** lets you drag it onto the right building. **Drop a pin** opens the map so you can click where the venue is, and **Use my location** places it where you're standing, handy when you set the venue up on site. **Remove pin** clears it.
The pin is what makes your events findable nearby. **Near me** and the area search on the tournaments list measure distance from the pin, so an event at a venue without one never shows up there, even though its address still shows on the event page. Set the pin once per venue and every event you run there is covered.
Address suggestions are built on OpenStreetMap data, so the event page credits OpenStreetMap under a pinned venue's address.
## TV display
The **TV display** button in the organizer console opens a full-screen board for a screen at the venue. Only the event's organizers can open it. Put it on the TV, press **Fullscreen**, and leave it: the board follows the event on its own.
### What the board shows
The top bar carries the event name, the format, the round and the field size, the time of day and a live light. Along the bottom, a results crawl lists each result as it is reported.
The main panel depends on where the event is:
- **During a round**: that round's pairings. Up to 24 pairings are listed by table number. A bigger round lists every player A to Z with their table and opponent, so players look for their own name.
- **Between rounds**: the standings, with the finished round's results beside them.
- **After the stage**: the final standings.
- **Elimination stages**: the round's pairings, like Swiss, with **Up next** beside them showing the next round's matches ("Winner of #3"), which fill in as results arrive. Once the rest of the bracket fits the screen at full size, the bracket replaces the pairings.
Lists never scroll. Rows are sized to fit the screen, and when they don't all fit, the list turns pages every few seconds, with a progress bar showing which page is up.
The right column holds the round clock, the top of the standings (as many rows as fit) and a QR code that opens each player's own match page on their phone.
### The round clock
The clock counts down to the end of the round and is the largest thing on screen. It turns amber in the last 5 minutes. When you pause the round timer from the console, the clock shows **Paused** and holds its time. At zero it turns red and shows **Time** with how far over time the round is. A stage without a round timer shows how many results are in instead.
### The live light
The light reads **Live** while the board is connected and receiving updates, and **Reconnecting** as soon as the connection drops. After 15 seconds without a connection it reads **Offline** with the time of the last update, and the clock stops at the last time it was sure of, because a pause or time change made meanwhile can't reach the board. Everything catches up when the connection returns.
### Following the event
The board shows the active stage's latest published round. Draft pairings stay off the screen until you publish them. When you publish a new round or start the next stage (a top cut, for example), the board switches to it within a second, with no reload. If you picked an earlier round or another stage from the toolbar, publishing the next round puts the board back on the live one.
### The toolbar
Move the mouse over the board to show the toolbar; it hides again after a few seconds. It holds:
- **Stage** and **Round**: show another stage or round.
- **Pairings**: **Auto** (by table up to 24 pairings, A to Z above that), **By table** or **A to Z**.
- **Page every**: how long each page of a long list stays up (8, 12, 20 or 30 seconds).
- **Zoom**: makes rows larger or smaller.
- **QR card** and **Show QR now**: see below.
- **Dark** or **Light**: dark suits a dimmed hall, light a bright one.
- **Fullscreen**.
The board remembers these settings in the browser it runs in.
### The QR card
Every 5 minutes, a full-screen card with a large QR code takes over the board for 15 seconds, with the round clock still on it, so players arriving late can find their match. Change how often it appears under **QR card** (every 2, 5 or 10 minutes, or off), or put it up straight away with **Show QR now**. The card is skipped while the round is over time, when the clock matters more.
## Printing {#printing}
The **Printable view** button (the printer icon) in the organizer console opens the **Print kit** in a new tab: the sheets you hand out or pin up at a venue, for one round at a time. Only the event's organizers can open it. The same page is the display page's **Print** mode, next to **TV**.
The setup panel walks you through four steps, with a page-accurate preview of every sheet beside it.
### Round {#printing-round}
Pick the **Stage** and the **Round** to print. The kit starts on the active stage's latest round.
### Sheets {#printing-sheets}
Tick the sheets you need. Each one says who it is for, and how many pages it will print once selected.
| Sheet | For | What it is |
| --------------------- | ---------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **Pairings by name** | Post on the wall | Every player A to Z with their table, seat, opponent and points. Players find their name, then their table. Seat A sits on the left, and a star marks a feature table. |
| **Pairings by table** | Scorekeeper | Every table in order, with a box to record results called in. |
| **Match slips** | Cut and hand out | One slip per match, for the players to fill in game by game and sign. Byes and seats still waiting on a result get no slip; the sheet lists the byes instead. |
| **Standings** | Post on the wall | Rank order with the stage's tiebreakers, as of the snapshot. |
| **Bracket** | Post on the wall | The elimination tree. A large bracket is scaled down or split into parts, and each part says which rounds it covers. |
| **Decklist** | Judges only | One page per player: their seat this round, when they submitted, whether the list passed validation, the deck code and the cards, plus a deck check box for the judge to fill in. |
Not every sheet fits every stage. **Standings** is for Swiss and round robin stages only, **Bracket** for elimination stages only, and the two pairing sheets and the match slips for one-on-one stages only, so a free-for-all stage prints standings and decklists. A sheet the stage can't print is greyed out with the reason.
**Quick picks** select a set of sheets in one click, keeping only the ones the stage supports:
- **Round kit**: pairings by name, pairings by table and match slips. Print it at the start of every round.
- **Wall**: pairings by name, plus the standings in a Swiss or round robin stage, or the bracket in an elimination stage.
- **Judge pack**: pairings by table, standings and decklists, for the judges' station.
### Report QR {#printing-qr}
With match slips or pairings by name selected, a **Report QR** switch appears. When it is on (the default), every match slip carries a code, eight slips to a page, and the pairings by name sheet carries one too ("Scan to report your result"). The code opens the event page, where each player reports from their own match panel. Turn it off for ten slips to a page and no codes.
### Check {#printing-check}
Before the **Print** button unlocks, the kit loads every player in the round, then takes a snapshot and shows its time. It warns you when:
- the round is still being played, so results reported after the snapshot are not on the sheets;
- the round has not started yet;
- the round has no physical tables, so sheets show match numbers instead;
- some players have no decklist on file, or your staff role cannot read decklists;
- results changed after the snapshot. Press **Refresh snapshot** to take a new one.
### Print {#printing-print}
Press **Print N pages**. In the browser's print dialog, use Letter or A4 paper, **Default** margins, 100% scale, and turn headers and footers off. Every page carries its own header (event, stage, round and the time it was printed) and page number, so a loose page is never a mystery.
The stage, round, sheets and the Report QR setting are kept in the page's address, so a bookmark or a link to a colleague opens the same selection.
## Announcements {#announcements}
Organizers can send a short message to the players of an event: a room change, a delayed round, a reminder before check-in closes. Announcements are private. Only the players they go to and the event's staff can read them, so they never appear on the public event page.
### Send an announcement {#announcements-send}
Owners, admins and operators find **Send announcement** on the event's **Announcements** tab, right after Overview. Choose who it goes to:
- **Players still in** (the default): every registered player who hasn't withdrawn or been disqualified and, once the event is running, isn't knocked out. Before the event starts this is everyone registered.
- **All registered players**: includes players already knocked out.
- **Specific players**: a private note to the players you pick.
Each option shows how many players it reaches right now. Who receives an announcement is fixed when you send it, so a player knocked out later keeps the ones they already got.
Every announcement shows up in the app. You also choose:
- **Email**: sends a copy to each player who gets announcement emails.
- **Post in the event's Discord channel**: shows only when the event has a working Discord webhook, and everyone in that channel can see the post. Not available for specific players.
- **Pin it**: keeps it at the top of every player's list. An event has one pinned announcement at a time, so pinning a new one replaces the old pin. Announcements to specific players can't be pinned.
An announcement can be up to 1,000 characters. **Review** shows how it will look on the Announcements tab, as a notification and as an email before you send it.
### Read receipts, edits and deletes {#announcements-manage}
The Announcements tab lists every announcement the event has sent, with who it went to and how. **Read by N of M** opens the names of the players who haven't read it yet, with a button that sends a new announcement to just those players.
- **Edit** changes the text. Edits don't notify anyone again, and emails and Discord posts already sent keep the original text. Players see an **Edited** marker.
- **Pin** and **Unpin** move the pin.
- **Delete** removes the announcement for every player. Emails and Discord posts already sent stay where they are.
### What players see {#announcements-players}
Registered players who still count see the **Announcements** tab, with a badge for unread ones. Spectators don't see the tab. The pinned announcement comes first, then the newest. An announcement counts as read once it has been fully on screen for 8 seconds, and **Mark all read** clears the rest. While a player has unread announcements, the other tabs show a banner that opens them.
Each announcement also arrives as a notification. Opening it from the notification bell jumps to that announcement, and reading it in either place marks both read. In-app announcements are always on; players can turn off the email copies under **Organizer announcements** in their notification settings.
## Judges, penalties and deck checks {#judging}
Event staff run the floor from **floor mode**, a phone-sized page built for walking between tables. Open it with **Floor mode** in the organizer console. Referees and everyone above them can use it.
### Staff roles on the floor {#judging-roles}
- **Referees** issue warnings, game losses and match losses, and run deck checks. They can revoke a penalty they issued themselves, except a disqualification.
- **Operators**, **admins** and the **owner** can also disqualify a player and revoke any penalty.
- Removing a player from the roster (a drop or a no-show) is separate from a disqualification: it records no penalty and needs an operator or above.
### Floor mode {#judging-floor-mode}
Floor mode has four tabs, and each one has its own address, so a judge can keep one open on a phone:
- **Tables**: every table of the current round, with both players. A gavel and a count mark a player who already has penalties at this event, a bell marks a table where a player called a judge, and finished tables are dimmed. Type a table number or part of a name into **Table or player** and press **Go** to jump to it.
- **Deck checks**: random deck checks for the round (see below).
- **Log**: every penalty at the event, newest first and grouped by round. Filter by kind (**W**, **GL**, **ML**, **DQ**) or tap a player's name to see only theirs. Revoked penalties stay in the log, struck through, with who revoked them and why.
- **Console**: the full organizer console, the same as the Administration tab.
Opening a table shows its score, including any games already given by a penalty, each player's penalties at this event and a **Penalty** button for each player. When a player calls a judge, **Judge call** on the table opens the match chat, and the chat links back to the table in floor mode.
### Issue a penalty {#judging-penalties}
**Penalty** opens the penalty form. Earlier penalties for that player at this event are listed at the top.
1. Pick the **Infraction**. The list is the same for every game: tardiness, slow play, procedural error, game rule violation, decklist problem, communication, outside assistance, unsporting conduct, cheating and other. Each one starts at its usual penalty, which you can change.
2. If the player already has an active penalty for the same infraction, a line such as **Repeat of Warning R2** appears with a button for the next penalty up. It is a suggestion only.
3. Pick the **Penalty**: warning, game loss, match loss or disqualification. For a game loss, match loss or disqualification the form shows the match **Score** before and after.
4. Add **Details** the player will see, and an optional **Staff note** that only staff see. For a disqualification the details become the required reason.
A match loss and a disqualification need a second tap to confirm. After issuing, a message offers **Undo**, which revokes the penalty straight away.
How each penalty changes the match:
- A **warning** is recorded and changes nothing else.
- A **game loss** gives the opponent the next game of the match, and the match carries on. Players then report only the games they still play: after a game loss, a 2-0 report reads as 2-1 overall. A game loss that brings the opponent to the games needed to win ends the match.
- A **match loss** ends the match as a win for the opponent.
- A **disqualification** removes the player from the event and forfeits their open matches.
- A penalty issued after the match is finished is only recorded; it doesn't change the result.
Revoking a game loss or match loss before the next round is paired undoes its effect on the score. After that, revoking only marks it in the log, and staff fix the result with the match override.
### Deck checks {#judging-deck-checks}
On the **Deck checks** tab, set how many tables you want and press **Pick N at random**. The pick skips tables whose match is already finished and tables where a player has already been checked at this event, so the same player isn't checked twice. When fewer tables qualify, you get fewer. To check a specific table instead, open it and press **Deck check**; it is recorded as the judge's choice.
Tap a player on a picked table to see their registered list next to the verdict:
- **OK** records the check.
- **Issue** needs a note saying what's wrong. **Issue penalty for this** then opens the penalty form with **Decklist problem** and a game loss already filled in, and links the penalty to the check.
Every check at the event is listed below the picked tables, with the round, table, verdict and any linked penalty.
### What players see {#judging-players}
Penalties never appear on the public event page. A player sees their own penalties at the event in a **Your penalties** card below **Your match**: the kind, the infraction and the round, and whether it was revoked. They never see the staff note, which judge issued it or why it was revoked.
When a game loss or match loss changes a match, both players see one line in their **Your match** card, such as "Game 1 to Zoe Quinn", with the games of the match below it and the penalty game locked. The opponent learns only the effect on the score, never the infraction.
---
url: https://docs.turny.gg/guide/series
description: "How Turny.gg series work: seasons, stops and divisions, how season points and best-N counting add up, ties and qualifying spots, where series show up, and how organizers run one."
---
# Series
A **series** ties tournaments together into **seasons**. Each tournament in a season is a **stop**, every finish at a stop earns season points, and a running table shows who leads. A season can build toward a **finale** with qualifying spots, pay out a reward, or simply keep going. A store's weekly league, a community cup and a circuit of official events are all series.
## The parts of a series {#parts}
- **Series**: the name, game and organizer. A series belongs to one game, and one organizer runs it.
- **Season**: one run of the series with its own schedule, points table and standings. A new season starts the table from zero; earlier seasons stay viewable from the **Season** picker.
- **Stop**: one date on a season's schedule. A stop is either a tournament on Turny or an **announced** date with no event on Turny yet.
- **Division**: a separate field with its own standings, such as Masters, Seniors and Juniors, or a single Open division. At each stop, every division plays its own tournament. Divisions are always scored separately and never merged; switch between them with the **Division** picker.
A tournament can be a stop in more than one series. Each series scores it with its own points table.
## For players
### How points work {#points}
The **Scoring** tab shows the season's **Points per finish** table: each finish (for example #1, or #5 to #8) is worth a set number of points. Finishes below the table earn nothing.
Some stops are **majors**, marked with a multiplier such as **2x points**. Every finish at a major is worth the table's points times the multiplier, rounded to a whole number.
Points only count once a stop is finished. A stop that is live or upcoming adds nothing yet.
### Best results only {#best-results}
A season can count only your best few stops, for example "Only your best 4 stops count". Your total is the sum of your best results, and any extra results still show on your **Season path**, struck through and marked **Not counted**. Playing another stop can only raise your total: a weaker finish is simply not counted.
If the season counts every stop, every result is added.
For example, with best 3 counting, a player who scores 100, 60, 40 and 25 points at four stops has a total of 200. The 25 stays on their path, struck through.
### Standings and ties {#standings}
The **Standings** tab ranks every player who has scored in the season. Players are ordered by:
1. Points.
2. Best single finish (a #1 beats a #2).
3. Most stops scored.
Players on equal points and an equal best finish share a rank. Click a player to open their season path: their result at every stop, with any points that were not counted.
A large series shows the top 100 first. **Show more** loads the next 100, and **Find a player** searches the whole table.
Players who entered without a Turny account only score at that one event. Their results at different stops are not added together, even under the same name, so make an account and enter each stop with it.
### Qualifying spots {#qualifying}
A season can give the top players of each division a spot, for example "Top 8 qualify" for the finale. Qualifying players are marked **Qualifies** in the standings. If several players share the last qualifying rank, all of them qualify, so a tie is never split.
Some seasons have no qualifying spots at all: the table itself is the result.
The **Still on the table** figure is the most points one player could still add from the stops left to play. It tells you whether a gap can still be closed. There are no "clinched" or "eliminated" labels: compare the gap with that figure yourself.
### Finales, rewards and open seasons {#season-endings}
A season ends in one of three ways:
- **Finale**: a closing event, with a name and a date, that the qualifying players are invited to. Once the finale is played on Turny, each player's finale finish shows in the standings.
- **Season reward**: a prize instead of a finale, such as store credit or a trophy for the top players.
- **Open-ended**: a league with no last stop. The table keeps running as new stops are added, and the season shows its stops "so far" instead of counting down to an end. New seasons start open-ended; the organizer turns that off once the season has a last stop.
A season can combine these, for example an open-ended league that still pays out a reward.
### Where you see series {#where}
There is no series entry in the menu. You reach a series from the tournaments it covers:
- **Tournament page**: a strip above the tournament shows which stop it is, what the winner earns, and a link to the season standings. Its track has a dot for each nearby stop, marked completed, live, announced or cancelled from its event: hover one for its name, date and state, or click it to open that stop's tournament. The flag at the end opens the finale (or the schedule, until the finale event is linked). In a long season, the count at either end of the track opens the full schedule.
- **Tournament list**: tournament cards that are stops show the series and stop number. The **Series** button at the top of the list opens the series list.
- **Series list**: every public series for the game, with its organizer, current season, stops played, next stop and finale. The series with the soonest next stop or finale comes first.
- **Profile**: the **Series** block in a player's **Played** tab shows each series they scored in, with their rank and points.
- **Series page**: the **Standings**, **Schedule**, **Calendar** and **Scoring** tabs. **Schedule** lists every stop as **Played**, **Live now**, **Upcoming** or **Announced**, with links to sign up for upcoming events. **Calendar** shows the season's stops month by month.
## For organizers
### Create a series {#create}
Start a series from **Your series** on My Tournaments. Give it a name, pick its game and choose who can see it:
- **Private**: only you.
- **Unlisted**: anyone with the link.
- **Public**: it also shows on its tournaments' pages, on the tournament list and in the series list.
A new series opens on its **Manage** tab with one **Open** division and a first season. Divisions, stops and seasons are all set up there. Your series are listed under **Your series**, and only the organizer sees **Manage**.
### Divisions and seasons {#divisions-and-seasons}
Every series starts with one **Open** division. Under **Divisions** on the **Manage** tab, rename it, add one for each separate field you run (for example Masters, Seniors and Juniors) and put them in order. A stop links one tournament per division, so a stop with Masters and Juniors links two tournaments.
Each season has its own settings, top to bottom on **Manage**:
- **Stops**: the season's schedule.
- **Points table**: finish bands, each worth a number of points.
- **Stops that count**: **All of them**, or the best few.
- **Open-ended season**: on for a new season. Turn it off once the schedule has a last stop.
- **Has a finale**: turn it on to name the finale, give it a date, pick the finale event for each division and set each division's **Qualifying spots**. Turning it off clears all of that.
- **Season reward**: a prize, with or without a finale.
Start a new season with **New season** when you want a fresh table. Changing the points table or the stops that count updates the standings right away, played stops included.
### Stops {#stops}
Under **Stops** on the **Manage** tab, stops are listed in date order. Change a stop's date to move it in the schedule.
To add a stop, give it a name, a date and a points multiplier. The multiplier is 1x for a regular stop; raise it for a major. It applies to every division at that stop.
A new stop is **announced** until you link its events. On the stop's row, use **Pick an event** for each division and search by name to find the tournament. In a series with one division that is a single tournament; with Masters and Juniors, it is one tournament each. You can add the stop before its events exist on Turny and link them later, once you have created them.
You can also link a new event while you create it: in the create form, pick the series and the division under **Part of a series**. The form shows where the event lands in the season and what its winner earns. Once the event is created, it joins the stop on that date if that division's spot is free, or a new stop is added for it.
### Which tournaments you can link {#linkable-tournaments}
You can link:
- Tournaments you created, or that you are staff on.
- Imported official events that are not private.
The tournament must be for the series' game. A tournament can only be linked once in a season, but it can be a stop in several different series.
### Choosing a points table {#points-tables}
A few tips:
- Pay points deep enough to reward a good day, not just the winner. A table that pays the top 8 of a 16-player store event keeps half the field in the race.
- Use bands for finishes that are hard to separate, such as #5 to #8 in a top-8 bracket, so a coin-flip quarterfinal does not swing the season.
- Use a multiplier for a few bigger stops, rather than a second table.
- Count the best few stops in a long season, so missing a week does not knock a player out of the race.
---
url: https://docs.turny.gg/guide/communities
description: "How Turny.gg communities work: one page for a store, play group or team, the Owner, Admin and Host roles, inviting your staff, hosting tournaments and series under the community's name, and changing or deleting it."
---
# Communities
A **community** is one page for a store, a play group or a team. It lists the events and series the community hosts, its staff and regulars, its recent champions and its stats. The same page shows on every game site, so a store that runs several games has one address for all of them: `turny.gg/communities/`.
Choose **Follow** on a community's page to hear about its new events. Its public events also show up on [your calendar](https://docs.turny.gg/guide/tournaments#calendar).
## Kinds of community {#kinds}
Pick the kind that fits when you create it. You can change it later.
- **Store**: a shop with a place to play. A Store can post its **opening hours**, and its page shows whether it's open right now and what's on this week.
- **Play group**: friends, a league or a Discord that plays together.
- **Team**: a team or org that competes together.
## Start a community {#create}
Go to **My Tournaments** and choose **Start a community** in the **Communities** section. Fill in:
- **Name** and **Page address**. The address follows the name until you edit it, and the form tells you right away whether it's free.
- **Kind** and **Games**. Pick every game you run; players filter the page's events by game.
- **Tagline** and **About**, shown in the page header and sidebar.
- **Home venue**: one of your saved venues, or none for an online community. Each event still picks its own venue.
- **Logo**, **Banner** and **Colour**. Images are uploaded to Turny (JPEG, PNG or WebP, up to 5 MB); links to images on other sites aren't accepted. Without a banner the header uses your colour.
- **Links** to your website, Discord, X, Instagram, YouTube and Twitch. A handle like `@arcanegames` or a domain like `discord.gg/yourserver` is turned into a full link.
- **Opening hours** (Stores only). Each day is open or closed. Hours use the home venue's time zone, so a Store needs a home venue to post them.
A preview beside the form shows the page header and how your events will look in lists. You become the community's **Owner**.
## Roles {#roles}
| Role | What they can do |
| ----- | -------------------------------------------------------------------------------------------------- |
| Owner | Everything: edit the page, manage members (including other Owners), delete the community. |
| Admin | Edit the page and the member list. Co-organizer on every event and series the community hosts. |
| Host | Host events and series under the community's name, with staff rights only on the ones they create. |
Owners and Admins automatically run every event the community hosts as co-organizers, without being added to each event's staff. Only an Owner can add, change or remove an Owner, and a community always keeps at least one Owner.
## Manage a community {#manage}
Owners and Admins see a **Manage** tab on the community page. It has three parts:
- **Profile**: the same fields as when you created it. Changing the **Page address** keeps the old one working: anyone who opens it lands on the new address, and the form lists your old addresses. An old address stays reserved for your community.
- **Members**: invite people, change roles, remove members or cancel invites, and leave. A guide below the list explains each role.
- **Delete community** (Owners only): type the community's name to confirm. The page goes away, and its events and series stay up, hosted by the people who created them.
### Invite your staff {#invites}
In **Members**, type a username and pick the person from the list, or type an email address to invite someone who doesn't have an account yet. Choose their role and select **Invite**.
The invitee gets a notification that opens the community page, where they choose **Accept** or **Decline**. An invite gives no rights until it's accepted. Open invites also show in the **Communities** section of their **My Tournaments**.
## Host under a community {#host}
Every member can host under the community's name. On the tournament create form, **Host as** offers **Myself** or any of your communities; **Host an event** from the community page or from **My Tournaments** opens the form with that community already chosen.
When a community hosts an event:
- the event shows the community's logo and name, and is listed on the community's page;
- the community's Owners and Admins can run it with you.
To move an existing event, open it in the editor and change **Host as**. Moving an event onto a community needs any role there; taking it off needs the event's Owner or a community Admin.
Series work the same way: **Host as** in the new series dialog lists your communities, and the community's Owners and Admins can manage a series it hosts.
## Deleting your account {#account-deletion}
If you're the only Owner of a community, your account can be deleted as long as someone else can take over: the longest-standing Admin becomes the Owner. If the community has no Admin, deleting your account is refused until you make someone an Owner or Admin, or delete the community.
---
url: https://docs.turny.gg/guide/deck-builder
description: "Import and export decks in every format the deck builder reads, organize them into piles and templates, and read its validation messages."
---
# Deck builder
The deck builder reads the deck codes and text lists players already share, splits a deck into piles when the game has zones, and checks the deck against your rulesets as you build. This page covers every import and export format per game, how piles and templates work, and what the builder's validation messages mean.
## Importing and exporting
To import, paste a deck code or a deck list into an empty deck's **Import a deck** box, or press **Import** in the deck panel's footer on a deck that already has cards (on a phone, open the deck with the **Build or Import** button first). The builder tries each format its game accepts, in the order listed below, and reads the first one that works. On an empty deck a clean list imports straight away. On a deck with cards, the import sheet asks what to do: **Replace deck** swaps the deck for the pasted list, and **Add to deck** adds the list's copies to the cards already there. With **Multi Pile** on and the piles set to **Single Deck**, a list that carries zones (a Riftbound deck, an MTG list with a sideboard) is sorted into its piles either way: Replace empties the pile you pasted into and every pile the list fills before importing, and Add puts each zone's cards on top of its pile, so a pasted sideboard still reaches the Sideboard pile. Each option shows the card count the pile is left with. Add keeps the deck's name; Replace takes the pasted deck's name when it has one. A list line the builder cannot read, or a card it cannot find, is skipped, and the sheet lists every skipped line with its line number before you import, so nothing disappears silently. For Pokémon, a line whose exact printing is missing but whose card name matches one card is imported as another printing of that card, and the sheet lists it as `: imported as ` under its own heading. **Edit list** takes you back to the pasted text. If a pasted list reads as a deck list but none of its lines can be imported, the sheet says nothing could be imported and lists every failed line; text that isn't a deck code or list at all shows the general "could not be read" error instead.
To export, open **Deck Preview** (the eye button). **Share** copies a link to the deck's page (`//decks/`) built from the game's Turny.gg deck code. Next to it are **Copy deck list** and, for Riftbound, **Copy deck code**. A shared link opens without an account, and **Open in deck builder** on the deck's page loads it back into the builder.
The **Maybeboard** pile is never exported. Whether a sideboard keeps its place depends on the format; the notes under each game say which formats carry one.
### Legends of Runeterra
The builder reads the standard Legends of Runeterra deck code, the same code the game client and other LoR sites use.
```text
CEAQ2AIAAEDASCYMCQKRUJZNFY2TOAABAEAQABY
```
- **Share** links to the deck code, and **Copy deck list** copies the code itself.
- The builder also opens a code from its address: `/en/deck-builder/`.
- LoR has no sideboard. If a pile is marked **Sideboard**, its cards are added to the shared code with the rest of the deck.
### Pokémon TCG
The builder reads two formats, tried in this order:
1. **Turny.gg deck code** (`PTCG1`). Pokémon TCG has no official deck code, so Turny.gg uses its own compact, link-safe one. Cards are grouped by set, and each entry is `x`, or just `` for a single copy.
```text
PTCG1.me55:4x66,4x128.sv8:2x76.sv8pt5:4x105.sve:2x4,4x5
```
2. **Pokémon TCG Live deck list**: the plain-text list the game client exports, one `` line per card.
```text
Pokémon: 6
4 Mew ex 30C 66
2 Latias ex SSP 76
Trainer: 8
4 Crispin PRE 105
4 Ultra Ball 30C 128
Energy: 6
4 Basic {P} Energy SVE 5
2 Basic {L} Energy SVE 4
```
The import is forgiving. Section headers, blank lines and a `Total Cards: 60` line are ignored, and `4x` works as well as `4`. Set codes are the Pokémon TCG Live abbreviations (`PAL`, `SSP`) and are not case-sensitive. Basic Energy lines may leave out the set and number, as Pokémon TCG Live does (`4 Basic {P} Energy` or `4 Basic Psychic Energy`). A list that lost its line breaks on the way (a common phone paste problem) is split back into lines when every card in it can be found.
- **Share** links to the `PTCG1` code. **Copy deck list** copies a Pokémon TCG Live list, which pastes straight into the game client.
- The builder also opens a code from its address: `/en/deck-builder/`.
- Neither format has a sideboard. If a pile is marked **Sideboard**, its cards are added to the shared code with the rest of the deck.
### Riftbound
The builder reads four formats, tried in this order:
1. **Turny.gg deck code** (`RIFT1`). The same grammar as `PTCG1`, with upper-case set codes. The Legend, Runes and Battlefields need no zone of their own, since a card's type decides its zone. A `CH` segment names the [Chosen Champion](#riftbound-chosen-champion), a card that is also in the main deck, and is left out when there is none. A `CS` segment after it carries [Neeko's Legends](#riftbound-neeko-legends), left out when there are none. The sideboard follows an `SB` segment at the end.
```text
RIFT1.OGN:6x042-298,3x043-298,3x045-298,3x064-298,6x166-298,205-298,259-298,282-298,289-298,293-298.CH.OGN:205-298.SB.OGN:2x050-298
```
2. **Piltover Archive deck code**: the community code that [Piltover Archive](https://piltoverarchive.com), Rift Atlas and Tabletop Simulator read. Cards resolve by set and collector number, so any printing of a card loads it. The code carries the Chosen Champion and Neeko's Legends too.
```text
CQAAAAAAAAAACAQFAAAQEAIFAAAACAYAAAACWABNABAAAAIFAAAABTIBACBQEAE2AIAKCAQAUUBAAAIBAAAAAMQAAEAAAAGNAE
```
3. **Piltover Archive deck list**: Piltover Archive's plain-text list, with cards named but not numbered. The card under `Champion:` joins the main deck as your Chosen Champion, and `Sideboard:` goes to the sideboard.
```text
Legend:
1 Yasuo, Unforgiven
Champion:
1 Yasuo, Windrider
MainDeck:
3 Charm
3 Defy
3 Wind Wall
Battlefields:
1 Monastery of Hirana
1 Targon's Peak
1 The Grand Plaza
Runes:
6 Calm Rune
6 Chaos Rune
Sideboard:
2 Rune Prison
```
Names match with either subtitle separator, so `Yasuo, Unforgiven` and `Yasuo - Unforgiven` are the same card.
4. **Turny.gg deck list**: the `` list Turny.gg exported before it switched to Piltover Archive's list. It still imports, so older lists keep working, and any printing's set and number loads the card.
```text
Main Deck (10)
3 Charm OGN 43
3 Defy OGN 45
3 Wind Wall OGN 64
1 Yasuo - Windrider OGN 205
Runes (12)
6 Calm Rune OGN 42
6 Chaos Rune OGN 166
Legend (1)
1 Yasuo - Unforgiven OGN 259
Battlefields (3)
1 Monastery of Hirana OGN 282
1 Targon's Peak OGN 289
1 The Grand Plaza OGN 293
```
The four samples above are the same deck; the Turny.gg deck list leaves out the sideboard and the Chosen Champion because it has no place for them.
- **Share** links to the `RIFT1` code, sideboard, Chosen Champion and Neeko's Legends included.
- **Copy deck list** copies a Piltover Archive list, sideboard included, with the Chosen Champion under `Champion:` and one fewer copy of it under `MainDeck:`. The list has no place for Neeko's Legends, so it leaves them out.
- **Copy deck code** copies a Piltover Archive code, sideboard, Chosen Champion and Neeko's Legends included.
- The exports carry the champion you starred, or the only candidate when there is just one. A deck with several candidates and none chosen exports without a Chosen Champion.
- `RIFT1`, the Piltover Archive code and the Piltover Archive list all carry a sideboard, and on import it lands in the **Sideboard** pile. In a single-deck layout (**Pile View** off) there is no sideboard pile, so the builder leaves the sideboard out and tells you how many cards it skipped.
- A Piltover Archive code can name Neeko's Legends for a deck with no Neeko in it. The deck imports without them, and a notice names the Legends it skipped.
- Pasting into any pile's **Import a deck** box sorts the cards into the Legend, Rune Deck, Battlefields, Main Deck and Sideboard piles by type, so there is no need to paste into each pile.
## Piles and deck sets
A simple deck is one list of cards. Turn on **Multi Pile** to split the builder into several **piles**, and **Pile View** to lay them out side by side in columns. Riftbound opens in Pile View because a Riftbound deck has zones; Legends of Runeterra and Pokémon start as a single deck.
### Pile settings
Each pile's settings (the gear on the pile) hold:
- **Deck name**: an optional label for the pile.
- **Deck rule**: the rule that checks this pile on its own. See [Zone rules and the whole-deck rule](#zone-rules-and-the-whole-deck-rule).
- **Role**: at most one of these, or none for an ordinary pile.
- **Sideboard**: the pile is the side deck. Its cards are checked as the sideboard, stay out of the main deck count, and go in the deck code's sideboard where the format has one.
- **Maybeboard**: a scratch pile. Its cards stay visible but never count toward any rule and are never exported.
- **Command zone**: only for games with a commander.
- **Placement**: the pile's column and its order in it. Dragging the pile's handle does the same.
The pile's panel menu sets its **View options**: the summary strip, the curve and the footer.
### Single Deck or Multi deck
With several piles, the header asks what they are:
- **Single Deck**: the piles are zones of one deck, like Riftbound's Legend, Rune Deck, Battlefields and Main Deck. The rule next to the toggle checks the whole deck, and the piles save as one deck.
- **Multi deck**: every pile is a separate deck, like a lineup of three decks for a best-of-three event. The rule next to the toggle is a **deck set rule** that checks the lineup, and the piles save together as a **deck set**.
### Templates
A **template** is a saved builder layout: which piles exist, each pile's deck rule and role, where each pile sits, what each pile shows, which pile the builder opens on, and a card ruleset. A template never holds cards.
- **Turny templates** are built in. Riftbound's **Constructed** template opens on the Legend pile, since the Legend decides which domains the rest of the deck can use:
| Pile | Role | Checks |
| ------------ | ---------- | ------------------------ |
| Legend | Main | exactly one Legend |
| Rune Deck | Main | 12 runes |
| Battlefields | Main | the Battlefields |
| Main Deck | Main | the 40-card main deck |
| Sideboard | Sideboard | the side deck |
| Maybeboard | Maybeboard | nothing; it never counts |
Legends of Runeterra and Pokémon have no built-in template yet.
- **Switch template** swaps in another layout. It replaces every pile, cards included, so save first if you want to keep the deck. Picking a deck set rule that a template was built for offers to switch to that template.
- **Save as Template** saves your own layout. It is offered while every pile is empty, and needs a deck set rule chosen. Saving again with the same name updates that template, and **Also save the card ruleset** pins the current card ruleset to it.
- Manage your templates under **Settings → Templates** ([Legends of Runeterra](https://lor.turny.gg/settings/templates), [Pokémon TCG](https://pokemon.turny.gg/settings/templates), [Riftbound](https://riftbound.turny.gg/settings/templates)): rename them, make them public or private, copy a link, hide Turny templates you don't use, or delete your own. Public templates appear on your profile, and a template's link opens the builder with its piles and rules.
A template's card ruleset is either **Recommended** or **Pinned**. A Turny template recommends one (Riftbound's recommends Standard): the builder uses it until you pick a card ruleset for that game yourself, and after that leaves your choice alone. A template saved with **Also save the card ruleset** pins it, so that ruleset applies every time the template loads.
The active pile also steers the card search. A pile's rule can suggest filters for its zone: the Legend pile shows Legends, and once a Legend is in, the Main Deck pile shows cards in that Legend's domains. You can change or clear the filters at any time.
## Zone rules and the whole-deck rule
A multi-pile deck is checked at two levels:
- **Zone rules**, one per pile, each checking only its own pile. Riftbound's Legend pile checks for exactly one Legend, the Rune Deck pile for 12 runes, the Main Deck pile for 40 cards.
- **The whole-deck rule**, chosen next to the **Single Deck** toggle, which checks the merged deck as a unit. **Riftbound constructed** checks all the zones together, including that you run a champion matching your Legend, that your [Chosen Champion](#riftbound-chosen-champion) is picked when more than one qualifies, that [Neeko's Legends](#riftbound-neeko-legends) follow her rules, and that the sideboard holds at most 10 cards. In a **Multi deck** layout this is the deck set rule instead.
On top of both, the **card ruleset** decides which cards are legal at all, for example a format's legal sets and banned cards.
### Riftbound Chosen Champion
A Riftbound deck names one Champion unit that matches its Legend as its **Chosen Champion**. It starts the game in the Champion Zone but still counts as one of the 40 main-deck cards, so choosing it changes no counts.
- **The star**: in the Main Deck pile, each Champion unit matching your Legend shows a star. There are no stars before you pick a Legend, and none on sideboard or off-Legend champions.
- **One candidate**: its star fills on its own. A deck with 3 copies of the same champion needs nothing from you.
- **Several candidates**: each shows an outline star until you click one, which fills it. Click another to switch; you can't clear the choice.
- **Resets**: the choice resets when the chosen card leaves the main deck or the Legend changes, falling back to the lone candidate or to outline stars.
- **Saving and copying** are never blocked. A deck with several candidates and none chosen saves and copies, but shows a message such as "Pick your Chosen Champion: click the star on one of your Yasuo units.", and tournament registration refuses it until you pick one.
- **Other rule messages**: the Chosen Champion must be in your main deck, must be a Champion unit, and must match your Legend. These are checked only when the deck has exactly one Legend, and a deck with a single matching champion never fails them.
- **Elsewhere**: deck pages, galleries, highlights and tournament deck results show a filled star on the Chosen Champion, listed first after the Legend. The sample hand never draws it, and draw odds count 39 cards.
### Riftbound Neeko's Legends {#riftbound-neeko-legends}
Neeko, Blending In lets a deck choose up to 3 more Legends besides its starting Legend. They are not deck cards: they count toward no zone, and the deck's domains, Chosen Champion and Signature cards still follow the starting Legend only.
For example, a Yasuo, Unforgiven deck running Neeko can pick Jinx, Loose Cannon, Lee Sin, Blind Monk and Viktor, Herald of the Arcane. Viktor shares no domain with Yasuo, and that is fine: the rest of the deck still has to be Calm and Chaos.
- **Choosing**: a **Legends 0 / 3** block sits under Neeko's row in the Main Deck pile, or in the Sideboard pile when she is only there. Click **Edit** and the card pool shows only the Legends you can still pick; a card you click goes to her Legends instead of the deck. **Done** returns the pool to normal, and the **×** next to a pick removes it.
- **Limits**: at most 3, each a Legend with a different name, none named like your starting Legend. Extra copies of Neeko share the same 3. With 3 chosen, the block says so until you remove one.
- **Removing Neeko**: the Legends belong to her. Take out the last Neeko and they are no longer saved, shared or checked.
- **Saving and copying** are never blocked. A deck whose Legends break the rules saves and copies with a message, and tournament registration refuses it. The card ruleset checks them too, so a banned Legend, or one outside Standard, is flagged like any other card.
- **Elsewhere**: deck pages, galleries, highlights and tournament deck results list them under Neeko, and the card gallery shows them in their own **Legends** section after the deck's cards. They are part of the decklist, so they are shown and hidden with it.
### Reading validation messages
- **On a pile**: the pile's warning icon lists its zone rule's messages and any card-level issues in it.
- **For the whole deck**: the builder's warning list repeats every pile's messages, prefixed with the pile's name (`Main Deck: The main deck must contain exactly 40 cards.`), followed by the whole-deck or deck set rule's messages without a prefix.
- **On a card**: a warning marker on a card names the problem with that card. "This card is directly banned by the selected ruleset." means the card ruleset bans it.
- **When a rule can't run**: if a rule fails to load, or your browser can't start the sandbox that runs rules, the builder says so rather than showing the deck as legal, and saving is turned off until rules can run.
A message comes from the rule that raised it. The built-in rules explain themselves; for a custom rule, see [Custom rulesets](https://docs.turny.gg/guide/rulesets) and the [ruleset script reference](https://docs.turny.gg/reference/scripting/rulesets).
## Tips
- **Calculators**: the calculator button in the builder header opens stats for the current deck, such as draw odds. See [Calculators](https://docs.turny.gg/guide/calculators).
- **Search syntax**: the card search box takes a query language as well as card names, for example `t:unit cost<=3`. Each game has its own fields: [Legends of Runeterra](https://docs.turny.gg/reference/search/lor), [Pokémon TCG](https://docs.turny.gg/reference/search/pokemon), [Riftbound](https://docs.turny.gg/reference/search/riftbound).
- **Saving**: **Save** needs you to be signed in. Deck names are unique on your account, so saving with an existing name replaces that deck. Private decks stay out of public areas until you share them, and the save dialog lists the rule warnings the deck still has.
- **Reusing a saved deck**: in a multi-pile layout, **Use a saved deck** loads one of your saved decks into a pile. With **Sync** on, the pile stays linked to it: changes to the saved deck show up in the pile, and saving the deck set writes the pile back to the saved deck.
- **Sharing a layout**: to share how you build rather than what you built, make a template public and share its link.
---
url: https://docs.turny.gg/reference/
description: "Generated reference for Turny.gg scripting, card data and card search, kept in sync with the code that runs the site."
---
# Reference
Reference pages are generated from Turny.gg's source code, so they always match what the site runs.
## Scripting
- [Ruleset script API](https://docs.turny.gg/reference/scripting/rulesets): what a custom ruleset script receives and returns.
- [Script sandbox](https://docs.turny.gg/reference/scripting/sandbox): what scripts can and cannot do.
- [Calculator script API](https://docs.turny.gg/reference/scripting/calculators): `compute` and every widget it can return.
- [Playtest rules script API](https://docs.turny.gg/reference/scripting/playtest): the table a playtest rules script returns, with every step, predicate and shortcut rule.
## Card data
The fields a script can read on each game's cards:
- [Cyberpunk TCG](https://docs.turny.gg/reference/card-data/cyberpunk)
- [Flesh and Blood](https://docs.turny.gg/reference/card-data/fab)
- [Hearthstone](https://docs.turny.gg/reference/card-data/hs)
- [Legends of Runeterra](https://docs.turny.gg/reference/card-data/lor)
- [Magic: The Gathering](https://docs.turny.gg/reference/card-data/mtg)
- [Palworld TCG](https://docs.turny.gg/reference/card-data/palworld)
- [Pokémon TCG](https://docs.turny.gg/reference/card-data/pokemon)
- [Riftbound](https://docs.turny.gg/reference/card-data/riftbound)
## Card search
Search syntax for each game:
- [Cyberpunk TCG](https://docs.turny.gg/reference/search/cyberpunk)
- [Flesh and Blood](https://docs.turny.gg/reference/search/fab)
- [Hearthstone](https://docs.turny.gg/reference/search/hs)
- [Legends of Runeterra](https://docs.turny.gg/reference/search/lor)
- [Magic: The Gathering](https://docs.turny.gg/reference/search/mtg)
- [Palworld TCG](https://docs.turny.gg/reference/search/palworld)
- [Pokémon TCG](https://docs.turny.gg/reference/search/pokemon)
- [Riftbound](https://docs.turny.gg/reference/search/riftbound)
## Script kinds
What a saved script is for.
| Member | Value | Description |
| --- | --- | --- |
| `DeckValidation` | `"deck_validation"` | A custom ruleset's deck-settings script: validates decks and deck sets. |
| `StatDashboard` | `"stat_dashboard"` | A calculator's `compute` script: turns a deck into dashboard widgets. |
| `Playtest` | `"playtest"` | A playtest rules script: declares the playtest table (zones, actions, shortcuts) as a `PlaytestDefinition`. |
---
url: https://docs.turny.gg/reference/scripting/rulesets
description: "Reference for custom ruleset scripts: entry points, arguments, context and return values."
---
# Ruleset script API
A custom ruleset can carry up to three scripts, one per scope: a **card** rule, a **deck** rule and a **deck set** rule. Each is a small JavaScript module that Turny.gg runs in the [script sandbox](https://docs.turny.gg/reference/scripting/sandbox) while a deck is built and again when it is submitted. For a walkthrough, start with the [custom rulesets guide](https://docs.turny.gg/guide/rulesets). This page is the exact contract.
## Entry points
Each script provides one function. The runner looks for it in this order:
1. **The default export.** `export default function validateDeck(deck) { … }` or `export default (deck) => …`. The function's own name does not matter.
2. **The scope's named fallback.** With no default export, a top-level function (or `const`) with the name below, for example a plain `function validateDeck(deck) { … }`. Do not `export` it by name: the only named export allowed is `resolvePoolFilters`.
If neither exists, the script fails with "did not export a function". The default export wins when both are present.
| Scope | Named fallback | When it runs |
| --- | --- | --- |
| Card | `validateCard` | Called once per card, both to validate a submitted card and to filter the deck builder's card pool. |
| Deck | `validateDeck` | Called once per deck (or builder pile) with every card the deck references. |
| Deck set | `validateDeckset` | Called once with the whole lineup of decks a player submits. |
```ts
// Card is the game's card object; see the card data reference.
function validateCard(card: Card, context?: DeckSettingsScriptContext): DeckSettingsScriptResult;
function validateDeck(deck: DeckSettingsScriptDeck, cardsById: Record, context?: DeckSettingsScriptContext): DeckSettingsScriptResult;
function validateDeckset(decks: DeckSettingsScriptDeck[], cardsById: Record, context?: DeckSettingsScriptContext): DeckSettingsScriptResult;
function resolvePoolFilters(input: DeckSettingsPoolFiltersInput, context?: DeckSettingsScriptContext): DeckSettingsPoolFiltersPatch;
```
`context` is always the last argument and always optional, so a script written as `validateDeck(deck, cardsById)` keeps working.
### Card scope
Called once per card. In the deck builder the card rule also filters the card pool: a card that fails is hidden. A failing card on a submitted deck blocks the submission.
```js
// Only cards from two sets are legal.
const LEGAL_SETS = ["set1", "set2"];
export default function validateCard(card) {
return LEGAL_SETS.includes(card.setCode);
}
```
### Deck scope
Called once per deck (in the builder, once per pile) with the deck's card quantities and the catalog entries for every card it references.
```js
export default function validateDeck(deck, cardsById) {
const total = Object.values(deck).reduce((sum, copies) => sum + copies, 0);
if (total !== 40) {
return {
valid: false,
issues: [
{
code: "deck_size",
message: `Decks need exactly 40 cards (found ${total}).`,
},
],
};
}
return true;
}
```
### Deck set scope
Called once with every deck in the player's lineup.
```js
// No card may appear in more than one deck of the lineup.
export default function validateDeckset(decks, cardsById) {
const seen = new Set();
const issues = [];
for (const deck of decks) {
for (const ref of Object.keys(deck)) {
if (seen.has(ref)) {
const name = cardsById[ref]?.name ?? ref;
issues.push({
code: "duplicate_card",
message: `${name} is in more than one deck.`,
});
}
seen.add(ref);
}
}
return { valid: issues.length === 0, issues };
}
```
## Arguments
Every argument is a deep copy of plain data, frozen before your script sees it. Writing to it throws, so build new objects instead (`{ ...deck }`, `Object.entries(deck)`).
### `card` and `cardsById`
`card` is one catalog entry. `cardsById` maps each card ref in the deck (or lineup) to its catalog entry. Every card has `id`, `name` and `setCode`; the rest is per game:
- [Cyberpunk TCG card data](https://docs.turny.gg/reference/card-data/cyberpunk)
- [Flesh and Blood card data](https://docs.turny.gg/reference/card-data/fab)
- [Hearthstone card data](https://docs.turny.gg/reference/card-data/hs)
- [Legends of Runeterra card data](https://docs.turny.gg/reference/card-data/lor)
- [Palworld TCG card data](https://docs.turny.gg/reference/card-data/palworld)
- [Pokémon TCG card data](https://docs.turny.gg/reference/card-data/pokemon)
- [Riftbound card data](https://docs.turny.gg/reference/card-data/riftbound)
### `deck`
The `deck` a deck-scope script receives. Usually the flat quantity map; a
zone-aware payload nests zones under `main` / `sideboard`. A flat map may
also carry a nested `sideboard` record, so read zones defensively and never
treat the literal `main` / `sideboard` keys as card refs.
#### Zoned deck
Zone-aware deck payload (e.g. MTG submissions): card refs nested under
`main`, with an optional `sideboard`.
| Property | Type | Description |
| --- | --- | --- |
| `main` | `DeckSettingsScriptCardQuantities` | Main-deck card refs → copies. |
| `sideboard?` | `DeckSettingsScriptCardQuantities` | Sideboard card refs → copies, when the game has one. |
With each game's default template and built-in rulesets, which is how these decks are usually built:
- **Legends of Runeterra** and **Pokémon TCG** pass the flat map.
- **Riftbound** passes the flat map too, with the sideboard nested under `deck.sideboard` when the deck has one, and the [Chosen Champion](https://docs.turny.gg/guide/deck-builder#riftbound-chosen-champion)'s card ref as a string under `deck.chosenChampion` when one is set. Cards that another card chooses outside the deck, such as the up to 3 Legends for Neeko, Blending In, sit under `deck.cardSideboards`, keyed by the choosing card's ref and then by each chosen card's ref with its quantity (`{ "": { "