Physarum

Population settings

Population
Color

Agent settings

Basic
Base
Deviation
Too much case
Too few case
Tools
Control panel

Physarum.md

Physarum  this is a remarkable microorganism capable of finding shortest paths. The tubular network is able to quickly change, reorganizing itself in such a way as to extract most effectively from the environment nutrients. At the same time, the slime mold does not have a single coordinating center, and the "memories" of the location of food is encrypted in the very architecture of the body (mycelium) of the organism. This saved the information is then used to make future decisions. This page presents an interactive simulation of the growth of such an organism inspired by fogleman.

How it works

Let's describe the principle of simulation: a set of agents are placed on the field, which move and leave behind a pheromone. Each agent has two sensors that pick up the pheromone and the direction of the gaze. The sensors are located at a configurable distance from the agent and are equidistant from the direct direction of his gaze. The pheromone in each cell can be from 0 to 255. The more pheromone is in the cell, the more pronounced the color it is drawn. The calculation of the pheromone and the position of the agents occurs according to next cycle:
  1. Determination of the amount of pheromone on sensors
    Each agent reads the amount of pheromone at two points - under the left and right sensor.
  2. Calculation of displacement
    Then the agents choose the speed and direction of movement. This also happens in several stages
    1. The situation is too much
      If there is too much pheromone on both sensors, then step and the angle is determined by separate settings
    2. Left more than right
      Step and turn are determined by the basic setting, turn it is carried out counterclockwise
    3. Right more than left
      Similar to the previous case, but the rotation is carried out clockwise
    4. The situation is too small
      If there is too little pheromone on both sensors, then step and the angle is determined by separate settings
    5. The situation of indifference
      If the amount of pheromone on the sensors is little different and the agent does not fall under any of the previous cases, then the step and the angle is determined by separate settings
  3. Pheromone spraying
    The amount of pheromone is added to the cell with the new position of the agent, according to the corresponding setting up
  4. Pheromone Reduction
    The amount of pheromone is removed from each cell of the field according to the corresponding setting
  5. Rendering
    Calculation of the color of each cell of the field depending on the amount of pheromone in it

Settings meaning

  • Population settings
    • Number of agents
      Number of agents per field
    • Pheromone by step
      The amount of pheromone added in step 3
    • Pheromone decrease value
      The amount of pheromone that is removed at stage 4
    • Color
      Background color and pheromone color, according to which the linear gradient is calculated
  • Agent settings
    • Farsight
      The distance to which the agent's sensors are separated from himself
    • Speed
      The value by which the step value is unconditionally multiplied
    • Base rotation
      The turn of the agent in case the pheromone is not too much and not too little and the difference is on sensors, it is significant (carried out in the direction of the sensor with a large number of pheromone)
    • Base step
      Agent step in case the pheromone is not too much and not too little and the difference is on sensors , it is essential
    • Normal pheromone range
      The lower and upper limit of the amount of pheromone, within which the basic step and turn
    • Deviation angle
      The angle by which the sensors deviate from the direction of the agent's gaze
    • Less deviation rotation
      The angle of rotation of the agent in the case described in paragraph 2.5
    • Less deviation step
      Agent's step in the case described in paragraph 2.5
    • Too much case
      Check the upper limit of the pheromone. If disabled, then 2.1 is skipped
    • Too much rotation
      Turn in the case of paragraph 2.1
    • Too much step
      Step in case of paragraph 2.1
    • Too few case
      Check the lower border of the pheromone. If disabled, 2.4 is skipped
    • Too few rotation
      Turn in the case of paragraph 2.4
    • Too few step
      Step in case of paragraph 2.4
    • Random
      Replace current settings with random ones
    • Restart
      Restart the simulation with the current settings