Browse documentation
Docs/Functionality

Authoring a Game laboratory

The Game laboratory combines a retained native match with a configurable presentation. Choose Game from the workspace New view or the sheet creation menu to open it. Process and chance…

Authoring a Game laboratory

The Game laboratory combines a retained native match with a configurable presentation. Choose Game from the workspace New view or the sheet creation menu to open it. Process and chance adapters use the native owner; local native owner and authenticated transport checks pass. See the implementation ledger for current delivery status and the version 1 contract for owner and replay guarantees.

Start with a game

Game includes chess, Prisoner's Dilemma, rock-paper-scissors, Kuhn poker, heads-up no-limit hold'em and custom Nim. Choose the parameters, competitors, seed and decision budget before starting a match. Starting retains the reviewed configuration. Step executes the current computer competitors; Run self-play continues on the native host until a human turn, terminal result, execution budget or explicit pause/stop. Opening a view starts no computation. While an explicitly running experiment is visible, the view inspects progress once per second. Hidden, paused and replay views install no progress timer. A transport failure stops inspection until you choose Refresh; the host can continue while the view is disconnected. Bound game, renderer and analysis formulas use existing ready snapshots. Choose Resolve model bindings explicitly when you want to evaluate missing or updated outputs; this can execute the configured solver formulas.

Complete source starters are provided for chess, Prisoner’s Dilemma, rock-paper-scissors, Kuhn poker, hold’em and Nim with its renderer.

Seeds make native deals and policy sampling reproducible. They are researcher configuration and are not supplied to authored opponent formulas. Chess and hold'em strategies receive only their permitted position observation. A matrix round keeps each pending submission private until both competitors submit.

Search and built-in heuristic policies explain their method. Solver policies are available for supported matrix games and Kuhn: admission must produce a certificate within the configured limits. A search score, a simulated win rate and a certified equilibrium are different evidence. Increasing a budget is a new admission decision, never a reason to label an unfinished solve certified.

Configuration

GameSurfaceSpec has kind = "game", version = 1, optional title, seed and max_decisions. It selects a definition or a game.symbol binding. Two seat strategies may be configured, with at most one human. analysis names up to 16 labeled model results, and renderer.symbol names trusted JSX source. The binding and lazy catalog adapters use the shared surface registry. Game embedded in another surface is inspection-only; open its standalone surface to start or advance a match.

This definition is the same finite payoff table accepted by native admission:

kind = "game"
version = 1
title = "Repeated cooperation"
seed = 42
max_decisions = 200

[definition]
kind = "matrix"
rounds = 10
strategies = [["Cooperate", "Defect"], ["Cooperate", "Defect"]]
payoffs = [[[3, 3], [0, 5]], [[5, 0], [1, 1]]]

[[strategies]]
kind = "human"

[[strategies]]
kind = "heuristic"

The existing declarative game syntax and GAME.* typed analytical values keep their existing meaning. A playable definition adds turn/observation/action semantics; it does not change formula evaluation.

Custom Grid rules

The Nim source demonstrates the rules contract. The example accepts parameters.stones, bounded to 1–1,000, and allows taking one to three stones. Taking the last stone wins.

The grid definition names five input bindings: stateInput, seatInput, actionsInput, seedInput and parametersInput. It names five outputs:

Output Meaning
initial Initial private state from the admitted parameters and seed
status Actors, simultaneous flag, terminal flag, two rewards and reason
observation State disclosed to the selected seat
actions Stable IDs, labels and optional integer minimum/maximum amounts
transition Successor state from accepted {seat, action} submissions
Optional chance Bounded {action, weight} outcomes for a chance phase

A chance status sets chance = TRUE, actors = [], simultaneous = FALSE, and terminal = FALSE. Supply 1–256 distinct legal chance actions with positive finite weights. The owner passes its sampled action to transition as [{seat: BLANK, action: ...}], retains it, and never exposes the distribution to opponent strategies. Only the researcher sees private chance outcomes in history.

The researcher may inspect complete state; each opponent receives only the observation returned for its seat. Authored observation rules are responsible for hiding their game's private information. The host additionally keeps pending opposing submissions, random seed and other strategy memories out of the strategy inputs.

Admission compiles only the named pure dependency closure through the existing native formula compiler and evaluator. Live model inputs outside the admitted set, stateful assignments, effects, recursion and excessive expression expansion are refused. Current limits include 1 MiB source/compiled formula, 64 dependencies, 512 expanded expression nodes, 16 KiB evaluation inputs and 128 KiB output. Large custom states must be redesigned or explicitly supported by a future admitted capability; React is not an execution fallback.

A Grid strategy names four inputs—observation, legal actions, private memory and limits—and one output. Return {action, memory, explanation}. The owner validates the proposed action, captures the observation and retains the result. Invalid output stops the match with its reason; it never silently substitutes another move.

Process opponents

The Process starter asks a configured opponent profile for a structured proposal. Choose Process opponent, inspect the model's plans, select policy, and select a saved AI connection for each profile. No API key is part of Game configuration. Inspection makes no provider call. Start freezes the plan and connection identity; Step or Run executes a decision with the explicitly configured call and time budgets.

The plan accepts exactly four positional arguments: observation, legal actions, private memory, and limits. Return an object with action, optional memory, and optional explanation. Native admission refuses ambient live reads and external effects; Game currently supports tool-free profile responders. The Process owner supplies the arguments as retained recipes reading an isolated published snapshot. Browser-overridden Process Start arguments remain forbidden.

Calls are reserved before dispatch. A lost reply does not permit a second call; reconcile the original match operation. An unresolved original Process pauses the match. After restart, a suspended Process may need explicit reconciliation in Process before Game continuation. Replaying accepted decisions never calls a provider. Analysis exposes the original Process reference, terminal evidence, known call counts and unknown monetary costs. For comparisons, the setup shows the maximum aggregate call reservation across all fixtures.

Trusted React renderer

The Nim renderer calls useGame() to read the projected view, busy state, legal actions and checkpoint. It calls act(seat, action) to propose a move, selectPanel("analysis") to open decision evidence, and selectCheckpoint(index) to inspect a recorded position. It has no rule reducer or authority to commit state.

The existing custom-UI trust policy controls execution. In-process JSX is trusted author code, not a sandbox; a scoped API reduces accidental coupling but does not isolate trusted JavaScript from the browser. Public embeds continue to refuse in-process JSX. Choose the native presentation when that trust is unavailable.

Compare and replay

Comparisons accept 2–16 computer competitors and an even number of matches per pair, defaulting to 100. The selected batch is bounded to 1,000 retained matches and executes sequentially. Every adjacent pair uses the same seed with swapped competitor seats. Hold'em uses independent hands with reset stacks.

The results distinguish complete outcomes, failures and incomplete experiments. Paired payoff standard error needs at least two complete pairs; unfinished pairs remain visible but do not enter that uncertainty estimate. It is an empirical estimate, not a proof that one policy is optimal. Decision time is measured; provider cost remains unknown when it has not been measured.

Replay consumes retained actions and frozen rules, with no opponent/provider calls. Choose a player's perspective for private observations or researcher perspective for full state. Branch creates a new match identity at the selected checkpoint and preserves the original. An uncertain save must reconcile its original attempt before another mutation. After a host restart, interrupted runs appear paused and require explicit continuation.