Cell Simulation in Javascript: Plants and critters

A little simulation I've programmed in javascript which can be run in the browser.

Simulation preview.

Screenshot of the simulation after a few hours of runtime. The green dots are the immobile plants and the red dots are the critters which move around. The red-black background shows the distribution of a resource.

This is a followup to the RGB cell simulation and reuses most of the code with a few rule changes.


The resources are:

  • Water (blue)
  • Soil (red)
  • Food (green)

The actors are:

  • Plants (green)
  • Critters (red)

Resource transformation:

  • Plants follow a life cycle of consuming water and soil and producing seed until the end of the life where the seed is spread over an area and forms new plants. Plants are immobile.
  • Critters are mobile and consume food provided by plants and transform it into waste.
  • Waste turns into soil.
  • Water gets replenished at a rate for the whole map.

Watch for yourself