Commit graph

44 commits

Author SHA1 Message Date
ac3863d582 Build inspector with fill-in editors, value picker and Plain/Text switch
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-08 21:24:25 -06:00
6f583ea4f5 Plain Build engine: Describe, Builder, checks, inputs, collections, why trace
Implements docs/PLAIN.md sections 1-5 (the engine half of the usability pass):

- core/describe.gd (Describe): rules in plain words, labelled from variable
  cards, collections and card inputs, falling back to the original text.
- core/builder.gd (Builder): effect and condition models that round-trip
  with the rule text, a rule tokenizer, and known_values(board).
- Collections: variable cards with var_type "collection" label their
  members and don't declare their stem.
- Check cards (kind "check"): dice + modifier vs target, Success/Failure,
  chain values nat/total/effect, node "check" info, lint and static checks.
- Card inputs and pipe "with" values, scoped over the pipe's subtree on the
  explicit work stack (OP_RESTORE frames), with defaults and snapshot
  evaluation.
- nat on every roll-table roll; dice faces recorded through ctx.faces.
- Why trace: facts on nodes and steps (input, roll, check, case, show_if,
  options_where, effect, when, otherwise).
- StateStore rules_view setting; JSON for the new keys; LOGIC.md and
  PLAIN.md updated (deviations in PLAIN.md 5a).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-08 21:01:24 -06:00
8ca50acd4b Add the Plain Build spec (usability pass)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-08 20:31:58 -06:00
6557998eee Fit the Build bar: icon-only Undo/Redo, Test board in Board ▾, hint in tooltip
With undo, redo, Test board and Arrange added, the Build-mode top bar
overflowed at 1440 px and pushed the zoom and Map buttons off screen.
Undo and Redo are now icon buttons whose tooltips name the step, Test
board is reached from Board ▾, and Build mode's hint moves to the hint
label's tooltip.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-08 19:05:24 -06:00
6ada00ad99 Run the endless-loop check after edits pause, not on every change
Roller.endless_cycles walks the whole board (about 30 ms on an 800-card
board) and ran on every keystroke in Build mode. It now runs 0.4 s after
edits stop, so a change costs about 0.4 ms instead of 34 ms.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-08 19:03:39 -06:00
292d45e179 Merge branch 'worktree-agent-a694f3c612ebce597' into undo-options 2026-11-08 19:01:35 -06:00
ff7c2023c2 Undo and redo for every Build edit
EditHistory (ui/edit_history.gd) keeps an undo and a redo stack of
whole-board snapshots per collection. Each table and group is its own
JSON string, shared with the previous snapshot when unchanged, so a step
costs about the size of the cards it changed. Collapsed flags are kept
apart: collapsing isn't a step and undo leaves it as it is. Labels come
from diffing the snapshots ("Delete table Loot", "Add pipe Loot → Gems",
"Move 3 cards", "Group Careers"), or from the caller.

Main.mark_dirty records steps: typing commits when it pauses (0.8 s) and
merges until focus moves, other edits commit at the end of the frame (a
drag is one step), and quick edits to the same card or pipe merge.
Actions in main.gd bracket their changes with _begin_edit/_end_edit.
Undo patches only the changed tables and groups in place and rebuilds
their cards, keeping view, mode, search and lit results, then flashes
what changed. Ctrl+Z, Ctrl+Shift+Z / Ctrl+Y outside text fields (Play
too), Undo/Redo buttons with step tooltips in the Build bar, and the
toast's Undo now goes through the history.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-08 19:00:47 -06:00
86d1b214c3 Dynamic pick options, show_if and indirect @[expr] names
Pick choice cards can take their options from variables (options_from:
@prefix_* or a @list, filtered by options_where with option, option_label
and option_value bound). A Chosen entry runs for whichever dynamic option
is picked; fixed entries stay as extras, listed first. Random weighs each
dynamic option as the Chosen entry and fixed ones by weight. Any pick
option can have show_if, which hides it from the pop-up and from Random;
with nothing offered the node stops with "No options available".

@[expr] reads or writes the variable named by expr in expressions,
effects (including reset) and text ({@[expr]}); bad computed names are
effect errors. JSON round trip, lint_options in lint_pipes, choice
pop-up value badges and previews, card and settings UI, docs, demo board
(Spend a find) and tests/test_options.gd.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-08 18:55:38 -06:00
0367d36647 Merge branch 'worktree-agent-a07ea998a8853dd17' into boards-v2
# Conflicts:
#	ui/main.gd
#	ui/pipe_layer.gd
2026-11-08 18:19:11 -06:00
7dca1f2c3b Big-board navigation: search, focus_table, minimap, pack, lazy cards
- Search (top bar button and Ctrl+F): a card-styled pop-over with live
  results from names, result text, details, prompts, variables and group
  names (BBCode stripped, case and accents ignored, exact names first).
  Up/Down, Enter or click jump to a result, Esc closes.
- Main.focus_table(table_id, entry_id): opens a collapsed group (toast),
  expands the card for an entry, glides to it at a readable zoom, scrolls
  the long list and flashes rings around the card and the row.
- Minimap (Map toggle beside Fit, M key): tinted blocks, lit cards in
  brass, the view rect; click or drag to pan. Off by default in Play, on in
  Build, remembered per mode. Redraws only on change.
- Zoom goes down to 0.08 and Fit uses it; far out, cards draw as plain
  cards and group names show large.
- Build > Arrange > Pack collapsed groups closes the gaps collapsed blocks
  leave, in reading order, with undo. Expanding a group whose frame would
  cover its neighbours pushes them right/down to clear it, with undo.
- Performance: cards in collapsed groups aren't built until expanded; the
  pipe, port and card layers redraw only when the board's geometry
  changes; unlit pipes go in per-pipe canvas items so off-screen ones are
  culled; off-screen cards aren't rendered. 792-card board: open 5.0 s ->
  0.38 s, idle frame 36 ms -> 0.7 ms (all groups expanded: 313 ms -> 9 ms).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-08 18:16:32 -06:00
51bfb93fd0 Router captions and hover summary, Test board run count, README branching
The tray captions router steps with the case taken, router hover
summaries no longer read "d2 · 2 results", the Test board runs selector
starts on the last report's run count, and the README covers
conditional pipes and router cards.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-08 17:55:22 -06:00
4bacb8100a Merge branch 'worktree-agent-a7e728aefe5051670' into boards-v2 2026-11-08 17:53:44 -06:00
dbbb9750eb Conditional pipes and router cards
Pipes can carry "when" (Only if) and "otherwise". When an entry is
chosen, its effects run, its text expands, then every pipe condition and
count is evaluated once as a snapshot before any pipe runs; when pipes
run if true, otherwise pipes if no when pipe was true, plain pipes
always. Condition errors count as false and show as error lines.

New router card (kind "router"): its entries are cases with an
entry-level "when"; the first true case is chosen (empty = Otherwise),
and "No case matched" stops the node. One action. JSON round trip for
entry/pipe when and pipe otherwise, including JsonIO.canonical and
edge labels. Roller.lint_pipes() and Roller.lint_router() for board
checks. A pick choice's save_as is now stored before the snapshot.

UI: Only if / Otherwise in the pipe popover with live validation, pipe
labels ("if @str >= 8", "otherwise") and a source-end diamond on
conditional pipes, router card with fork icon, per-case condition rows,
case editing / reordering in Build, router settings, "+ Table" entry,
router cases in table previews. Logic demo now routes through a router.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-08 17:53:00 -06:00
be75723aef Test board: BoardTester class, Build-mode dialog, README section
Moves the simulator into core/board_tester.gd (static checks, sliced runs on
fresh variables and decks), keeps tools/simulate_board.gd as a thin wrapper,
adds the Test board dialog with a Build tools button and Board menu item.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-08 17:49:35 -06:00
14a0b6e6a4 Keep long sheets from widening the tray; show sheets filled in in previews
The tray's sheet headline now wraps at a fixed width and scrolls past
220 px, so a long character sheet can't stretch the window (which also
threw off Fit on big boards). Option previews in the choice pop-up show
a sheet card rendered with current values instead of its raw template
and a meaningless 100%.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-08 17:11:19 -06:00
d29c09a679 Merge branch 'worktree-agent-a9067d487b0c63a09' into groups-templates 2026-11-08 17:08:59 -06:00
9cd1f1ea95 Groups and templates: docs, export filter and screenshot flags
Ship templates/*.json in exports, document groups and templates in the
README and design doc, and add --group-menu, --drag-demo, --insert-form,
--save-group-template and --clear-result for screenshots.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-08 17:08:22 -06:00
9fdf65c00b Group cards and templates
Groups: an optional groups list on a collection (frame rect, collapsed,
members, details), saved by TowerBoard and kept by JsonIO. Expanded groups
draw a frame behind their cards with a title bar; collapsed ones become one
compact card that lists the members' lit results, with pipes re-routed to
its inlet and right edge. Build mode adds multi-select (Ctrl/Shift-click,
Ctrl-drag), Group (Ctrl+G), drop in/out of frames, rename, ungroup, delete
with undo and a details editor.

Templates: TemplateKit saves cards, groups or selections with relative
positions, internal pipes and outside pipes by name, detects {$name}
parameters and inserts with fresh ids. TemplateLibrary keeps user templates
in user://templates and lists the built-in ones in templates/.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-08 17:01:34 -06:00
6e69b64385 Choice pop-up: minimize pill, option preview panel, reusable TablePreview
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-08 16:39:56 -06:00
2ddf8c7c42 Add if(condition, then, else) and refuse the broken inline ternary
Godot's Expression parses "a if c else b" but returns the wrong branch,
so boards silently computed nonsense. Expressions now offer a
spreadsheet-style if() and reject the inline form with a hint.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-08 14:20:05 -06:00
8feaf2f217 Merge branch 'worktree-agent-acd18b8074059cf4a' into logic-cards 2026-11-08 14:17:55 -06:00
82d46b927d Add a headless board simulator tool and its test
tools/simulate_board.gd rolls a collection N times with a random (or
regex-preferred) player answering every choice card, each run on fresh
board variables, and reports completions, halt reasons, action stats,
effect/expression errors with table and entry, dead ends, unset or
failed markers in text and prompts, unreached tables, never-chosen
entries, tracked variable ranges, the longest run's busiest tables and
a sample final sheet. tests/test_simulate.gd runs it on an inline board.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-08 14:15:21 -06:00
38e66501b3 Logic cards UI: choice pop-up, card kinds, Build creation and settings, tray
- ChoiceDialog: card-styled pop-up for pick (option rows with details, Random,
  1-9 / R keys), number (spin box with min/max/default, Enter) and text.
  Cancel, Esc, freeing the dialog, a new roll or a collection switch all
  answer null through a separate Reply object, so a roll never hangs.
- Main: real prompt hook; the steps so far light on the board and in the
  tray before each question; a roll with questions shows the rest at once;
  a new roll cancels an open question cleanly; refresh_live() re-renders
  variable, sheet and question text only after rolls and edits.
- TableCard: "?" badge and question for choice cards, loop icon, rule chip
  and Each time / Afterwards rows, compact live variable cards (reset in
  Build), live sheet cards with one outlet, expression-dice subtitles,
  effect chips in Play and a validated effects editor in Build.
- Build: "+ Table" menu for every kind; kind-specific settings (choice type,
  question, save as, min/max; loop mode and rule; variable name, type,
  starting value; sheet template) checked with Expr.check; expression pipe
  counts in the pipe popover and on pipe labels.
- Tray: effect lines under chips, last 12 steps behind "+N earlier steps",
  sheet headline, Cancelled / action-limit pill, capped indents and Earlier
  rows; Variables tab lists every board variable with Reset all.
- RichText: error markers in red; previews show {@x_*} and {= expr}.
- examples/logic_demo.json and tests/test_logic_ui.gd.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-08 14:07:57 -06:00
85b8a99ef5 Logic cards engine: expressions, effects, choice/loop/variable/sheet cards, coroutine roller
- Expr: @vars, chain vars, dice tokens, dm/has/count, lone = as ==, errors as values, parse cache
- Effects: = += -= *= /= and reset (with prefix), number vs list semantics, logs, validation
- RollTable kinds and per-kind fields with factories; expression dice with end clamping
- TableEntry effects and expression pipe counts; JSON round trip through JsonIO
- TextExpander: {@prefix_*}, {= expr}, number display, expand_async and live render()
- Roller: coroutine with an explicit work stack, prompts for choice cards, loops,
  10,000-action limit, partial tree on ctx.root, iterative flatten/collect_lit
- Variables keep numbers as numbers through StateStore
- Main: awaits the roll with a default (headless) prompt hook, iterative playback,
  long chains show at once

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-08 13:38:42 -06:00
49b9a0c10e Add logic cards spec: choice, loop, variable and sheet cards
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-08 13:11:24 -06:00
2a79640c9d Add fast roll: Shift-click a die to skip the animation
Holding Shift while clicking a table's die (or "Roll again") skips the
flicker and the beads and shows the whole result at once: every result
and pipe on the path lit, long lists scrolled to their result, and the
full chain in the tray without the chip fade-in. A fast roll started
mid-animation takes over cleanly. The Play hint and roll tooltips
mention Shift-click, and --fast pairs with --roll for screenshots.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-08 12:53:39 -06:00
667ee1d9f0 Merge play-side UI; connect it to the collection switcher
Combines the play-side integration (refs and variables through the
roller, BBCode rendering, hover details, card decks, variables panel,
copy, reference pipes, pipe options, Build card editors) with the app
shell. Switching collections now loads that collection's decks,
variables and history and relights its last roll. Adds a Quest Hooks
and Towns table to the sample so references and variables show by
default, and updates the README.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-08 12:45:34 -06:00
87e578b85a Play-side UI: BBCode rendering, hover details, card decks, variables, copy, ref pipes
- Cards, result chips and the Earlier list render BBCode with RichTextLabel;
  Play rows show [[refs]] as teal chips and {vars} in brass, lit rows show the
  rolled text; missing/unset/too-deep markers are red.
- Hover pop-up (DetailsPopup) for table headers, entries with details, result
  chips and [url] metas in rendered text; items with details get a small ⓘ.
- Card-mode tables show cards left and Reshuffle; chips note reshuffles.
- Local state: decks, persistent variables and history per collection via
  StateStore (memory only when saving is off); delete_table forgets its state.
- Result tray: Copy menu (text / BBCode / with details) and a Variables tab
  (edit, re-roll, clear; last roll's chain variables read-only).
- Reference pipes drawn dashed from TextExpander.references; lit when used.
- Build mode: weight field, per-entry and table details editors, a gear
  button for table settings, pipe popover (count, save as, remove), range
  clamps use min_value(); Build cards are 300px wide.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-08 12:43:01 -06:00
38e3819898 Roller: expand refs and variables through RollContext, save pipe results
Entry text is expanded by TextExpander with a shared RollContext; inline
reference rolls become children marked inline, pipes with save_as save the
child's export BBCode. MAX_DEPTH is 32. Steps carry BBCode text, depth and
inline/reshuffle flags. Adds tests/test_integration.gd.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-08 12:26:33 -06:00
2e353224ab Add app-shell UI: table settings, collection switcher, import/export, endless-loop chip
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-08 12:23:21 -06:00
f3a6964044 Merge branch 'worktree-agent-a605529cce27c4de2' into pipe-board 2026-11-08 12:15:32 -06:00
cd4e13c85a Add import/export converters: JSON, JSON Canvas, Mermaid, DOT, GraphML
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-08 12:14:56 -06:00
51f2cc9e6d Merge branch 'worktree-agent-a0e26080a92828227' into pipe-board 2026-11-08 12:14:05 -06:00
29ab755a3e Add RollContext, TextExpander and Formatter for inline references and BBCode
RollContext holds chain and persistent variables, depth and the
resolve/roll hooks for one top-level roll. TextExpander expands [[Table]],
[[Table -> var]], [[3x T]], [[1d4 T]], {var}, {@var} and {@var|Table} left to
right, wrapping inserted pieces in internal [url=table:/var:/missing:/unset:/deep:]
meta tags for hover pop-ups. Formatter closes open tags, strips tags for plain
text, exports BBCode without internal markers and filters imported tags.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-08 12:13:25 -06:00
6a873810b0 Merge branch 'worktree-agent-a2900db2ff6409443' into pipe-board 2026-11-08 12:12:16 -06:00
438529d7a4 Merge Linux export preset 2026-11-08 12:12:03 -06:00
70dc23360f Merge branch 'worktree-agent-afc79ec9adbb5d317' into pipe-board 2026-11-08 12:12:03 -06:00
8ea83947ff Add a test-window wrapper that keeps test runs in the background
tools/test_window.sh runs the game under the window class "TableTower
Test" (via a temporary override.cfg) so a KWin window rule can keep
automated screenshot runs unfocused and behind other windows, without
affecting normal playtests from the editor. Also ignore override.cfg
and agent worktrees.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-08 12:11:55 -06:00
388759f5b6 Add weights, dice expressions, pipe options, card mode and cycle check to the model
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-08 12:11:43 -06:00
6f29e9373d Add collection storage: LibraryStore, StateStore, format version 2
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-08 12:11:26 -06:00
01717a66f9 Add Linux export preset (M7)
Adds a Linux/x86_64 release preset exporting to build/linux/TableTower.x86_64
with embedded PCK, all resources included, and tests/* excluded.

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
2026-11-08 12:08:26 -06:00
60c2d03147 Build the pipe-board app in Godot
Tables are cards on a felt board, joined by copper pipes that carry a
roll from one table to the next. Play mode rolls with a flicker and a
bead down each pipe; Build mode edits names, results, ranges and pipes.

- core/: data model (RollTable, TableEntry, TowerBoard), sample board
  with a d100 table of 100 trinkets and a weighted d100 range table,
  and a Roller with a depth limit
- ui/: board with pan and zoom, pipe and port layers, collapsible table
  cards, result tray with earlier rolls, undo toasts, and a Collapse all
  / Expand all button
- assets/fonts/: Rokkitt and Atkinson Hyperlegible (SIL OFL)
- tests/test_roller.gd: headless checks for the model and roller

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-08 12:05:41 -06:00
cf1d8a6f1e Add design document
Covers roll tables, chained triggers and inline references, Card mode,
chain and persistent variables, hover details, BBCode formatting,
graph layout, import/export formats, and milestones.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-08 11:13:57 -06:00
eab10500bc Initial Godot 4.7 project: TableTower
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-08 10:38:06 -06:00