Running this, I see that this is a typical "XOR-like" cellular automata, but a quick glance at the code, without any serious attempt to dissect it in detail, reveals that you're doing all the heavylifting yourself, whereas you may have perl do it for you courtesy of bitwise operators acting on strings. Here follows a minimal example exploiting them. It does something similar to yours. Of course it's left as an exercise to you to suitably golf/obfuscate it if you like. I used a similar technique in My 1st post (japh).

#!/usr/bin/perl -l use strict; use warnings; my $len=80; my $line = '!' x $len; substr +($line ^= $line), $len/2, 1, "\xFF"; { local $_=$line; y/\0\xFF/ ^/; print; my ($lf, $rt) = map { substr $line x 2, $_ % $len, $len; } 1, -1; $line=$lf ^ $rt; select undef, undef, undef, .1; redo; } __END__

In reply to Re: Christmas Lights = keeping a terminal alive with a CA by blazar
in thread Christmas Lights = keeping a terminal alive with a CA by l3v3l

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.