One-dimensional cellular automata: Difference between revisions
Content deleted Content added
add language: Retro |
|||
Line 931: | Line 931: | ||
end</lang> |
end</lang> |
||
=={{header|Locomotive Basic}}== |
|||
<lang basic>10 MODE 1:n=10:READ w:DIM x(w+1),x2(w+1):FOR i=1 to w:READ x(i):NEXT |
|||
20 FOR l=1 TO n |
|||
30 FOR j=1 TO w |
|||
40 IF x(j)=1 THEN PRINT "#"; ELSE PRINT "_"; |
|||
50 IF x(j-1)+x(j)+x(j+1)=2 THEN x2(j)=1 ELSE x2(j)=0 |
|||
60 NEXT:PRINT |
|||
70 FOR j=1 TO w:x(j)=x2(j):NEXT |
|||
80 NEXT |
|||
90 DATA 20,0,1,1,1,0,1,1,0,1,0,1,0,1,0,1,0,0,1,0,0</lang> |
|||
Output: |
|||
[[File:Cellular automaton locomotive basic.png|400px]] |
|||
=={{header|Logo}}== |
=={{header|Logo}}== |