Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
Last revisionBoth sides next revision
selfgol [2007-10-06 19:47] 192.168.1.48selfgol [2020-10-22 14:34] – Working selfgol code from https://debconf2.debconf.org/talks/dconway/dconway-extreme-perl.tex 63.241.40.119
Line 16: Line 16:
 SelfGOL was written to win all four categories in the Obfuscated Perl contest (3rd year, I believe, whose web pages are no longer available) and still comply with other restrictions of not using modules and being under 1000 bytes. Alas, the rules were drastically changed for the following year's contest, and so it was never entered. SelfGOL was written to win all four categories in the Obfuscated Perl contest (3rd year, I believe, whose web pages are no longer available) and still comply with other restrictions of not using modules and being under 1000 bytes. Alas, the rules were drastically changed for the following year's contest, and so it was never entered.
  
-the self-replicating code, used the standard quine code:+the self-replicating code, used the standard [[quine]] code:
  
 <code perl> <code perl>
-  @s=(  +#!/usr/bin/perl -s 
-    q[printf pop@s, @s],  +$;=$/;seek+DATA,undef$/,!$s;$_=<DATA>;$s&&print||(*{q;::\; 
-    q[@s=(q[%s],q[%s])x2;%s],  +;}=sub{$d=$d-1?$d:$0;s;';\t#$d#;,$_})&&$g&&do{$y=($x||=20)*($y||8);sub 
-  )x2;  +i{sleep&f}sub'p{print$;x$=,join$;,$b=~/.{$x}/g,$;}sub'f{pop||1}sub'n{substr($b, 
-  printf pop @s, @s;  +&f%$y,3)=~tr,O,O,}sub'g{@_[~~@_]=@_;--($f=&f);$m=substr($b,&f,1);($w,$w,$m,O) 
- +[n($f-$x)+n($x+$f)-(${m}eq+O=>)+n$f]||$w}$w="\40";$b=join'',@ARGV?<>:$_,$w 
-#!/usr/bin/perl -s  +x$y;$b=~s).)$&=~/\w/?O:$w)gse;substr($b,$y)=q++;$g='$i=0;$i?$b:$c=$b; 
-$;=$/;seek+DATA,!++$/,!$s;$_=<DATA>;$s&&print||$g&&do{$y=($x||=20)*($y||8);sub +substr+$c,$i,1,g$i;$g=~s?\d+?($&+1)%$y?e;$i-$y+1?eval$g:do{$b=$c;p;i}'; 
-i{sleep&f}sub'p{print$;x$=,join$;,$b=~/.{$x}/g}$j=$j;sub'f{pop}sub +sub'e{eval$g;&e};e}||eval||die+No.$;
-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'',@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__ __DATA__
-if($j){{$^W=$|;*_=sub{$=+s=#([A-z])(.*)#=#$+$1#=g}} +$d&&do{{$^W=$|;*_=sub{$=+s=#([A-z])(.*)#=#$+$1#=g}} 
-@s=(q[$_=sprintf+pop@s,@s],q[ +@s=(q[$_=sprintf+pop@s,@s],";\n"->($_=q[ 
-if($j){{$^W=$|;*_=sub{$=+s=#([A-z])(.*)#=#$+$1#=g}}     #_The_Perl_Journal_# +$d&&do{{$^W=$|;*_=sub{$=+s=#([A-z])(.*)#=#$+$1#=g}}' 
-@s=(q[%s],q[%s])x2;%s;print"\n"x&_,$_;i$j;eval} +@s=(q[%s],q[%s])x2;%s;print"\n"x&_,$_;i;eval}; 
-])x2;$_=sprintf+pop@s,@s;print"\n"x&_,$_;i$j;eval}$/=$y;$"=",";print +]))x2;$_=sprintf+pop@s,@s;print"\n"x&_,$_;i;eval};$/=$y;$"=",";print 
-q<#!/usr/local/bin/perl -sw +q<#!/usr/bin/perl -sw 
-if(!$s){>.($_=<>).q<}else{@s=(q[printf+pop@s,@s],q[#!/usr/local/bin/perl -sw +!$s?{do{>.($_=<>).q<}:do{@s=(q[printf+pop@s,@s],q[#!/usr/bin/perl -sw 
-if(!$s){>.(s$%$%%$g,tr=[=[===tr=]=]=||&d,$_).q<}else{@s=(q[%s],q[%s])x2;%s}+!$s?{do{>.(s$%$%%$g,y=[====y=]==||&d,$_).q<}:do{@s=(q[%s],q[%s])x2;%s}
 ])x2;printf+pop@s,@s} ])x2;printf+pop@s,@s}
 > >
  • selfgol.txt
  • Last modified: 2020-10-22 15:13
  • by nik