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.
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.