Add preview of 1984-2019

The 2020 winners are hinted it, but the source code is not there,
nor are the hints. Someone could look into the HTML and
see what was commented out, but that is not a problem because
WHO won is known and the name of their AWARD is known already.
Moreover a number of the winners have talked about what their
entirs do, so the commented out spoiler text is not a bit problem.

One will find HTML commented out with:

    <!-- XXX remove when 2020 is ready
    2020 links here
    XXX remove when 2020 is ready -->

The "XXX remove when 2020 is ready" string is found at the
start and end comment blocks.  Again, soneone could read
what was commented out, but that is OK since most of that
information is known or can be known.  The following files
have such HTML comment blocks in them.

    ./winners.html
    ./years-spoiler.html
    ./years.html

In addition, ./all/summary.txt was modified to not
include the 2020 entries for the momemt.

The 2020 winner code AND write-ups are NOT part of this set.

p.s. The all/all.tar.bz2 does not contain the 2020 source code (yet?).
This commit is contained in:
Landon Curt Noll committed 2020-12-30 16:57:03 -08:00
1 parent 28efc67f5d
commit c0663537cb
1683 files changed
+220064

No files matched your search

+117
View File
@@ -0,0 +1,117 @@
#!/usr/bin/env make
#
# 2011 makefile
#
# Copyright (C) 2011, Landon Curt Noll, Simon Cooper, and Leonid A. Broukhis.
#
# Creative Commons Attribution-ShareAlike 3.0 Unported License.
# See: http://creativecommons.org/licenses/by-sa/3.0/
################
# tool locations
################
#
SHELL= /bin/bash
CP= cp
CPP= cpp
GUNZIP= gunzip
LD= ld
MAKE= make
RM= rm
SED= sed
TAR= tar
TRUE= true
# optimization
#
# Most compiles will safely use -O2. Some can use only -O1 or -O.
# A few compilers have broken optimizers or this entry make break
# under those buggy optimizers and thus you may not want anything.
#
OPT= -O2
# bitness
#
# Some entries require 32-bitness,
# other entries require 64-bitess.
# By default we assume nothing.
#
ARCH=
# default flags for ANSI C compilation
#
CFLAGS= -Wall -W -ansi ${ARCH} ${OPT} -D_BSD_SOURCE -lm
# ANSI compiler
#
# Set CC to the name of your ANSI compiler.
#
CC= cc
##############################
# Special flags for this entry
##############################
#
ENTRY= zucker
DATA=
#################
# build the entry
#################
#
all: ${ENTRY} ${DATA}
@${TRUE}
${ENTRY}: ${ENTRY}.c
${CC} ${CFLAGS} ${ENTRY}.c -o ${ENTRY}
# alternative executable
#
alt:
@${TRUE}
###############
# utility rules
###############
#
everything: all alt
clean:
${RM} -f ${ENTRY}.o
clobber: clean
${RM} -f ${ENTRY}
nuke: clobber
@echo gnab gib!
install:
@echo "Surely you're joking Mr. Feynman!"
# backwards compatibility
#
build: all
##################
# 133t hacker rulz
##################
#
love:
@echo 'not war?'
haste:
$(MAKE) waste
waste:
@echo 'waste'
easter_egg:
@echo you expected to mis-understand this $${RANDOM} magic
@echo chongo '<was here>' "/\\oo/\\"
@echo Readers shall not be disallowed from being unable to partly misunderstand this final echo.
@${TRUE}
+194
View File
@@ -0,0 +1,194 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta name="GENERATOR" content="mkd2html 2.1.3 DL=DISCOUNT">
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=utf-8">
<link rel="stylesheet"
type="text/css"
href="../hint.css">
<title>Most shiny</title>
</head>
<body>
<h1>Most shiny</h1>
<p>Matt Zucker<br>
<a href="&#x6d;&#x61;&#105;&#108;&#116;&#111;&#58;&#109;&#122;&#117;&#x63;&#107;&#101;&#114;&#x31;&#64;&#x73;&#119;&#97;&#114;&#116;&#104;&#x6d;&#111;&#114;&#101;&#46;&#101;&#x64;&#117;">&#109;&#122;&#x75;&#99;&#107;&#x65;&#114;&#x31;&#x40;&#x73;&#x77;&#97;&#x72;&#116;&#x68;&#109;&#111;&#114;&#101;&#x2e;&#101;&#100;&#x75;</a><br>
<a href="http://www.swarthmore.edu/NatSci/mzucker1/">http://www.swarthmore.edu/NatSci/mzucker1/</a></p>
<h2>Judges' comments:</h2>
<h3>To build:</h3>
<pre><code>make zucker
</code></pre>
<h3>To run:</h3>
<pre><code>./zucker &gt; image.ppm
</code></pre>
<h3>Try:</h3>
<pre><code>./zucker "Hello!!!" &gt; hello.ppm
./zucker faster\! -preview &gt; image2.ppm
# Display the PPM image with your favorite image viewer
</code></pre>
<h3>Selected Judges Remarks:</h3>
<p>The rendered image is centered and is output as a 600 by 220 pixel PPM.
The vector font is proportional.</p>
<p>This entry uses no local variables. None! At! All!</p>
<h2>Author&rsquo;s comments:</h2>
<h1>An image generator</h1>
<h2>What it does:</h2>
<p>This program makes pretty pictures. To see the default output, try
running</p>
<pre><code> ./zucker &gt; image.ppm
</code></pre>
<p>On the author&rsquo;s 2.5 GHz MacBook Pro, this command takes approximately
1 minute and 18 seconds to run &ndash; your runtime may vary. You will
need an image viewer capable of displaying Netpbm images in order to
display the output. On the Mac, <a href="http://wakaba.c3.cx/s/apps/xee">Xee</a>
works well; otherwise <a href="http://www.imagemagick.org/">ImageMagick</a>
and/or <a href="http://www.graphicsmagick.org/">GraphicsMagick</a> are both
capable of displaying Netpbm files, and are available on multiple
platforms. (Using Xee is particularly nice because it periodically
reloads the image as it is rendered.)</p>
<p>Aside from the default image, you may create your own by running the
program as follows:</p>
<pre><code> ./zucker "your text" &gt; image.ppm
</code></pre>
<p>To mitigate long runtimes, the program can be invoked in a &ldquo;preview&rdquo;
mode by appending <code>-preview</code> to the command line arguments, like so:</p>
<pre><code> ./zucker faster\! -preview &gt; image.ppm
</code></pre>
<p>If your platform distinguishes between binary and text streams, you
may need to insert some code to reopen standard output in binary mode
at the start of <code>main</code>. An ASCII platform is assumed.</p>
<h2>Pedagogical value:</h2>
<p>This program is quite suitable for the inexperienced programmer, due
to a number of considerations:</p>
<ul>
<li><p>It is fairly short: just 4 preprocessor directives followed by 29
lines of source.</p></li>
<li><p>It compiles cleanly as ANSI C under gcc 4.2.1 with very strict
compilation flags.</p></li>
<li><p>It uses a very small subset of the keywords available in C, namely
<code>char</code>, <code>float</code>, <code>int</code>, <code>typedef</code>, <code>struct</code>, <code>for</code>, and <code>return</code>.
More difficult concepts such as <code>void</code>, <code>if</code>, <code>switch</code>, and
<code>while</code> are eschewed for simplicity&rsquo;s sake.</p></li>
<li><p>It also uses a very small number of library functions: just <code>putchar</code>,
<code>cos</code>, <code>sin</code>, <code>atan2</code>, <code>sqrt</code>, and <code>pow</code>.</p></li>
<li><p>New programmers often prefer to use global variables when
possible. Hence, <em>all</em> variables in this program (aside from
function parameters) have global scope.</p></li>
<li><p>An important aspect of the computation is graphically illustrated
by the source code itself: the geometric construction of a
reflection ray at an object&rsquo;s surface, given the incoming
direction and surface normal.</p></li>
</ul>
<h2>Further details (contains spoilers):</h2>
<p>The program is not quite a traditional ray tracer, but a &ldquo;sphere
tracer&rdquo; which uses distance fields to encode proximity to objects in
the scene. Using sphere tracing to compute visibility instead of
analytic ray tracing provides two advantages: first, it greatly eases
the computation of ray-torus intersection (which would otherwise
require solving a quartic polynomial), and second, it makes it
possible to compute ambient occlusion (which is used to generate soft
shadows). Unlike many traditional ray tracers and sphere tracers, this
one uses iteration instead of recursion to compute the effect of
reflections. This, unfortunately, resulted in the programmer going
insane; however, program size was reduced and readability
hindered. Neither the plaintext for the program&rsquo;s default output nor
for the Netpbm header appears in the program source, which hinders
readability as well. Also, unlike some previous IOCCC entries which
render ASCII text, this one uses a vector (as opposed to raster)
font. Although the program does not generate uppercase letters, it
handles them in a reasonable manner when they appear in the input.</p>
<p>Even when the program is pretty-printed and preprocessor macros are
expanded, it should be fairly resistant to analysis due to reckless
reuse of global variables, to the inherently opaque nature of the
math, and to its overall density. Global variables are used to store
the results of intermediate computation. As a result, seemingly simple
functions have important side effects. Although some of the global
variables are simply constants, their use is overloaded. For instance,
the variable <code>X</code> is used both as the number 40 and as the ASCII
character <code>'('</code>. Maintainability is hindered due to hardcoding
several aspects of the program in multiple locations. As an example,
it is impossible to modify either the image width or height without
changing the source in at least three different places, including
inside the large string literal.</p>
<p>Some of the functions are simple vector algebra operations such as
vector construction, dot product, and normalization. However, it was
found to be much more compact to define a single operation for
multiply-and-add rather than to have separate functions for addition,
subtraction, and scaling. Again, compactness led to obfuscation.</p>
<p>This program heavily abuses <code>for</code> loops. The comma operator is used to
get as much milage as possible out of statements inside of loop
declarations. Between <code>for</code> loops, the comma operator, and the ternary
operator, it was possible to avoid <code>if</code> and <code>while</code> altogether.</p>
<p>Bitwise and arithmetic operators are used instead of logical operators
whenever gcc doesn&rsquo;t warn about it. Conversely, integer
multiplication, division, and modulus are sometimes used in place of
traditional bitwise operators just to keep the reader on his or her
toes. Automatic casting between characters, integers, and floats is
performed just about everywhere. Fascinatingly, this doesn&rsquo;t seem to
affect performance too badly. Sometimes when an explicit cast
(i.e. from float to int) is needed, the program instead simply assigns
to a free variable of the desired type instead. Both the <code>array[index]</code>
and <code>index[array]</code> notations are used interchangably throughout the
program.</p>
<p>Two other programs were written to support development of this
program. The first used a randomized search algorithm to deduce the
most compact encoding of the vector font instructions into ASCII; the
second used a modified form of the Knuth-Plass algorithm to layout the
final text on top of a hand-generated ASCII &ldquo;stencil&rdquo;. The programs
were not submitted as entries for this year&rsquo;s IOCCC, not because they
lack obfuscation, but because neither is written in C (they are in C++
and Python, respectively).</p>
<hr />
<!--
(c) Copyright 1984-2012, [Leo Broukhis, Simon Cooper, Landon Curt Noll][judges] - All rights reserved
This work is licensed under a [Creative Commons Attribution-ShareAlike 3.0 Unported License][cc].
[judges]: http://www.ioccc.org/judges.html
[cc]: http://creativecommons.org/licenses/by-sa/3.0/
-->
<TABLE><TR>
<TD><a rel="license" href="http://creativecommons.org/licenses/by-sa/3.0/"><img alt="Creative Commons License" style="border-width:0" src="http://i.creativecommons.org/l/by-sa/3.0/88x31.png" /></a></TD>
<TD><P>&copy; Copyright 1984-2012,
<A HREF="/judges.html">Leo Broukhis, Simon Cooper, Landon Curt Noll</A>
- All rights reserved<BR>
This work is licensed under a <a rel="license" href="http://creativecommons.org/licenses/by-sa/3.0/">Creative Commons Attribution-ShareAlike 3.0 Unported License</a>.</P></TD>
<TD>&nbsp;<!--<a href="http://validator.w3.org/check?uri=referer"><img src="http://www.w3.org/Icons/valid-html401" alt="Valid HTML 4.01 Transitional" height="31" width="88"></a>--></TD>
</TR></TABLE>
</body>
</html>
+171
View File
@@ -0,0 +1,171 @@
# Most shiny
Matt Zucker
<mzucker1@swarthmore.edu>
<http://www.swarthmore.edu/NatSci/mzucker1/>
## Judges' comments:
### To build:
make zucker
### To run:
./zucker > image.ppm
### Try:
./zucker "Hello!!!" > hello.ppm
./zucker faster\! -preview > image2.ppm
# Display the PPM image with your favorite image viewer
### Selected Judges Remarks:
The rendered image is centered and is output as a 600 by 220 pixel PPM.
The vector font is proportional.
This entry uses no local variables. None! At! All!
## Author's comments:
An image generator
==================
What it does:
-------------
This program makes pretty pictures. To see the default output, try
running
./zucker > image.ppm
On the author's 2.5 GHz MacBook Pro, this command takes approximately
1 minute and 18 seconds to run -- your runtime may vary. You will
need an image viewer capable of displaying Netpbm images in order to
display the output. On the Mac, [Xee](http://wakaba.c3.cx/s/apps/xee)
works well; otherwise [ImageMagick](http://www.imagemagick.org/)
and/or [GraphicsMagick](http://www.graphicsmagick.org/) are both
capable of displaying Netpbm files, and are available on multiple
platforms. (Using Xee is particularly nice because it periodically
reloads the image as it is rendered.)
Aside from the default image, you may create your own by running the
program as follows:
./zucker "your text" > image.ppm
To mitigate long runtimes, the program can be invoked in a "preview"
mode by appending `-preview` to the command line arguments, like so:
./zucker faster\! -preview > image.ppm
If your platform distinguishes between binary and text streams, you
may need to insert some code to reopen standard output in binary mode
at the start of `main`. An ASCII platform is assumed.
Pedagogical value:
------------------
This program is quite suitable for the inexperienced programmer, due
to a number of considerations:
* It is fairly short: just 4 preprocessor directives followed by 29
lines of source.
* It compiles cleanly as ANSI C under gcc 4.2.1 with very strict
compilation flags.
* It uses a very small subset of the keywords available in C, namely
`char`, `float`, `int`, `typedef`, `struct`, `for`, and `return`.
More difficult concepts such as `void`, `if`, `switch`, and
`while` are eschewed for simplicity's sake.
* It also uses a very small number of library functions: just `putchar`,
`cos`, `sin`, `atan2`, `sqrt`, and `pow`.
* New programmers often prefer to use global variables when
possible. Hence, *all* variables in this program (aside from
function parameters) have global scope.
* An important aspect of the computation is graphically illustrated
by the source code itself: the geometric construction of a
reflection ray at an object's surface, given the incoming
direction and surface normal.
Further details (contains spoilers):
------------------------------------
The program is not quite a traditional ray tracer, but a "sphere
tracer" which uses distance fields to encode proximity to objects in
the scene. Using sphere tracing to compute visibility instead of
analytic ray tracing provides two advantages: first, it greatly eases
the computation of ray-torus intersection (which would otherwise
require solving a quartic polynomial), and second, it makes it
possible to compute ambient occlusion (which is used to generate soft
shadows). Unlike many traditional ray tracers and sphere tracers, this
one uses iteration instead of recursion to compute the effect of
reflections. This, unfortunately, resulted in the programmer going
insane; however, program size was reduced and readability
hindered. Neither the plaintext for the program's default output nor
for the Netpbm header appears in the program source, which hinders
readability as well. Also, unlike some previous IOCCC entries which
render ASCII text, this one uses a vector (as opposed to raster)
font. Although the program does not generate uppercase letters, it
handles them in a reasonable manner when they appear in the input.
Even when the program is pretty-printed and preprocessor macros are
expanded, it should be fairly resistant to analysis due to reckless
reuse of global variables, to the inherently opaque nature of the
math, and to its overall density. Global variables are used to store
the results of intermediate computation. As a result, seemingly simple
functions have important side effects. Although some of the global
variables are simply constants, their use is overloaded. For instance,
the variable `X` is used both as the number 40 and as the ASCII
character `'('`. Maintainability is hindered due to hardcoding
several aspects of the program in multiple locations. As an example,
it is impossible to modify either the image width or height without
changing the source in at least three different places, including
inside the large string literal.
Some of the functions are simple vector algebra operations such as
vector construction, dot product, and normalization. However, it was
found to be much more compact to define a single operation for
multiply-and-add rather than to have separate functions for addition,
subtraction, and scaling. Again, compactness led to obfuscation.
This program heavily abuses `for` loops. The comma operator is used to
get as much milage as possible out of statements inside of loop
declarations. Between `for` loops, the comma operator, and the ternary
operator, it was possible to avoid `if` and `while` altogether.
Bitwise and arithmetic operators are used instead of logical operators
whenever gcc doesn't warn about it. Conversely, integer
multiplication, division, and modulus are sometimes used in place of
traditional bitwise operators just to keep the reader on his or her
toes. Automatic casting between characters, integers, and floats is
performed just about everywhere. Fascinatingly, this doesn't seem to
affect performance too badly. Sometimes when an explicit cast
(i.e. from float to int) is needed, the program instead simply assigns
to a free variable of the desired type instead. Both the `array[index]`
and `index[array]` notations are used interchangably throughout the
program.
Two other programs were written to support development of this
program. The first used a randomized search algorithm to deduce the
most compact encoding of the vector font instructions into ASCII; the
second used a modified form of the Knuth-Plass algorithm to layout the
final text on top of a hand-generated ASCII "stencil". The programs
were not submitted as entries for this year's IOCCC, not because they
lack obfuscation, but because neither is written in C (they are in C++
and Python, respectively).
--------------------------------------------------------------------------------
<!--
(c) Copyright 1984-2012, [Leo Broukhis, Simon Cooper, Landon Curt Noll][judges] - All rights reserved
This work is licensed under a [Creative Commons Attribution-ShareAlike 3.0 Unported License][cc].
[judges]: http://www.ioccc.org/judges.html
[cc]: http://creativecommons.org/licenses/by-sa/3.0/
-->
+33
View File
@@ -0,0 +1,33 @@
#include <stdio.h>
#include <math.h>
#define E return
#define S for
char*J="LJFFF%7544x^H^XXHZZXHZ]]2#( #@@DA#(.@@%(0CAaIqDCI$IDEH%P@T@qL%PEaIpBJCA\
I%KBPBEP%CBPEaIqBAI%CAaIqBqDAI%U@PE%AAaIqBcDAI%ACaIaCqDCI%(aHCcIpBBH%E@aIqBAI%A\
AaIqB%AAaIqBEH%AAPBaIqB%PCDHxL%H@hIcBBI%E@qJBH#C@@D%aIBI@D%E@QB2P#E@'C@qJBHqJBH\
%C@qJBH%AAaIqBAI%C@cJ%" "cJ" "CH%C@qJ%aIqB1I%PCDI`I%BAaICH%KH+@'JH+@KP*@%S@\
3P%H@ABhIaBBI%P@S@PC#", *j ,*e;typedef float x;x U(x a){E a<0?0:a>1?1:a; }
typedef struct{x c,a,t; } y;y W={1,1,1},Z={0,0,0},B[99],P,C,M,N,K,p,s,d,h
;y G(x t,x a,x c){K.c=t ; K.t=c; K.a=a;E K;}int T=-1,b=0,r,F=-111,(*m)(i\
nt)=putchar,X=40,z=5,o, a, c,t=0 ,n,R;y A(y a,y b,x c){E G(a.c+b.c*c,a.a
+c*b.a,b.t*c+a.t);}x H= .5,Y =.66 ,I,l=0,q,w,u,i,g;x O(y a,y b){E q=a.t*
b.t+b.c*a.c+a.a*b.a;}x Q(){E A(P,M,T ),O(K,K)<I?C=M,I=q:0;}y V(y a){E A(Z,
a,pow(O(a,a),-H));}x D(y p){S(I=X,P =p,b=T; M=B[++b],p=B[M.c+=8.8-l*.45,
++b],b<=r;Q())M=p.t?q =M_PI*H,w=atan2( P.a-M.a,P.c-M.c) /q,o=p.c-2,a=p.a+1,t=
o+a,w=q*(w>t+H*a?o: w>t?t:w<o-H*a?t :w<o?o:w),A( M,G(cos(w),sin(w),0),
1):A(M,p,U(O(A(P,M,T) ,p)/O(p,p))); M=P;M.a=- .9;o=P.c/8+8;o^=a=P.t
/8+8; M=Q ()?o&1 ?G(Y,0,0):W :G(Y,Y,1);E sqrt (I)-.45;}
int main( int L,char **k){ S(e =L>1?1[z= 0, k]:J ;*e &&l<24 ;
++e)S(o=a =0,j =J+9;(c= *++j)&& !(o&&c< X&&(q=l+=w) );o ?o=*j++/
32,b++[B] =G(q +=*j/8&3,* j&7,0 ),B[r =b++]=G((c/8& 3)*( o<2?
T:1), (c& 7)+ 1e-4,o>2),1: (o =(a =(c-=X)<0?w=c+6 ,t= a+1:c?(t
?0:m(c),a ):*++j)==((*e|32 ) ^z)&&1[j]-X));S(z =3*( L<3);++
F<110;)S(L=-301;p=Z,++L<300;m( p.c),m(p.a),m(p.t))S(c=T;++c<=z;)S(h
=G(-4,4.6,29),d=V(A(A(A(Z,V(G(5,0 ,2)),L+L+c/2),V(G(2,-73,0)),F+F+c%2),G
(30.75,-6,-75),20)),g=R=255-(n=z)*64; R*n+R;g*=H){S(u=i=R=0;!R&&94>(u+=i=D(h=
A(h,d,i)));R=i<.01);S(N=V(A(P,C, T)),q=d.t*d.t,s=M,u=1;++i<6*R;u-=
U(i/3-D(A(h,N,i/3)))/pow( 2,i));s=R?i=pow(U(O(N,V(A(
M=V(G(T,1,2)),d,T)))) ,X),p=A(p,W,g*i),u*=U(
O(N,M))*H*Y+Y,g*= n--?Y-Y*i:1-i,s:G(
q,q,1); p=A(p,s ,g*u);h=A(h,N,.1
);d=A(d,N,-2*O (d,N));}E 0;}