A colorful simulation of the physarum polycephalum. A slime mold.
Each slime cell is represented by a pixel. Every iteration a slime samples the area to the front, front-left and front-right. Depending on the color value of each sample it will decide whether to turn left, turn right or move straight ahead. These simple rules cause the slimes to form these organic looking patterns.
The values for the sense directions, sense distance, turn angle and movement speed are different for each color.
Depending on the hash, the different colors also have a chance to be "infectious", causing other slime to turn to their color if they touch. (Red eats green, green eats blue, blue eats red).
Many thanks to these two resources from which I learned about this interesting slime :) https://www.sagejenson.com/physarum https://github.com/nicoptere/physarum
Created with Three.js