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
coderepresenting 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.Networkclasses, the names of the nodes and network-wide metadata can be provided.
In addition to all inherited methods, ECA exposes the following properites:
codeThe Wolfram code of the elementary cellular automaton. boundaryThe boundary conditions of the elemenary cellular automaton. Parameters: Raises: - ValueError – if
codeis not in \(\{0,1,\ldots,255\}\) - ValueError – if
boundaryis a neitherNonenor 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 codeis 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 boundaryis a neitherNonenor a pair of binary states
- ValueError – if