One-dimensional cellular automata: Difference between revisions
→{RPL entry
Thundergnat (talk | contribs) m (syntax highlighting fixup automation) |
|||
Line 5,064:
generation 8: 00110000000000000000
generation 9: 00110000000000000000
</pre>
=={{header|RPL}}==
Rather than assuming fixed values for cells beyond borders, it has been decided to make the board 'circular', as it is the case in many 2D versions. A new generation is directly derived from the output string of the previous generation.
{{works with|Halcyon Calc|4.2.7}}
≪ 1 10 START
DUP DUP 1 1 SUB
OVER DUP SIZE DUP SUB ROT + SWAP +
{ "_##" "#_#" "##_" }
→ gen lives
≪ "" 2 gen SIZE 1 - FOR j
lives gen j 1 - DUP 2 + SUB POS "#" "_" IFTE +
NEXT
≫
NEXT
≫
'CELLS' STO
"_###_##_#_#_#_#__#__" CELLS
{{out}}
<pre>
10: _###_##_#_#_#_#__#__
9: _#_#####_#_#_#______
8: __##___##_#_#_______
7: __##___###_#________
6: __##___#_##_________
5: __##____###_________
4: __##____#_#_________
3: __##_____#__________
2: __##________________
1: __##________________
</pre>
|