One-dimensional cellular automata: Difference between revisions
→Python :: Composition of pure functions: Adjusted one value name for legibility
(→{{header|Python}}: Added a generalised variant (any Wolfram rule) constructed as a composition of pure functions.) |
(→Python :: Composition of pure functions: Adjusted one value name for legibility) |
||
Line 4,018:
# nextRowByRule :: Int -> [Bool] -> [Bool]
def nextRowByRule(
'''A row of booleans derived by Wolfram rule n
from another boolean row of the same length.'''
Line 4,024:
# step :: (Bool, Bool, Bool) -> Bool
def step(l, x, r):
return bool(
# go :: [Bool] -> Bool
|