HomeBiology & LifeSlime Mold Network (Physarum)

🟡 Slime Mold Network (Physarum)

Physarum polycephalum-style agents deposit and sense a decaying trail field, self-organising into efficient transport networks between food sources — the same algorithm behind the Tokyo rail-network experiment.

Biology & Life2DEasy60 FPS
slime-mold-network ↗ Open standalone

How it Works

Each of the yellow agents carries a heading angle and reads a shared trail-concentration grid at three points projected ahead of it: front-left, straight ahead, and front-right, offset by the sensor angle and sensor distance sliders. The agent rotates toward whichever sensor reads the strongest trail, steps forward, and stamps a fresh dose of trail onto the grid cell it lands on — the same sense-turn-move-deposit loop used to model real Physarum polycephalum foraging.

After every agent has moved, the whole trail grid is diffused with a box blur (spreading pheromone into neighbouring cells) and then multiplied by a decay factor so old trail fades. Routes that many agents keep reinforcing survive this decay and grow into thick, efficient tubes; rarely used trails vanish. Food sources continuously inject a strong attractant into the grid, so over time the surviving tube network settles into near-optimal connections between food points, mirroring the famous experiment where Physarum grown over a map of Japan reconstructed the Tokyo rail network.

Sensor sample: S(θ) = trail(x + d·cos(h+θ), y + d·sin(h+θ))
Turn: h += turnSpeed · sign(argmax(S(-a), S(0), S(a)))
Deposit: trail(x,y) += depositAmount
Diffuse+decay: trail = blur3x3(trail) · diffuseAmount + trail · (1-diffuseAmount); trail *= (1 - decayRate)

Frequently Asked Questions

What is Physarum polycephalum?

Physarum polycephalum is a single-celled slime mold that forages by extending a network of protoplasmic tubes across a surface. Despite having no brain or nervous system, it can solve maze and network-optimization problems.

How does the simulation model the slime mold's behaviour?

Thousands of simple agents each sense a shared trail field at three points ahead of them, turn toward the strongest reading, move forward, and deposit their own trail, reproducing the sense-turn-move-deposit cycle used in Physarum agent models.

What is stigmergy?

Stigmergy is indirect coordination where agents communicate by modifying a shared environment rather than by direct signalling. Here agents leave a chemical trail that other agents sense later, letting a coherent network emerge from purely local rules.

Why do the trails form efficient tube-like networks?

Paths that are reinforced by many agents decay more slowly than they are replenished, so heavily used routes between food sources grow stronger while weak, rarely used paths fade out, leaving only the most efficient connecting tubes.

What is the Tokyo rail-network experiment?

In a well-known 2010 study, researchers placed Physarum on a map of Tokyo with oat flakes marking city locations; the slime mold grew a network strikingly similar in efficiency and redundancy to the real Tokyo rail system.

What do the sensor angle and sensor distance controls do?

Sensor angle sets how far left and right of the heading the two side sensors are placed, and sensor distance sets how far ahead all three sensors sample the trail field; together they control how sharply and how far ahead agents can detect trails.

Why does the trail field blur and fade over time?

Each frame the trail grid is diffused with a box blur to spread pheromone to neighbouring cells and then multiplied by a decay factor, which mimics the physical dilution and chemical breakdown of the trail-forming substance.

What happens when I click on the canvas?

Clicking places a new food source at that point. Food sources continuously emit a strong attractant signal that agents sense and move toward, which is why new tubes quickly grow to connect any freshly placed food.

About this simulation

Every agent on screen is blind to the whole network — it only ever reads three points of trail concentration a few pixels ahead of itself and turns toward the brightest one. There is no central planner deciding where a tube should go, yet watching the yellow haze condense from a diffuse cloud into crisp connecting lines between food sources shows how millions of purely local, myopic decisions can add up to a network as efficient as a human-engineered rail map.

🔬 What it shows

A population of simple agents depositing a decaying, diffusing trail field that self-organises into thickened transport tubes connecting scattered food sources, reproducing the classic Physarum foraging network.

🎮 How to use

Click anywhere on the canvas to drop a new food source and watch tubes grow toward it; tune Sensor Angle, Sensor Distance and Turn Speed to change how agents track trails, and adjust Trail Decay and Diffusion to see networks stabilise or dissolve.

💡 Did you know?

In a real 2010 experiment, researchers grew Physarum polycephalum over a map of the Tokyo area with oat flakes at station locations, and the slime mold spontaneously reconstructed a network nearly identical in efficiency to the actual Tokyo rail system.

Frequently asked questions

What is Physarum polycephalum?

Physarum polycephalum is a single-celled slime mold that forages by extending a network of protoplasmic tubes across a surface. Despite having no brain or nervous system, it can solve maze and network-optimization problems.

How does the simulation model the slime mold's behaviour?

Thousands of simple agents each sense a shared trail field at three points ahead of them, turn toward the strongest reading, move forward, and deposit their own trail, reproducing the sense-turn-move-deposit cycle used in Physarum agent models.

What is stigmergy?

Stigmergy is indirect coordination where agents communicate by modifying a shared environment rather than by direct signalling. Here agents leave a chemical trail that other agents sense later, letting a coherent network emerge from purely local rules.

Why do the trails form efficient tube-like networks?

Paths that are reinforced by many agents decay more slowly than they are replenished, so heavily used routes between food sources grow stronger while weak, rarely used paths fade out, leaving only the most efficient connecting tubes.

What is the Tokyo rail-network experiment?

In a well-known 2010 study, researchers placed Physarum on a map of Tokyo with oat flakes marking city locations; the slime mold grew a network strikingly similar in efficiency and redundancy to the real Tokyo rail system.

⚙ Under the hood

Physarum polycephalum-style agents deposit and sense a decaying trail field, self-organising into efficient transport networks between food sources — the same algorithm behind the Tokyo rail-network experiment.

Canvas 2DPhysarumSlime MoldStigmergyNetwork Optimization

2D · HTML5 Canvas 2D · 60 FPS target · runs fully client-side, no install

What did you find?

Add reproduction steps (optional)