One-dimensional cellular automata: Difference between revisions
One-dimensional cellular automata (view source)
Revision as of 11:42, 27 February 2014
, 10 years ago→{{header|Perl 6}}: adding wp link and fixing indent
m (→{{header|Perl 6}}: precisions about the choice of the rule number.) |
m (→{{header|Perl 6}}: adding wp link and fixing indent) |
||
Line 2,360:
=={{header|Perl 6}}==
We'll make a general algorithm capable of computing any cellular automata as defined by [[wp:Stephen Wolfram|Stephen Wolfram]]'s famous book ''[[wp:A new kind of Science|A new kind of Science]]''. The rule currently proposed for this task is rule 0b01101000 = 104 but it is not particularly interesting so instead we'll show the automata defined by rule n°90, which shows a [[wp:Sierpinski Triangle|Sierpinski Triangle]]-like figure.
<lang perl6>class Automata {
Line 2,371:
self.new: :$.code, :cells(
self.mapping{
4 «*« @.cells.rotate(-1)
Z+ 2 «*« @.cells
Z+ @.cells.rotate(1)
|