cellular automata
i made a program for generating cellular automata


I made a program that generates CA cellular automata. turns out its called wolfram
Stephen Wolfram studied this in the 80's.
Elementary Cellular Automaton -- from Wolfram MathWorld
The simplest class of one-dimensional cellular automata. Elementary cellular automata have two possible values for each cell (0 or 1), and rules that depend only on nearest neighbor values. As a result, the evolution of an elementary cellular automaton can completely be described by a table specifyi…

the different patterns are just different repesentations of binary numbers from 0-255 (0000 0000 - 1111 1111)
Rule 30 is the most popular (binary 00011110 = decimal 30)








the code
GitHub - wisehackermonkey/celular-automata
Contribute to wisehackermonkey/celular-automata development by creating an account on GitHub.
the interesting bit
code is processing.org python mode
def calc_grid():
global current_row
global rule
if current_row < height - 1:
next_row = [0] * width
for i in range(width):
if i == 0:
next_row[i] = grid[current_row][i+1]
elif i == width - 1:
next_row[i] = grid[current_row][i-1]
else:
window = grid[current_row][i-1:i+2]
if window == [1, 1, 1]:
next_row[i] = rule[0]
fill(0)
elif window == [1, 1, 0]:
next_row[i] = rule[1]
fill(32)
elif window == [1, 0, 1]:
next_row[i] = rule[2]
fill(64)
elif window == [1, 0, 0]:
next_row[i] = rule[3]
fill(96)
elif window == [0, 1, 1]:
next_row[i] = rule[4]
fill(160)
elif window == [0, 1, 0]:
next_row[i] = rule[5]
fill(192)
elif window == [0, 0, 1]:
next_row[i] = rule[6]
fill(224)
elif window == [0, 0, 0]:
next_row[i] = rule[7]
fill(255)
grid[current_row + 1] = next_row
current_row += 1
draw_grid()
Note:
rule = [0,0,0,1,1,1,1,0]
here's how the rules work

Thanks for reading!

Author 
by o()r()a()n c()o()l()l()i()n()s
github.com/wisehackermonkey