Elementary Cellular Automata¶
The neet.boolean.ECA
class describes an Elementary Cellular Automaton with an
arbitrary rule.
-
class
neet.boolean.
ECA
(code, size, boundary=None, names=None, metadata=None)[source]¶ ECA represents an elementary cellular automaton rule. Each ECA contains an 8-bit integral member variable
code
representing the Wolfram code for the ECA rule and a set of boundary conditions which is eitherNone
, signifying periodic boundary conditions, or a pair of cell states signifying fixed, open boundary conditions. As with allneet.Network
classes, the names of the nodes and network-wide metadata can be provided.In addition to all inherited methods, ECA exposes the following properites:
code
The Wolfram code of the elementary cellular automaton. boundary
The boundary conditions of the elemenary cellular automaton. Parameters: Raises: - ValueError – if
code
is not in \(\{0,1,\ldots,255\}\) - ValueError – if
boundary
is a neitherNone
nor a pair of binary states
-
code
¶ The Wolfram code of the elementary cellular automaton.
Examples
>>> eca = ECA(30, size=5) >>> eca.code 30 >>> eca.code = 45 >>> eca.code 45 >>> eca.code = 256 Traceback (most recent call last): ... ValueError: invalid ECA code
Type: int Raises: ValueError – if code
is not in \(\{0,1,\ldots,255\}\)
-
boundary
¶ The boundary conditions of the elemenary cellular automaton.
Examples
>>> eca = ECA(30, size=5) >>> eca.boundary >>> eca.boundary = (0, 1) >>> eca.boundary (0, 1) >>> eca.boundary = None >>> eca.boundary >>> eca.boundary = [0, 1] Traceback (most recent call last): ... TypeError: ECA boundary are neither None nor a tuple
Type: tuple, None Raises: ValueError – if boundary
is a neitherNone
nor a pair of binary states
- ValueError – if