One-dimensional cellular automata: Difference between revisions

Content added Content deleted
m (→‎{{header|Phix}}: added syntax colouring the hard way)
(Added Quackery.)
Line 4,348: Line 4,348:
███ █ █████ ███ ███ ██ ███ ███ ██ ██ █ █████ █
███ █ █████ ███ ███ ██ ███ ███ ██ ██ █ █████ █
█ █ ██ ██ █ ██ █ ██ █ █████ ███ █ ███ █████ ██ ███ </pre>
█ █ ██ ██ █ ██ █ ██ █ █████ ███ █ ███ █████ ██ ███ </pre>

=={{header|Quackery}}==

<lang Quackery> [ stack 0 ] is cells ( --> s )

[ dup size cells replace
0 swap witheach
[ char # =
| 1 << ] ] is setup ( $ --> n )

[ 0 swap
cells share times
[ dup i >> 7 &
[ table 0 0 0 1 0 1 1 0 ]
rot 1 << | swap ]
drop 1 << ] is nextline ( n --> n )

[ cells share times
[ dup i 1+ bit &
iff [ char # ]
else [ char _ ]
emit ]
cr drop ] is echoline ( n --> )

[ setup
[ dup echoline
dup nextline
tuck = until ]
echoline ] is automate ( $ --> )

$ "_###_##_#_#_#_#__#__" automate</lang>

{{out}}

<pre>_###_##_#_#_#_#__#__
_#_#####_#_#_#______
__##___##_#_#_______
__##___###_#________
__##___#_##_________
__##____###_________
__##____#_#_________
__##_____#__________
__##________________
__##________________
</pre>



=={{header|R}}==
=={{header|R}}==