One-dimensional cellular automata: Difference between revisions
One-dimensional cellular automata (view source)
Revision as of 13:00, 27 February 2014
, 10 years ago→{{header|Perl 6}}: simplification
m (→{{header|Perl 6}}: splitting code + fixing indent) |
(→{{header|Perl 6}}: simplification) |
||
Line 2,363:
<lang perl6>class Automata {
has ($.rule, @.cells);▼
▲ has @.cells;
method gist { <| |>.join: @!cells.map({$_ ?? '#' !! ' '}).join }
method code {
method succ {
self.new: :$.rule, :cells(
self.code
Z+ 2 «*« @.cells
Z+ @.cells.rotate(-1)
)
}
|