Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

Swap JAPH

by chipmunk (Parson)
on May 02, 2001 at 02:04 UTC ( [id://77154]=obfuscated: print w/replies, xml ) Need Help??

This JAPH uses console escape sequences to produce a simple animation. I don't expect it will work on all platforms. :)

After getting the code working, I concentrated on making it as compact as possible (I just got it down to six lines!), rather than making it as obfuscated as possible.

Enjoy!

$|=@m=@n=($")x(@j=@k='Just another Perl hacker'=~/./g);sub d{$k[$_]ne$ +j[$_]or$w [$_]=_}sub p{local$";print"\e[H\e[J@m\n@k\n@n\n";select$,,$,,$,,.05}@k +[$_,$i]=@ k[$i=rand@k,$_]for@w=0..23;d,for@w;sub a{@_[1,0]=@_}sub w{($y,$z)=$s<$ +_?@_[1,0] :@_;p@y=$y..$z-1;p,($m[$_],$n[$s])=@k[@_];p@k[@_]=($")x2;p a@m[$_+1,$_ +],a@n[$n= $y+$z-$_,$n-1]for$s<$_?reverse@y:@y;@k[@_]=($n[$_],$m[$s]);$m[$s]=$n[$ +_]=$"}{($ _=$s[rand(@s=grep!/_/,@w)])^($s=$s[rand@s])&&w$_,$s;d,d$_=$s;"@j"ne"@k +"?redo:p}

Replies are listed 'Best First'.
Re: Swap JAPH
by MeowChow (Vicar) on May 02, 2001 at 02:15 UTC
    Magnifique, chipmunk! A tip for Windows users: to get a feel for the animation, use a DOS console window that is exactly 4 rows high. The animation also works fine in Windows under Cygwin.
       MeowChow                                   
                   s aamecha.s a..a\u$&owag.print

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: obfuscated [id://77154]
Approved by root
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others pondering the Monastery: (5)
As of 2024-03-28 23:16 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found