cellular_automaton


cellular_automaton, a C code which demonstrates the behavior of the 1D Cellular Automaton rule #30.

This program carries out iterations of the 1D cellular automaton known as rule 30.

Given an initial linear array of 0's and 1's, rule 30 produces a new array using transformations based on each value and the value of its left and right neighbors, as follows:

      111  110  101  100  011  010  001  000
       V    V    V    V    V    V    V    V
       0    0    0    1    1    1    1    0     
      
Note that there are 256 = 2^8 possible ways to fill in this output chart, and that rule 30 gets its index by the fact that (0,0,0,1,1,1,1,0) can be interpreted as the binary representation of 30.

For instance, if the current values of X(4), X(5) and X(6) are 0, 1 and 1, respectively, then the new value of X(5) will be 1.

The first and last entries of the array must be treated specially, since they don't have a left or right neighbor. One simple treatment is to assume that there are phantom neighbors whose values are both 0. Another is to enforce periodic boundary conditions.

Licensing:

The computer code and data files described and made available on this web page are distributed under the MIT license

Languages:

cellular_automaton is available in a C version and a C++ version and a Fortran90 version and a MATLAB version and an Octave version and a Python version.

Related Data and Programs:

cellular_automaton_test

life_opengl, a C code which uses OpenGL to display the evolution of John Conway's Game of Life, by Simon Green.

Reference:

  1. Christian Hill,
    Problem P4.3.3,
    Learning Scientific Programming with Python,
    Cambridge University Press, 2020,
    Second Edition.
  2. Stephen Wolfram,
    A New Kind of Science,
    Wolfram Media, 2002,
    ISBN13: 978-1579550080,
    LC: QA267.5.C45.W67.

Source Code:


Last revised on 22 September 2023.