[Chicago-talk] Selfgol no longer works?

Steven Lembark lembark at wrkhors.com
Tue Jul 28 09:31:18 PDT 2009


On Thu, 23 Jul 2009 12:37:53 -0500
Andy_Bach at wiwb.uscourts.gov wrote:

> I remember, long ago, coming down to Chicago for D. Conway's selfgol 
> explanation in a bar session (the explanation made me woozier than
> the beer as I recall).

I have the autographed printout :-)

> I get a number of failures, that is, -j (and the banner param from:
> http://libarynth.org/?id=selfgol
> 
> -b or -d) produces "No" as does the 'turn any pl into a quine'
> behaviour. Does anybody know if perl versions improvements have
> broken selfgol?  As it is so small
> 
> #!/usr/local/bin/perl -sw
> $;=$/;seek+DATA,!++$/,!$s;$_=<DATA>;$s&&print||$g&&do{$y=($x||=20)*($y||8);sub
> i{sleep&f}sub'p{print$;x$=,join$;,$b=~/.{$x}/g}$j=$j;sub'f{pop}sub
> n{substr($b,&f%$y,3)=~tr,O,O,}sub'g{$f=&f-1;($w,$w,substr($b,&f,1),O)[n($f-$x)+
> n($x+$f)-(substr($b,&f,1)eq+O)+n$f]||$w}$w="\40";$b=join'', at ARGV?<>:$_,$w
> x$y;$b=~s).)$&=~/\w/?O:$w)ge;substr($b,$y)=q++;$g='$i=0;$i?$b:$c=$b;
> substr+$c,$i,1,g$i;$g=~s?\d+?($&+1)%$y?e;$i-$y+1?eval$g:do{$i=-1;$b=$c;p;i
> 1}';sub'e{eval$g;&e}e}||eval||die+No.$;
> __DATA__
> if($j){{$^W=$|;*_=sub{$=+s=#([A-z])(.*)#=#$+$1#=g}}
> @s=(q[$_=sprintf+pop at s, at s],q[
> if($j){{$^W=$|;*_=sub{$=+s=#([A-z])(.*)#=#$+$1#=g}}
> #_The_Perl_Journal_# @s=(q[%s],q[%s])x2;%s;print"\n"x&_,$_;i$j;eval}
> ])x2;$_=sprintf+pop at s, at s;print"\n"x&_,$_;i$j;eval}$/=$y;$"=",";print
> q<#!/usr/local/bin/perl -sw
> if(!$s){>.($_=<>).q<}else{@s=(q[printf+pop at s, at s],q[#!/usr/local/bin/perl 
> -sw
> if(!$s){>.(s$%$%%$g,tr=[=[===tr=]=]=||&d,$_).q<}else{@s=(q[%s],q[%s])x2;%s}
> ])x2;printf+pop at s, at s}
> >

This only works for that particular version [probably
sub- & sub-sub] version of Perl due to use of oddities
and side-effects. Check the specs for that year's OP
contest and see what version they required the code to
run on.




-- 
Steven Lembark                                          85-09 90th St.
Workhorse Computing                               Woodhaven, NY, 11421
lembark at wrkhors.com                                    +1 888 359 3508


More information about the Chicago-talk mailing list