Reward, condition, action, and trigger fields accept inline expressions wrapped
in {{ … }}, evaluated at runtime against the live game state. This is the
difference between a fixed board and a reactive one — without leaving the builder
for a workflow.
It's a sandboxed expression language (evaluated with no eval, no Function,
no globals, finite recursion): an expression that returns a value — no loops, no
statements, no JavaScript.
Where you can use them
| Field | Returns | Example |
|---|---|---|
reward.base / reward.variable | number | {{ space.tier * 10 }} · {{ random(1, 5) + session.streak }} |
reward.probability | 0–1 | {{ session.streak >= 7 ? 1 : 0.5 }} |
condition.expr | boolean | {{ player.xp > 500 && time.hour >= 18 }} |
trigger.when | boolean | {{ session.streak >= 3 }} |
action params (e.g. award_xp) | number | {{ 10 + session.lap * 5 }} |
Context
The values available inside {{ }}:
player.*—xp,currency.<id>,badges(list),level.session.*—streak,lap,moveCount, plus anyeval_exprvariables.space.*—id, and the space's owndata.*(e.g.space.data.requiredCount).board.*—shape,theme,spaceCount.time.*—hour(0–23),weekday, … (the player's local time).
Functions & operators
- Arithmetic:
+ - * / %and parentheses. - Comparison / logic:
== != < <= > >=,&& || !. - Conditional:
cond ? a : b. random(min, max)— a number in[min, max). Seeded from the session PRNG, so a landing replays to the same value (the event log is deterministic).- Helpers —
min,max,floor,round,abs, list membership, …
Not available: loops, assignment, function definitions, JavaScript, IO. Heavy
logic belongs in a Kaizen workflow (the run_workflow action); the DSL covers
the 80% case. Use the eval_expr action to set a session.* variable you can
read back later.
Patterns
# streak-scaled payout
reward.base: 10
reward.variable: {{ random(1, 5) + session.streak }}
# evening-only bonus
trigger.when: {{ time.hour >= 18 && time.hour < 22 }}
# escalating requirement
condition.expr: {{ space.data.progress >= space.data.baseRequirement + session.lap }}
# 70% chance, guaranteed on a long streak
reward.probability: {{ session.streak >= 7 ? 1 : 0.7 }}