Anonymous user
One-dimensional cellular automata: Difference between revisions
m
→{{header|REXX}}: added/changed comments and whitespace, changed indentations.
(added GFA Basic example) |
m (→{{header|REXX}}: added/changed comments and whitespace, changed indentations.) |
||
Line 3,619:
=={{header|REXX}}==
This REXX version will show (as a default) 40 generations, or less if the generations of cellular automata repeat.
<lang rexx>/*REXX program
parse arg $ gens .
if
if gens=='' | gens=="," then gens=40 /* "
do #=0 for gens /* process the one-dimensional
say " generation" right(#,length(gens)) ' ' translate($, "#·", 10)
@=0 /*+ generation*/▼
@=0
if x==011 | x==101 | x==110
$=@ /*now use the next generation of cells.*/▼
if $==@ then do; say right('repeats', 40); leave; end /*does it repeat? */
$=@
'''output''' when using the default input:
<pre>
|