In this example, we will build a simple cellular automaton based on John Conway's Game of Life. The main idea is that this engine will perform operations from a grid at a time t to a grid at a time t+1. The grid (in 2D) contains cells which can be either alive or dead. Consider a 3x3 patch within this grid, if the center cell is dead at time t and surrounded by exactly three neighbours alive, then it will be alive at time t+1 or will remain dead otherwise. If the center cell is alive at time t and surrounded by either two or three neighbours alive, then it will stay alive at time t+1, or it will die otherwise.
The filter will read a local 3x3 window over the current location :
We write the following script, life.ppl :
// Grid size (get from the program, force RGB 8 bits per channel) :
We can now connect the two, then loop over the lifePipeline (with buffer cells, as described in Using The Library). It will produce something similar to the following animation :
Generated on Sun Aug 30 2015 21:57:59 for GLIP-Lib by 1.8.8