One-dimensional cellular automata: Difference between revisions

m
Line 2,624:
<lang lb>' [RC] 'One-dimensional cellular automata'
 
' does not wrap so fails for some rules
 
global rule$, state$
 
rule$ ="00010110" ' Rule 22 decimal
 
Line 2,632 ⟶ 2,630:
 
for j =1 to 20
print state$
oldState$ =state$
state$ ="0"
for k =2 to 32len( oldState$) -1
NHood$ =mid$( oldState$, k -1, 3) ' pick 3 char neighbourhood and turn binary string to decimal
vNHood =0
Line 2,643 ⟶ 2,642:
state$ =state$ +mid$( rule$, vNHood +1, 1)
next k
state$ =state$ +"0"
 
print state$
next j