Slime mold

Jump to: navigation, search


Slime mold (or more accurately physarum polycephalum) is a slime mold that inhabits shady, cool, moist areas, such as decaying leaves and logs. Like slime molds in general, it is sensitive to light; in particular, light can repel the slime mold and be a factor in triggering spore growth. The interesting factor of this mold for my purpose of simulation is the smart-like path finding. This was demonstrated by Harvard Magazine in a topic of solving a simple 2D maze, with finding the shortest path. Also in another demonstration was proven, when the researchers place food at cities on the map, the fungus collaborates, spreading out to map many possible configurations and then dying away to highlight the shortest routes between cities and the most efficient overall system map. For more see: link (

Problem definition

The biggest challenge of this simulation is the correct format of the pattern movement when the mold spreads. The ability to find most effective route while keep this randomized movement pattern is the alfa and omega of the whole simulation. The movement itself is useless without considering the mold is also living organism and as every living organism its main purpose is to survive. Therefore there has to be a resource in place to be capable of deciding when the mold actually dies. This resource is of course possible to replenish by some interaction with the environment – and that’s surviving in a nutshell. In order to correctly replicate the well know pattern movement from nature the agents have to be compliant with two vital rules. Diffusion-limited aggregation describes how replicate such pattern with particles moving corresponding to a Brownian motion.


A DLA consists of particles that attach to each other. How they attach is described here. First of all, we start with a complete empty space and put one particle somewhere in it. Now, a second particle is 'fired' at an infinitely distance away from this particle. This new particle keeps moving randomly in the empty space until it collides with the already placed particle. At this moment, the particles attach to each other and are settled. Now a third particle is fired likewise, and the same procedure repeats itself over and over.

Brownian motion

If a number of particles subject to Brownian motion are present in a given medium and there is no preferred direction for the random oscillations, then over a period of time the particles will tend to be spread evenly throughout the medium. Thus, if A and B are two adjacent regions and, at time t, A contains twice as many particles as B, at that instant the probability of a particle’s leaving A to enter B is twice as great as the probability that a particle will leave B to enter A.


Simulation is created using Netlogo 6.0.2.



Agents are spawned and placed on the edge of the world facing in to the center. Every tick they move unpredictably and if they reach to the edge they will deleted. In this instance we call the agents spores and they only purpose is to die. One way I already mentioned, the second is to bump to a slime mold cell. The creation of new spores depends on current number of spores in the simulation (to prevent from clustering) and on the resources of the mold in this world. Every unit of resource is one agent which is capable of creating one slime mold cell. Their visibility can be switch on and off by user. Spores are created from resource called “endurance of mold” every cycle up to number defined by “spores by cycle”.

Slime mold

The yellow pixels represent the slime mold itself. Those cell are static and are waiting for incoming spores to help them find food (spread). Current number of mold cell are displayed in the plot “Number of mold cells” with additional exact number. The origin point can be put directly in to the center of the world. Also the number of the origin points can be up to 5 and they are going to be generated in random points in defined radius.


The food is represented in this simulation as a red pixels. The amount of these pixels can be shifted up to 50 by user and are generated randomly in defined radius around circle. The amount of gained resources can be also adjusted up to 20000 with slider named “power of food”. Once agent (spore) connects the slime mold with a food pixel the mold gains that defined amount of resources immediately.


In every tick agents move forward in a random matter and if there is a collision with a mold cell, they transform itself in that cell also - spreading in to space. The randomized spawning was a little bit tricky without the ability to correctly generating signed integers. To workaround this I came up with:

ifelse random 1 = 1 [set originX random-float 80] [set originX random-float -80]  ;;true random signed int
ifelse random 1 = 1 [set originY random-float 80] [set originY random-float -80]  ;;true random signed int

In a setup we set the patch size to a much smaller number, otherwise the patterns would not have been so visible. After setting all user-depended inputs there is endless cycle of wandering spores waiting to be terminated.


The pattern replicating was u huge success.

Run down1.jpg

There are really obvious similarities between our simulation and the video showcasing the spreading of the mold. Also the food which is founded by the mold is very clear on the plot of the resources.

Mold found food.jpg

One very interesting founding is that if there are 4 or 5 points of origins, there is a high probability of drying out one or two branches and the other remaining branches wraps around them.

5 origins points.jpg

- red are the dry ones, green are the healthy ones

Sadly considering the nature of spreading of this mold there is an area given by the inner circle of the square-world, which formulates an impenetrable layer. There is a trigger for this in code, however in the random generated origins scenario there is a high possibility of triggering this very early in to simulation.

Edge of radius.jpg

Numeric results

Considering the nature of our simulation I decided to do extensive experimenting only with one point of origin in the center. Other alternatives were way too inconsistent considering so many depending variables were random generated. Together with the random motion of particles it was nearly impossible to derive any meaningful results. For the conservative scenario there is threshold around 4000 units of mold-resource, where doesn’t really matter if there are any food present. Everything above 4000 units of mold-resource is very depended on the number, strength and location of the food. Above 25000 – 35000 units of mold-resource is almost certain that mold will consume all the food in the world. And above 90000 there is for mold not really need for food to be present in the world whatsoever. The effectiveness of the spores seems to be something below 20% - which means more than 80% spores die because they wander off the world’s edge.


The simulation were successful in replicating the pattern of the slime mold with the help of DLA algorithm. Unfortunately there were several issues with the simulation on the technical side as well as on the simulation side. The possibilities with randomizing points of origins turned out to be not useful at all for drawing any meaningful conclusions. The world is very limited and therefore the patches has to be shrinked down by a lot. That leads in simulations with ending at some millionth tick. Adding that the number of particles in this world that needs to be redrawn every cycle leads to a very heavy computing power-hungry simulation.


External source:!Hf0bjuUH3dCS/slime-mold-nlogo

Internal source: File:Slime mold.nlogo