Remove hint.html and index.html
As per discussions on GitHub the index.html and hint.html files should be deleted in favour of README.md files (from any .text/.txt/.markdown/.md files which will be turned into README.md in an upcoming commit).
This commit is contained in:
1 parent
ee8a36310f
commit
77fb0f11a2
143 files changed
-28606
No files matched your search
@@ -1,186 +0,0 @@
|
||||
<!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="mailto:mzucker1@swarthmore.edu">mzucker1@swarthmore.edu</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 > image.ppm
|
||||
</code></pre>
|
||||
|
||||
<h3>Try:</h3>
|
||||
|
||||
<pre><code>./zucker "Hello!!!" > hello.ppm
|
||||
./zucker faster\! -preview > 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’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 > image.ppm
|
||||
</code></pre>
|
||||
|
||||
<p>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, <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" > image.ppm
|
||||
</code></pre>
|
||||
|
||||
<p>To mitigate long runtimes, the program can be invoked in a “preview”
|
||||
mode by appending <code>-preview</code> to the command line arguments, like so:</p>
|
||||
|
||||
<pre><code> ./zucker faster\! -preview > 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’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’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 “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.</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’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 <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 “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).</p>
|
||||
|
||||
<hr />
|
||||
|
||||
<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>© 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> <!--<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>
|
||||
Reference in new issue
Block a user