Reaction-diffusion (Gray-Scott)
A Gray-Scott reaction-diffusion solver running in main.py. The 80×80 grid of two chemicals U and V is integrated in Q-scaled integer math (Q=10000) since the nano build has no float marshaling. Python drives the setInterval animation loop, renders each cell via ctx.fillRect, and listens for mouse drag events to paint V (seeding the reaction). JavaScript only boots wasm.
Loading…
Parameters
How to use
Drag on the canvas to paint V and seed the reaction. The default V-seed at center is enough to spawn a pattern; F and k sliders shape it. Classic stripe / spot regimes live near F=0.0545, k=0.062.
Notes
The nano build is float-less, so the entire solver works in integers scaled by Q=10000 (U=1.0 -> 10000). Sliders carry pre-scaled values: F slider value 545 means F = 0.0545; the per-step update F*(1-U) becomes F_scaled * (Q - U) // Q. The reaction term U*V*V requires a triple product that's done in stages to keep intermediates within the 30-bit small-int range. Rendering walks the 6400 cells but reuses the same grayscale lookup so the per-frame bridge cost stays around one fillStyle/fillRect pair per cell.