Merry Christmas Monks!!!
perl -e 'for(1..40){push(@a1,($_==20? "^" : " "))};$l=@a1;while(1){@a2 +="";print "@a2\n@a1\n";for(0..($l-1)){$a2[$_] = ($a1[$_] eq " " ? ($a +1[$_-1] eq "^"? "^" : ($a1[$_+1] eq "^" ? "^" : " ")) : ($a1[$_-1] eq + " " ? "^" : ($a1[$_+1] eq " " ? "^" : " ")))}qx(sleep 1);@a1=@a2;}'
alternate = liner incorporating blazar's suggestion :
perl -le '$l=80;$l2="!" x $l;substr+($l2^=$l2),$l/2,1,"\xFF";{local $_ +=$l2;y/\0\xFF/ ^/;print;($lf,$rt)=map{substr $l2 x 2,$_%$l,$l;}1,-1;$ +l2=$lf^$rt;select undef,undef,undef,.1;redo}'

Replies are listed 'Best First'.
Re: Christmas Lights = keeping a terminal alive with a CA
by blazar (Canon) on Dec 27, 2005 at 12:50 UTC

    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__
Re: Christmas Lights = keeping a terminal alive with a CA
by turo (Friar) on Dec 28, 2005 at 16:05 UTC

    Oh God!!! Sierpinski Triangle in a perlish flavoured ASCII Art!!!!
    Wow, i'm really impressed!!

    turo

    PS: umm, ... i'm wondering, why didnt' you post this code-opera at 'Obfuscation' or 'Poetry' or 'Perl Hacks :-P' ... anyway ... it's really cool :-)

    perl -Te 'print map { chr((ord)-((10,20,2,7)[$i++])) } split //,"turo"'