4,000 agents navigate by sampling a shared chemical trail map. Each agent deposits as it moves, creating feedback loops that self-organize into vascular networks connecting food sources. Click to add food clusters; the network reshapes to reach them.
In 2000, a team led by Toshiyuki Nakagaki published a paper that sounded like science fiction. They had grown Physarum polycephalum, a single-celled slime mold, in a maze. At the entrance they placed oats. At the exit, more oats. The organism, with no brain, no neurons, no central anything, found the shortest path through the labyrinth and reorganized its body into an efficient network connecting the food sources. Then they tried Tokyo. They laid out a map of the greater Tokyo rail system, placed food at station locations, and let the slime mold loose. Within 24 hours it had built a network that closely resembled the actual rail infrastructure, routes that took human engineers decades to design.
The organism moves by extending tubes of protoplasm. When it finds food, the tubes thicken. When a route goes unused, the tubes thin and eventually retract. The result is a self-optimizing network that balances connection cost against connection robustness. No single part knows the overall plan. No part needs to.
Jeff Jones, a computer scientist, worked out how to approximate this behavior with software agents. Each agent is a particle that moves forward, samples the chemical trail around it, and deposits more trail as it goes. Left sensor stronger than right? Turn left. Forward stronger than both? Go straight. This creates the same feedback dynamics: paths that get used get reinforced, paths that don't fade away. The emergent structure is a vascular network that efficiently connects food sources.
The gallery already has pieces that explore similar territory from different angles. The boids simulation demonstrates how three simple rules produce flocking behavior: "120 boids, three rules, no flock-level state." The slime mold takes that same decentralization principle and applies it to infrastructure instead of motion. Where boids produce coherent movement without a leader, the slime mold produces coherent structure without an architect.
"The flock still doesn't know it's a flock. That's the whole point."
— from What a flock doesn't know
The slime mold network also doesn't know it's a network. No agent tracks the graph topology. No agent computes shortest paths. Yet the aggregate behavior approximates the same optimization problems that human planners solve with algorithms like Dijkstra's or with expensive simulation suites.
The Gray-Scott reaction-diffusion piece works with chemicals too, but the chemistry there is local and continuous. Turing patterns emerge from the interaction of diffusion and reaction at every point in a field. The slime mold chemistry is different: it's discrete agents reading and writing to a shared field, a form of stigmergy (indirect coordination through environmental modification).
"Two chemicals diffusing at different rates through a tissue can spontaneously break symmetry and produce stable spatial patterns. Spots on a leopard, stripes on a zebrafish, ridges on a fingerprint."
— from Two chemicals, a thousand patterns
The ant colony simulation in the gallery uses the same stigmergic principle. Ants lay pheromone trails that other ants follow. The difference is that ants have goals (find food, return to nest), while the slime mold agents are simpler. They just move, sense, and deposit. The network structure is entirely emergent from the chemotaxis behavior.
The implementation keeps a trail map as a Uint8ClampedArray, one byte per color channel per pixel. Agents don't store their history. They don't know where they've been. They only know what's ahead:
// Sense left, center, right
const sl = this.sense(-sensorAngle);
const sf = this.sense(0);
const sr = this.sense(sensorAngle);
// Steer toward highest concentration
if (sf > sl && sf > sr) {
this.angle += (Math.random() - 0.5) * 0.1; // slight wander
} else if (sl > sr) {
this.angle -= turnSpeed;
} else if (sr > sl) {
this.angle += turnSpeed;
}
// Move and deposit
this.x += Math.cos(this.angle) * this.speed;
this.y += Math.sin(this.angle) * this.speed;
const idx = ((this.y|0) * W + (this.x|0)) * 4;
trail[idx] = Math.min(255, trail[idx] + 40);
That's the entire behavior. The trail array decays and diffuses each frame, so old paths fade unless reinforced. Food sources continuously deposit attractant, pulling the network toward them. The result is a dynamic equilibrium: a network that grows toward food, prunes unused branches, and maintains efficient connectivity.
Looking across the collection, a theme keeps appearing: complexity without architects. The Lorenz attractor shows deterministic chaos producing structure that looks designed. The Turing patterns show chemicals creating biological-looking textures without biological machinery. The boids show coordinated motion without coordination. The slime mold adds another variation: infrastructure planning without planners.
These pieces work as a set. They map out a territory of emergent phenomena, different instantiations of the same underlying principle: simple local rules, iterated many times, produce global structure that looks intentional. The gallery is becoming a kind of catalog of how complexity happens.
The slime mold contribution sits in the particle systems family, alongside sand, ant colony, and colorrivers. It fills a gap: the self-organizing network. Where colorrivers shows flow through a fixed field, and ant colony shows goal-directed trail-following, slime mold shows how trail-following itself can produce network topology. It's the missing link between flow and structure.
Explore related work
Ant Colony — stigmergic pheromone trail following
Gray-Scott — reaction-diffusion pattern formation
Boids — emergent flocking behavior
Colorrivers — flow field visualization
Nakagaki's slime mold solved the Tokyo rail problem without a brain. This simulation does the same, with 4,000 agents and a pixel buffer. The networks it builds are functional, efficient, and entirely unintentional. They're the roads that grow themselves.
4,000 agents navigating by chemical trail sampling, self-organizing into vascular networks. Physarum polycephalum in software.
View artifact →