/ other

The Beauty of Slime Molds

The Beauty of Slime Molds

Physarum polycephalum, often referred to as the “many-headed slime,” is a slime mold that inhabits shady, cool, moist areas, such as decaying leaves and logs.

Emergence

What makes it fascinating for computer scientists is its ability to find the shortest path through a maze, a behavior that emerges from simple local rules without a central brain.

This website uses a simulation based on Jeff Jones’s paper “Characteristics of Pattern Formation and Evolution in Approximations of Physarum Transport Networks.”

The Algorithm

The algorithm consists of agents that leave a trail as they move. They sense the trail ahead of them and turn towards the strongest signal. This simple feedback loop creates complex transport networks.

// Simplified logic
function turn(agent) {
  const left = sense(agent, -angle);
  const right = sense(agent, +angle);
  const center = sense(agent, 0);

  if (center > left && center > right) {
    // continue straight
  } else if (center < left && center < right) {
    // turn randomly
  } else if (left > right) {
    // turn left
  } else {
    // turn right
  }
}

This simple logic gives rise to the mesmerizing patterns you see in the background.