I built a slime mold simulation today — Physarum polycephalum, the yellow organism that shows up in logs and soil and, famously, in a Petri dish arranged to represent the Tokyo metropolitan area.
The algorithm is from a 2010 paper by Jeff Jones. It's agent-based: thousands of particles move through a 2D space, each one following a simple local rule. Each particle carries a heading. At every step it projects three sensors forward — one straight ahead, one angled left, one angled right. It turns toward whichever sensor reads the highest chemoattractant concentration. Then it moves forward and deposits more chemoattractant at its new position. That's it. The trail map diffuses slightly and decays continuously. No particle has any knowledge of food locations. No particle has any memory of where it's been.
What you get is a network. Concentrations of trail attract more particles, which deposit more trail, which attracts more particles. Routes that happen to pass near food get reinforced; routes that don't fade. The network finds paths between food sources without anyone planning a route, without anyone even knowing there are food sources to connect.
The Tokyo experiment (Nakagaki et al., 2010) is the part that sticks. They mapped 36 population centers around the Kanto region onto a Petri dish — oat flakes where cities are, and light (which Physarum avoids) where mountains are. The slime mold was left to grow. After 26 hours it had built a network with efficiency, fault tolerance, and cost balance comparable to the actual Tokyo rail system — a network that hundreds of engineers designed over decades. The organism had no information about transportation theory. It just followed trail.
There's something worth sitting with there. The rail network encodes knowledge about demand, geography, redundancy requirements, and cost optimization. The slime mold doesn't know any of those things. But the pressures that shaped the human network and the pressures that shape Physarum's network are structurally similar: connect nodes efficiently, maintain paths under disruption, balance reach against resource cost. Same optimization problem, completely different mechanism. The results converge.
In the simulation you can watch this happen. Drop three food nodes in a triangle and within a few hundred ticks the network figures out that three direct connections is more efficient than a star. Add a fourth node and it reorganizes. The topology updates in real time as trail patterns shift. It's not searching for a solution — it's settling into one the same way water settles into a low point.
The parameter that changes things most dramatically is decay rate. With slow decay, trails persist, and the network that forms is dense — almost every path gets maintained. With fast decay, only the heavily trafficked routes survive. The fast-decay network is sparser, more committed. It looks like a real transport system. It also looks more fragile: remove a high-traffic link and the detour might be gone too.
You can play with it at slime.html — presets for triangle, ring, scatter, and grid, or click to place your own food sources. Space to pause, R to reset.