|
# Recipe — Emitter meets a Mirror Wall
**A notebook `canvas` cell that runs a `buildExperiment(exp)` RECIPE.** Unlike the
setup-factory galleries (`fn(frqtl, universe, options)`), this canvas declares
`shape="recipe"`: the module installs a `buildExperiment(exp)` recipe (the same
`exp.init()/addObject()` form STUDIO saves and the Walk-through rungs run), and the
shim builds a `RecipeContext` and calls `exp.build(buildExperiment)` for it.
A spherical source of oppositely-charged quanta on the left sprays a disk of walks; a
reflective **Wall** on the right bounces every arrival back on its axis of incidence.
No wave equation — the mirror is a single-occupancy collision behavior.
|
The recipe — a `buildExperiment(exp)` module. It adds a `SphereEmitter` (which
self-inits the universe) and a bounce/reflect `Wall`, exactly as a saved STUDIO
project or a Walk-through rung would. The `window.buildExperiment` dual-mode tail is
the canonical recipe form (what STUDIO codegen emits):
|
/* buildExperiment(exp) — a mini emitter + mirror-wall RECIPE.
*
* The RecipeContext (`exp`) form: exp.addObject(kind, config) registers palette
* objects on the runner; the SphereEmitter builder self-inits the universe (so this
* recipe does NOT call exp.init — matching the Walk-through rungs). This is the
* `shape="recipe"` counterpart of the setup-factory galleries.
*
* SU1: zero new physics — the SphereEmitter + Wall are already-goldened behaviors
* (canonical-bench S* + LO1 Bounce/Reflect); the recipe only composes them.
*/
function buildExperiment(exp) {
var W = exp.runner.canvas_rect.w, H = exp.runner.canvas_rect.h;
var cy = Math.round(H / 2);
// A spherical source of oppositely-charged dim-2 leaves (the interference braiding
// comes from the random ± charge). In 2D the ball-rejected sampler collapses to an
// even disk of launch directions.
exp.addObject('SphereEmitter', {
preset: 'spherical', is2D: true, center: [Math.round(W * 0.15), cy],
chargeMode: 'random', fundamentalDimension: 2, wavelength: 32,
burstSize: 24, emitEveryTicks: 1
});
// A reflective wall — Bounce/Reflect inverts each arrival on its axis of incidence
// (a real mirror, canonical-bench LO1). Drag/rotate it in STUDIO to steer.
exp.addObject('Wall', {
rect: [Math.round(W * 0.6), Math.round(H * 0.2), 20, Math.round(H * 0.6)],
collisionBehavior: 'bounce', bounceDirection: 'reflect',
name: 'mirror', color: [170, 190, 230]
});
}
if (typeof module !== 'undefined' && module.exports) {
module.exports = { buildExperiment: buildExperiment };
} else if (typeof window !== 'undefined') {
window.buildExperiment = buildExperiment;
}
|
Declare a `shape="recipe"` canvas that runs it. `setup="#buildExperiment"` +
`stage`/`seed`; the shim synthesizes a `RecipeContext` builder and runs it in the
realm. Click **Run** (or **Run All**):
|
|
## What you are seeing
The source on the left sprays a disk of charged quanta; those that reach the wall on
the right reflect off it. The bright/dark structure in the beam is the emergent
interference of the oppositely-charged walks — no wave function anywhere.
**Edit the recipe:** open the `./setups/recipe-emitter-wall.js` tab, change the
`wavelength`, `burstSize`, or the wall's `collisionBehavior` (`bounce` → `absorb` /
`detect`), then re-Run. Because this is the `buildExperiment(exp)` recipe form, the
same source round-trips through STUDIO Save and the Walk-through rungs.
|