home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 October / usenetsourcesnewsgroupsinfomagicoctober1994disk2.iso / unix / volume9 / old.bad.code < prev    next >
Text File  |  1987-03-10  |  23KB  |  753 lines

  1. Subject:  v09i020:  Previous "obfuscated C" winners
  2. Newsgroups: mod.sources
  3. Approved: rs@mirror.TMC.COM
  4.  
  5. Submitted by: amdahl!chongo (Landon Curt Noll)
  6. Mod.sources: Volume 9, Issue 20
  7. Archive-name: old.bad.code
  8.  
  9. [  There's been lots of bad code posted to the net in the past; time
  10.    to get some of it into the archives. :-)  --r$  ]
  11.  
  12.  
  13. International Obfuscated C Code Contest Winners for 1984, 1985, 1986
  14. This is a shell archive.  Remove anything before this line, then unpack
  15. it by saving it in a file and typing "sh file".
  16.  
  17.          SEE THE README FILE FOR DETAILS ABOUT THESE SOURCES
  18.  
  19. --------cut--------here---------
  20. echo x - README
  21. cat > "README" << '//E*O*F README//'
  22.  
  23. This shar file contains the winning entries of the International
  24. Obfuscated C Code Contest for the years 1984 thru 1986.
  25.  
  26. Each contest starts near March 15.  The official start consists of the
  27. posting of new contest rules in:
  28.  
  29.                     comp.lang.c    comp.unix.wizards    
  30.  
  31. For those people who do not read the above mentioned groups, a short note is 
  32. also posted to mod.announce stating where the new rules have been posted.
  33. Rules may also be obtained by sending Email to (after March 15th):
  34.  
  35.     judge@amdahl.com  -or-  {decwrl,sun,seismo,hplabs}!amdahl!judge
  36.  
  37. The winners below are given to serve as examples.  It should be noted
  38. that contest rules change from year to year, so some the previous winning
  39. entries would be disqualified under some rules.  Since some obfuscation
  40. ideas get old (such as #define-ing something to death), some winning
  41. might be eliminated in the first judging round of another year.  All this can
  42. be summed up in the phrase: "read the new rules before you submit an entry".
  43.  
  44. NOTE:  You are free to distribute/use these programs as long they are not
  45.        used for profit, and as long author's name stays attached to the
  46.        source code.
  47.  
  48. Enjoy
  49.  
  50. chongo <Landon Curt Noll, chongo@amdahl.COM> /\cc/\
  51.  
  52. //E*O*F README//
  53.  
  54. echo x - 1984
  55. cat > "1984" << '//E*O*F 1984//'
  56. <dis>honorable mention:
  57. ------------------------------------------------------------------------------
  58. int i;main(){for(;i["]<i;++i){--i;}"];read('-'-'-',i+++"hell\
  59. o, world!\n",'/'/'/'));}read(j,i,p){write(j/p+p,i---j,i/i);}
  60. -----------------------------------------------------------------------------
  61. anonymous entry   (too embarrassed that he/she could write such trash i guess)
  62.  
  63.  
  64.  
  65. Third place:
  66. ---------------------------------------------------------------------------
  67. a[900];        b;c;d=1        ;e=1;f;        g;h;O;        main(k,
  68. l)char*        *l;{g=        atoi(*        ++l);        for(k=
  69. 0;k*k<        g;b=k        ++>>1)        ;for(h=        0;h*h<=
  70. g;++h);        --h;c=(        (h+=g>h        *(h+1))        -1)>>1;
  71. while(d        <=g){        ++O;for        (f=0;f<        O&&d<=g
  72. ;++f)a[        b<<5|c]        =d++,b+        =e;for(        f=0;f<O
  73. &&d<=g;        ++f)a[b        <<5|c]=        d++,c+=        e;e= -e
  74. ;}for(c        =0;c<h;        ++c){        for(b=0        ;b<k;++
  75. b){if(b        <k/2)a[        b<<5|c]        ^=a[(k        -(b+1))
  76. <<5|c]^        =a[b<<5        |c]^=a[        (k-(b+1        ))<<5|c]
  77. ;printf(    a[b<<5|c    ]?"%-4d"    :"    "        ,a[b<<5
  78. |c]);}        putchar(    '\n');}}    /*Mike        Laman*/
  79. ----------------------------------------------------------------------------
  80.             Mike Laman
  81.             UUCP: {ucbvax,philabs,sdccsu3,sdcsla}!sdcsvax!laman
  82. P.S.  I hope you have the C beautifier! The program accepts ONE positive
  83.       argument.  Seeing is believing!  Try something like "cmd 37" for an
  84.       example.  <ed: also try cmd 4; cmd 9; cmd 16; cmd 25; cmd 36; ...>
  85.  
  86.  
  87.  
  88. Second place award:
  89. ---------------------------------------------------------------------------
  90. #define x =
  91. #define double(a,b) int
  92. #define char k['a']
  93. #define union static struct
  94.  
  95. extern int floor;
  96. double (x1, y1) b,
  97. char x {sizeof(
  98.     double(%s,%D)(*)())
  99. ,};
  100. struct tag{int x0,*xO;}
  101.  
  102. *main(i, dup, signal) {
  103. {
  104.   for(signal=0;*k * x * __FILE__ *i;) do {
  105.    (printf(&*"'\",x);    /*\n\\", (*((double(tag,u)(*)())&floor))(i)));
  106.     goto _0;
  107.  
  108. _O: while (!(char <<x - dup)) {    /*/*\*/
  109.     union tag u x{4};
  110.   }
  111. }
  112.  
  113.  
  114. while(b x 3, i); {
  115. char x b,i;
  116.   _0:if(b&&k+
  117.   sin(signal)        / *    ((main) (b)-> xO));/*}
  118.   ;
  119. }
  120.  
  121. */}}}
  122. -------------------------------------------------------------------------------
  123. By: Dave Decot   hplabs!hpda!hpdsd!decot
  124.  
  125.  
  126.  
  127. First place award goes to:
  128. ------------------------------------------------------------------------
  129. /* Portable between VAX11 && PDP11 */
  130.  
  131. short main[] = {
  132.     277, 04735, -4129, 25, 0, 477, 1019, 0xbef, 0, 12800,
  133.     -113, 21119, 0x52d7, -1006, -7151, 0, 0x4bc, 020004,
  134.     14880, 10541, 2056, 04010, 4548, 3044, -6716, 0x9,
  135.     4407, 6, 5568, 1, -30460, 0, 0x9, 5570, 512, -30419,
  136.     0x7e82, 0760, 6, 0, 4, 02400, 15, 0, 4, 1280, 4, 0,
  137.     4, 0, 0, 0, 0x8, 0, 4, 0, ',', 0, 12, 0, 4, 0, '#',
  138.     0, 020, 0, 4, 0, 30, 0, 026, 0, 0x6176, 120, 25712,
  139.     'p', 072163, 'r', 29303, 29801, 'e'
  140. };
  141. ------------------------------------------------------------------------------
  142.         Sjoerd Mullender
  143.         Robbert van Renesse
  144. Both @ Vrije Universiteit, Amsterdam, the Netherlands.
  145.     ..!decvax!mcvax!vu44!{sjoerd,cogito}
  146. <ed: try this on your local VAX or pdp-11>
  147. //E*O*F 1984//
  148.  
  149. echo x - 1985
  150. cat > "1985" << '//E*O*F 1985//'
  151. Since people often request the previous year's winners at the start of
  152. the contest, I include the 1985 winners below.  Please keep in mind that
  153. the rules have chanmged between 1985 and 1986.
  154.  
  155. ------------------------------------------------------------------------
  156.  
  157. The following programs were judged good (bad? wierd?) enough to win
  158. awards. This year, rather than trying to rank the programs in order of
  159. obfuscatedness, we gave a single award in each of 4 categories and a
  160. grand prize.
  161.  
  162. ________________________________________________________________________
  163.  
  164. 1. The most obscure program:
  165. (submitted by Lennart Augustsson <seismo!mcvax!enea!chalmers!augustss> )
  166.  
  167. #define p struct c
  168. #define q struct b
  169. #define h a->a
  170. #define i a->b
  171. #define e i->c
  172. #define o a=(*b->a)(b->b,b->c)
  173. #define s return a;}q*
  174. #define n (d,b)p*b;{q*a;p*c;
  175. #define z(t)(t*)malloc(sizeof(t))
  176. q{int a;p{q*(*a)();int b;p*c;}*b;};q*u n a=z(q);h=d;i=z(p);i->a=u;i->b=d+1;s
  177. v n c=b;do o,b=i;while(!(h%d));i=c;i->a=v;i->b=d;e=b;s
  178. w n o;c=i;i=b;i->a=w;e=z(p);e->a=v;e->b=h;e->c=c;s
  179. t n for(;;)o,main(-h),b=i;}main(b){p*a;if(b>0)a=z(p),h=w,a->c=z(p),a->c->a=u,a->c->b=2,t(0,a);putchar(b?main(b/2),-b%2+'0':10);}
  180.  
  181. ________________________________________________________________________
  182.  
  183. 2. The worst abuse of the C preprocessor:
  184. (submitted by Col. G. L. Sicherman <decvax!sunybcs!colonel> )
  185.  
  186. #define C_C_(_)~' '&_
  187. #define _C_C(_)('\b'b'\b'>=C_C>'\t'b'\n')
  188. #define C_C _|_
  189. #define b *
  190. #define C /b/
  191. #define V _C_C(
  192. main(C,V)
  193. char **V;
  194. /*    C program. (If you don't
  195.  *    understand it look it
  196.  */    up.) (In the C Manual)
  197. {
  198.     char _,__; 
  199.     while (read(0,&__,1) & write((_=(_=C_C_(__),C)),
  200.     _C_,1)) _=C-V+subr(&V);
  201. }
  202. subr(C)
  203. char *C;
  204. {
  205.     C="Lint says "argument Manual isn't used."  What's that
  206.     mean?"; while (write((read(C_C('"'-'/*"'/*"*/))?__:__-_+
  207.     '\b'b'\b'|((_-52)%('\b'b'\b'+C_C_('\t'b'\n'))+1),1),&_,1));
  208. }
  209.  
  210. [ This program confused the C preprocessor so badly that it left some
  211. comments in the preprocessed version. Also, lint DID complain that
  212. "argument Manual isn't used". ]
  213.  
  214. ________________________________________________________________________
  215.  
  216. 3. The strangest appearing program:
  217. (submitted by Ed Lycklama <decvax!cca!ima!ism780!ed> )
  218.  
  219. #define o define
  220. #o ___o write
  221. #o ooo (unsigned)
  222. #o o_o_ 1
  223. #o _o_ char
  224. #o _oo goto
  225. #o _oo_ read
  226. #o o_o for
  227. #o o_ main
  228. #o o__ if
  229. #o oo_ 0
  230. #o _o(_,__,___)(void)___o(_,__,ooo(___))
  231. #o __o (o_o_<<((o_o_<<(o_o_<<o_o_))+(o_o_<<o_o_)))+(o_o_<<(o_o_<<(o_o_<<o_o_)))
  232. o_(){_o_ _=oo_,__,___,____[__o];_oo ______;_____:___=__o-o_o_; _______:
  233. _o(o_o_,____,__=(_-o_o_<___?_-o_o_:___));o_o(;__;_o(o_o_,"\b",o_o_),__--);
  234. _o(o_o_," ",o_o_);o__(--___)_oo _______;_o(o_o_,"\n",o_o_);______:o__(_=_oo_(
  235. oo_,____,__o))_oo _____;}
  236.  
  237. [it looks like tty noise]
  238.  
  239. ________________________________________________________________________
  240.  
  241. 4. The best "small" program:
  242. (submitted by Jack Applin [with help from Robert Heckendorn]
  243. <hplabs!hp-dcd!jack> )
  244.  
  245. main(v,c)char**c;{for(v[c++]="Hello, world!\n)";(!!c)[*c]&&(v--||--c&&execlp(*c,*c,c[!!c]+!!c,!c));**c=!c)write(!!*c,*c,!!**c);}
  246.  
  247. ________________________________________________________________________
  248.  
  249. 5. The grand prize (most well-rounded in confusion):
  250. (submitted by Carl Shapiro <sdcrdcf!otto!carl> )
  251.  
  252. #define P(X)j=write(1,X,1)
  253. #define C 39
  254. int M[5000]={2},*u=M,N[5000],R=22,a[4],l[]={0,-1,C-1,-1},m[]={1,-C,-1,C},*b=N,
  255. *d=N,c,e,f,g,i,j,k,s;main(){for(M[i=C*R-1]=24;f|d>=b;){c=M[g=i];i=e;for(s=f=0;
  256. s<4;s++)if((k=m[s]+g)>=0&&k<C*R&&l[s]!=k%C&&(!M[k]||!j&&c>=16!=M[k]>=16))
  257. a[f++]=s;if(f){f=M[e=m[s=a[rand()/(1+2147483647/f)]]+g];j=j<f?f:j;f+=c&-16*!j;
  258. M[g]=c|1<<s;M[*d++=e]=f|1<<(s+2)%4;}else e=d>b++?b[-1]:e;}P(" ");for(s=C;--s;
  259. P("_"))P(" ");for(;P("\n"),R--;P("|"))for(e=C;e--;P("_ "+(*u++/8)%2))
  260. P("| "+(*u/4)%2);}
  261.  
  262. [As submitted, this program was 3 lines (2 of defines and 1 of code).
  263. To make news/mail/etc. happy we split the last line into 7. Join them
  264. back without the newlines to get the original version]
  265.  
  266. ----------------------------------------------------------------------
  267.  
  268. Congratulations to the winners (and anyone else who wasted their time
  269. creating such wierd programs).
  270.  
  271. For your own enjoyment, you can figure out what these programs do. Or 
  272. if this is too hard, compile and run them! All of these compiled and
  273. ran on the vax. Lint was even happy with most of the entries.
  274. //E*O*F 1985//
  275.  
  276. echo x - 1986
  277. cat > "1986" << '//E*O*F 1986//'
  278.  
  279.  
  280.           1986 International Obfuscated C Code Contest Winners
  281.  
  282.  
  283. We recommend that you first try to understand the program from just reading
  284. the source.  If you are still confused try sending the source through the C
  285. Preprocessor (/lib/cpp).  If you are still confused, we suggest you read the
  286. judges comments and run each program.  Last, if you are still confused then
  287. you are not alone!
  288.  
  289.  
  290. ===============================================================================
  291. Best layout:
  292.  
  293.     Eric Marshall
  294.     System Development Corporation, a Burroughs Company
  295.     P.O. Box 517
  296.     Paoli, PA.
  297.     19301
  298.  
  299.     [Ed: some compilers have problems with this, see Judges comments below]
  300.     sdcrdcf!burdvax!eric    {sjuvax,ihnp4,akgua,cadre}!psuvax1!burdvax!eric
  301. -------------------------------------------------------------------------------
  302.                                                    extern int
  303.                                                        errno
  304.                                                          ;char
  305.                                                             grrr
  306.                              ;main(                           r,
  307.   argv, argc )            int    argc                           ,
  308.    r        ;           char *argv[];{int                     P( );
  309. #define x  int i,       j,cc[4];printf("      choo choo\n"     ) ;
  310. x  ;if    (P(  !        i              )        |  cc[  !      j ]
  311. &  P(j    )>2  ?        j              :        i  ){*  argv[i++ +!-i]
  312. ;              for    (i=              0;;    i++                   );
  313. _exit(argv[argc- 2    / cc[1*argc]|-1<<4 ]    ) ;printf("%d",P(""));}}
  314.   P  (    a  )   char a   ;  {    a  ;   while(    a  >      "  B   "
  315.   /* -    by E            ricM    arsh             all-      */);    }
  316. ===============================================================================
  317.  
  318.  
  319.  
  320. ===============================================================================
  321. Worst abuse of the C preprocessor:
  322.  
  323.     Jim Hague
  324.     University of Kent at Canterbury
  325.     Canterbury, Kent
  326.     UK
  327.  
  328.     ..mcvax!ukc!jmh
  329. -------------------------------------------------------------------------------
  330. #define    DIT    (
  331. #define    DAH    )
  332. #define    __DAH    ++
  333. #define DITDAH    *
  334. #define    DAHDIT    for
  335. #define    DIT_DAH    malloc
  336. #define DAH_DIT    gets
  337. #define    _DAHDIT    char
  338. _DAHDIT _DAH_[]="ETIANMSURWDKGOHVFaLaPJBXCYZQb54a3d2f16g7c8a90l?e'b.s;i,d:"
  339. ;main            DIT            DAH{_DAHDIT
  340. DITDAH            _DIT,DITDAH        DAH_,DITDAH DIT_,
  341. DITDAH            _DIT_,DITDAH        DIT_DAH DIT
  342. DAH,DITDAH        DAH_DIT DIT        DAH;DAHDIT
  343. DIT _DIT=DIT_DAH    DIT 81            DAH,DIT_=_DIT
  344. __DAH;_DIT==DAH_DIT    DIT _DIT        DAH;__DIT
  345. DIT'\n'DAH DAH        DAHDIT DIT        DAH_=_DIT;DITDAH
  346. DAH_;__DIT        DIT            DITDAH
  347. _DIT_?_DAH DIT        DITDAH            DIT_ DAH:'?'DAH,__DIT
  348. DIT' 'DAH,DAH_ __DAH    DAH DAHDIT        DIT
  349. DITDAH            DIT_=2,_DIT_=_DAH_;    DITDAH _DIT_&&DIT
  350. DITDAH _DIT_!=DIT    DITDAH DAH_>='a'?    DITDAH
  351. DAH_&223:DITDAH        DAH_ DAH DAH;        DIT
  352. DITDAH            DIT_ DAH __DAH,_DIT_    __DAH DAH
  353. DITDAH DIT_+=        DIT DITDAH _DIT_>='a'?    DITDAH _DIT_-'a':0
  354. DAH;}_DAH DIT DIT_    DAH{            __DIT DIT
  355. DIT_>3?_DAH        DIT             DIT_>>1 DAH:'\0'DAH;return
  356. DIT_&1?'-':'.';}__DIT DIT            DIT_ DAH _DAHDIT
  357. DIT_;{DIT void DAH write DIT            1,&DIT_,1 DAH;}
  358. ===============================================================================
  359.  
  360.  
  361.  
  362. ===============================================================================
  363. Best one liner:
  364.  
  365.     Jan Stein
  366.     Chalmers Computer Society
  367.     Gothenburg
  368.     Sweden
  369.  
  370.     ..!mcvax!enea!chalmers!gustaf!cd-jan
  371.  
  372. [The single line has been split to avoid any problems with E-mailers]
  373. -------------------------------------------------------------------------------
  374. typedef char*z;O;o;_=33303285;main(b,Z)z Z;{b=(b>=0||(main(b+1,Z+1),
  375. *Z=O%(o=(_%25))+'0',O/=o,_/=25))&&(b<1||(O=time(&b)%0250600,
  376. main(~5,*(z*)Z),write(1,*(z*)Z,9)));}
  377. ===============================================================================
  378.  
  379.  
  380.  
  381. ===============================================================================
  382. Most adaptable program:
  383.  
  384.     Jack Applin
  385.     Hewlett-Packard
  386.     Ft. Collins
  387.     Colorado
  388.     USA
  389.  
  390.     hplabs!hpfcdc!jack
  391. -------------------------------------------------------------------------------
  392. cat =13 /*/ >/dev/null 2>&1; echo "Hello, world!"; exit
  393. *
  394. *  This program works under cc, f77, and /bin/sh.
  395. *
  396. */; main() {
  397.       write(
  398. cat-~-cat
  399.      /*,'(
  400. */
  401.      ,"Hello, world!"
  402.      ,
  403. cat); putchar(~-~-~-cat); } /*
  404.      ,)')
  405.       end
  406. */
  407. ===============================================================================
  408.  
  409.  
  410.  
  411. ===============================================================================
  412. Most useful obfuscation:
  413.  
  414.     Walter Bright
  415.     <Postal address not given>
  416.  
  417.     decwrl!sun!fluke!uw-beaver!entropy!dataio!bright
  418. -------------------------------------------------------------------------------
  419. #include <stdio.h>
  420. #define O1O printf
  421. #define OlO putchar
  422. #define O10 exit
  423. #define Ol0 strlen
  424. #define QLQ fopen
  425. #define OlQ fgetc
  426. #define O1Q abs
  427. #define QO0 for
  428. typedef char lOL;
  429.  
  430. lOL*QI[] = {"Use:\012\011dump file\012","Unable to open file '\x25s'\012",
  431.  "\012","   ",""};
  432.  
  433. main(I,Il)
  434. lOL*Il[];
  435. {    FILE *L;
  436.     unsigned lO;
  437.     int Q,OL[' '^'0'],llO = EOF,
  438.  
  439.     O=1,l=0,lll=O+O+O+l,OQ=056;
  440.     lOL*llL="%2x ";
  441.     (I != 1<<1&&(O1O(QI[0]),O10(1011-1010))),
  442.     ((L = QLQ(Il[O],"r"))==0&&(O1O(QI[O],Il[O]),O10(O)));
  443.     lO = I-(O<<l<<O);
  444.     while (L-l,1)
  445.     {    QO0(Q = 0L;((Q &~(0x10-O))== l);
  446.             OL[Q++] = OlQ(L));
  447.         if (OL[0]==llO) break;
  448.         O1O("\0454x: ",lO);
  449.         if (I == (1<<1))
  450.         {    QO0(Q=Ol0(QI[O<<O<<1]);Q<Ol0(QI[0]);
  451.             Q++)O1O((OL[Q]!=llO)?llL:QI[lll],OL[Q]);/*"
  452.             O10(QI[1O])*/
  453.             O1O(QI[lll]);{}
  454.         }
  455.         QO0 (Q=0L;Q<1<<1<<1<<1<<1;Q+=Q<0100)
  456.         {    (OL[Q]!=llO)? /* 0010 10lOQ 000LQL */
  457.             ((D(OL[Q])==0&&(*(OL+O1Q(Q-l))=OQ)),
  458.             OlO(OL[Q])):
  459.             OlO(1<<(1<<1<<1)<<1);
  460.         }
  461.         O1O(QI[01^10^9]);
  462.         lO+=Q+0+l;}
  463.     }
  464.     D(l) { return l>=' '&&l<='\~';
  465. }
  466. ===============================================================================
  467.  
  468.  
  469.  
  470. ===============================================================================
  471. Best simple task performed in a complex way:
  472.  
  473.     Bruce Holloway
  474.     Digital Research, Inc.
  475.     Monterey, CA
  476.     USA
  477.  
  478.     (ucbvax!hplabs!amdahl!drivax!holloway)
  479. -------------------------------------------------------------------------------
  480. #include "stdio.h"
  481. #define    e 3
  482. #define    g (e/e)
  483. #define    h ((g+e)/2)
  484. #define    f (e-g-h)
  485. #define    j (e*e-g)
  486. #define k (j-h)
  487. #define    l(x) tab2[x]/h
  488. #define    m(n,a) ((n&(a))==(a))
  489.  
  490. long tab1[]={ 989L,5L,26L,0L,88319L,123L,0L,9367L };
  491. int tab2[]={ 4,6,10,14,22,26,34,38,46,58,62,74,82,86 };
  492.  
  493. main(m1,s) char *s; {
  494.     int a,b,c,d,o[k],n=(int)s;
  495.     if(m1==1){ char b[2*j+f-g]; main(l(h+e)+h+e,b); printf(b); }
  496.     else switch(m1-=h){
  497.     case f:
  498.         a=(b=(c=(d=g)<<g)<<g)<<g;
  499.         return(m(n,a|c)|m(n,b)|m(n,a|d)|m(n,c|d));
  500.     case h:
  501.         for(a=f;a<j;++a)if(tab1[a]&&!(tab1[a]%((long)l(n))))return(a);
  502.     case g:
  503.         if(n<h)return(g);
  504.         if(n<j){n-=g;c='D';o[f]=h;o[g]=f;}
  505.         else{c='\r'-'\b';n-=j-g;o[f]=o[g]=g;}
  506.         if((b=n)>=e)for(b=g<<g;b<n;++b)o[b]=o[b-h]+o[b-g]+c;
  507.         return(o[b-g]%n+k-h);
  508.     default:
  509.         if(m1-=e) main(m1-g+e+h,s+g); else *(s+g)=f;
  510.         for(*s=a=f;a<e;) *s=(*s<<e)|main(h+a++,(char *)m1);
  511.     }
  512. }
  513. ===============================================================================
  514.  
  515.  
  516.  
  517. ===============================================================================
  518. Best non-simple performed in a complex way:
  519.  
  520.     Lennart Augustsson
  521.     Dept. of Comp. Sci.
  522.     Chalmers University of Technology,
  523.     412 96 Gothenburg
  524.     Sweden
  525.  
  526.     augustss@chalmers.{uucp,csnet}
  527. -------------------------------------------------------------------------------
  528. typedef struct n{int a:3,
  529. b:29;struct n*c;}t;t*
  530. f();r(){}m(u)t*u;{t*w,*z;
  531. z=u->c,q(z),u->b=z->b*10,
  532. w=u->c=f(),w->a=1,w->c=z->
  533. c;}t*k;g(u)t*u;{t*z,*v,*p,
  534. *x;z=u->c,q(z),u->b=z->b,v
  535. =z->c,z->a=2,x=z->c=f(),x
  536. ->a=3,x->b=2,p=x->c=f(),p
  537. ->c=f(),p->c->a=1,p->c->c=
  538. v;}int i;h(u)t*u;{t*z,*v,*
  539. w;int c,e;z=u->c,v=z->c,q(
  540. v),c=u->b,e=v->b,u->b=z->b
  541. ,z->a=3,z->b=c+1,e+9>=c&&(
  542. q(z),e=z->b,u->b+=e/c,w=f(
  543. ),w->b=e%c,w->c=z->c,u->c=
  544. w);}int(*y[4])()={r,m,g,h};
  545. char *sbrk();main(){t*e,*p,*o;
  546. o=f(),o->c=o,o->b=1,e=f(),
  547. e->a=2,p=e->c=f(),p->b=2,
  548. p->c=o,q(e),e=e->c,(void)write
  549. (1,"2.",2);for(;;e=e->c){q(e),
  550. e->b=write(1,&e->b["0123456789"],
  551. 1);}}t*f(){return i||(i=1000,
  552. k=(t*)sbrk(i*sizeof(t))),k+--i;
  553. }q(p)t*p;{(*y[p->a])(p);}
  554. ===============================================================================
  555.  
  556.  
  557.  
  558. ===============================================================================
  559. Most illegible code:
  560.  
  561.      Michael H. Pawka
  562.     Naval Ocean Systems Center
  563.     San Diego, Ca
  564.     92152
  565.  
  566.     DDN - PAWKA@NOSC-TECR.ARPA
  567. -------------------------------------------------------------------------------
  568. #include "stdio.h"
  569. #define xyxx char
  570. #define xyyxx putchar
  571. #define xyyyxx while
  572. #define xxyyyx int
  573. #define xxxyyx main
  574. #define xyxyxy if
  575. #define xyyxyy '\n'
  576. xyxx *xyx [] = {
  577. "]I^x[I]k\\I^o[IZ~\\IZ~[I^|[I^l[I^j[I^}[I^n[I]m\\I]h",
  578. "]IZx\\IZx[IZk\\IZk[IZo_IZ~\\IZ~[IZ|_IZl_IZj\\IZj]IZ}]IZn_IZm\\IZm_IZh",
  579. "]IZx\\IZx[I^k[I\\o]IZ~\\IZ~\\I]|[IZl_I^j]IZ}]I^n[IZm\\IZm_IZh",
  580. "]IZx\\IZx[IZk\\IZk[IZo_IZ~\\IZ~_IZ|[IZl_IZj\\IZj]IZ}]IZn_IZm\\IZm]IZh",
  581. "]I^x[I]k\\IZo_I^~[I^|[I^l[IZj\\IZj]IZ}]I^n[I]m^IZh",'\0'};/*xyyxyxyxxxyxxxyy*/
  582. xyxx *xyyx; xxyyyx xyyyx,xyyyyx,xyyyyyx=0x59,xyyyyyyx=0x29,/*yxxyxyyyxxyyyxyy*/
  583. xxyx=0x68;xxxyyx(){xyyyyx=0;xyyyxx(xyx[xyyyyx]){xyyx=xyx[xyyyyx++];/*xyyyxxyx*/
  584. xyyyxx(*xyyx){xyyyx= *xyyx++-xyyyyyx;xyyyxx(xyyyx--)xyyxx(*xyyx-xyyyyyyx);/*x*/
  585. xyxyxy(*xyyx==xxyx)xyyxx(xyyxyy);*xyyx++;}}}/*xyxyxyyyyxxyxxxyyyxyyyxyxxyyy*/
  586. ===============================================================================
  587.  
  588.  
  589. ===============================================================================
  590. The grand prize (most well-rounded in confusion):
  591.  
  592.      Larry Wall
  593.     System Development Corporation
  594.     Santa Monica
  595.     California
  596.     US of A
  597.  
  598.     [ed: modified to run on Sys V, see comments below]
  599.      {allegra,burdvax,cbosgd,hplabs,ihnp4,sdcsvax}!sdcrdcf!lwall
  600. -------------------------------------------------------------------------------
  601. #define _c(C)_ (C)&('|'+3):c_()(C)>>('\n'-3) __; /**/
  602. #define C char*
  603. #define keyboard ",,B3-u;.(&*5., /(b*(1\036!a%\031m,,,,,\r\n"
  604. #define main(o,oo)oo(o){
  605. #define _ ;case
  606. C
  607. #define c_(cc)c cc=
  608. #define C_(sand)_O(sand)witch
  609. o=keyboard;
  610. #define __ ;break;
  611. C
  612. ccc(
  613. cc)
  614. C
  615. cc;
  616. {
  617. C
  618. cccc=
  619. cc;int
  620. #ifndef lint
  621. #define keyboard "dijs QH.soav Vdtnsaoh DmfpaksoQz;kkt oa, -dijs"
  622. #endif
  623. c;
  624. main(;c_(=(*cc);*cc++)c,for);
  625. #define _O(s)s
  626. main(0xb+(c>>5),C_(s))
  627. _'\v'
  628. :__ _'\f':
  629. main(c,C_(s));
  630. _c(8098)_c(6055)_c(14779)_c(10682)
  631. #define O_(O)_O(O)stem(ccc(
  632. _c(15276)_c(11196)_c(15150)
  633. #define _C ;return
  634. _c(11070)_c(15663)_c(11583)
  635. }
  636. __
  637. default
  638. :c_(+)o[c&__LINE__-007];
  639. main(c_(-)'-'-1,C_(s))_
  640. 0214
  641. :_
  642. 0216
  643. :c_(+)025 _
  644. 0207
  645. :c_(-)4 _
  646. 0233
  647. :c_(+)' '-1;
  648. }}c_(&)'z'+5;
  649. }_C cccc;
  650. }main(,cc)
  651. C
  652. #define O write(1,
  653. c="O";
  654. O_(sy) keyboard));
  655. main(;;,for);
  656. read(0,
  657. c,1);*
  658. c_(&)'~'+1
  659. ;O ccc(
  660. c),
  661. '\0');
  662. main(*c,
  663. C_(s));_
  664. 4
  665. :O_(sy)";kkt -oa, dijszdijs QQ"))_C
  666. _
  667. 13
  668. :O o+' ',
  669. 3
  670. )
  671. #undef main
  672. __ _ 127:O"\b \b",3)__
  673. default
  674. :O
  675. c,1)
  676. __}}}main(){
  677. cc();
  678. }
  679. ===============================================================================
  680.  
  681.  
  682. ===============================================================================
  683. Judges comments:
  684.  
  685.     Best layout:    
  686.     Compile and execute.  Known to give some C compilers a problem.
  687.     If your C compiler is one of them, then just paste the source
  688.     picture up on your wall.
  689.  
  690.     Worst abuse of the C preprocessor:
  691.     Compile and execute.  Feed it chars from standard input.
  692.     Works with international standard rather than the US standard.
  693.     Passes lint.
  694.  
  695.     Best one liner:
  696.     Join the 3 lines into one line.  Compile and link to the
  697.     filename 'a.out'.  Execute it the following 2 character
  698.     argument: ^M^L (Return/Formfeed).  Passes lint.
  699.  
  700.     Most adaptable program:
  701.     Compile and/or execute in the methods documented.
  702.  
  703.     Most useful obfuscation:
  704.     Compile and execute.  Give a filename as an argument.
  705.  
  706.     Best simple task performed in a complex way:
  707.     Compile and execute and understand.
  708.  
  709.     Best non-simple performed in a complex way:
  710.     Compile and execute.  Works best with an infinite amount of
  711.     stack space.  (otherwise a 'segmentation violation' eventually
  712.     occurs)  Do an 'unlimit stacksize' command if your system
  713.     allows it.  Passes lint.
  714.  
  715.     Most illegible code:
  716.     Read, compile and execute.
  717.  
  718.     The grand prize (most well-rounded obfuscation):
  719.     Compile and execute.  Feed it chars from a standard input.
  720.     The C compiler documents this program during compilation.
  721.  
  722.     The Sys V /lib/cpp does not handle with the first '#define' line
  723.     in this program.  The ';' was added to allow both BSD and Sys V
  724.     machines to compile it.  I.e.,:
  725.  
  726.         < #define _c(C)_ (C)&('|'+3):c_()(C)>>('\n'-3) __ /**/
  727.         ---
  728.         > #define _c(C)_ (C)&('|'+3):c_()(C)>>('\n'-3) __; /**/
  729.  
  730.     Next year, we would like to obtain help in running 'nominated' programs
  731.     in different machines.  We will solicit such help near the proper time.
  732. ===============================================================================
  733.  
  734. We received over twice the number of entries this year, than we did
  735. last year.  Judging this year was made more difficult due to the number
  736. of very good entries received.  We elected to break down several of the
  737. contest categories rather than exclude some programs.
  738.  
  739. Thank you to all persons who entered the contest.  We hope you will try
  740. again next year.
  741.  
  742. This years winning programs will be published in the Micro/Systems Journal
  743. and perhaps in an up comming book.  See ...!seismo!nbs-amrf!libes for
  744. details about the Journal.
  745.  
  746. chongo           <Landon Curt Noll - decwrl!nsc!chongo>      /\oo/\
  747. Larry Bassel     <decwrl!nsc!oblio!lab>
  748.  
  749. NOTE: chongo is now at decwrl!amdahl!chongo
  750. //E*O*F 1986//
  751.  
  752. exit 0
  753.