Petri, the petri-dish simulator

Jul 27, 2015

programming, c++, biology, automata, and evolution

Lately I’ve been very interested in the idea of cellular automata and had an couple of attempts at replicating Conway’s game of life or played around with existing implementations. However, after being particularly bored on a Saturday afternoon I decided to start writing what I disingenuously called a petri dish simulator.

alt text

At the moment the program is rather simple, there are cell objects and food objects that are randomly placed in a grid of constant size. These cells have a few properties including size, energy and metabolism. The basic idea is that cells with higher metabolism will move around faster but die quicker without food, while cells with greater size will be able to consume smaller cells for energy but move more slowly and require more energy to do so. The eventual plan is to have these properties be passed on to their children with random mutations so that cells who are better suited to their surroundings will propagate.

At the moment the total amount of energy in the system is always decreasing as cells move however and there is currently no energy input into the system. In future this would hopefully be added through food randomly being added to the grid, but another possibility would be to add energy expended by cells to the grid so it can be collected when moving so that no energy is lost.

Eventually it would also be nice to create conditions where predator and prey relationships evolve, but this would require a very large grid and several new instance variables for the cells including the ability to collect energy or detect and consume other cells more effectively.

There are also some pretty horrible inefficiencies in the way in which the grid is displayed which I am actively working to improve.

Check out the repository here.

Previous Next