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
|
|
|
|
class_name Describe
|
|
|
|
|
|
extends RefCounted
|
|
|
|
|
|
## Rules in plain words (docs/PLAIN.md §1): pure functions that turn stored
|
|
|
|
|
|
## rule text into short phrases, using value labels (§3). Anything they can't
|
|
|
|
|
|
## read comes back as the original text; they never fail and keep phrases
|
|
|
|
|
|
## short (MAX_LEN characters, else the original text or a cut with "…").
|
|
|
|
|
|
##
|
|
|
|
|
|
## Labels: a value's label is its variable card's name, else the collection
|
|
|
|
|
|
## it belongs to names it by the rest of its name ("@skill_gun_combat" in the
|
|
|
|
|
|
## Skills collection -> "Gun Combat"), else a pretty form of its name ("soc"
|
|
|
|
|
|
## -> "Soc"). Card inputs are labelled by their declared label. `board` may be
|
|
|
|
|
|
## null everywhere (pretty names only).
|
|
|
|
|
|
|
|
|
|
|
|
## Longest phrase before falling back to the original text (or a cut).
|
|
|
|
|
|
const MAX_LEN := 90
|
|
|
|
|
|
const MINUS := "−"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# ---------------------------------------------------------------- labels
|
|
|
|
|
|
|
Terminology pass: one set of kind and choice names, 2d6, result/change wording
- Describe.kind_label / choice_label / choice_labels replace six drifting
label tables. Search no longer calls Check and Router cards "Table", and
a Check card's dialog is titled "Check settings".
- Choice types read "Which option / How many / Open ended" everywhere
(menu, settings, inspector, card, preview, details).
- Plain dice read "2d6" / "d6" instead of the 2D-game "2D" / "1D".
- The built-in "2D skill check" template becomes "Skill check (2d6 vs
target)" (builtin:skill-check), a real Check card with Success and Failure.
- User text says "result" and "change" instead of "entry", "row" and "effect"
(Test board, settings dialog, lint, variables panel, pipe options).
- Pipes are deleted (link, toast, undo label), like cards and results; the
reset statement reads "Reset" in the builder and "Reset all X" for
prefixes. "Clear" stays for a value that really was erased.
- The template-saved toast points at "+ Card ▾".
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-09 09:14:30 -06:00
|
|
|
|
## What each kind of card is called in the UI (search, inspector, settings, previews).
|
|
|
|
|
|
const KIND_LABELS := {
|
2026-11-10 18:24:23 -06:00
|
|
|
|
RollTable.KIND_ROLL: "Roll table", RollTable.KIND_CHOICE: "Choice", RollTable.KIND_LOOP: "Repeat",
|
|
|
|
|
|
RollTable.KIND_ROUTER: "Branch", RollTable.KIND_CHECK: "Check", RollTable.KIND_VARIABLE: "Variable",
|
Terminology pass: one set of kind and choice names, 2d6, result/change wording
- Describe.kind_label / choice_label / choice_labels replace six drifting
label tables. Search no longer calls Check and Router cards "Table", and
a Check card's dialog is titled "Check settings".
- Choice types read "Which option / How many / Open ended" everywhere
(menu, settings, inspector, card, preview, details).
- Plain dice read "2d6" / "d6" instead of the 2D-game "2D" / "1D".
- The built-in "2D skill check" template becomes "Skill check (2d6 vs
target)" (builtin:skill-check), a real Check card with Success and Failure.
- User text says "result" and "change" instead of "entry", "row" and "effect"
(Test board, settings dialog, lint, variables panel, pipe options).
- Pipes are deleted (link, toast, undo label), like cards and results; the
reset statement reads "Reset" in the builder and "Reset all X" for
prefixes. "Clear" stays for a value that really was erased.
- The template-saved toast points at "+ Card ▾".
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-09 09:14:30 -06:00
|
|
|
|
RollTable.KIND_SHEET: "Sheet",
|
|
|
|
|
|
}
|
|
|
|
|
|
## What each kind of choice is called (the + Card menu, settings, card, previews).
|
|
|
|
|
|
const CHOICE_LABELS := {"pick": "Which option", "number": "How many", "text": "Open ended"}
|
|
|
|
|
|
|
|
|
|
|
|
|
2026-11-11 08:39:07 -06:00
|
|
|
|
## "Roll table", "Check", "Ledger", ...
|
Terminology pass: one set of kind and choice names, 2d6, result/change wording
- Describe.kind_label / choice_label / choice_labels replace six drifting
label tables. Search no longer calls Check and Router cards "Table", and
a Check card's dialog is titled "Check settings".
- Choice types read "Which option / How many / Open ended" everywhere
(menu, settings, inspector, card, preview, details).
- Plain dice read "2d6" / "d6" instead of the 2D-game "2D" / "1D".
- The built-in "2D skill check" template becomes "Skill check (2d6 vs
target)" (builtin:skill-check), a real Check card with Success and Failure.
- User text says "result" and "change" instead of "entry", "row" and "effect"
(Test board, settings dialog, lint, variables panel, pipe options).
- Pipes are deleted (link, toast, undo label), like cards and results; the
reset statement reads "Reset" in the builder and "Reset all X" for
prefixes. "Clear" stays for a value that really was erased.
- The template-saved toast points at "+ Card ▾".
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-09 09:14:30 -06:00
|
|
|
|
static func kind_label(t: RollTable) -> String:
|
2026-11-11 08:39:07 -06:00
|
|
|
|
return "Ledger" if t.is_collection() else str(KIND_LABELS.get(t.kind, "Card"))
|
Terminology pass: one set of kind and choice names, 2d6, result/change wording
- Describe.kind_label / choice_label / choice_labels replace six drifting
label tables. Search no longer calls Check and Router cards "Table", and
a Check card's dialog is titled "Check settings".
- Choice types read "Which option / How many / Open ended" everywhere
(menu, settings, inspector, card, preview, details).
- Plain dice read "2d6" / "d6" instead of the 2D-game "2D" / "1D".
- The built-in "2D skill check" template becomes "Skill check (2d6 vs
target)" (builtin:skill-check), a real Check card with Success and Failure.
- User text says "result" and "change" instead of "entry", "row" and "effect"
(Test board, settings dialog, lint, variables panel, pipe options).
- Pipes are deleted (link, toast, undo label), like cards and results; the
reset statement reads "Reset" in the builder and "Reset all X" for
prefixes. "Clear" stays for a value that really was erased.
- The template-saved toast points at "+ Card ▾".
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-09 09:14:30 -06:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
## "Which option", "How many" or "Open ended".
|
|
|
|
|
|
static func choice_label(choice: String) -> String:
|
|
|
|
|
|
return str(CHOICE_LABELS.get(choice, choice))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
## The choice kinds' labels in RollTable.CHOICES order (for segmented pickers).
|
|
|
|
|
|
static func choice_labels() -> Array:
|
|
|
|
|
|
return RollTable.CHOICES.map(choice_label)
|
|
|
|
|
|
|
|
|
|
|
|
|
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
|
|
|
|
## The label of a value: "@luck", "@skill_pilot", "@skill_*" (a collection
|
|
|
|
|
|
## or prefix: "Skills", or "Skill values" without a collection card), "@[…]"
|
|
|
|
|
|
## ("Chosen value"), or a chain name ("answer" -> "Answer", an input's label).
|
|
|
|
|
|
static func label(name: String, board: TowerBoard) -> String:
|
|
|
|
|
|
return _label(name, _labels(board))
|
|
|
|
|
|
|
|
|
|
|
|
|
2026-11-14 13:28:48 -06:00
|
|
|
|
## Label table for a board (see DescribeLabels.build).
|
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
|
|
|
|
static func _labels(board: TowerBoard) -> Dictionary:
|
2026-11-14 13:28:48 -06:00
|
|
|
|
return DescribeLabels.build(board)
|
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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static func _label(name: String, L: Dictionary) -> String:
|
2026-11-14 13:28:48 -06:00
|
|
|
|
return DescribeLabels.lookup(name, L)
|
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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# ---------------------------------------------------------------- effects
|
|
|
|
|
|
|
|
|
|
|
|
## One effect statement in plain words: "@luck -= 1" -> "Luck −1",
|
Terminology pass: one set of kind and choice names, 2d6, result/change wording
- Describe.kind_label / choice_label / choice_labels replace six drifting
label tables. Search no longer calls Check and Router cards "Table", and
a Check card's dialog is titled "Check settings".
- Choice types read "Which option / How many / Open ended" everywhere
(menu, settings, inspector, card, preview, details).
- Plain dice read "2d6" / "d6" instead of the 2D-game "2D" / "1D".
- The built-in "2D skill check" template becomes "Skill check (2d6 vs
target)" (builtin:skill-check), a real Check card with Success and Failure.
- User text says "result" and "change" instead of "entry", "row" and "effect"
(Test board, settings dialog, lint, variables panel, pipe options).
- Pipes are deleted (link, toast, undo label), like cards and results; the
reset statement reads "Reset" in the builder and "Reset all X" for
prefixes. "Clear" stays for a value that really was erased.
- The template-saved toast points at "+ Card ▾".
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-09 09:14:30 -06:00
|
|
|
|
## "@town = \"Millbrook\"" -> "Town = Millbrook", "reset @skill_*" -> "Reset
|
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
|
|
|
|
## all Skills", "@traits += \"Psionic\"" -> "Add Psionic to Traits",
|
|
|
|
|
|
## "@[option] += 1" -> "Chosen skill +1" when `table` is a pick card taking
|
|
|
|
|
|
## options from a collection (else "Chosen value +1").
|
|
|
|
|
|
static func effect(stmt: String, board: TowerBoard, table: RollTable = null) -> String:
|
|
|
|
|
|
return _effect(stmt, _labels(board), table)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
## One phrase per statement of an effects field.
|
|
|
|
|
|
static func effects(text: String, board: TowerBoard, table: RollTable = null) -> Array[String]:
|
|
|
|
|
|
var L := _labels(board)
|
|
|
|
|
|
var out: Array[String] = []
|
|
|
|
|
|
for s in Effects.split(text):
|
|
|
|
|
|
out.append(_effect(s, L, table))
|
|
|
|
|
|
return out
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static func _effect(stmt: String, L: Dictionary, table: RollTable) -> String:
|
|
|
|
|
|
var src := stmt.strip_edges()
|
|
|
|
|
|
var m := Builder.parse_effect(src)
|
|
|
|
|
|
if not m["ok"]:
|
|
|
|
|
|
return src
|
|
|
|
|
|
var v := str(m["var"])
|
|
|
|
|
|
var subj := _chosen(table, L) if v.begins_with("@[") else _label(v, L)
|
UI for scales: make, show and edit ordered-step values
- Making one: Scale (ordered steps) in + Card, the inspector's Type switch
and the settings dialog; steps one per line and a starting step dropdown
(InspectorScale); new scales get Low, Medium, High.
- Showing one: the variable card shows the current step and the steps in a
row with the current one marked; the Variables tab stores a typed step
number or name as the step.
- Plain words: Builder ops step_up, step_down, toward, at_least, at_most
(BuilderScales; step_up/down need the board), DescribeScales phrases,
scale effect rows (EffectsScaleRow) and step dropdowns in conditions.
- Help: a Scales topic after Values and changes.
- Tests: test_ui_scales, plus builder and describe cases.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-10 21:25:30 -06:00
|
|
|
|
var steps: Variant = _steps(v, L)
|
|
|
|
|
|
if steps != null:
|
|
|
|
|
|
var sc := DescribeScales.effect(BuilderScales.refine(m, true), subj, steps, func(a: String) -> String: return _expr(a, L))
|
|
|
|
|
|
if sc != "":
|
|
|
|
|
|
return _short(sc, src)
|
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
|
|
|
|
var amount := str(m["amount"])
|
|
|
|
|
|
var out := ""
|
|
|
|
|
|
match str(m["op"]):
|
|
|
|
|
|
"reset":
|
|
|
|
|
|
if v.ends_with("*"):
|
Terminology pass: one set of kind and choice names, 2d6, result/change wording
- Describe.kind_label / choice_label / choice_labels replace six drifting
label tables. Search no longer calls Check and Router cards "Table", and
a Check card's dialog is titled "Check settings".
- Choice types read "Which option / How many / Open ended" everywhere
(menu, settings, inspector, card, preview, details).
- Plain dice read "2d6" / "d6" instead of the 2D-game "2D" / "1D".
- The built-in "2D skill check" template becomes "Skill check (2d6 vs
target)" (builtin:skill-check), a real Check card with Success and Failure.
- User text says "result" and "change" instead of "entry", "row" and "effect"
(Test board, settings dialog, lint, variables panel, pipe options).
- Pipes are deleted (link, toast, undo label), like cards and results; the
reset statement reads "Reset" in the builder and "Reset all X" for
prefixes. "Clear" stays for a value that really was erased.
- The template-saved toast points at "+ Card ▾".
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-09 09:14:30 -06:00
|
|
|
|
out = "Reset all " + _label(v, L)
|
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
|
|
|
|
elif L["vars"].has(v.trim_prefix("@")):
|
|
|
|
|
|
out = "Reset " + subj
|
|
|
|
|
|
else:
|
|
|
|
|
|
out = "Clear " + subj
|
|
|
|
|
|
"set":
|
|
|
|
|
|
out = "%s = %s" % [subj, _expr(amount, L)]
|
|
|
|
|
|
"add", "subtract":
|
|
|
|
|
|
var sub: bool = m["op"] == "subtract"
|
|
|
|
|
|
if amount.is_valid_float() and not amount.to_lower().contains("e") and not amount.to_lower().contains("n"):
|
|
|
|
|
|
var x: Variant = Expr.to_value(amount)
|
|
|
|
|
|
if x < 0:
|
|
|
|
|
|
sub = not sub
|
|
|
|
|
|
x = -x
|
|
|
|
|
|
out = "%s %s%s" % [subj, MINUS if sub else "+", Expr.format_value(x)]
|
|
|
|
|
|
else:
|
|
|
|
|
|
out = "%s %s %s" % [subj, MINUS if sub else "+", _expr(amount, L)]
|
|
|
|
|
|
"multiply":
|
|
|
|
|
|
out = "%s ×%s" % [subj, _compact(amount, L)]
|
|
|
|
|
|
"divide":
|
|
|
|
|
|
out = "%s ÷%s" % [subj, _compact(amount, L)]
|
|
|
|
|
|
"append":
|
|
|
|
|
|
out = "Add %s to %s" % [amount, subj]
|
|
|
|
|
|
"remove":
|
|
|
|
|
|
out = "Remove %s from %s" % [amount, subj]
|
|
|
|
|
|
return _short(out, src)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static func _compact(amount: String, L: Dictionary) -> String:
|
|
|
|
|
|
var t := Builder.tokens(amount)
|
|
|
|
|
|
var e := _expr(amount, L)
|
|
|
|
|
|
return e if t.size() == 1 else " " + e
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
## "Chosen skill" on a pick card whose options come from a collection, else
|
|
|
|
|
|
## "Chosen value".
|
|
|
|
|
|
static func _chosen(table: RollTable, L: Dictionary) -> String:
|
|
|
|
|
|
if table != null and table.is_dynamic():
|
|
|
|
|
|
var p := RollTable.parse_options_from(table.options_from)
|
|
|
|
|
|
if str(p["kind"]) == "prefix":
|
|
|
|
|
|
var stem := str(p["name"]).trim_suffix("_")
|
|
|
|
|
|
for sp: Array in L["stems"]:
|
|
|
|
|
|
if sp[0] == stem:
|
|
|
|
|
|
return "Chosen " + _singular(str(sp[1]).to_lower())
|
|
|
|
|
|
return "Chosen value"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static func _singular(s: String) -> String:
|
|
|
|
|
|
if s.length() > 3 and s.ends_with("s") and not s.ends_with("ss"):
|
|
|
|
|
|
return s.substr(0, s.length() - 1)
|
|
|
|
|
|
return s
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# ---------------------------------------------------------------- conditions
|
|
|
|
|
|
|
|
|
|
|
|
## A condition in plain words: "@str >= 8" -> "Strength is 8 or more",
|
|
|
|
|
|
## "@x = 0 and @soc >= 9" -> "X is 0 and Social Standing is 9 or more",
|
|
|
|
|
|
## "has(@traits, \"Psionic\")" -> "Traits include Psionic". "" for an empty
|
|
|
|
|
|
## condition; the original text for anything Builder.parse_condition() can't
|
|
|
|
|
|
## read.
|
|
|
|
|
|
static func condition(expr: String, board: TowerBoard) -> String:
|
|
|
|
|
|
return _condition(expr, _labels(board))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static func _condition(expr: String, L: Dictionary) -> String:
|
|
|
|
|
|
var src := expr.strip_edges()
|
|
|
|
|
|
var m := Builder.parse_condition(src)
|
|
|
|
|
|
if not m["ok"]:
|
|
|
|
|
|
return src
|
|
|
|
|
|
var parts := PackedStringArray()
|
|
|
|
|
|
for c: Dictionary in m["clauses"]:
|
|
|
|
|
|
parts.append(_clause(c, L))
|
|
|
|
|
|
return _short((" %s " % m["join"]).join(parts), src)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static func _clause(c: Dictionary, L: Dictionary) -> String:
|
|
|
|
|
|
var subj := _label(str(c["var"]), L)
|
|
|
|
|
|
var cmp := str(c["cmp"])
|
|
|
|
|
|
match cmp:
|
|
|
|
|
|
"set":
|
|
|
|
|
|
return subj + " is set"
|
|
|
|
|
|
"unset":
|
|
|
|
|
|
return subj + " is not set"
|
|
|
|
|
|
"has":
|
|
|
|
|
|
return "%s include %s" % [subj, _value(str(c["value"]), L)]
|
UI for scales: make, show and edit ordered-step values
- Making one: Scale (ordered steps) in + Card, the inspector's Type switch
and the settings dialog; steps one per line and a starting step dropdown
(InspectorScale); new scales get Low, Medium, High.
- Showing one: the variable card shows the current step and the steps in a
row with the current one marked; the Variables tab stores a typed step
number or name as the step.
- Plain words: Builder ops step_up, step_down, toward, at_least, at_most
(BuilderScales; step_up/down need the board), DescribeScales phrases,
scale effect rows (EffectsScaleRow) and step dropdowns in conditions.
- Help: a Scales topic after Values and changes.
- Tests: test_ui_scales, plus builder and describe cases.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-10 21:25:30 -06:00
|
|
|
|
var value := str(c["value"])
|
|
|
|
|
|
var steps: Variant = _steps(str(c["var"]), L)
|
|
|
|
|
|
if steps != null and value.is_valid_int():
|
|
|
|
|
|
value = Builder.quote(Scales.label_at(steps, int(value)))
|
|
|
|
|
|
return "%s %s" % [subj, _tail(cmp, value, L)]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
## The steps of a scale value ("@climate"), or null when it isn't one.
|
|
|
|
|
|
static func _steps(v: String, L: Dictionary) -> Variant:
|
|
|
|
|
|
return L.get("scales", {}).get(v.trim_prefix("@").to_lower()) if v.begins_with("@") else null
|
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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
## The comparison after a value name: "is 8 or more", "is at most 3", "is
|
|
|
|
|
|
## Aslan", "is not 0", "is more than 2", "is less than 2".
|
|
|
|
|
|
static func _tail(cmp: String, value: String, L: Dictionary) -> String:
|
|
|
|
|
|
var v := _value(value, L)
|
|
|
|
|
|
var num := Expr.is_number(value) or (value.begins_with("-") and Expr.is_number(value.substr(1)))
|
|
|
|
|
|
match cmp:
|
|
|
|
|
|
"eq":
|
|
|
|
|
|
return "is " + v
|
|
|
|
|
|
"ne":
|
|
|
|
|
|
return "is not " + v
|
|
|
|
|
|
"ge":
|
|
|
|
|
|
return ("is %s or more" % v) if num else "is at least " + v
|
|
|
|
|
|
"le":
|
|
|
|
|
|
return "is at most " + v
|
|
|
|
|
|
"gt":
|
|
|
|
|
|
return "is more than " + v
|
|
|
|
|
|
"lt":
|
|
|
|
|
|
return "is less than " + v
|
|
|
|
|
|
"has":
|
|
|
|
|
|
return "includes " + v
|
|
|
|
|
|
"set":
|
|
|
|
|
|
return "is set"
|
|
|
|
|
|
"unset":
|
|
|
|
|
|
return "is not set"
|
|
|
|
|
|
return "%s %s" % [cmp, v]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
## A value token in words: numbers as they are, quoted text without quotes,
|
|
|
|
|
|
## @names and chain names by label, true/false as yes/no.
|
|
|
|
|
|
static func _value(tok: String, L: Dictionary) -> String:
|
|
|
|
|
|
var s := tok.strip_edges()
|
|
|
|
|
|
if s == "true":
|
|
|
|
|
|
return "yes"
|
|
|
|
|
|
if s == "false":
|
|
|
|
|
|
return "no"
|
|
|
|
|
|
if Builder.is_text_literal(s):
|
Plain Build display: plain rules on cards, pipes and tray, Why this?, check/collection/inputs visuals
- RulesView (ui/rules_view.gd): plain-or-text helpers over Describe, reading
Main.rules_plain() when present (else StateStore, else plain; --rules=text
for screenshots) and refreshing on Main.rules_view_changed.
- Cards: effect chips, router cases, option sources, show_if, loop rules,
expression dice and variable kinds read in plain words. Build cards drop the
inline effects / show_if / condition / details editors for plain chips;
result text and names stay inline. Row clicks call main.select_result();
the selected row gets a copper bar (set_selected_entry / inspector_selection).
- Check cards: 2D badge, the rule as a sentence, Success / Failure outlets.
Collection cards: live members and "+ Add" (main.select_card). Inputs:
a dashed "Input Tier · starts at 1" box.
- Pipe labels via Describe.pipe, nudged apart and cut to the gap.
- Tray: plain captions (inputs, checks, cases), effect lines from why facts,
and a "Why this?" button opening a WhyPopover; hovers show the same reasons.
- Previews and the choice pop-up read conditions, effects and option sources
in plain words. Style.rules_switch() for the Plain words / Text switch.
- Describe: empty text reads "empty" ("Loot is not empty").
- tests/test_plain_display.gd; option and choice tests pin the Text view
where they check stored text.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-08 21:30:55 -06:00
|
|
|
|
var u := Builder.unquote(s)
|
|
|
|
|
|
return u if u != "" else "empty"
|
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
|
|
|
|
if s.begins_with("-") and Expr.is_number(s.substr(1)):
|
|
|
|
|
|
return MINUS + s.substr(1)
|
|
|
|
|
|
if Expr.is_number(s):
|
|
|
|
|
|
return s
|
|
|
|
|
|
if s.begins_with("@") or Builder._is_word(s.substr(0, 1)):
|
|
|
|
|
|
return _label(s, L)
|
|
|
|
|
|
return s
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# ---------------------------------------------------------------- dice
|
|
|
|
|
|
|
Terminology pass: one set of kind and choice names, 2d6, result/change wording
- Describe.kind_label / choice_label / choice_labels replace six drifting
label tables. Search no longer calls Check and Router cards "Table", and
a Check card's dialog is titled "Check settings".
- Choice types read "Which option / How many / Open ended" everywhere
(menu, settings, inspector, card, preview, details).
- Plain dice read "2d6" / "d6" instead of the 2D-game "2D" / "1D".
- The built-in "2D skill check" template becomes "Skill check (2d6 vs
target)" (builtin:skill-check), a real Check card with Success and Failure.
- User text says "result" and "change" instead of "entry", "row" and "effect"
(Test board, settings dialog, lint, variables panel, pipe options).
- Pipes are deleted (link, toast, undo label), like cards and results; the
reset statement reads "Reset" in the builder and "Reset all X" for
prefixes. "Clear" stays for a value that really was erased.
- The template-saved toast points at "+ Card ▾".
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-09 09:14:30 -06:00
|
|
|
|
## A dice or count expression in plain words: "2d6 + dm(@str)" -> "2d6 +
|
|
|
|
|
|
## Strength modifier", "1d6 + tier" -> "d6 + Tier", "@terms" -> "Terms".
|
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
|
|
|
|
## d6 dice read as "ND"; other dice as "dN" / "NdM". Text that can't be read
|
|
|
|
|
|
## comes back as it is.
|
|
|
|
|
|
static func dice(expr: String, board: TowerBoard) -> String:
|
|
|
|
|
|
return _expr(expr, _labels(board))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static func _expr(expr: String, L: Dictionary) -> String:
|
2026-11-14 13:28:48 -06:00
|
|
|
|
return DescribeDice.words(expr, L)
|
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
|
|
|
|
|
|
|
|
|
|
|
2026-11-10 19:41:08 -06:00
|
|
|
|
# ---------------------------------------------------------------- helpers
|
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
|
|
|
|
|
2026-11-10 19:41:08 -06:00
|
|
|
|
## `s`, or when it's too long the original text (if that's shorter) or a cut.
|
|
|
|
|
|
static func _short(s: String, original: String) -> String:
|
|
|
|
|
|
if s.length() <= MAX_LEN:
|
|
|
|
|
|
return s
|
|
|
|
|
|
if original.length() <= MAX_LEN:
|
|
|
|
|
|
return original
|
|
|
|
|
|
return s.substr(0, MAX_LEN - 1) + "…"
|
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
|
|
|
|
|
|
|
|
|
|
|
2026-11-10 19:41:08 -06:00
|
|
|
|
static func check(table: RollTable, board: TowerBoard) -> String:
|
|
|
|
|
|
return DescribeCards.check(table, board)
|
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
|
|
|
|
|
|
|
|
|
|
|
2026-11-10 19:41:08 -06:00
|
|
|
|
static func options(table: RollTable, board: TowerBoard) -> String:
|
|
|
|
|
|
return DescribeCards.options(table, board)
|
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
|
|
|
|
|
|
|
|
|
|
|
2026-11-10 19:41:08 -06:00
|
|
|
|
static func pipe(entry: TableEntry, target_id: String, board: TowerBoard) -> String:
|
|
|
|
|
|
return DescribeCards.pipe(entry, target_id, board)
|
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
|
|
|
|
|
|
|
|
|
|
|
2026-11-10 19:41:08 -06:00
|
|
|
|
static func roll(table: RollTable, board: TowerBoard) -> String:
|
|
|
|
|
|
return DescribeCards.roll(table, board)
|
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
|
|
|
|
|
|
|
|
|
|
|
2026-11-10 19:41:08 -06:00
|
|
|
|
static func signed_number(n: int) -> String:
|
|
|
|
|
|
return DescribeWhy.signed_number(n)
|
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
|
|
|
|
|
|
|
|
|
|
|
2026-11-10 19:41:08 -06:00
|
|
|
|
static func why(fact: Dictionary, board: TowerBoard, plain: bool = true) -> String:
|
|
|
|
|
|
return DescribeWhy.why(fact, board, plain)
|