3 Nov 2005 09:37
computing with really simple machines
<kragen <at> pobox.com>
2005-11-03 08:37:01 GMT
2005-11-03 08:37:01 GMT
Universal cellular automata
---------------------------
There's a rumor from Stephen Wolfram that certain one-dimensional
two-state three-cell-neighborhood cellular automata are
Turing-complete, in particular rule 110. Here's a simple Python
script for running such 1-D CAs:
#!/usr/bin/python
import sys
def display(line):
sys.stdout.write(''.join([' #'[x] for x in line]) + '\n')
def run(n=110, ng=1000, nc=400, display=display):
cells = [0] * nc
cells[nc/2] = 1
for ii in range(ng):
display(cells)
newcells = [0] * len(cells)
for jj in range(1, len(newcells)-1):
index = 4 * cells[jj-1] + 2 * cells[jj] + cells[jj+1]
newcells[jj] = n & (1 << index) and 1 or 0
cells = newcells
if __name__ == '__main__':
run()
Supposing this rumor is correct, and rule 110 is indeed a universal
computer (which seems plausible even from the output from this
(Continue reading)
RSS Feed