Physarum Slime Mold Simulator (2D)

This top-down 2D simulation models Physarum polycephalum as thousands of independent agents moving over a shared pheromone trail field. Each agent has three sensors — front-left, center, and front-right — that sample the trail map's intensity ahead of it; the agent turns toward the strongest reading and deposits a fresh trail at its new position. The entire trail field then diffuses and decays every frame, so only trails reinforced by many agents persist while stray wandering fades away. Out of these purely local sensing-and-depositing rules, the colony self-organizes into the same branching, network-optimizing transport lines the real organism uses to connect food sources. Adjust agent density, sensor geometry, turn speed, deposit strength, and trail persistence to see how each parameter reshapes the emergent network.