Tutorial 17: Feedback Using Named Matrices
This tutorial shows a simple example of using named jit.matrix objects in a feedback loop. We'll use a matrix of random values to seed an iterative process (in this case, Conway's Game of Life).
The tutorial patch generates an initial matrix of randomized values with the jit.noise object:
The jit.noise object generates a Jitter matrix full of random values. The , , and attributes of the object determine its output matrix (in this instance, we want an x cell matrix of one-plane char data). Our random cell values (which are initially in the range - ) are then set to false ( ) or true ( ) by the jit.op object. The operator to jit.op takes the value from the number box (arriving at the right inlet of the object) and uses it as a comparison operator. If a cell value is below that value the cell's value is set to . Otherwise the cell is set to . Sending a to jit.noise will generate a new random matrix.
Jitter Matrix Feedback
This jit.matrix object, which receives messages from a metro object at the top of the patch, is connected to an object called jit.conway, the output of which is hooked up to another jit.matrix with the same ( ) as the first. The result of this is that the output of the jit.conway object (whatever it does) is written into the same matrix that its input came from, creating a feedback loop.
If you want to start with a fresh random matrix, you can always copy a new matrix into the feedback loop by clicking the button attached to thejit.noise object. The matrix from the jit.op object will go into our shared matrix and will be used in the feedback loop.
The Game of Life
The jit.conway object performs a very simple cellular automata algorithm called the 'Game of Life' on an input matrix. Developed by John Conway at Princeton University, the algorithm simulates cycles of organic survival in an environment with a finite food supply. The cells in the matrix are considered either alive (non- ) or dead ( ). Each cell is compared with the cells surrounding it in space. If a live cell has two or three live neightbors, it stays alive. If it has more or less than that number, it dies (i.e. is set to ). If a dead cell has exactly three live neighbors it becomes alive (i.e. is set to ). It's that simple.
Every time the jit.conway object receives an input matrix it performs one generation of the Game of Life on that matrix. Therefore, it makes sense to use the object inside of a feedback loop, so we can see multiple generations of the algorithm performed on the same initial set of data.
For example, the initial random matrix:
Generates the following matrices in the first four iterations through the jit.conway object:
After seeding the feedback loop with a random matrix, you can turn on the metro object and watch the algorithm run! The Game of Life is designed in such a way that the matrix will eventually stabilize to either a group of self-oscillating cell units or an empty matrix (a dead world). In either case you can just in a new set of numbers and start all over again.
You can use the jit.matrix object to create feedback loops in your Jitter processing. By using two jit.matrix objects with the same at either end of an object chain, you create a patch where the output of the chain gets written to the same Jitter matrix as the input comes from. The jit.noise object generates matrices of random numbers of any , , or . The jit.conway object, which works best within such a feedback loop, performs simple cellular automatation on an input matrix.attribute of the