[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

Re: [FWP] Obfuscated Perl AI (was Re: [FWP] a thought had while...)



Adam Sampson wrote:
> 
> On Tue, Jun 29, 1999 at 09:48:24PM -0400, Ronald J Kimball wrote:
> > Well, here's a start.  I shortened it by 63 characters and squeezed it onto
> > two lines.
> > while(<>){split;$w{'>'}.=" $_[0]";while(@_){$w{$_[0]}.=$".($#_?$_[1]:0);
> > shift@_}$n='>';while($n){print"$n ";split' ',$w{$n};$n=$_[rand@_]}print$/}
> 
> Unk. You can tell I'm a C programmer in disguise. :)
> 
> I got it down one more character (moving the $n= def and using it twice):
> while(<>){split;$n='>';$w{$n}.=" $_[0]";while(@_){$w{$_[0]}.=$".($#_?$_[1]:0);
> shift@_}while($n){print"$n ";split' ',$w{$n};$n=$_[rand@_]}print$/}

I missed the beginning of this insanity, but you could clip off 2 more
bytes from this hideously bloated source. Of course, there may be the
little matter of megabytes lost to sponging, but sacrifices must be
made. Besides, considering that this code is retrieved off of the
network, it's important to streamline for that bottleneck, and to hell
with the local clients.
So, can you see the simple, elegant change here? Like finding Waldo in a
porn flick.
 
for(<>){split;$n='>';$w{$n}.="
$_[0]";while(@_){$w{$_[0]}.=$".($#_?$_[1]:0);
shift@_}while($n){print"$n ";split' ',$w{$n};$n=$_[rand@_]}print$/}

==== Want to unsubscribe from Fun With Perl?
==== Well, if you insist... Send mail with body "unsubscribe" to
==== fwp-request@technofile.org