Cells
My latest development project is a simulation of cells that runs in the browser. The simulation shows the change in number of cells over time. There are 2 kinds of cells: green cells with a fixed position and movers colored red and blue. The simulation is based on a few rules:
- The top of the area is connected to the bottom and the left side to the right side. So cells moving beyond a side will appear on the other side
- Each cell has an energy level ranging from 1 to 100. When the energy level reaches 0 the cell is removed.
- Green cells have a fixed position and store energy, which is supplied automatically in every step.
- Blue/red cells are movers with a random motion. Their color indicates their energy level. Blue cells have a high energy level and as their level drops they turn red.
- When a mover is positioned on an energy cell it may take in some of the energy.
- If the energy of a cell is above a certain limit it can split and create a new cell. This reduces the energy level of the original cell.
- When energy cells reach their allowed age, the amount of energy slowly reduces and the cell disappears when no energy is left. This is visible as a color change from orange into darker brown. When movers reach their age a random choice in each step determines if they continue or are removed.
Status bar
The top of the screen shows a status bar with the amount of cells, steps and changes over time. There are also 2 icons, one to start a new simulation, and one to show a dialog with settings.
Settings
The direction to move, place new cells, energy levels when to split, amount to take in energy, etc. are all influenced by random factors. The settings let you change a number of values that are used during the simulation. For example, you can view the effect of storing more of the incoming energy or higher split rate.
Zoom level
The number of cells depends on the size of the area and the zoom level. Reducing the zoom level increases the amount of cells. This will also slow down the simulation because of the increased number of calculations. To balance this you can increase the time between screen redraws. Because redrawing the screen also takes time, increasing this waiting period speeds up the simulation. The cost for this is that you will see less of the individual changes of each step.