"""

The table below depicts the Cellular Automata rule set known as #110.
This is because the output values, when read from bottom to top create
the string: 01101110.  When treated as a binary number, where the most
significant bit is on the left, this represents the the number 110 in
decimal.

Rule Left   Cell   Right      Output
     ----   ----   -----      ------
  0    0     0       0          0
  1    0     0       1          1
  2    0     1       0          1
  3    0     1       1          1
  4    1     0       0          0
  5    1     0       1          1
  6    1     1       0          1
  7    1     1       1          0

This rule set has a radius of 1 because it only considers one cell on
either side of the current cell to determine the next output value for
that cell.

"""

from pyrobot.general.ca import *

rules = Rules(radius = 1)
rules.init(110)
rules.display()
data = Lattice()
data.init('0'*data.size)
data.data[0][data.size/2]=1
rules.applyAll(data)
data.display()

"""
Experiment with different starting conditions:

data.randomize(0.1)  # randomly initializes 10% of bits to 1
data.display(0)      # displays the initial state of the CA
rules.applyAll(data) # applies the rules for a fixed number of generations
data.display()       # displays the space-time diagram
"""

