http://qs321.pair.com?node_id=528042

Important Note:  For the correct visual effect, run this in an xterm (Linux) or 'cmd' shell (Windows) at least 120 characters wide, and 48 characters tall.

In Windows, the Win32::Console::ANSI module is required.

Most will recognize that the picture is based on Erudil's amazing Camel Code, to which this is a tribute.

Update:  Fixed a minor warning.  (Also fixed spelling of "spatial")

#!/usr/bin/perl -w sub j(\$){($ P,$V)= @_;while($$P=~s:^ ([()])::x){ $V+=('('eq$1)?-32:31 }$V+=ord( substr( $$P,0,1,""))-74} sub a{ my($I,$K,$ J,$L)=@_ ;$I=int($I*$M/$Z);$K=int( $K*$M/$Z);$J=int($J*$M /$Z);$L=int($L*$M/$Z); $G=$ J-$I;$F=$L-$K;$E=(abs($ G)>=abs($F))?$G:$F;($E<0) and($ I,$K)=($J,$L);$E||=.01 ;for($i=0;$i<=abs$E;$i++ ){ $D->{$K +int($i*$F/$E) }->{$I+int($i*$G/$E)}=1}}sub p{$D={};$ Z=$z||.01;map{ $H=$_;$I=$N=j$H;$K=$O=j$H;while($H){$q=ord substr($H,0,1,"" );if(42==$q){$J=j$H;$L=j$H}else{$q-=43;$L =$q %9;$J=($q-$L)/9;$L=$q-9*$J-4;$J-=4}$J+=$I;$L+=$K;a($I,$K,$J,$ L) +; ($I,$K)=($J,$L)}a($I,$K,$N,$O)}@_;my$T;map{$y=$_;map{ $T.=$D->{$ +y} ->{$_}?$\:' '}(-59..59);$T.="\n"}(-23..23);print"\e[H$T"}$w= eva +l{ require Win32::Console::ANSI};$b=$w?'1;7;':'';($j,$u,$s,$t,$a,$n +,$o ,$h,$c,$k,$p,$e,$r,$l,$C)=split/}/,'Tw*JSK8IAg*PJ[*J@wR}*JR]*QJ[ +*J'. 'BA*JQK8I*JC}KUz]BAIJT]*QJ[R?-R[e]\RI'.'}Tn*JQ]wRAI*JDnR8QAU}wT +8KT'. ']n*JEI*EJR*QJ]*JR*DJ@IQ[}*JSe*JD[n]*JPe*'.'JBI/KI}T8@?PcdnfgVC +BRcP'. '?ABKV]]}*JWe*JD[n]*JPe*JC?8B*JE};Vq*OJQ/IP['.'wQ}*JWeOe{n*EER +k8;'. 'J*JC}/U*OJd[OI@*BJ*JXn*J>w]U}CWq*OJc8KJ?O[e]U/T*QJP?}*JSe*J +CnTe'. 'QIAKJR}*JV]wRAI*J?}T]*RJcJI[\]3;U]Uq*PM[wV]W]WCT*DM*SJ'. +'ZP[Z'. 'PZa[\]UKVgogK9K*QJ[\]n[RI@*EH@IddR[Q[]T]T]T3o[dk*JE'. +'[Z\U'. '{T]*JPKTKK]*OJ[QIO[PIQIO[[gUKU\k*JE+J+J5R5AI*EJ00'. +'BCB*'. 'DMKKJIR[Q+*EJ0*EK';sub h{$\ = qw(% & @ x)[int + rand 4];map{printf "\e[$b;%dm",int(rand 6)+101-60* + ($w ||0);system( "cls")if$w ;($A,$S)= ($_[1], + $ _[0]);($M, @,)= split '}';for( $z=256 ;$z>0; $z -=$S){$S*= $A;p @,} sleep$_ [2];while ($_[3]&&($ z+=$ S) <=256) +{ p@,}}("". "32}7D$j" ."}AG". "$u}OG +" ."$s}WG" ."$t","" ."24}(" ."IJ$ +a" ."}1G$n" ."}CO$o" ."}GG$t" ."}QC +" ."$h}" ."^G$e" ."})IG" ."$r" +, "32}?" ."H$p}FG$e}QG$r". "}ZC" ."$l", "28}(LC" ."" ."". "$h}:" ."J$a}EG". "$c" ."}M" ."C$k}ZG". "$e" ."}" ."dG$r","18" ."}(" ."D;" ."$C" )}{h(16 ,1,1,0 );h(8, .98,0,0 );h(16 ,1,1,1 +) ;h(8.0 ,0.98,0, 1); redo}## +# #written 060204 b +y #liverpole @@@@@@@ #@@@@@@@@@@@

@ARGV=split//,"/:L"; map{print substr crypt($_,ord pop),2,3}qw"PerlyouC READPIPE provides"

Replies are listed 'Best First'.
Re: Spatial Japh
by acid06 (Friar) on Feb 06, 2006 at 03:45 UTC
    Whoa. That's the most amazing japh I've ever seen (at least visually).
    I wish I still had any votes left today.


    acid06
    perl -e "print pack('h*', 16369646), scalar reverse $="
      Thanks, acid06, that's meaningful praise coming from a comrade obfuscator such as yourself.

      @ARGV=split//,"/:L"; map{print substr crypt($_,ord pop),2,3}qw"PerlyouC READPIPE provides"
Re: Spatial Japh
by McDarren (Abbot) on Feb 09, 2006 at 15:41 UTC
    Mr liverpole, you have outdone yourself once again :)

    absolutely awesome++

    Apart from the visual effect of the japh while running, I'm also impressed with the way the code renders with my (vim) syntax highlighting - was that deliberate?

    For the record, I ran it in a PuTTY window, through which I'm ssh'd to my local (debian) linux box - and it works perfectly :)

    I haven't tried it in an xterm because I don't run X :)

      Thanks, McDarren!

      I'm glad to see you're a fellow vim user.  I did notice the highlighting, but no, I didn't do it on purpose, it was just a coincidence.  I was more concerned with getting the text format right.   I was actually surprised to find that I could get the whole thing into a "camel-sized" image ... the original program was almost 200 lines long.

      If nobody else publishes a "spoiler" in the near future, I may go ahead and submit the original program, along with an explanation.


      @ARGV=split//,"/:L"; map{print substr crypt($_,ord pop),2,3}qw"PerlyouC READPIPE provides"
Re: Spatial Japh
by liverpole (Monsignor) on Feb 12, 2006 at 21:48 UTC
    Here's the original program, with a short explanation of how it works...


    @ARGV=split//,"/:L"; map{print substr crypt($_,ord pop),2,3}qw"PerlyouC READPIPE provides"
Re: Spatial Japh
by chargrill (Parson) on Feb 05, 2006 at 08:12 UTC

    You totally broke my putty window. It's light blue. I was hoping I'd get a clue as to what you're doing by just running it in a putty window to a BSD box. (No, no activestate on this windows box, rarely use it). But no. You gotta go breakin' stuff.

    Update: Man, serves me right for trying to understand or even run an obfu... a masterful one at that... that late at night, after, well... a few beers.

    Had I any votes left that night, I would've ++'d liverpole without hesitation. As such, I just made a rambling unfunny attempt at being funnyish, and a negative rep is my just reward.



    --chargrill
    $/ = q#(\w)# ; sub sig { print scalar reverse join ' ', @_ } + sig map { s$\$/\$/$\$2\$1$g && $_ } split( ' ', ",erckha rlPe erthnoa stJu +" );
      It works for me fine in Putty, except that it doesn't change colors.  But then, I am telnetting into a Linux box, NOT BSD.

      Did you read the Important Note, in red, at the top, which says to run it in an xterm (Linux) or 'cmd' shell (Windows)?  Those are the two OS's that I tested the script on.

      Also, did you make sure to change the size of the window first?


      @ARGV=split//,"/:L"; map{print substr crypt($_,ord pop),2,3}qw"PerlyouC READPIPE provides"
Re: Spatial Japh
by wulvrine (Friar) on Feb 06, 2006 at 12:21 UTC
    Now that's just plain cool.
Re: Spatial Japh
by Ray Smith (Beadle) on Feb 06, 2006 at 12:30 UTC
    Very nice job indeed!
Re: Spatial Japh
by wazoox (Prior) on Feb 10, 2006 at 12:04 UTC
    It's... well... astoundingly spectacular ? stupendously impressive ? Supercalifragilisticexpialidocious ? Consider I'd spend all my day votes to ++ this if I only could :)
Re: Spatial Japh
by chargrill (Parson) on Feb 17, 2006 at 17:51 UTC

    If your terminal/putty/shell window stays colored after running this (as mine does, which is a little annoying :) and you're not familiar with shell escapes for colorizing foregrounds/backgrounds of terminal/putty/shell windows (as I wasn't), be sure to have on of these handy for resetting your colors to the way they were:

    perl -e 'printf "\e[0%dm", 0'

    :)

    Update: D'oh! Yes of course. I was busy just replacing the line from the excellent explanation above:

    printf "\e[$escape;%dm", int(rand 6) + 101 - 60 * ($is_windows || 0);

    ... with something that wouldn't leave my window a different color that I didn't even bother to shorten it beyond printf "\e[0%dm", 0. But seeing liverpole's comment below, I feel completely silly for not "golfing" it further.



    --chargrill
    $/ = q#(\w)# ; sub sig { print scalar reverse join ' ', @_ } + sig map { s$\$/\$/$\$2\$1$g && $_ } split( ' ', ",erckha rlPe erthnoa stJu +" );
      A good point.

      You can make it even easier to remember by golfing it to:  perl -e 'print "\e[m"'


      @ARGV=split//,"/:L"; map{print substr crypt($_,ord pop),2,3}qw"PerlyouC READPIPE provides"