@jeff, yes, this method works for all the rules. It’s based on me staring at the CA thing until it finally dawned on me how smart and simple Wolfram’s coding scheme is. It works like this:
This kind of 1D CA determines the next state of a cell by looking at the cell and it’s neighbors to the left and right. They’re binary - can only be on or off. Taken together, they make a 3 bit number, which will have a value from 0 to 7 depending on the cell configuration.
In Wolfram’s scheme, the rule number (0…255) is simply a binary encoding of what the next cell state should be for each of the 8 possible configurations. 8 bits == 256 rules.
So to generate the next state, all you have to do is use the current state to get your 3 bit 0-7 configuration code
n, then look up bit
n in the rule. If it’s 1, then the cell lives. If 0, it dies.
And yeah, the wrapping is dubious. I kept it in because it looks cooler in the display version, and doesn’t seem to interfere visibly with the chaos. But I didn’t test it, and I should, particularly since I just built tools to do so.
Clearly, there will be randograms, with and without wrap in the near future! I can test various widths too, but I did find a paper where somebody had actually patented a variant of this with only 27(!?) columns. I’m really curious about what other interesting looking streams of bits I can get out of this , maybe using some of the less chaotic rules, or switching periodically between rules. It’s a fun toy to have around!