SimulatorEducationBrain

Slime Mold Maze Solver

Watch a simulated Physarum polycephalum flood a maze, then retract every branch except the shortest path between two food sources — the 2000 Nature experiment, with the answer checked against breadth-first search.

Phase

Exploration

Slime path

BFS optimum

Maze filled

0%

Exploring — the slime is filling every corridor.

0 simulation steps elapsed. The dashed blue line is the true shortest route computed by breadth-first search on the maze graph — the slime never sees it.

Maze

Phase control

BFS solution overlay

Agents3,400
Simulation speed
Sensor distance7 px
Sensor angle23°
Turn angle32°
Deposit5
Trail decay98.5%
Diffusion0.70

The experiment this reproduces

In 2000, Toshiyuki Nakagaki, Hiroyasu Yamada and Ágota Tóth published a one-page paper in Nature titled "Maze-solving by an amoeboid organism" (Nature 407, 470). They laid a small maze on an agar plate and filled its corridors with fragments of the plasmodium of Physarum polycephalum — a slime mould. The fragments fused into one continuous sheet of organism occupying the entire maze.

Then they placed blocks of nutrient agar at the start and the end. Over the following hours the plasmodium withdrew from every dead end, and then from the longer of the alternative routes, until what remained was a single thick tube connecting the two food sources along the shortest path through the maze. Where several routes linked the two food blocks, the organism settled on the shortest.

What makes this notable is what Physarum does not have. It is a single cell — very large, containing many nuclei, but one cell. It has no neurons, no brain, and no central controller of any kind. The paper's claim, and the reason it is still cited, is that this counts as a primitive form of computation carried out by cell physiology alone.

How a cell with no nervous system finds a shortest path

The plasmodium is a network of tubes through which protoplasm is pumped back and forth by rhythmic contractions — shuttle streaming, reversing roughly every 90 to 120 seconds. The mechanism behind the maze result is a positive feedback loop on that flow:

  • Flow thickens tubes. A tube carrying a high rate of protoplasmic flow grows in diameter.
  • Thicker tubes carry more flow. Hydraulic resistance falls sharply with radius, so widening a tube increases the flow through it further.
  • Starved tubes disappear. A tube carrying little or no flow shrinks and is eventually resorbed by the organism.

Once food is placed at two points, the sustained traffic between them runs along connecting routes. A dead-end branch carries no through-traffic at all, so it starves first. Between two routes that both connect the food sources, the shorter one has less resistance, draws more flow, thickens faster, and progressively steals flow from the longer one until the longer route collapses. Nobody computes the shortest path; it is the only configuration the feedback loop is stable at.

The same idea as ant trails. This is stigmergy: agents modify a shared medium, and the modified medium redirects the agents. Ants reinforce pheromone on shorter routes because shorter routes get traversed more often per unit time; Physarum reinforces tubes for the mechanically equivalent reason. Ant Colony Optimisation, the engineering algorithm, was derived from the same principle.

The Tokyo rail network follow-up

In 2010 Atsushi Tero, Nakagaki and colleagues published "Rules for Biologically Inspired Adaptive Network Design" in Science (327, 439–442). They arranged oat flakes on a wet surface in the pattern of 36 locations around Tokyo — the city itself plus the surrounding stations of the real rail network — and used bright light, which Physarum avoids, to stand in for geographical obstacles such as water and mountainous terrain.

Within about a day the organism had settled into a network of tubes whose topology closely resembled the actual Tokyo rail system. The authors scored the result on three measures against the engineered network:

  • Cost: total length of all links in the network.
  • Transport efficiency: average distance along the network between pairs of locations.
  • Fault tolerance: probability that severing a single random link disconnects part of the network.

The slime mould's network was comparable to the real rail network on all three, which is striking given that the rail system is the product of decades of deliberate engineering. The paper's more useful contribution was a mathematical model, abstracted from the organism, for growing robust low-cost networks — the point was not that slime mould should design railways, but that a decentralised biological rule produces solutions in the same quality class as centralised design.

The model running on this page

The simulation above is not a fluid-mechanical model of protoplasm. It is the agent-based model introduced by Jeff Jones in 2010 ("Characteristics of pattern formation and evolution in approximations of Physarum transport networks", Artificial Life 16(2), 127–153), confined to the maze corridors. Thousands of particles move over a chemoattractant grid. Each one, every step, does exactly three things: sense, turn, deposit.

ParameterWhat it controlsEffect of raising it
Sensor distanceHow far ahead the three sensors sample the trail grid.Smoother, wider tubes; too far and agents stop resolving corridor width.
Sensor angleAngular offset of the left and right sensors from straight ahead.Agents notice trails further off-axis, so networks branch more.
Turn angleHow far an agent rotates when a side sensor beats the front one.Sharper course corrections; jittery paths if much larger than the sensor angle.
DepositChemoattractant added to the grid cell an agent lands on.Stronger self-reinforcement, so trails lock in sooner.
Trail decayFraction of the trail value surviving each step.Trails persist longer, so the maze fills more completely during exploration.
DiffusionWeight of the 3 × 3 blur applied to the grid each step.Trails spread sideways and merge; too much and fine structure is lost.

Two things are added to the plain Jones model to reproduce the Nakagaki setup specifically. The grid carries a wall mask, so sensors read walls as maximally unattractive and agents slide along corridors instead of crossing them. And each agent carries a flux value that is refilled whenever it touches a food source and bleeds away as it travels. During the retraction phase, deposit is scaled by that flux, so only agents genuinely shuttling between A and B keep feeding their tube. That is the digital stand-in for flow-dependent tube thickening; branches with no through-traffic run dry and vanish.

Checking the answer, and where the model breaks

An animation that merely looks organic proves nothing, so the page verifies the result. The dashed line is the true shortest route, computed by breadth-first search on the maze graph — the correct algorithm here because every corridor has equal cost, which makes BFS optimal and O(V + E). The agents never see it.

To read the slime's own answer, the surviving trail is averaged per maze cell and then a widest-path search finds the A-to-B route whose thinnest cell is as thick as possible. That is a deliberate choice over following the strongest neighbour greedily: a greedy walk will happily chase near-zero noise through a broken network and report a path that is not really there, whereas requiring every cell on the route to clear the same visibility threshold means a reported path is a genuinely continuous tube.

The honest limitation: this works while the two food sources are close enough that agents complete round trips between them within a run. Push them much further apart and the trail connecting A to B never becomes continuous in the first place, the flux rule has nothing to reinforce, and the retraction produces a dead network rather than a shortest path. That is why the three layouts here are hand-built and compact rather than randomly generated — a random maze generator produces failures more often than demonstrations, and a simulation that only sometimes shows the phenomenon it claims to show is not worth shipping.