Game flags

Flags tell the front and back ends which optional features a game may use: pie-rule UI, stash panels, inCheck() display, exploration restrictions, and so on. The authoritative enum is in gameinfo.json; prose below explains how to read and override flags.

How to read flags

There are three sources. Pick the one that matches your context:

Source When to use
gameinfo.flags Browse/catalog UI, experimental registry filtering, or before you know variants and player count
resolveGameFlags(uid, context) Challenge setup — variants and player count are chosen but no engine instance exists yet
game.getFlags() Active game session — resumed or in-progress state is loaded

Consumer rule: for UI and optional-feature gating, prefer game.getFlags() (in-game) or resolveGameFlags(uid, context) (challenge setup) over raw gameinfo.flags. Static metadata alone is wrong whenever a game overrides resolveFlags() (for example Basalt pie-even only with the pie variant).

Authoring rule: override static resolveFlags(context) on the game class. Do not add one-off shouldOfferX() methods.

Overriding flags

The categories below describe typical usage, not hard rules. Any flag may be added or removed in resolveFlags() / getFlags() unless noted for structural flags.

simultaneous (session routing): Front and back ends route partial-move / comma-submit behaviour when the effective simultaneous flag is present in getFlags() or resolveGameFlags(). Use sessionIsSimultaneous(engine, uid, context) in integrators. Do not use turnModel() for that routing — turn model describes move-table / record replay shape and may differ (for example Thricewise: flag on, turnModel() === "sequenced"). Session mode is fixed at game start from challenge variants; it does not change mid-game.

Default path: list simultaneous on gameinfo.flags when the default config uses simultaneous play; default resolveFlags() copies static flags, so getFlags() includes it with no override.

Variant path: override resolveFlags() to add or remove simultaneous per variant (like pie-even). Integrators must use resolvers, not static gameinfo.flags.

Structural caveat: experimental affects registry inclusion and build filtering. Compile-time base class choice (GameBaseSimultaneous vs GameBase) is fixed at authoring time; dual-mode games may still toggle the session flag via resolveFlags() while implementing both wire formats in one class.

Deferred requests (no overrides yet): random-start, no-moves, and perspective have been requested as variant- or context-dependent. Use resolveFlags() when implementing them — not ad-hoc helper methods.

Example (Basalt)

public static resolveFlags(context: FlagContext = {}): readonly GameFlag[] {
    const flags: GameFlag[] = [...(this.gameinfo.flags ?? [])];
    if (context.variants?.includes("pie")) {
        flags.push("pie-even");
    }
    return flags;
}

Flag classification

1. Structural / registry (typically static gameinfo.flags)

Flag Meaning
experimental Omitted from production registry and gameinfo export
simultaneous Session uses simultaneous submit protocol when present in getFlags() / resolveGameFlags; often paired with GameBaseSimultaneous; may be variant-overridden

Variants marked experimental: true in gameinfo.variants are omitted from production gameinfo exports and from challengeVariants(), but remain in allvariants() for historical games. Incompatible variant combinations are declared separately — see Variants.

2. Capability (typically static; optional game methods)

Flag Method
check inCheck(): number[]
custom-buttons getButtons()
custom-colours getPlayerColour(n)
custom-rotation getCustomRotation()
player-stashes getPlayerStash(n)
shared-stash getSharedStash()

Consumer pattern: game.getFlags().includes("check") then call the method.

3. Automation (typically static)

Flag Meaning
automove Auto-execute when only one legal move
autopass Auto-execute pass when it is the only move
no-moves Cannot enumerate all legal moves
no-explore Disable exploration mode
custom-randomization randomMove() despite no-moves

4. Presentation (typically static)

Flag Meaning
perspective Per-player board rotation
shared-pieces No player-owned piece colours
scores Final scores in EOG emails
rotate90 90° rotation increments
stacking-expanding Hover expands a cell stack in a side area via renderColumn(col, row, panelId?); pass click row/col into render() when needed
random-start getStartingPosition() for game record

5. Conditional (first resolveFlags overrides: pie / pie-even)

Flag Meaning
pie Seat swap only — second player may accept pie to swap seats
pie-even Seat swap and insert a pass (komi-style opening)

These are the first flags migrated off shouldOfferPie(). Other flags may use the same override mechanism.

pie vs pie-even

These are distinct flags with different front-end behaviour — not gradations of the same feature.

Flag Behaviour
pie Seat swap only
pie-even Seat swap and insert a pass

getFlags() vs turn-phase methods

Question API
Does this session support pie / pie-even at all? game.getFlags().includes("pie") or "pie-even"
Are we on the pie decision turn right now? game.isPieTurn() (per-game; not on GameBase)
Are we on the komi placement turn? game.isKomiTurn() (pie-even games only)

Front enables pie UI when the resolved flag is present and uses isPieTurn() / getButtons() for the actual turn.

Quick reference (all flags)

Flag Meaning
automove Often only one legal move — auto-execute when detected
autopass Like automove but only for pass
check Implement inCheck() => number[]
custom-buttons Implement getButtons()
custom-colours Implement getPlayerColour(n) — not with shared-pieces
custom-randomization randomMove() despite no-moves
custom-rotation getCustomRotation() for board angle
experimental Omitted from production builds and gameinfo
no-explore Disable exploration mode
no-moves Cannot list all legal moves
perspective Per-player board rotation
pie Pie rule: seat swap only
pie-even Pie rule: seat swap and pass (komi-style)
player-stashes getPlayerStash(n)
random-start getStartingPosition() for game record
rotate90 90° rotation increments
scores Final scores in EOG emails
shared-pieces No player-owned colours
shared-stash getSharedStash()
simultaneous Turn-based simultaneous rounds — use GameBaseSimultaneous
stacking-expanding Hover expands a cell stack in a side area via renderColumn(col, row, panelId?); pass click row/col into render() when needed

Flag enum (from gameinfo.json)

Flag
automove
autopass
check
custom-buttons
custom-colours
custom-randomization
experimental
no-explore
no-moves
perspective
pie-even
pie
player-stashes
random-start
rotate90
scores
shared-pieces
shared-stash
simultaneous
stacking-expanding
custom-rotation