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 |