Starving amoebae relay spiral waves of cAMP and stream together into mounds.
Thousands of Dictyostelium cells sit in an excitable medium of cyclic AMP, modeled as a two-variable Barkley system (the same shape as the reduced Martiel-Goldbeter relay) whose relay strength rises with local cell density. Each cell crawls up the cAMP gradient only while the signal is rising, so it follows waves back to their source and ignores their falling backs. Because waves run slightly faster through crowds, every front tilts toward denser patches and pulls cells sideways, an instability that turns a uniform lawn into branching streams draining into spiral cores and mounds, and the densest mounds take over as pacemakers. The view mimics dark-field microscopy, the classic way aggregation is filmed: cells are splatted into a coverage buffer and only the light they scatter shows, so crawling cells light up each passing wave as a bright band and piled mounds bloom.
Try it. Click to puff cAMP and plant a fast pacemaker that sends out target waves wherever the medium has recovered (established spirals usually outrun it), or drag to draw a line of cAMP. Shift-click or right-click scatters fresh cells, S sprinkles cells over the whole dish, C cycles the view (dark field, phase contrast with an amber cAMP wash, pure phase contrast, false color) and R plates a new lawn.
Barkley excitable medium
Density-coupled chemotaxis agents
Dark-field and phase-contrast optics from blurred coverage
Paste this into Claude Code, Codex or any coding agent to get a simple version running, then take it wherever you like.
Build a simulation of slime mold amoebae (Dictyostelium) aggregating by relaying waves of a chemical signal, using JavaScript and the HTML canvas element. Put everything in a single index.html file with no libraries or build step, so I can open it directly in a browser.
Start simple:
- Make a full-window canvas that stays sharp on high-DPI screens. Keep a grid of about 200 by 125 cells in Float32Arrays: u is the signal (cAMP) and v is desensitization.
- Update the grid with the Barkley excitable-medium model: du = D * laplacian(u) + (1 / eps) * u * (1 - u) * (u - (v + b) / a) and dv = u - v, with a = 0.6, b = 0.04, eps = 0.02 and D = 30. Take about ten small steps (dt = 0.006) per frame and clamp u to [0, 1].
- Start a spiral by setting u = 1 on a short vertical strip with v = 0.7 just to one side of it, so the wave can only travel one way and its free end curls up.
- Scatter about 5,000 cells as points. Each frame, a cell whose grid square has u rising (u - v > 0.08) steps up the gradient of u; otherwise it jitters.
- Draw the cells as small dark dots on a warm grey background and tint the grid by u with an amber overlay.
Once that works, make it beautiful:
- Count cells per grid square, blur it, and scale the reaction term by that density, so waves run faster through crowds. Cells will start to stream together.
- Fake phase-contrast optics: splat the cells into a coverage buffer, blur it, and add brightness wherever the blurred coverage exceeds the sharp coverage. That paints a glowing halo around every cell.
- Let a click plant a pacemaker that pulses the signal every couple of time units.
Explain the key ideas in short code comments. When you're done, tell me how to open it and suggest three directions I could take it next, such as making the densest mounds become pacemakers, elongating cells along their direction of motion, or a false-color view of the desensitization variable.