home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 January / usenetsourcesnewsgroupsinfomagicjanuary1994.iso / sources / misc / volume39 / ioccc.1993 / part02 < prev    next >
Encoding:
Text File  |  1993-09-26  |  62.0 KB  |  1,556 lines

  1. Newsgroups: comp.sources.misc
  2. From: chongo@toad.com (Landon Curt Noll)
  3. Subject: v39i105:  ioccc.1993 - 1993 International Obfuscated C Code Contest winners, Part02/04
  4. Message-ID: <1993Sep26.172540.4105@sparky.sterling.com>
  5. X-Md4-Signature: bdb6183873fdfc0378b0208175a55f2c
  6. Keywords: ioccc
  7. Sender: kent@sparky.sterling.com (Kent Landfield)
  8. Reply-To: chongo@toad.com (Landon Curt Noll)
  9. Organization: Nebula Consultants in San Francisco
  10. Date: Sun, 26 Sep 1993 17:25:40 GMT
  11. Approved: kent@sparky.sterling.com
  12.  
  13. Submitted-by: chongo@toad.com (Landon Curt Noll)
  14. Posting-number: Volume 39, Issue 105
  15. Archive-name: ioccc.1993/part02
  16. Environment: C
  17.  
  18. #! /bin/sh
  19. # This is ioccc.1993, a shell archive.  Remove anything before this line,
  20. # then feed it into a shell via "sh file" or similar.  To overwrite existing
  21. # files, type "sh file -c".
  22. #
  23. # Contents:  1993/guidelines 1993/lmfjyh.c 1993/lmfjyh.hint
  24. #   1993/plummer.hint 1993/rince.hint 1993/rules 1993/vanb.hint
  25. #
  26. # Send comments, questions, bugs to:
  27. #
  28. #    judges@toad.com   -or-   ...!{sun,uunet,utzoo,pyramid}!hoptoad!judges
  29. #
  30. # You are strongly encouraged to read the new contest rules before
  31. # sending any entries.  The rules, and sometimes the contest Email
  32. # address itself, change over time.  Valid entries one year may
  33. # be rejected in a later year due to changes in the rules.  The typical
  34. # start date for contests is in early March.  Contest rules are normally not
  35. # finalized and posted until the beginning of the contest.  The typical closing
  36. # date for contests are in early May.
  37. #
  38. # The contest rules are posted to comp.unix.wizards, comp.lang.c,
  39. # misc.misc, alt.sources and comp.sources.d.  If you do not have access
  40. # to these groups, or if you missed the early March posting, you may
  41. # request a copy from the judges, via Email, at the address above.
  42. #
  43. # Copyright (c) 1993, Landon Curt Noll & Larry Bassel.
  44. # All Rights Reserved.  Permission for personal, educational or non-profit
  45. # use is granted provided this this copyright and notice are included in its
  46. # entirety and remains unaltered.  All other uses must receive prior permission
  47. # in writing from both Landon Curt Noll and Larry Bassel.
  48. #
  49. # Previous contest winners are available via anonymous ftp from
  50. # ftp.uu.net under the directory /pub/ioccc.
  51. #
  52. # Wrapped by kent@sparky on Sun Sep 26 12:05:11 1993
  53. PATH=/bin:/usr/bin:/usr/ucb:/usr/local/bin:/usr/lbin ; export PATH
  54. echo If this archive is complete, you will see the following message:
  55. echo '          "shar: End of archive 2 (of 4)."'
  56. if test -f '1993/guidelines' -a "${1}" != "-c" ; then 
  57.   echo shar: Will not clobber existing file \"'1993/guidelines'\"
  58. else
  59.   echo shar: Extracting \"'1993/guidelines'\" \(25594 characters\)
  60.   sed "s/^X//" >'1993/guidelines' <<'END_OF_FILE'
  61. X10th International Obfuscated C Code Contest Guidelines, Hints and Comments
  62. X
  63. XCopyright (c) Landon Curt Noll & Larry Bassel, 1993.
  64. XAll Rights Reserved.  Permission for personal, educational or non-profit use is
  65. Xgranted provided this this copyright and notice are included in its entirety
  66. Xand remains unaltered.  All other uses must receive prior permission in writing
  67. Xfrom both Landon Curt Noll and Larry Bassel.
  68. X
  69. XABOUT THIS FILE:
  70. X
  71. X    This file is intended to help people who wish to submit entries to
  72. X    the International Obfuscated C Code Contest (IOCCC for short).
  73. X
  74. X    This is not the IOCCC rules, though it does contain comments about
  75. X    them.  The guidelines should be viewed as hints and suggestions.
  76. X    Entries that violate the guidelines but remain within the rules are
  77. X    allowed.  Even so, you are safer if you remain within the guidelines.
  78. X
  79. X    You should read the current IOCCC rules, prior to submitting entries.
  80. X    The rules are typically sent out with these guidelines.
  81. X
  82. X    Changes from the 1993 draft are noted by change bars.  --->              |
  83. X
  84. X
  85. XWHAT IS NEW IN 1993:
  86. X
  87. X    The entry format is better (for us anyway).  The program mkentry.c
  88. X    has been updated.  See ENTRY FORMAT.
  89. X
  90. X    We will reject entries that cannot be compiled using an ANSI C
  91. X    compiler.  Certain old Obfuscation hacks that cause ANSI C compilers
  92. X    fits are no longer permitted.  Some of the new issues deal with
  93. X    non-integral array types, variable number of arguments, C preprocessor
  94. X    directives and the exit() function.  See OUR LIKES AND DISLIKES.
  95. X
  96. X
  97. XHINTS AND SUGGESTIONS:
  98. X
  99. X    You are encouraged to examine the winners of previous contests.  See
  100. X    FOR MORE INFORMATION for details on how to get previous winners.
  101. X
  102. X    Keep in mind that rules change from year to year, so some winning entries
  103. X    may not be valid entries this year.  What was unique and novel one year
  104. X    might be 'old' the next year.
  105. X
  106. X    An entry is usually examined in a number of ways.  We typically apply
  107. X    a number of tests to an entry:
  108. X
  109. X    * look at the original source
  110. X    * convert ANSI tri-graphs to ASCII
  111. X    * C pre-process the source ignoring '#include' lines
  112. X    * C pre-process the source ignoring '#define' and '#include' lines
  113. X    * run it through a C beautifier
  114. X    * examine the algorithm
  115. X    * lint it
  116. X    * compile it
  117. X    * execute it
  118. X
  119. X    You should consider how your entry looks in each of the above tests.
  120. X    You should ask yourself if your entry remains obscure after it has been
  121. X    'cleaned up' by the C pre-processor and a C beautifier.
  122. X
  123. X    Your entry need not do well under all, or in most tests.  In certain
  124. X    cases, a test is not important.  Entries that compete for the
  125. X    'strangest/most creative source layout' need not do as well as
  126. X    others in terms of their algorithm.  On the other hand, given
  127. X    two such entries, we are more inclined to pick the entry that
  128. X    does something interesting when you run it.
  129. X
  130. X    We try to avoid limiting creativity in our rules.  As such, we leave
  131. X    the contest open for creative rule interpretation.  As in real life
  132. X    programming, interpreting a requirements document or a customer request
  133. X    is important.  For this reason, we often award 'worst abuse of the
  134. X    rules' to an entry that illustrates this point in an ironic way.
  135. X
  136. X    If you do plan to abuse the rules, we suggest that you let us know
  137. X    in the remarks section.  Please note that an invitation to abuse
  138. X    is not an invitation to break.  We are strict when it comes to the
  139. X    3217 byte size limit.  Also, abusing the entry format tends to
  140. X    annoy more than amuse.
  141. X
  142. X    We do realize that there are holes in the rules, and invite entries
  143. X    to attempt to exploit them.  We will award 'worst abuse of the rules'
  144. X    and then plug the hole next year.  Even so, we will attempt to use
  145. X    the smallest plug needed, if not smaller.  :-)
  146. X
  147. X    Check out your program and be sure that it works.  We sometimes make
  148. X    the effort to debug an entry that has a slight problem, particularly
  149. X    in or near the final round.  On the other hand, we have seen some
  150. X    of the best entries fall down because they didn't work.
  151. X
  152. X    We tend to look down on a prime number printer, that claims that
  153. X    16 is a prime number.  If you do have a bug, you are better off
  154. X    documenting it.  Noting "this entry sometimes prints the 4th power
  155. X    of a prime by mistake" would save the above entry.  And sometimes,
  156. X    a strange bug/feature can even help the entry!  Of course, a correctly
  157. X    working entry is best.
  158. X
  159. X
  160. XOUR LIKES AND DISLIKES:
  161. X
  162. X    Doing masses of #defines to obscure the source has become 'old'.  We
  163. X    tend to 'see thru' masses of #defines due to our pre-processor tests
  164. X    that we apply.  Simply abusing #defines or -Dfoo=bar won't go as far
  165. X    as a program that is more well rounded in confusion.
  166. X
  167. X    Many ANSI C compilers dislike the following code, and so do we:
  168. X
  169. X    #define d define
  170. X    #d foo           <-- don't expect this to turn into #define foo
  171. X
  172. X    int i;
  173. X    j;           <-- don't use such implicit type declaration
  174. X    int k;
  175. X
  176. X    We suggest that you compile your entry with an ANSI C compiler.  If you
  177. X    must use non-ANSI C, such as K&R C, you must avoid areas that result in
  178. X    compile/link errors for ANSI C compilers.
  179. X
  180. X    Unfortunately, some ANSI C compilers require array indexes to be of       |
  181. X    integral type.  Thus, the following classical obfuscation hacks should    |
  182. X    not be used in 1993.  This rule may be relaxed in future contests.          |
  183. X
  184. X    int i;
  185. X    char *c;
  186. X    i[c];           <--- use c[i] instead
  187. X    (i+3)["string"];   <--- use "string"[i+3] instead
  188. X
  189. X    If your entry uses functions that have a variable number of
  190. X    arguments, be careful. Systems implement va_list as a wide variety
  191. X    of ways.  Because of this, a number of operations using va_list are
  192. X    not portable and must not be used:
  193. X
  194. X    * assigning a non-va_list variable to/from a va_list variable
  195. X    * casting a non-va_list variable into/from a va_list variable
  196. X    * passing a va_list variable to a function expecting a non-va_list arg
  197. X    * passing a non-va_list variable to a function expecting a va_list arg
  198. X    * performing arithmetic on va_list variables
  199. X    * using va_list as a structure or union
  200. X
  201. X    In particular, do not treat va_list variables as if they were a char **'s.
  202. X
  203. X    Avoid using <varargs.h>, use <stdarg.h> instead.
  204. X
  205. X    If you use C preprocessor directives (#define, #if, #ifdef, ...),
  206. X    the leading '#' must be the first character on a line.  While some
  207. X    C preprocessors allow whitespace the leading '#', many do not.
  208. X
  209. X    Because the exit() function returns void on some systems, entries
  210. X    must not assume that it returns an int.
  211. X
  212. X    Small programs are best when they are short, obscure and concise.
  213. X    While such programs are not as complex as other winners, they do
  214. X    serve a useful purpose.  They are often the only program that people
  215. X    attempt to completely understand.  For this reason, we look for
  216. X    programs that are compact, and are instructional.
  217. X
  218. X    One line programs should be short one line programs, say around 80
  219. X    bytes long.  Getting close to 160 bytes is a bit too long in our opinion.
  220. X
  221. X    We tend to dislike programs that:
  222. X
  223. X    * are very hardware specific
  224. X    * are very OS or Un*x version specific
  225. X         (index/strchr differences are ok, but socket/streams specific
  226. X          code is likely not to be)
  227. X    * dump core or have compiler warnings
  228. X         (it is ok only if you warn us in the 'remark' header item)
  229. X    * won't compile under both BSD or SYS V Un*x
  230. X    * abusing the build file to get around the size limit
  231. X    * obfuscate by excessive use of ANSI tri-graphs
  232. X    * are longer than they need to be
  233. X    * are similar to previous winners
  234. X    * are identical to previous losers  :-)
  235. X
  236. X    Unless you are cramped for space, or unless you are entering the
  237. X    'best one liner' category, we suggest that you format your program
  238. X    in a more creative way than simply forming excessively long lines.
  239. X
  240. X    The build file should not be used to try and get around the size
  241. X    limit.  It is one thing to make use of a several -D's to help out,
  242. X    but it is quite another to use 200+ bytes of -D's in order to
  243. X    try and squeeze the source under the size limit.  You should feel
  244. X    free to make use of the build file space, but you are better off
  245. X    if you show some amount of restraint.
  246. X
  247. X    We allowed whitespace, and in certain cases ; { or } do not impact
  248. X    your program size (up to a certain point), because we want to get
  249. X    away from source that is simply a compact blob of characters.
  250. X
  251. X    Given two versions of the same program, one that is a compact blob
  252. X    of code, and the other that is formatted more like a typical C
  253. X    program, we tend to favor the second version.  Of course, a third
  254. X    version of the same program that is formatted in an interesting
  255. X    and/or obfuscated way, would definitely win over the first two!
  256. X
  257. X    We suggest that you avoid trying for the 'smallest self-replicating'
  258. X    program.  We are amazed at the many different sizes that claim
  259. X    to be the smallest.  There is nothing wrong with self-replicating
  260. X    programs.  In fact, a number of winners have been self-replicating.
  261. X    You might want to avoid the claim of 'smallest', lest we (or others)
  262. X    know of a smaller one!
  263. X
  264. X    X client entries should be as portable as possible.  Entries that
  265. X    adapt to a wide collection of environments will be favored.  Don't
  266. X    depend on a particular type of display.  For example, don't depend
  267. X    on color or a given size.  Don't require backing store.
  268. X
  269. X    X client entries should avoid using X related libraries and
  270. X    software that is not in wide spread use.  We ask that such X client
  271. X    entries restrict themselves to only the low level Xlib and the
  272. X    Athena widget set (libX11.a, libXaw.a, libXmu.a and libXt.a).
  273. X    Don't use M*tif, Xv*ew, or OpenL*ok toolkits, since not everyone
  274. X    has them.  Avoid depending on a particular window manager.  Not
  275. X    everyone has X11r5, and some people are stuck back in X11r4 (or
  276. X    earlier), so try to target X11r5 without requiring X11r5.  Better
  277. X    yet, try to make your entry run on all version 11 X Window Systems.
  278. X
  279. X    X client entries should not to depend on particular items on
  280. X    .Xdefaults.  If you must do so, be sure to note the required lines
  281. X    in the ---remark--- section.
  282. X
  283. X    We like programs that:
  284. X
  285. X    * are as concise and small as they need to be
  286. X    * do something at least quasi-interesting
  287. X    * pass lint without complaint (not a requirement, but it is nice)
  288. X    * are portable
  289. X    * are unique or novel in their obfuscation style
  290. X    * MAKE USE OF A NUMBER OF DIFFERENT TYPES OF OBFUSCATION
  291. X    * make us laugh and/or throw up  :-)
  292. X
  293. X    Some types of programs can't excel in some areas.  Of course, your
  294. X    program doesn't have to excel in all areas, but doing well in several
  295. X    areas really does help.
  296. X
  297. X    We freely admit that interesting, creative or humorous comments in
  298. X    the ---remark--- section helps your chance of winning.  If you had to
  299. X    read of many twisted entries, you too would enjoy a good laugh or two.
  300. X    We think the readers of the contest winners do as well.
  301. X
  302. X    Be creative!
  303. X
  304. X
  305. XENTRY FORMAT:
  306. X
  307. X    In order to help us process the many entries, we must request your
  308. X    assistance by formatting your entries in a certain way.  This format,
  309. X    in addition, allows us to quickly separate information about the
  310. X    author from the program itself.  (see JUDGING PROCESS)
  311. X
  312. X    We have provided the program, mkentry, as an example of how to
  313. X    format entries.  You should be aware of the following warning that
  314. X    is found in mkentry.c:
  315. X
  316. X    This program attempts to implement the IOCCC rules.  Every
  317. X    attempt has been made to make sure that this program produces
  318. X    an entry that conforms to the contest rules.  In all cases,
  319. X    where this program differs from the contest rules, the
  320. X    contest rules will be used.  Be sure to check with the
  321. X    contest rules before submitting an entry.
  322. X
  323. X    You are not required to use mkentry.  It is convenient, however,
  324. X    as it attempts to uuencode the needed files, and attempt to check
  325. X    the entry against the size rules.
  326. X
  327. X    If you have any suggestions, comments, fixes or complaints about
  328. X    the mkentry.c program, please send Email to the judges.  (see below)
  329. X
  330. X    The following is a sample entry:
  331. X
  332. X---entry---
  333. Xrule:    1993
  334. Xfix:    n
  335. Xtitle:    chonglab
  336. Xentry:    0
  337. Xdate:    Mon Mar  1 08:45:20 1993
  338. Xhost:    Un*x v6, pdp11/45
  339. X    2.9BSD, pdp11/70
  340. X---remark---
  341. X    This is a non-obfuscated obfuscated C program.
  342. X
  343. X    It is likely not to win a prize.  But what do you expect from
  344. X    a short example!
  345. X---author---
  346. Xname:    Landon Curt Noll
  347. Xorg:    IOCCC Judging Group
  348. Xaddr:    Toad Hall
  349. X    PO Box 170608
  350. X    San Francisco, California
  351. X    94117-0608
  352. X    USA
  353. Xemail:    chongo@toad.com
  354. Xanon:    n
  355. X---author---
  356. Xname:    Larry Bassel
  357. Xorg:    IOCCC Judging Group
  358. Xaddr:    Toad Hall
  359. X    PO Box 170608
  360. X    San Francisco, California
  361. X    94117-0608
  362. X    USA
  363. Xemail:    hoptoad!sun!lab
  364. X    lab@sun.com
  365. Xanon:    n
  366. X---info---
  367. Xbegin 444 info.file
  368. XM0V]P>7)I9VAT("AC*2!,86YD;VX@0W5R="!.;VQL+"`Q.3DS+@I!;&P@4FEG
  369. XM:'1S(%)E<V5R=F5D+B`@4&5R;6ES<VEO;B!F;W(@<&5R<V]N86PL(&5D=6-A
  370. XM=&EO;B!O<B!N;VXM<')O9FET('5S92!I<PIG<F%N=&5D('!R;W9I9&5D('1H
  371. XM:7,@=&AI<R!C;W!Y<FEG:'0@86YD(&YO=&EC92!A<F4@:6YC;'5D960@:6X@
  372. XM:71S(&5N=&ER971Y"F%N9"!R96UA:6YS('5N86QT97)E9"X@($%L;"!O=&AE
  373. XM<B!U<V5S(&UU<W0@<F5C96EV92!P<FEO<B!P97)M:7-S:6]N(&EN('=R:71I
  374. XM;F<*9G)O;2!,86YD;VX@0W5R="!.;VQL+@H*5&AA="!T:&%T(&ES+"!I<RX*
  375. XM5&AA="!T:&%T(&ES(&YO="P*("`@(&ES(&YO="!T:&%T('1H870@;F]T(&ES
  376. XM+@I4:&%T(&ES+"!T:&%T('1H870@:7,@;F]T+"!I<R$*"@D)+2T@8VAO;F=O
  377. XM(#$Y-S0*"DQA<W0@>65A<BP@;VYE('!E<G-O;B!T;VQD('5S('1H870@=&AE
  378. XM>2!A8W1U86QL>2!D96-O9&5D('1H:7,@9FEL92X*22!W;VYD97(@:&]W(&UA
  379. X9;GD@=VEL;"!D;R!I="!T:&ES('EE87(_"@``
  380. X`
  381. Xend
  382. X---build---
  383. Xbegin 444 build
  384. X28V,@<')O9RYC("UO('!R;V<*
  385. X`
  386. Xend
  387. X---program---
  388. Xbegin 444 prog.c
  389. XM;6%I;B@I"GL*(VEF(&1E9FEN960H05]214=)4U1%4D5$7U9/5$527TE.7U-5
  390. XM3DY95D%,15]#04Q)1D]23DE!7U5302D*("`@('!R:6YT9B@B5F]T92!,86YD
  391. XM;VX@3F]L;"!F;W(@4W5N;GEV86QE($-I='D@0V]U;F-I;"!S96%T(",Q+EQN
  392. X:(BD["B-E;F1I9@H@("`@97AI="@P*3L*?0H`
  393. X`
  394. Xend
  395. X---end---
  396. X
  397. X    Typically the build file should assume that the source is prog.c
  398. X    and will compile into prog.  If an entry wins, we will rename
  399. X    its source and binary to avoid filename collision.  By tradition,
  400. X    we use the name of the entry's title, followed by an optional
  401. X    digit in case of name conflicts.
  402. X
  403. X    If the above entry somehow won the 'least likely to win' award,
  404. X    we would use chonglab.c and chonglab.
  405. X
  406. X    If your entry depends on, or requires that your build, source
  407. X    and/or binary files be a particular name, please say so in the
  408. X    ---remark--- section.  If this case applies, it would be be helpful
  409. X    if you did one of the following:
  410. X
  411. X    * Tell us how to change the filename(s) in your entry.
  412. X
  413. X    * Have the build file make copies of the files.  For example:
  414. X
  415. X        cc prog.c -o special_name        need special binary
  416. X
  417. X        or  rm -f special_src.c            need special source
  418. X        cp prog.c special_src.c
  419. X        cc special_src.c -o special_name
  420. X
  421. X        or  rm -f special_build            need special build
  422. X        tail +4 build > special_build
  423. X        sh < special_build
  424. X
  425. X    * Assume that we will use the entry title.  Send us a version of
  426. X      your build/program files that uses the name convention.  You
  427. X      should uuencode these files in ---data--- sections.
  428. X
  429. X    If your entry needs to modify its source, info or binary files,
  430. X    please say so in the ---remark--- section.  You should try to avoid
  431. X    touching your original build, source and binary files.  You should
  432. X    arrange to make copies of the files you intend to modify.  This
  433. X    will allow people to re-generate your entry from scratch.
  434. X
  435. X    Remember that your entry may be built without a build file.  We
  436. X    typically incorporate the build lines into a Makefile.  If the
  437. X    build file must exist, say so in the ---remark--- section.
  438. X
  439. X    If your entry needs special info files, you should uuencode them
  440. X    into ---info--- sections.  In the case of multiple info files,
  441. X    use multiple ---info--- sections.  If no info files are needed,
  442. X    then skip the ---info--- section.
  443. X
  444. X    Info files are intended to be input, or detailed information that
  445. X    does not fit well into the ---remark--- section.  For example, an
  446. X    entry that implements a compiler might want to provide some sample
  447. X    programs for the user to compile.  An entry might want to include a
  448. X    lengthy design document, that might not be appropriate for a
  449. X    'hints' file.
  450. X
  451. X    Info files should be used only to supplement your entry.  For
  452. X    example, info files may provide sample input or detailed
  453. X    information about your entry.  Because they are supplemental,
  454. X    the entry should not require them exist.
  455. X
  456. X    In some cases, your info files might be renamed to avoid name
  457. X    conflicts.  If info files should not be renamed for some reason,
  458. X    say so in the ---remark--- section.
  459. X
  460. X    Info files must uudecode into the current directory.  If they
  461. X    absolutely must be renamed, or moved into a sub-directory, say
  462. X    so in the ---remark--- section.
  463. X
  464. X    When submitting multiple entries, be sure that each entry has
  465. X    a unique entry number from 0 to 7.  Your first entry should
  466. X    have entry number 0.
  467. X
  468. X    With the exception of the header, all text outside of the entry
  469. X    format may be ignored.  That is, don't place text outside of the
  470. X    entry and expect the judges to see it.  (Our decoding tools aren't
  471. X    AI progs!) If you need tell the the something, put it in the
  472. X    ---remark--- section, or send a Email to the judges at:
  473. X
  474. X    ...!{apple,pyramid,sun,uunet}!hoptoad!judges    (not the address for
  475. X    judges@toad.com                     submitting entries)
  476. X
  477. X    The date should be given with respect to UTC.  (Some systems refer
  478. X    to this as GMT or GMT0)  The format of the date should be that as
  479. X    returned by asctime() in the C locale.  An example of such a string is:
  480. X
  481. X    Thr Apr 01 00:47:00 1993
  482. X
  483. X    This format is similar to the output of the date(1) command.  The
  484. X    string does not include the timezone name before the year.  On many
  485. X    systems, one of the following command will produce a similar string:
  486. X
  487. X    date -u "+%a %h %d %T 19%y"
  488. X    date -u | sed -e 's/... \(19[0-9][0-9]\)$/\1/'
  489. X    sh -c 'TZ=UTC date | sed -e "s/... \(19[0-9][0-9]\)$/\1/"'
  490. X    sh -c 'TZ=GMT date | sed -e "s/... \(19[0-9][0-9]\)$/\1/"'
  491. X    sh -c 'TZ=GMT0 date | sed -e "s/... \(19[0-9][0-9]\)$/\1/"'
  492. X
  493. X    You are allowed to update/fix/revise your entry.  To do so, set
  494. X    the 'fix' line in the ---entry--- section to 'y' instead of 'n'.
  495. X    Be sure that the resubmittion uses the same title and entry number
  496. X    as well, as these are used to determine which entry is to be
  497. X    replaced.
  498. X
  499. X
  500. XJUDGING PROCESS:
  501. X
  502. X    Entries are judged by Larry Bassel and Landon Curt Noll.
  503. X
  504. X    Entries are unpacked into individual directories.  The Email message
  505. X    is unpacked into individual files, each containing:
  506. X
  507. X    ---entry--- section
  508. X    all ---author--- sections
  509. X    all ---info--- sections
  510. X    ---build--- section
  511. X    ---program--- section
  512. X    any other text, including the Email message headers
  513. X
  514. X    Prior to judging, the 'any other text' file is scanned to be sure
  515. X    it does not contain useful information (or in case the entry was
  516. X    malformed and did not unpack correctly).  Information from the
  517. X    ---author--- sections are not read until the judging process is
  518. X    complete, and then only from entries that have won an award.
  519. X
  520. X    The above process helps keep us biased for/against any one particular
  521. X    individual.  We are usually kept in the dark as much as you are
  522. X    until the final awards are given.  We like the surprise of finding
  523. X    out in the end, who won and where they were from.
  524. X
  525. X    We attempt to keep all entries anonymous, unless they win an award.
  526. X    Because the main 'prize' of winning is being announced, we make all
  527. X    attempts to send non-winners into oblivion.  We remove all non-winning
  528. X    files, and shred all related paper.  By tradition, we do not even
  529. X    reveal the number of entries that we received.  (for the curious,
  530. X    we do indicate the volume of paper consumed when presenting the IOCCC
  531. X    winners at talks)
  532. X
  533. X    After the Usenix announcement, we attempt to send Email to the
  534. X    authors of the winning entries.  One reason we do this is to give
  535. X    the authors a chance to comment on the way we have presented their
  536. X    entry.  They are given the chance to correct mistakes, typos.  We
  537. X    often accept their suggestions/comments about our remarks as well.
  538. X    This is done prior to posting the winners to the wide world.
  539. X
  540. X    Judging consists of a number of elimination rounds.  During a round,
  541. X    the collection of entries are divided into two roughly equal piles;
  542. X    the pile that advances on to the next round, and the pile that does
  543. X    not.  We also re-examine the entries that were eliminated in the
  544. X    previous round.  Thus, an entry gets at least two readings.
  545. X
  546. X    A reading consists of a number of actions:
  547. X
  548. X    * reading the ---entry--- section
  549. X    * reading the uudecoded ---build--- section
  550. X    * reading the uudecoded ---program--- section
  551. X    * reading the uudecoded ---info--- section(s), if any
  552. X    * passing the source thru the C pre-processor
  553. X        shipping over any #include files
  554. X    * performing a number of C beautify/cleanup edits on the source
  555. X    * passing the beautified source thru the C pre-processor
  556. X        shipping over any #include files
  557. X
  558. X    In later rounds, other actions are performed:
  559. X
  560. X    * linting the source
  561. X    * compiling/building the source
  562. X    * running the program
  563. X    * performing misc tests on the source and binary
  564. X
  565. X    Until we reduce the stack of entries down to about 25 entries, entries
  566. X    are judged on an individual basis.  An entry is set aside because it
  567. X    does not, in our opinion, meet the standard established by the round.
  568. X    When the number of entries thins to about 25 entries, we begin to form
  569. X    award categories.  Entries begin to compete with each other for awards.
  570. X    An entry often will compete in several categories.
  571. X
  572. X    The actual award category list will vary depending on the types of entries
  573. X    we receive.  A typical category list might be:
  574. X
  575. X    * best small one line program
  576. X    * best small program
  577. X    * strangest/most creative source layout
  578. X    * most useful obfuscated program
  579. X    * best game that is obfuscated
  580. X    * most creatively obfuscated program
  581. X    * most deceptive C code
  582. X    * best X client (see OUR LIKES AND DISLIKES)
  583. X    * best abuse of ANSI C
  584. X    * worst abuse of the rules
  585. X    * <anything else so strange that it deserves an award>
  586. X
  587. X    We do not limit ourselves to this list.  For example, a few entries are so
  588. X    good/bad that they are declared winners at the start of the final round.
  589. X    We will invent awards categories for them, if necessary.
  590. X
  591. X    In the final round process, we perform the difficult tasks of
  592. X    reducing the remaining entries (typically about 25) down to 8 or 10
  593. X    winners.  Often we are confident that the entries that make it into
  594. X    the final round are definitely better than the ones that do not
  595. X    make it.  The selection of the winners out of the final round, is
  596. X    less clear cut.
  597. X
  598. X    Sometimes a final round entry good enough to win, but is beat out
  599. X    by a similar, but slightly better entry.  For this reason, it is
  600. X    sometimes worthwhile to re-enter an improved version of an entry
  601. X    that failed to win in a previous year.  This assumes, of course,
  602. X    that the entry is worth improving in the first place!
  603. X
  604. X    More often that not, we select a small entry (usually one line), a
  605. X    strange/creative layout entry, and an entry that abuses the contest
  606. X    rules in some way.
  607. X
  608. X    In the end, we traditionally pick one entry as 'best'.  Sometimes such
  609. X    an entry simply far exceeds any of the other entry.  More often, the
  610. X    'best' is picked because it does well in a number of categories.
  611. X
  612. X
  613. XANNOUNCEMENT OF WINNERS:
  614. X
  615. X    The first announcement, occurs at a Summer Usenix conference.  By tradition,
  616. X    this is done during the latter part of the UUNET/IOCCC BOF, just prior to
  617. X    the Berkeley BSD, and BSDI BOF.
  618. X
  619. X    Winning entries will be posted in late June to the following groups:
  620. X
  621. X        comp.lang.c          comp.unix.wizards    alt.sources
  622. X
  623. X    In addition, pointers to these postings are posted to the following
  624. X
  625. X        comp.sources.d      alt.sources.d        misc.misc
  626. X        comp.sources.misc      comp.windows.x
  627. X
  628. X    Winning entries will be deposited into the uunet archives.  See
  629. X    below for details.
  630. X
  631. X    Often, winning entries are published in selected magazines.  Winners
  632. X    have appeared in books ("The New Hackers Dictionary") and on T-Shirts.
  633. X
  634. X    Last, but not least, winners receive international fame and flames!  :-)
  635. X
  636. X
  637. XFOR MORE INFORMATION:
  638. X
  639. X    You may contact the judges by sending Email to the following address:
  640. X
  641. X    ...!{apple,pyramid,sun,uunet}!hoptoad!judges    (not the address for
  642. X    judges@toad.com                     submitting entries)
  643. X
  644. X    Questions and comments about the contest are welcome.
  645. X
  646. X    The rules and the guidelines may (and often do) change from year to          |
  647. X    year.  You should be sure you have the current rules and guidelines          |
  648. X    prior to submitting entries.  To obtain them, send Email to the address   |
  649. X    above and use the subject 'send rules'.                      |
  650. X
  651. X    One may obtain winners of previous contests (1984 to date), via ftp from: |
  652. X
  653. X    host: ftp.uu.net    (192.48.96.9)                      |
  654. X    user: anonymous
  655. X    pass: yourname@yourhost
  656. X    dir:  ~/pub/ioccc                              |
  657. X
  658. X    As a last resort, previous winners may be obtained by sending Email          |
  659. X    to the above address.  Please use the subject 'send YEAR winners',          |
  660. X    where YEAR is a single 4 digit year, a year range, or 'all'.          |
  661. X
  662. X
  663. Xchongo <Landon Curt Noll> /\cc/\      chongo@toad.com                  |
  664. XLarry Bassel                  lab@sun.com                  |
  665. END_OF_FILE
  666.   if test 25594 -ne `wc -c <'1993/guidelines'`; then
  667.     echo shar: \"'1993/guidelines'\" unpacked with wrong size!
  668.   fi
  669.   # end of '1993/guidelines'
  670. fi
  671. if test -f '1993/lmfjyh.c' -a "${1}" != "-c" ; then 
  672.   echo shar: Will not clobber existing file \"'1993/lmfjyh.c'\"
  673. else
  674.   echo shar: Extracting \"'1993/lmfjyh.c'\" \(17 characters\)
  675.   sed "s/^X//" >'1993/lmfjyh.c' <<'END_OF_FILE'
  676. Xchar*_=__FILE__;
  677. END_OF_FILE
  678.   if test 17 -ne `wc -c <'1993/lmfjyh.c'`; then
  679.     echo shar: \"'1993/lmfjyh.c'\" unpacked with wrong size!
  680.   fi
  681.   # end of '1993/lmfjyh.c'
  682. fi
  683. if test -f '1993/lmfjyh.hint' -a "${1}" != "-c" ; then 
  684.   echo shar: Will not clobber existing file \"'1993/lmfjyh.hint'\"
  685. else
  686.   echo shar: Extracting \"'1993/lmfjyh.hint'\" \(5414 characters\)
  687.   sed "s/^X//" >'1993/lmfjyh.hint' <<'END_OF_FILE'
  688. XMost Versatile Source: <lmfjyh@ericsson.fi> Jyrki Holopainen
  689. X
  690. X    Jyrki Holopainen
  691. X    Oy LM Ericsson Ab
  692. X    SF-02420 Jorvas
  693. X    Finland
  694. X
  695. X
  696. XJudges' comments:
  697. X
  698. X    To use:
  699. X    make lmfjyh
  700. X    ./lmfjyh
  701. X    
  702. X    See the makefile for details.
  703. X
  704. X    There's more than one way to get around disk quotas. :-)
  705. X
  706. X    Some people have reported problems compiling this entry
  707. X    with gcc 2.3.3.
  708. X
  709. X    The make command:
  710. X
  711. X    make tidy
  712. X    
  713. X    will remove the "special" file that is created during the 
  714. X    make of lmfjyh.
  715. X
  716. X
  717. XSelected notes from the author:
  718. X
  719. X    "Practical and efficient method of compressing source code"
  720. X
  721. X    1. Introduction
  722. X
  723. X    I will shortly present a totally new compression method.
  724. X    It may be used to compress any types of files, but it works
  725. X    best with C-source code.
  726. X
  727. X    As an example, I have taken a simple "Hello world!" program
  728. X    that should be familiar to all C-programmers.
  729. X
  730. X    Listing 1. A simple "Hello World" program:
  731. X
  732. X    main()
  733. X    {
  734. X      puts("Hello World!");
  735. X    }
  736. X
  737. X
  738. X    2. Packing method
  739. X
  740. X    Normally a file name is used only to identify the file, 
  741. X    but this new revolutionary method introduces a totally new concept: 
  742. X    THE FILE NAME IS THE PROGRAM. There is no need to waste
  743. X    valuable disk space to store source code. The program is
  744. X    embedded in the file name, only a minor portion of it
  745. X    is inside the file.
  746. X
  747. X    Listing 2. Compressed "Hello world":
  748. X
  749. X    char*_=__FILE__;
  750. X
  751. X
  752. X    Listing 3. Code embedded in the file name:
  753. X
  754. X    ";main(){puts("Hello World!");}char*C=".c
  755. X
  756. X
  757. X    The sample program in listing 1 is 36 bytes long. By using the new
  758. X    compression method, the example program may be squeezed to sixteen
  759. X    bytes. In the example the compression ratio is 2:1. It is evident
  760. X    that the longer the program is, the better the compression ratio
  761. X    is. The maximum compression ratio in a UNIX environment is 254:16
  762. X    which equals approximately to 16:1.  By using the method a one
  763. X    megabyte of source code can be compressed to 64 kilobytes.
  764. X
  765. X    One might easily think that the program could be compressed to a
  766. X    single byte by writing a one character long preprocessor directive
  767. X    in the source file and defining the actual source code in the
  768. X    command line, eg. 'cc hello.c -DX=main(){puts...'.  With this
  769. X    method nothing is gained, since the compiling commands must be
  770. X    stored in a file, and that takes even more space than writing the
  771. X    code in a source file as presented in listing 1.
  772. X
  773. X
  774. X    3. Packing files in a UNIX environment
  775. X
  776. X    In a UNIX environment it is possible to write almost any program by
  777. X    including the code in file names. Since '/' is used to separate
  778. X    path components and cannot therefore exist in a file name, all
  779. X    features of C-language cannot be used.
  780. X
  781. X    In C, the '/' is used as a division operator and it may also be a
  782. X    part of a comment start and end identifier. This is, however, not a
  783. X    dangerous limitation, since practice has shown that comments are
  784. X    almost totally unnecessary. A real programmer can more easily
  785. X    understand pure source code, and misleading comments are
  786. X    disastrous. The division operation may be replaced with pow(x, -1)
  787. X    and multiplication when using real numbers or with div() function
  788. X    when using integers.
  789. X
  790. X    Large programs must be separated into small modules. This enforces
  791. X    people to write better programs, since monolithic programming style
  792. X    cannot be used. Program development will also be faster, no extra
  793. X    code need not be recompiled after changes have been made.
  794. X
  795. X
  796. X    4. Usage with currently available tools
  797. X
  798. X    I have tested how well this new method works with currently
  799. X    available programming tools.
  800. X
  801. X    Any ANSI conforming C-compiler that runs under a REAL operating
  802. X    system should be able to compile the code.  (there may be problems
  803. X    with some older UNIX variants)
  804. X
  805. X    4.1. Compilers:
  806. X
  807. X    These worked:
  808. X    gcc versions 2.0, 2.1, 2.3.2 (ld failed at AIX with gcc 2.1)
  809. X    cc (HP-UX)
  810. X    cc (VAX)
  811. X
  812. X    These failed miserably:
  813. X    cc (SunOs/Solaris)      - could not start cpp properly
  814. X    cc/xlc (AIX)            - could not open source
  815. X
  816. X    4.2. Other tools:
  817. X
  818. X    4.2.1 Debuggers: (tested at SunOs 4.1.2)
  819. X
  820. X    dbx     - Quit with a very 'informative' error message:
  821. X        "dbx: fatal error: Is a directory"
  822. X
  823. X    gdb     - Printed almost the same error message ":Is a directory".
  824. X        It was, however, possible to step through the code but 
  825. X        not list it.
  826. X
  827. X    4.2.2 Lints:
  828. X
  829. X        - None of the lints at tested environments were able
  830. X          to open the file.
  831. X
  832. X
  833. X    5. Conclusions
  834. X
  835. X    The method can be used to compress any types of files, actually the
  836. X    compression ratios are even better when compressing other files
  837. X    than C-source.  For example plain text files may be compressed with
  838. X    INFINITE compression ratio. It is trivial task to compress a 100
  839. X    kilobytes long text file in about 400 files whose lengths are zero
  840. X    bytes.  The drawback is that the files must be unpacked before they
  841. X    can be used, so a large amount of temporary disk space is needed,
  842. X    while C-source is totally usable in the compressed form.
  843. X
  844. X    Evidently, there is a long way to go before this new programming
  845. X    technique may be widely used, since currently there are only few
  846. X    tools supporting it. The advantages over the traditional methods
  847. X    are, however, so great that there is no doubt that this method will
  848. X    be new standard.
  849. END_OF_FILE
  850.   if test 5414 -ne `wc -c <'1993/lmfjyh.hint'`; then
  851.     echo shar: \"'1993/lmfjyh.hint'\" unpacked with wrong size!
  852.   fi
  853.   # end of '1993/lmfjyh.hint'
  854. fi
  855. if test -f '1993/plummer.hint' -a "${1}" != "-c" ; then 
  856.   echo shar: Will not clobber existing file \"'1993/plummer.hint'\"
  857. else
  858.   echo shar: Extracting \"'1993/plummer.hint'\" \(3613 characters\)
  859.   sed "s/^X//" >'1993/plummer.hint' <<'END_OF_FILE'
  860. XBest One Liner: <plummer@cthulu.med.jhu.edu> Mark Plummer
  861. X
  862. X    Mark Plummer
  863. X    2901 Reckord Road
  864. X    Fallston, MD, 21047
  865. X    USA
  866. X
  867. X
  868. XJudges' comments:
  869. X
  870. X    To run:
  871. X    make plummer
  872. X    ./plummer number arg
  873. X
  874. X    where:
  875. X    number    a number     (try 21701)
  876. X    arg    any argument
  877. X    
  878. X    For extra credit: What happens when 'number' contains non-numeric
  879. X    characters, and why?
  880. X
  881. X
  882. XSelected notes from the author:
  883. X
  884. X    This program prints out all numbers up to a given number of digits
  885. X    on a single line.  When the largest number is reached, the program
  886. X    starts again with 0.  It takes two arguments: the first argument
  887. X    specifies the number to start counting from and uses leading 0's to
  888. X    indicate the number of digits, the second argument can be anything
  889. X    but must be present.
  890. X
  891. X    Variable names are single characters chosen for their similarity to
  892. X    other characters (O for 0, l for 1, S for 5 (in some fonts), and _
  893. X    for ...  well nothing really, but it is easy to miss).  To prevent
  894. X    the need for strlen(), the fact that argv is laid out sequentially
  895. X    is exploited (ie.  argv[i + 1] == argv[i] + strlen(argv[i]) + 1).
  896. X    This is not portable (by the books), but it seems to work
  897. X    everywhere I try (actually, for vms, that only holds for i > 1).
  898. X    Also, I depend on the fact that a carriage return causes the line
  899. X    just written to be overwritten.  lint (and most compilers) complain
  900. X    that there is no control path leading to a return from main().  At
  901. X    125 characters, it still fits on a single line (for those of us who
  902. X    don't mind ruining our eyes with 132 column screens).
  903. X
  904. X    The first statement points the base of l (the argument vector) to
  905. X    be the first argument by incrementing it.  It then assigns O to
  906. X    point to the character before the first character of the second
  907. X    argument which also happens to be the null termination of the first
  908. X    argument.  *O gets a \r assigned to it.  Finally 0 is assigned to
  909. X    the first character of the second argument which has the effect of
  910. X    null terminating the first argument after the carriage return had
  911. X    removed its null termination.  I really tried to make the last part
  912. X    of that statement part of the original expression, but the best I
  913. X    could do was attach it with a comma (against the advice of K&R).
  914. X    The for loop runs the next for loop continuously (actually until
  915. X    the machine crashes or the user gets tired of seeing the
  916. X    counting).  The next for loop is the meat of the program.  In the
  917. X    initialization statement, the string pointed to by l (the first
  918. X    argument containing the digits used for counting followed by a \r)
  919. X    is printed, and _ is started at the least significant digit in the
  920. X    string.  In the test portion, _ is insured not to be past the
  921. X    beginning of the string (the most significant digit), and the digit
  922. X    pointed to by _ is incremented and checked to be sure that it _is_
  923. X    greater than '9' (written here as (S+*O+S)*S).  If the test fails,
  924. X    either the string has been incremented or each digit in the string
  925. X    has been reset to '0'.  If the test succeeded, the iteration
  926. X    statement assigns '0' (written here as (S+*O)*S (which has the
  927. X    added bonus of having the code be a cry for help)) to *_ and
  928. X    decrements _ to point to the next more significant digit to be
  929. X    incremented; it is done only when a carry situation results (*_ has
  930. X    been incremented past '9').
  931. X
  932. X    The inspiration for this program came from actual code which dealt
  933. X    with scanning for a unique temporary filename by appending a
  934. X    successively larger number to the end of a string.
  935. END_OF_FILE
  936.   if test 3613 -ne `wc -c <'1993/plummer.hint'`; then
  937.     echo shar: \"'1993/plummer.hint'\" unpacked with wrong size!
  938.   fi
  939.   # end of '1993/plummer.hint'
  940. fi
  941. if test -f '1993/rince.hint' -a "${1}" != "-c" ; then 
  942.   echo shar: Will not clobber existing file \"'1993/rince.hint'\"
  943. else
  944.   echo shar: Extracting \"'1993/rince.hint'\" \(6839 characters\)
  945.   sed "s/^X//" >'1993/rince.hint' <<'END_OF_FILE'
  946. XMost Well Rounded: <jkb@mrc-lmb.cam.ac.uk> James Bonfield
  947. X
  948. X    James Bonfield
  949. X    MRC Laboratory of Molecular Biology,
  950. X    Hills Road,
  951. X    Cambridge,
  952. X    England
  953. X
  954. X
  955. XJudges' comments:
  956. X
  957. X    To run:
  958. X    make rince
  959. X    rince [cabbage]
  960. X
  961. X    where:
  962. X    [cabbage]    a CABBAGE description file  (default: rince.c)
  963. X    
  964. X    The author has provided several CABBAGE files for your amusement:
  965. X
  966. X    rince.data1    plays breakout.  Keys are ',' for left, '/' 
  967. X            for right, and '.' for 'fire the ball'.
  968. X
  969. X    rince.data2    plays the old rince game from IOCCC 1991
  970. X
  971. X    rince.data3    Sokoban screen 11. You are the 'o' character. You 
  972. X            must push the money 'm' into the dotted region of 
  973. X            the screen. The game is considered finished when 
  974. X            all the 'm's are then 'M's.
  975. X
  976. X    rince.data4    Sokoban screen 13. Same rules as above.
  977. X
  978. X    For a brief design description, see rince.design.
  979. X
  980. X    The select(2) from SunOS says:
  981. X
  982. X    BUGS
  983. X
  984. X    ...
  985. X
  986. X    select() should probably return the time remaining from  the
  987. X    original  timeout,  if  any,  by modifying the time value in
  988. X    place.  This may be implemented in future  versions  of  the
  989. X    system.   Thus,  it  is  unwise  to  assume that the timeout
  990. X    pointer will be unmodified by the select() call.
  991. X
  992. X    Systems such as Linux does return the remaining time in timeout
  993. X    field (0 if no keys were pressed), but `rince' assumes that
  994. X    timeout remains unmodified.
  995. X
  996. X    It has been suggested that:
  997. X
  998. X        select(k,&y,0,0,&v)
  999. X    
  1000. X    should be replaced with:
  1001. X
  1002. X        select(k,&y,0,0,(v.tv_usec=1<<whatever_you_want,&v))
  1003. X    
  1004. X    where whatever_you_want is some integer such as 17 or 19.
  1005. X
  1006. X    WARNING:
  1007. X
  1008. X    If you are running SunOS 4.1.x (assuming you can find an ANSI
  1009. X    compiler in the first place), this program may be used to log
  1010. X    out very quickly.  Unfortunately, you can't do anything else
  1011. X    with it.
  1012. X
  1013. X    Some people may want to slow down the game by increasing the
  1014. X    value 17 in the line:
  1015. X
  1016. X        struct timeval v= {0,1<<17} ;
  1017. X    
  1018. X    to something like 18 or 19.
  1019. X
  1020. X    One may also need to do a "stty sane" if you kill the program
  1021. X    to restore your terminal state.
  1022. X
  1023. X    Some people report that rince dumps core on their system.
  1024. X
  1025. X    On some systems that use gcc, the curses.h used by gcc
  1026. X    (typically /usr/local/include/curses.h) is not compatible with
  1027. X    the curses library (typically /lib/libcurses.a) used.  It has
  1028. X    been suggested that the following gcc command may help:
  1029. X
  1030. X        gcc -fno-builtin -I/usr/include -o rince rince.c -lcurses -ltermcap
  1031. X    
  1032. X
  1033. XSelected notes from the author:
  1034. X
  1035. X    This is a Cellular Automata Based, Beautifully Abysmal Game Environment (or
  1036. X    CABBAGE for short). To execute the program simply type 'jkb gamefile',
  1037. X    where `gamefile' is a game description file. A couple are supplied for
  1038. X    your enjoyment. Alternatively, with no arguments it will default to using
  1039. X    it's own datafile (the source code infact). This happens to be a game of
  1040. X    space invaders. To prevent people from firing too often a very simple
  1041. X    method is employed; you must move after firing to be able to fire again.
  1042. X
  1043. X    Keys are:   Left  :    j
  1044. X            Right :    l
  1045. X            Fire  :    k
  1046. X
  1047. X    This is a new breed of generic games. For instance:
  1048. X    Game play   : Whatever you define
  1049. X    Keys        : Whatever you define
  1050. X    Score       : If you can figure out how to update it!
  1051. X    Levels      : Ahh well... it's not *totally* generic.
  1052. X
  1053. X    The proper definition for usage would be:
  1054. X    jkb [data_filename]
  1055. X
  1056. X    Portability
  1057. X    -----------
  1058. X
  1059. X    I have compiled in on the following systems:
  1060. X
  1061. X    System              OS              Compiler        
  1062. X    -------------------------------------------------------------------------
  1063. X    DECstation 5000/240 Ultrix 4.2A     c89 -std
  1064. X    SPARCstation 1+     SunOS 4.1       gcc -ansi -pedantic
  1065. X    SPARCstation 10/31  Solaris 2.1     gcc -ansi -pedantic     (*)
  1066. X    DECAlpha 3000/500   OSF/1 V1.2      c89 -std
  1067. X    SGI Indigo (R4000)  IRIX 4.0.5F     cc -ansi
  1068. X    Alliant FX2800      Conentrix 3.0.0 fxc
  1069. X
  1070. X    (*) I never said it worked! The guidelines state that you dislike programs
  1071. X        that won't *compile* under both BSD or SYS V Un*x. This compiles, and
  1072. X        indeed runs on all the others (both BSD and SYS V) correctly.
  1073. X
  1074. X    Alas, on Solaris it compiles, but mysteriously stops displaying output
  1075. X    after a while until you quit with control C, when it all catches up again.
  1076. X    I think the problem may lie in either select(), or curses, (or perhaps
  1077. X    conflict of the two).
  1078. X
  1079. X    The use of select() no doubt makes it less portable to STRICT system V
  1080. X    machines. However I have tested this on several so-called system V
  1081. X    machines, and all of them support select(). In fact, the select() they
  1082. X    support appears to be more portable between them than their poll() call.
  1083. X
  1084. X    Obfuscation details
  1085. X    -------------------
  1086. X
  1087. X    I have tried to use as many different obfuscation techniques, including
  1088. X    some of which (such as sizeof confusion) I have not seen in any winners
  1089. X    (hmmm - perhaps there's a reason for that...) so far. Also, very poor
  1090. X    structure (yes, I use goto's) has lead to apparently having an fgets() as
  1091. X    the last line of main. Note that I have still tried to aim at least some
  1092. X    efficiency (provided it makes things slightly more obfuscated of course).
  1093. X    One such thing is the way I dynamically allocate a 2-dimensional array
  1094. X    using only ONE malloc(). Hence this program could be used as a tutorial
  1095. X    for all those people who consistently ask this question in the C
  1096. X    newsgroups.
  1097. X
  1098. X    Also, the program does require a volatile type (especially when
  1099. X    optimising) to perform correctly. This is the first time I have ever
  1100. X    truly needed this when not accessing memory external to this process :-)
  1101. X
  1102. X    Of course, all the usual obfuscation lurks within, such as combining
  1103. X    multiple for loops into single ones; warped and twisted logic; plus a
  1104. X    plethora of other minor oddities. It's up to you to discover some of them
  1105. X    of course... Sometimes I have sacrificed length for obfuscation. It is all
  1106. X    too easy to change the arguments in main to one character identifiers, but
  1107. X    in my opinion they add to obfuscation in this case by being longer.
  1108. X
  1109. X    Lint complains about lots of things. Firstly the use of curses immediately
  1110. X    makes lint complain. The Alpha's lint gave me some positive encouragement!
  1111. X    'precedence confusion possible: parenthesize!' :-) :-)
  1112. X    main() does not return correctly, because, basically, it doesn't return.
  1113. X
  1114. X    Bugs
  1115. X    ----
  1116. X
  1117. X    Very little error checking is performed. I do check for not being able to
  1118. X    open the requested filename and return 1 upon failure. However, badly
  1119. X    formatted data files will cause major problems. No other checking (such as
  1120. X    insufficient memory) is performed.
  1121. X
  1122. X    There is no 'end of game' checking method. Hence games like sokoban rely
  1123. X    on the user to decide when they have had enough. Also, there is no quit
  1124. X    mechanism other than control C.
  1125. END_OF_FILE
  1126.   if test 6839 -ne `wc -c <'1993/rince.hint'`; then
  1127.     echo shar: \"'1993/rince.hint'\" unpacked with wrong size!
  1128.   fi
  1129.   # end of '1993/rince.hint'
  1130. fi
  1131. if test -f '1993/rules' -a "${1}" != "-c" ; then 
  1132.   echo shar: Will not clobber existing file \"'1993/rules'\"
  1133. else
  1134.   echo shar: Extracting \"'1993/rules'\" \(9010 characters\)
  1135.   sed "s/^X//" >'1993/rules' <<'END_OF_FILE'
  1136. X10th International Obfuscated C Code Contest Rules
  1137. X
  1138. XCopyright (c) Landon Curt Noll & Larry Bassel, 1993.
  1139. XAll Rights Reserved.  Permission for personal, educational or non-profit use is
  1140. Xgranted provided this this copyright and notice are included in its entirety
  1141. Xand remains unaltered.  All other uses must receive prior permission in writing
  1142. Xfrom both Landon Curt Noll and Larry Bassel.
  1143. X
  1144. X    Obfuscate:  tr.v.  -cated, -cating, -cates.  1. a.  To render obscure.
  1145. X        b.  To darken.  2. To confuse:  his emotions obfuscated his
  1146. X        judgment.  [LLat. obfuscare, to darken : ob(intensive) +
  1147. X        Lat. fuscare, to darken < fuscus, dark.] -obfuscation n.
  1148. X        obfuscatory adj.
  1149. X
  1150. X
  1151. XGOALS OF THE CONTEST:
  1152. X
  1153. X    * To write the most Obscure/Obfuscated C program under the rules below.
  1154. X    * To show the importance of programming style, in an ironic way.
  1155. X    * To stress C compilers with unusual code.
  1156. X    * To illustrate some of the subtleties of the C language.
  1157. X    * To provide a safe forum for poor C code.  :-)
  1158. X
  1159. X
  1160. XNOTE: Changes from the 1993 draft are noted by change bars.  --->          |
  1161. X
  1162. X
  1163. XRULES:
  1164. X
  1165. X    To help us with the volume of entries, we ask that you follow these rules:
  1166. X
  1167. X    1) Your entry must be a complete program.
  1168. X
  1169. X    2) Your entry must be <= 3217 bytes in length.  The number of characters
  1170. X       excluding whitespace (tab, space, newline), and excluding any ; { or }
  1171. X       followed by either whitespace or end of file, must be <= 1536.
  1172. X
  1173. X    3) Your entry must be submitted in the following format:
  1174. X
  1175. X---entry---
  1176. Xrule:    1993
  1177. Xfix:    y or n   (n => this is a new entry, y => this replaces an older entry)
  1178. Xtitle:    title of entry              (see comments below)
  1179. Xentry:    Entry number from 0 to 7 inclusive  (your 1st entry should by 0)
  1180. Xdate:    Date/time of submission in UTC        (see comments below)
  1181. Xhost:    Machine(s) and OS(s) under which your entry was tested
  1182. X    Use tab indented lines if needed
  1183. X---remark---
  1184. X    Place remarks about this entry in this section.  It would be helpful if
  1185. X    you were to indent your remarks with 4 spaces, though it is not a
  1186. X    requirement.  Also, if possible, try to avoid going beyond the 79th
  1187. X    column.  Blank lines are permitted.
  1188. X---author---
  1189. Xname:    your name
  1190. Xorg:    School/Company/Organization
  1191. Xaddr:    postal address
  1192. X    use tab indented lines to continue
  1193. X    don't forget to include the country
  1194. Xemail:  Email address from a well known site or registered domain.
  1195. X        If you give several forms, list them on separate tab indented lines.
  1196. Xanon:    y or n   (y => remain anonymous, n => ok to publish this info)
  1197. X---info---
  1198. XIf your program needs an info file, place a uuencoded copy of it in
  1199. Xthis section.  In the case of multiple info files, use multiple info
  1200. Xsections.  If your entry does not need a info file, skip this section.
  1201. X---build---
  1202. XPlace a uuencoded copy of the command(s) used to compile/build your program
  1203. Xin this section.  It must uudecode into a file named 'build'.  The resulting
  1204. Xfile must be 255 bytes or less.
  1205. X---program---
  1206. XPlace a uuencoded copy of your program in this section.  It must uudecode
  1207. Xinto a file named is 'prog.c'.  The resulting file must follow rule #2.
  1208. X---end---
  1209. X
  1210. X      Regarding the above format:
  1211. X
  1212. X    * The title must match the expression: [a-zA-Z0-9_=][a-zA-Z0-9_=+-]*
  1213. X      and must be 1 to 12 characters in length.
  1214. X
  1215. X      It is suggested, but not required, that the title should
  1216. X      incorporate your username; in the case of multiple authors,
  1217. X      consider using parts of the usernames of the authors.
  1218. X
  1219. X    * The date in the ---entry--- section should be given with respect
  1220. X      to UTC.  The format of the date should be as returned by asctime()
  1221. X      using the C locale.  (see guidelines for more info)
  1222. X
  1223. X    * You may correct/revise a previously submitted entry by sending
  1224. X      it to the contest email address.  Be sure to set 'fix' in the
  1225. X      ---entry--- section to 'n'.  The corrected entry must use the same
  1226. X      title and entry number as submittion that is being corrected.  Be
  1227. X      sure that you note the resubmittion in the ---remark--- as well.
  1228. X
  1229. X    * With the exception of the header, all text outside of the above
  1230. X      format may be ignored by the judges.  If you need tell the judges
  1231. X      something, put it in the ---remark--- section, or send a separate
  1232. X      Email message to the judges.
  1233. X
  1234. X    * Information from the ---author--- section will be published unless
  1235. X      'y' was given to the respective author's 'anon' line.
  1236. X
  1237. X    * To credit multiple authors, include an ---author--- section for
  1238. X      each author.  Each should start with ---author--- line, and
  1239. X      should be found between the ---entry--- and ---build--- sections.
  1240. X
  1241. X    * The entry's remarks should include:
  1242. X        - what this program does
  1243. X        - how to run the program (sample args or input)
  1244. X        - special compile or execution instructions, if any
  1245. X        - special filename requirements (see rule 4 and 5)
  1246. X        - information about any ---data--- files
  1247. X        - why you think the program is obfuscated
  1248. X        - note if this entry is a re-submission of a previous entry.
  1249. X        - any other remarks (humorous or otherwise)
  1250. X
  1251. X    * Do not rot13 your entry's remarks.  You may suggest that certain
  1252. X      portions of your remarks be rot13ed if your entry wins an award.
  1253. X
  1254. X        * Info files should be used only to supplement your entry.  They
  1255. X      should not be required to exist.
  1256. X
  1257. X      If your entry does not need an info file, skip the ---info---
  1258. X      section.  If your entry needs multiple info files, use multiple
  1259. X      ---info--- sections, one per info file.  You should describe
  1260. X      each info file in the ---remark--- section.
  1261. X
  1262. X    4) If your entry is selected as a winner, it will be modified as follows:
  1263. X
  1264. X       'build' is incorporated into a makefile, and 'build' is removed
  1265. X       'prog.c' is renamed to your entry's title, followed by an optional
  1266. X           digit, followed by '.c'
  1267. X       your entry is compiled into a file with the name of your entry's
  1268. X           title, possibly followed by a digit
  1269. X
  1270. X       If your entry requires that a build file exist, state so in your
  1271. X       entry's remark section.  The makefile will be arranged to execute a
  1272. X       build shell script containing the 'build' information.  The name of
  1273. X       this build shell script will be your entry's title, possibly followed
  1274. X       by a digit, followed by '.sh'.
  1275. X
  1276. X       If needed, your entry's remarks should indicate how your entry must
  1277. X       be changed in order to deal with the new filenames.
  1278. X
  1279. X    5) The build file, the source and the resulting executable should be
  1280. X       treated as read-only files.  If your entry needs to modify these files,
  1281. X       it should make and modify a copy of the appropriate file.  If this
  1282. X       occurs, state so in your entry's remarks.
  1283. X
  1284. X    6) Entries that cannot be compiled by an ANSI C compiler will be rejected.
  1285. X       Use of common C (K&R + extensions) is permitted, as long as it does not
  1286. X       cause compile errors for ANSI C compilers.
  1287. X
  1288. X    7) The program must be of original work.  All programs must be in the
  1289. X       public domain.  All copyrighted programs will be rejected.
  1290. X
  1291. X    8) Entries must be received prior to 07-May-93 0:00 UTC.  (UTC is
  1292. X       essentially equivalent to Greenwich Mean Time)  Email your entries to:
  1293. X
  1294. X        ...!{apple,pyramid,sun,uunet}!hoptoad!obfuscate
  1295. X        obfuscate@toad.com
  1296. X
  1297. X       We request that your message use the subject 'ioccc entry'.
  1298. X
  1299. X       If possible, we request that you hold off on Emailing your entries
  1300. X       until 1-Mar-93 0:00 UTC.  Early entries will be accepted, however.
  1301. X       We will attempt to email a confirmation to the the first author for
  1302. X       all entries received after 1-Mar-93 0:00 UTC.
  1303. X
  1304. X    9) Each person may submit up to 8 entries per contest year.  Each entry
  1305. X       must be sent in a separate Email letter.
  1306. X
  1307. X   10) Entries requiring human interaction to be built are not allowed.
  1308. X       Compiling an entry (must) produce a file (or files) which may           |
  1309. X       be executed.                                  |
  1310. X
  1311. X   11) Programs that require special privileges (setuid, setgid, super-user,
  1312. X       special owner or group) are not allowed.
  1313. X
  1314. X
  1315. XFOR MORE INFORMATION:
  1316. X
  1317. X    The Judging will be done by Landon Noll and Larry Bassel.  Please send
  1318. X    questions or comments about the contest, to:
  1319. X
  1320. X    ...!{apple,pyramid,sun,uunet}!hoptoad!judges    (not the address for  |
  1321. X    judges@toad.com                     submitting entries)  |
  1322. X
  1323. X    The rules and the guidelines may (and often do) change from year to
  1324. X    year.  You should be sure you have the current rules and guidelines
  1325. X    prior to submitting entries.  To obtain them, send Email to the address   |
  1326. X    above and use the subject 'send rules'.                      |
  1327. X
  1328. X    One may obtain winners of previous contests (1984 to date), via ftp from: |
  1329. X
  1330. X    host: ftp.uu.net    (192.48.96.9)                      |
  1331. X    user: anonymous
  1332. X    pass: yourname@yourhost
  1333. X    dir:  ~/pub/ioccc                              |
  1334. X
  1335. X    As a last resort, previous winners may be obtained by sending Email       |
  1336. X    to the above address.  Please use the subject 'send YEAR winners',        |
  1337. X    where YEAR is a single 4 digit year, a year range, or 'all'.          |
  1338. X
  1339. X
  1340. Xchongo <Landon Curt Noll> /\cc/\      chongo@toad.com                  |
  1341. XLarry Bassel                  lab@sun.com                  |
  1342. END_OF_FILE
  1343.   if test 9010 -ne `wc -c <'1993/rules'`; then
  1344.     echo shar: \"'1993/rules'\" unpacked with wrong size!
  1345.   fi
  1346.   # end of '1993/rules'
  1347. fi
  1348. if test -f '1993/vanb.hint' -a "${1}" != "-c" ; then 
  1349.   echo shar: Will not clobber existing file \"'1993/vanb.hint'\"
  1350. else
  1351.   echo shar: Extracting \"'1993/vanb.hint'\" \(5857 characters\)
  1352.   sed "s/^X//" >'1993/vanb.hint' <<'END_OF_FILE'
  1353. XMost Irregular Expression: <vanb@isx.com> David Van Brackle
  1354. X
  1355. X    David Van Brackle
  1356. X    ISX Corporation
  1357. X    1165 Northchase Parkway, Suite 120
  1358. X    Marietta, GA  30067
  1359. X    USA
  1360. X
  1361. X
  1362. XJudges' comments:
  1363. X
  1364. X    To run:
  1365. X    make vanb
  1366. X    ./vanb 'exp'
  1367. X    
  1368. X    where:
  1369. X    'exp'    an octal expression
  1370. X    
  1371. X    The octal expression may contain:
  1372. X
  1373. X    unary operators:    +, -
  1374. X    binary operators    +, -, *, /, %
  1375. X    hex numbers:        x or X follow by hex digits
  1376. X    decimal numbers:    d or D follow by decimal digits
  1377. X    octal numbers:        octal digits
  1378. X    grouping:        ()
  1379. X    
  1380. X    No spaces are allowed in the expression.  To avoid shell expansion,
  1381. X    one should surround the expression in single quotes.
  1382. X
  1383. X    It is a good thing that this program consists of only one
  1384. X    expression, otherwise it might become hard to understand.  :-)
  1385. X
  1386. X
  1387. XSelected notes from the author:
  1388. X
  1389. X    The program does no error checking - erroneous expressions will
  1390. X    produce spurious results. Note that unary '-' is an operator. Thus,
  1391. X    decimal -46 would be entered as -d46 and not d-46.
  1392. X
  1393. X    What Makes This Program Special:
  1394. X
  1395. X    0) Of course, the fact that the program takes input and produces output
  1396. X       in octal, rather than a more useful system like decimal, makes
  1397. X       it "special".
  1398. X
  1399. X    1) The entire program consists of a single expression, returned from main.
  1400. X
  1401. X    2) There are no global or local variables other than the parameters
  1402. X       to main
  1403. X
  1404. X    3) All of the constants in the program are expressed in octal - including
  1405. X       the printf string.
  1406. X
  1407. X    4) The variables are given names which cause visual confusion with the
  1408. X       octal constants.
  1409. X
  1410. X    5) The program is formatted like a roman numeral 8. The significance of
  1411. X       8 is obvious. I chose roman numerals because it is a numbering
  1412. X       system even more arcane than octal. It's not very 'deceptive',
  1413. X       but it's difficult to deceptively format a program which has no
  1414. X       explicit control structures (other than ?:'s).
  1415. X
  1416. X    6) Many simple tasks are done many times. I tried to do these differently
  1417. X       each time, to make the program harder to understand.
  1418. X
  1419. X    How It Works:
  1420. X
  1421. X    It's a recursive descent parser, calling main
  1422. X    for all of its recursion. O2 is a state variable, telling main
  1423. X    what grammar non-terminal to parse. **O7 is the next character.
  1424. X    O3 is an intermediate result. Whenever you see a construct like:
  1425. X
  1426. X      !(expression with O2)?
  1427. X
  1428. X    it's decrementing & testing O2 to see what state it's in. Comparisons
  1429. X    involving **O7 and octal constants are looking for certain characters.
  1430. X
  1431. X    Here's the grammar ('e' denotes the empty string) :
  1432. X
  1433. X    <E>  ::=  <T><E'>
  1434. X    <E'> ::=  +<T><E'> | -<T><E'> | e
  1435. X    <T>  ::=  <F><T'>
  1436. X    <T'> ::=  *<F><T'> | /<F><T'> | %<F><T'> | e
  1437. X    <F>  ::=  +<F> | -<F> | (<E><C> | d<D> | D<D> |  x<X> | X<X> | <O>
  1438. X    <C>  ::=  )
  1439. X    <D>  ::=  [0-9]<D> | e
  1440. X    <X>  ::=  [0-9]<X> | [A-F]<X> | [a-f]<X> | e
  1441. X    <O>  ::=  [0-7]<O> | e
  1442. X
  1443. X    Here's how the grammar nonterminals map to octal state numbers:
  1444. X
  1445. X    <E>  is  012
  1446. X    <E'> is  011
  1447. X    <T>  is  010
  1448. X    <T'> is   07
  1449. X    <F>  is   06
  1450. X    <C>  is  013
  1451. X    <D>  is   04
  1452. X    <X>  is   05
  1453. X    <O>  is   03
  1454. X
  1455. X    Here's a version of the program before it got formatted into the VIII,
  1456. X    augmented with comments showing where each state begins. N1 and N2 are
  1457. X    notes:
  1458. X
  1459. X    #define O5 main
  1460. X    O5(O2,O7,O3)char**O7;
  1461. X    {
  1462. X             return
  1463. X    /* N1 */ !(O2+=~01+01) ? 
  1464. X              00:
  1465. X    /* N2 */ !(O2-=02>01) ? 
  1466. X              printf("\045\157\012",O5(012,O7+01,00)):
  1467. X    /* O  */ !(O2-=02>>01) ? 
  1468. X                  (**O7<=067 && **O7>057 ? O5(03,O7,*(*O7)++-060+010*O3):O3):
  1469. X    /* D  */ !(O2-=-O3-~O3) ? 
  1470. X                  (072>**O7 && 060<=**O7 ? O5(04,O7,012*O3-060+*(*O7)++):O3):
  1471. X    /* X  */ !(O2-=!O3+!!O3) ? 
  1472. X                  (**O7>057 && **O7<=071 ? O5(05,O7,*(*O7)+++O3*020-060):
  1473. X                  **O7<=0106 && 0101<=**O7 ? O5(05,O7,020*O3+*(*O7)++-067):
  1474. X                  0140<**O7 && **O7<0147 ? O5(05,O7,-0127+*(*O7)+++020*O3):O3):
  1475. X    /* F  */ !(O2-=02-01) ? 
  1476. X                  (**O7==050 ? 050**++*O7,O5(013,O7,O5(012,O7,00)):
  1477. X                  **O7<056 && 054<**O7 ? 055**++*O7,-O5(06,O7,00):
  1478. X                  054>**O7 && 052<**O7 ? 050**(*O7)++,O5(06,O7,00):
  1479. X                  !(**O7^0170)||!(0130^**O7) ? *++*O7,O5(05,O7,00):
  1480. X                  **O7==0144||**O7==0104 ? ++*O7,O5(04,O7,00):O5(03,O7,00)):
  1481. X    /* T' */ !--O2 ? 
  1482. X              (**O7==052 ? O5(07,O7,O3*(*++*O7,O5(06,O7,00))):
  1483. X                  !(045-**O7) ? O5(07,O7,O3%(03+(*O7)++,O5(06,O7,00))):
  1484. X                  !(**O7^057) ? O5(07,O7,O3/(03-*++*O7,O5(06,O7,00))):O3):
  1485. X    /* T  */ !(O2+=01-02) ? 
  1486. X              O5(07,O7,O5(06,O7,00)):
  1487. X    /* E' */ !(O2+=-02/02) ? 
  1488. X              (!(**O7-053)?O5(011,O7,O3+(++*O7,O5(010,O7,00))):
  1489. X                  !(055^**O7) ? O5(011,O7,O3-(03+*(*O7)++,O5(010,O7,00))):O3):
  1490. X    /* E  */ !(O2-=0563&0215) ? 
  1491. X              O5(011,O7,O5(010,O7,00)):
  1492. X    /* C  */ (++*O7,O3);
  1493. X    }
  1494. X
  1495. X    Note N1: It should never enter this state, unless the user invokes the
  1496. X         program with no parameters, in which case it just returns 0.
  1497. X
  1498. X    Note N2: Since the program is properly invoked with 1 parameter, this is
  1499. X         the first state it will go into. This state just invokes
  1500. X         printf, and sends the parser to state 012 (which is <E>).
  1501. X
  1502. X    The E and T states work like this:
  1503. X
  1504. X    int e(){ return eprime( t() ); }
  1505. X
  1506. X    The E' and T' states work like this:
  1507. X
  1508. X    int eprime( int intermediate )
  1509. X    {
  1510. X    if( ch == '+' )
  1511. X    {
  1512. X        ch = nextchar();
  1513. X        return eprime( intermediate + t() );
  1514. X    }
  1515. X    else return intermediate;
  1516. X    }
  1517. X
  1518. X    The D, X and O states work like this (they assume that they're initially
  1519. X    called with 0):
  1520. X
  1521. X    int octal( int intermediate )
  1522. X    {
  1523. X    if( ch>='0' && ch<='7' )
  1524. X    {
  1525. X        intermediate = intermediate * 8 + ch - '0';
  1526. X        ch = nextchar();
  1527. X        return octal( intermediate );
  1528. X    }
  1529. X    else return intermediate;
  1530. X    }
  1531. X
  1532. X    F and C work similarly.
  1533. END_OF_FILE
  1534.   if test 5857 -ne `wc -c <'1993/vanb.hint'`; then
  1535.     echo shar: \"'1993/vanb.hint'\" unpacked with wrong size!
  1536.   fi
  1537.   # end of '1993/vanb.hint'
  1538. fi
  1539. echo shar: End of archive 2 \(of 4\).
  1540. cp /dev/null ark2isdone
  1541. MISSING=""
  1542. for I in 1 2 3 4 ; do
  1543.     if test ! -f ark${I}isdone ; then
  1544.     MISSING="${MISSING} ${I}"
  1545.     fi
  1546. done
  1547. if test "${MISSING}" = "" ; then
  1548.     echo You have unpacked all 4 archives.
  1549.     rm -f ark[1-9]isdone
  1550. else
  1551.     echo You still must unpack the following archives:
  1552.     echo "        " ${MISSING}
  1553. fi
  1554. exit 0
  1555. exit 0 # Just in case...
  1556.