Bacterial colonies branch into fractals on starved agar, in a backlit petri dish.
This is Ben-Jacob's communicating walkers model of Paenibacillus colonies. Thousands of walkers, each standing for many bacteria, eat peptone from the agar, split when well fed and freeze into spores when starved, while the nutrient diffuses. They can only swim inside the colony's wetted envelope: a step outward is refused and counts as a push, and a patch of agar joins the colony once it has been pushed enough times, so the threshold acts as agar hardness. On poor agar only the tips find food, a tip that sticks out finds more and grows faster, and the colony splits into dense fractal branches; rich agar fills in a solid disc. The chiral strain swims in arcs that always turn the same way, which sweeps every side branch to one side. To keep the square grid from imprinting a four-fold shape, the envelope is read as a smooth bilinear surface and pushes are splatted over a round kernel, and the colony is shaded as a dark-field photograph with relief, glow and glass.
Try it. Click the agar to inoculate more colonies and watch them compete for food. Click or drag in the morphology diagram to choose peptone and agar hardness for a new plate, switch strains, or show the nutrient field. Keys: C strain, N nutrient view, arrows to move through the diagram, R to restart.
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 a bacterial colony growing into fractal branches on a petri dish, with 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 canvas that fills the window, stays sharp on high-DPI screens (scale by devicePixelRatio), with a dark circular dish on a near-black background.
- Use a 256 x 256 grid for the agar. Each cell holds a nutrient amount (start every cell inside the dish at the same value) and a flag for whether it is part of the colony. Mark a small disc in the center as colony.
- Add a few hundred walkers inside that disc. Each step, a walker picks a random direction. If the new spot is colony, it moves there. If not, it stays put and adds one push to that outside cell; when a cell has been pushed N times (try 20), it joins the colony.
- Each walker eats nutrient from its cell, burns a fixed amount per step, splits in two when its energy is high, and becomes a stationary spore when it runs out.
- Let the nutrient diffuse every step by blending each cell with its four neighbors.
- Draw colony density (spores plus walkers per cell) as milky white into an ImageData on a small offscreen canvas, and scale it up into the dish.
Once that works, make it beautiful:
- Lower the nutrient or raise N and the colony splits into branches, because tips that stick out reach fresh food first. Raise the nutrient and it becomes a solid disc.
- Spread each push over the few cells around the target point instead of one cell, so the grid does not make the colony grow as a square or a cross.
- Add a soft glow, relief shading from the density gradient, and glass highlights on the dish rim.
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 a chiral strain whose walkers turn the same way each step, several colonies competing for food, or a clickable morphology diagram of nutrient versus agar hardness.