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,142 +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.5a DL=DISCOUNT">
|
||||
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=utf-8">
|
||||
<link rel="stylesheet"
|
||||
type="text/css"
|
||||
href="../hint.css">
|
||||
<title>Most GIFted expressions</title>
|
||||
</head>
|
||||
<body>
|
||||
<h1>Most GIFted expressions</h1>
|
||||
|
||||
<p>Philip Blakely<br>
|
||||
Cambridge, UK<br>
|
||||
<a href="mailto:pmblakely@gmail.com">pmblakely@gmail.com</a></p>
|
||||
|
||||
<h2>Judges' comments:</h2>
|
||||
|
||||
<h3>To build:</h3>
|
||||
|
||||
<pre><code>make blakely
|
||||
</code></pre>
|
||||
|
||||
<h3>To run:</h3>
|
||||
|
||||
<pre><code>./blakely "RPN formula" resolution > output.gif
|
||||
</code></pre>
|
||||
|
||||
<h3>Try:</h3>
|
||||
|
||||
<pre><code>./blakely "xx*yy*+" 64 > paraboloid.gif
|
||||
|
||||
./blakely 9 32 > empty.gif
|
||||
|
||||
time ./blakely 0 250 > flat.gif
|
||||
</code></pre>
|
||||
|
||||
<h3>Selected Judges Remarks:</h3>
|
||||
|
||||
<p>Several IOCCC themes (RPN calculator, animated GIF generator, ray tracing) in one package! Very impressive!</p>
|
||||
|
||||
<p>The checkerboard pattern in the output can be broken. Could you figure out how?</p>
|
||||
|
||||
<p>Larger GIF files confuse some image viewers.</p>
|
||||
|
||||
<h2>Author’s comments:</h2>
|
||||
|
||||
<h2>Remarks</h2>
|
||||
|
||||
<p>This program renders a generic RPN expression in ray-traced animated GIF form.
|
||||
The expression in spatial variables x and y is specified on the command-line with the required resolution,
|
||||
and an animated GIF showing a fly-around of the resulting surface is output to stdout.</p>
|
||||
|
||||
<h2>Usage</h2>
|
||||
|
||||
<p>The program should be run as:</p>
|
||||
|
||||
<pre><code>./blakely xy* 32 > pic.gif
|
||||
</code></pre>
|
||||
|
||||
<p>where the first parameter is a RPN expression, and the second is the width of the required GIF, up to a maximum of 250.</p>
|
||||
|
||||
<p>The expressions are written in Reverse Polish Notation with the following characters recognised:</p>
|
||||
|
||||
<ul>
|
||||
<li>+,-,*,/ - usual arithmetic operations</li>
|
||||
<li>^ - Exponentiation - valid for constant exponent only</li>
|
||||
<li>s - sin</li>
|
||||
<li>c - cos</li>
|
||||
<li>0-9 - single digit integers</li>
|
||||
<li>d - duplicate number on stack</li>
|
||||
<li>t - transpose top two elements on stack</li>
|
||||
<li>x - x coordinate value</li>
|
||||
<li>y - y coordinate value</li>
|
||||
</ul>
|
||||
|
||||
|
||||
<p>NB all arithmetic is done in double precision, so 23/ is two-thirds, rather than 0</p>
|
||||
|
||||
<p>The surface plotted corresponds to -1 <= x,y <= 1 and for best results, the generated z value should lie between -1 and 1.</p>
|
||||
|
||||
<p>If there is a division by zero, square-root of a negative number, or similar operation, then the results are undefined.</p>
|
||||
|
||||
<h2>Examples</h2>
|
||||
|
||||
<p>For test-runs, use a resolution of 32. For simple expressions, the GIF generation should take only
|
||||
a few seconds with a modern processor and full optimization. Run-time scales as O(N<sup>3</sup>) with resolution N,
|
||||
and more complex expressions take longer to compute. For example, increasing the resolution of ripple.gif
|
||||
to 250 took ~35 minutes to render on an i7 processor.</p>
|
||||
|
||||
<pre><code>./blakely xy* 32 > saddle.gif
|
||||
|
||||
./blakely xx*yy*1++d5*ct/ 64 > ripple.gif
|
||||
</code></pre>
|
||||
|
||||
<h2>Algorithm</h2>
|
||||
|
||||
<p>A generic root-finding algorithm to find the point of intersection between a ray
|
||||
and the surface is done using a simple forward search from the eye.
|
||||
In order to make the rendering realistic, both the value of the expression, and its derivative with respect to x and y must be tracked.
|
||||
This is done using an obvious stack-based approach.</p>
|
||||
|
||||
<h2>Obfuscations</h2>
|
||||
|
||||
<p>Much of the obfuscation is achieved through the use of single-letter variables and #defines.
|
||||
The characters output for the GIF format are generated in myriad and wonderful ways, making use
|
||||
of XOR, return values from putchar, and odd expressions.
|
||||
The layout is in the form of X Y Z.</p>
|
||||
|
||||
<h2>Limitations</h2>
|
||||
|
||||
<p>ASCII is assumed since many bytes for the GIF output are generated from characters given in the source code.
|
||||
On compilation a few warnings about parentheses come up when using gcc 4.6.3, and one about no return value from main() (who uses exit codes anyway?),
|
||||
but clang 3.1 emits no warnings.</p>
|
||||
|
||||
<h2>Questions</h2>
|
||||
|
||||
<ul>
|
||||
<li>Apart from their appearance when computing the RPN expression, sin and cos are not used.
|
||||
How do we then get the correct angles for rotation?</li>
|
||||
<li>Exactly how many times will the animation repeat?</li>
|
||||
<li>Why is there an upper limit of 250x250 for the resolution?</li>
|
||||
<li>What is the point of b[0]?</li>
|
||||
<li>Where are the words NETSCAPE and GIF hidden in the source?</li>
|
||||
</ul>
|
||||
|
||||
|
||||
<p>(Note that the author may or may not be able to answer all of the above questions.)</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-2015,
|
||||
<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