# What does rule 30 mean in this example? [closed]

This starts with the list given, then evolves rule 30 for four steps.

In[1]:= CellularAutomaton[30, {0, 0, 0, 1, 0, 0, 0}, 4]

Out[1]= {{0, 0, 0, 1, 0, 0, 0}, {0, 0, 1, 1, 1, 0, 0}, {0, 1, 1, 0, 0, 1,
0}, {1, 1, 0, 1, 1, 1, 1}, {0, 0, 0, 1, 0, 0, 0}}

• Here's one way to specify your CA: stackoverflow.com/q/11326620/1725571 – bill s Mar 11 '14 at 21:38
• Please do not change the question or ask different questions after you have gotten answers. Open a new question instead. – rm -rf Mar 11 '14 at 22:55
• I really think this is all explained in the documentation. Cellular automata are not particularly easy to understand, since the rule number is an encoded (i.e. obfuscated) form of the automaton. I always find it takes a bit of concentration and work to figure out how to specify the automaton I want, but the docs have always given me the principles I need to work it out. – Michael E2 Mar 11 '14 at 23:10

The "rule" for CAs defines the mapping that is used to calculate successive generations. When you have 3-neighborhoods (one to each side of the current element) there are 8 patterns that can occur: 111, 110, 101, 100, 011, 010, 001, 000. Each of these patterns must be mapped to some binary value. For example the rule that takes 111->0, 110->0, 101->0, 100->1, 011->1, 010->1, 001->1, 000->0 is called rule 30, since the sequence of numbers 00011110, interpreted in base 2, is 30. Accordingly, there are 256 possible 3-neighbor CAs, and this number increases rapidly as the neighborhood increases in size.

Here is a visualization of what bill s told:

GraphicsRow[
GraphicsColumn[
{Style[2^#, Medium],
ArrayPlot[
{#, {0, CellularAutomaton[30, #, {{1}, {1}}][[1, 1]], 0}},
Mesh -> All] &@IntegerDigits[#, 2, 3]}
] & /@ Range[0, 7]]


First row of cells represents eight 3-bit binary values from 0 to 7. The middle cell on the second row displays the result of rule 30 generated by three cells above it. If you sum up numbers above these visualizations for every black cell, you end up with 30, and this holds also for other automaton rules numbered this way.