Yeah, at this point it’s identical to what Loren described here on twitter.

This is in javascript because I wanted to test some es6 features I haven’t used before.

A rule is a 2d array containing values of 0, 1, 2, or 3:

Here’s the JS that applies the rule to each cell:

Every step, for each cell, we loop through the neighboring cells in its Moore Neighborhood (the 8 cells around it, not counting itself).

We count the number of neighbors that have 1s and 2s.

We use the 1s value to pick a row in the rule array, and the 2s value to pick an element from that array. (That values is stored as ‘outcome.’)

The outcome of 3 is “stay the same,” so we just return the cell’s same value.

Otherwise, we return whatever value was in the rule table at rule[ones][twos].

For the non-programmers reading this, just read it as “each cell gets a new value determined by counting how many of each type of neighbor it has.”

Future areas for expansion I might tackle: random chance in rules, randomly setting a few cells to random values each step, adding history as a rule input, adding more possible states (represented by a larger color palette), having cells’ colors determined by combinations of their neighbors colors.

Thanks for the question :)