Docs: Overview

Tabletwin documentation

A Tabletwin model describes the rules of a board or card game in one YAML file: the rules as data. You write the model; the site does the rest, in your browser:

ToolWhat it does with your model
ValidatorPaste a model (and optionally a view): errors, warnings, how much of it the engine can run, what is still missing, the flow as a tree, and 20 random test games. Then "Open in the player"
PlayerPlays a game question by question: watch the computer play it, or play seats yourself. Your model from the validator appears as an extra game, next to the built-in ones
DiagramDraws the rules as a text tree and as a track diagram; "Draw your own model" draws a pasted model

Nothing is uploaded: the validator keeps your text in your own browser only. Simulating thousands of games to measure balance and compare strategies is not yet available on the site.

Pages

ReadFor
GuideFrom rulebook to model: a complete tutorial, the workflow, decision rules, patterns, pitfalls and checks. Start here.
Quick referenceEverything needed to write a model on one page: keys, flow, ops, end conditions, names in scope, checking, complete patterns
Authoring with an AI agentThe workflow and prompt for letting an AI agent write a model from a rulebook
ReferenceEvery key of a model file: state, actions, ops, flow, windows, triggers, content, end conditions
ExpressionsThe expression language of the _x fields: syntax, built-in functions, names in scope
Board geometrySquare and hex boards, the geometry functions and own functions
TacticsPlayers as a separate layer: rules per decision place, look-ahead
ViewsHow the table looks in the player: view files
How the engine runs a modelRequests, chance, who sees what, windows, end conditions, executability, the validator's messages, limits
DiagramHow the diagram is drawn from a model, and the step markers
schema.json, tactic.schema.jsonJSON Schemas for models and tactics: completion and checking in your editor

To get completion and checking in VS Code (YAML extension by Red Hat), put this on the first line of a model file:

# yaml-language-server: $schema=https://tabletwin.com/models/docs/schema.json

and # yaml-language-server: $schema=https://tabletwin.com/models/docs/tactic.schema.json on the first line of a tactic file.

Examples

Small, fully executable examples, each for a group of patterns. Each model is also a built-in game in the player and can be loaded in the validator with "Start from".

FilePatterns
pig.yamlTurn loop, repeat until something happens, push your luck, a die, a winner. The rulebook as comments
pig-tactic.yamlA tactic: rules per decision place (for pig.yaml)
higher-lower.yamlShuffled deck, a hand per player, hidden information, secret choice, reveal, score
ambush.yamlPriority window, fast actions with costs, the stack, cancelling
neighbours.yamlA grid of cells, choosing a free cell, patterns as a table, whoever just moved wins
auction.yamlA round that stops halfway, an own turn variable, returns larger than 1
expedition.yamlCampaign: scenarios, lasting state, reset, end conditions with a scope
hex-skirmish.yamlHex map with gaps, obstacles and difficult terrain; initiative; choosing, resting and losing cards; monsters with focus, movement and line of sight; area attacks with rotation; modifier decks

More small models, each focused on one feature (all but modifiers.yaml are built-in games in the player):

FilePatterns
stack-game.yamlCards as instances with their own state, looking at a deck, putting cards on the bottom, shuffling, searching
triggers.yamlTrigger timing, optional triggers, triggers on content
modifiers.yamlModifiers in layers, temporary modifiers, modifiers on content
spell-duel.yamlPriority windows with lifo_stack, costs paid on play, counterspells
subset.yamlChoosing a subset
coop-clock.yamlA cooperative game
campaign.yamlA small campaign

Games:

FileShows
tictactoe.yamlThe smallest complete game on a grid
kuhn-poker.yamlHidden cards and betting
chess.yamlA square board, move generation in own functions (ray, leap, neighbours), castling, en passant, promotion, mate, stalemate and draw rules
eightball.yamlAn outcome model for skill, a heuristic agent (agents with policy_x; "heuristic threshold" in the player)

The commercial games on the site (The Lord of the Rings LCG, Gloomhaven, Arkham Horror LCG, Aeon's End, Too Many Bones, Codenames) are shown in the diagram as their rules structure only; their model files are not published. The Lord of the Rings LCG is the largest executable model: cards as instances, card texts as triggers, modifiers and abilities, rule procedures as triggers, end_event for "until the end of the phase", windows, and loops over players and enemies (once).

Published tactics: chess-material.yaml and hex-skirmish-basic.yaml. Published views: chess.yaml, hex-skirmish.yaml and tictactoe.yaml. The commented metamodel lists every layer of a model in one file. All games and examples are listed on the games page.

This page as Markdown