We change various uses of winner to entry, including variable names and code comments.
388 lines
19 KiB
HTML
388 lines
19 KiB
HTML
<!DOCTYPE html>
|
||
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
||
<!-- START: two lines up starts content from: inc/top.default.html -->
|
||
<!-- -->
|
||
<!-- !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
|
||
<!-- !!! DO NOT MODIFY THIS FILE - This file is generated by a tool !!! -->
|
||
<!-- !!! DO NOT MODIFY THIS FILE - This file is generated by a tool !!! -->
|
||
<!-- !!! DO NOT MODIFY THIS FILE - This file is generated by a tool !!! -->
|
||
<!-- !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
|
||
<!-- -->
|
||
<!-- END: this line ends content from: inc/top.default.html -->
|
||
<!-- -->
|
||
<!-- The original markdown content was formed by the tool: bin/readme2index.sh -->
|
||
<!-- The HTML was converted from markdown by the tool: bin/md2html.sh -->
|
||
<!-- -->
|
||
<!-- START: this line starts content from: inc/head.default.html -->
|
||
|
||
<head>
|
||
<link rel="stylesheet" href="../../ioccc.css">
|
||
<meta charset="utf-8">
|
||
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=yes">
|
||
<title>1994/tvr - Best X11 Program</title>
|
||
<meta name="description" content="1994 IOCCC entry tvr - Best X11 Program">
|
||
<meta name="keywords" content="IOCCC, 1994, IOCCC 1994, IOCCC entry, tvr, Best X11 Program">
|
||
</head>
|
||
|
||
<!-- END: this line ends content from: inc/head.default.html -->
|
||
<!-- START: this line starts content from: inc/body.default.html -->
|
||
|
||
<body>
|
||
|
||
<!-- END: this line ends content from: inc/body.default.html -->
|
||
<!-- START: this line starts content from: inc/header.default.html -->
|
||
|
||
<div class="header">
|
||
<img src="../../png/ioccc.png" alt="IOCCC image by Matt Zucker" width=300 height=110>
|
||
<h1>The International Obfuscated C Code Contest</h1>
|
||
<h2>1994/tvr - Best X11 Program</h2>
|
||
</div>
|
||
|
||
<!-- END: this line ends content from: inc/header.default.html -->
|
||
<!-- START: this line starts content from: inc/topnav.mid.html -->
|
||
|
||
<div class="topnav">
|
||
<a class="Left" href="../smr/index.html">← smr</a>
|
||
<a class="Left" href="../index.html">↑ 1994 ↑</a>
|
||
<a class="Left" href="../weisberg/index.html">weisberg →</a>
|
||
<a class="Right" href="#inventory">Inventory</a>
|
||
</div>
|
||
|
||
<!-- END: this line ends content from: inc/topnav.mid.html -->
|
||
<!-- START: this line starts content from: inc/begin-row.default.html -->
|
||
|
||
<div class="row">
|
||
|
||
<!-- END: this line ends content from: inc/begin-row.default.html -->
|
||
<!-- START: this line starts content from: inc/begin-leftcolumn.default.html -->
|
||
|
||
<div class="leftcolumn">
|
||
|
||
<!-- END: this line ends content from: inc/begin-leftcolumn.default.html -->
|
||
<!-- START: this line starts content from: inc/sidenav.default.html -->
|
||
|
||
<div class="sidenav">
|
||
<a href="#content">Jump to contents</a>
|
||
</div>
|
||
<hr>
|
||
<div class="sidenav">
|
||
<a href="../../index.html">IOCCC Home</a>
|
||
<a href="../../years.html">Winning Entries</a>
|
||
<a href="../../winners.html">People who have won</a>
|
||
</div>
|
||
<hr>
|
||
<div class="sidenav">
|
||
<a href="../../news.html">IOCCC News</a>
|
||
<a href="../../faq.html#submit">How to enter the IOCCC</a>
|
||
<a href="../../faq.html">FAQ</a>
|
||
</div>
|
||
<hr>
|
||
<div class="sidenav">
|
||
<a href="../../bugs.html">Bugs & (mis)features</a>
|
||
<a href="../../faq.html#fix_a_winner">Fixing IOCCC winners</a>
|
||
<a href="../../faq.html#fix_web_site">Fixing the web site</a>
|
||
<a href="../../faq.html#fix_author">Fixing winner info</a>
|
||
<a href="../../thanks-for-help.html">Thanks for the help</a>
|
||
</div>
|
||
<hr>
|
||
<div class="sidenav">
|
||
<a href="../../judges.html">The IOCCC Judges</a>
|
||
<a href="../../contact.html">Contacting the IOCCC</a>
|
||
</div>
|
||
<hr>
|
||
<div class="sidenav">
|
||
<a href="#top">Jump to top</a>
|
||
</div>
|
||
|
||
<!-- END: this line ends content from: inc/sidenav.default.html -->
|
||
<!-- START: this line starts content from: inc/end-leftcolumn.default.html -->
|
||
|
||
</div>
|
||
|
||
<!-- END: this line ends content from: inc/end-leftcolumn.default.html -->
|
||
<!-- START: this line starts content from: inc/begin-rightcolumn.default.html -->
|
||
|
||
<div class="rightcolumn">
|
||
|
||
<!-- END: this line ends content from: inc/begin-rightcolumn.default.html -->
|
||
<!-- START: this line starts content from: inc/before-content.default.html -->
|
||
|
||
<a name="content"></a>
|
||
|
||
<!-- END: this line ends content from: inc/before-content.default.html -->
|
||
<!-- START: this line starts content generated by: bin/output-index-author.sh -->
|
||
|
||
<h2 id="author"><a name="author"></a>Author:</h2>
|
||
<ul>
|
||
<li>Name: <a href="../../authors.html#Teemu_Rantanen">Teemu
|
||
Rantanen</a><br> Location: <a href="../../location.html#FI">FI</a>
|
||
<br><br></li>
|
||
</ul>
|
||
|
||
<!-- END: next line ends content generated by: bin/output-index-author.sh -->
|
||
<h2 id="to-build">To build:</h2>
|
||
<div class="sourceCode" id="cb1"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb1-1"><a href="#cb1-1" aria-hidden="true" tabindex="-1"></a><span class="fu">make</span> all</span></code></pre></div>
|
||
<p>The author provided a spoiler version as alt code. See <a
|
||
href="#alternate-code">Alternate code</a> below.</p>
|
||
<h3 id="bugs-and-misfeatures">Bugs and (Mis)features:</h3>
|
||
<p>The current status of this entry is:</p>
|
||
<pre><code>STATUS: known bug - please help us fix</code></pre>
|
||
<p>For more detailed information see <a href="/bugs.md#1994-tvr">1994
|
||
tvr in bugs.md</a>.</p>
|
||
<h2 id="to-use">To use:</h2>
|
||
<div class="sourceCode" id="cb3"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb3-1"><a href="#cb3-1" aria-hidden="true" tabindex="-1"></a><span class="ex">./tvr</span> mode screensize/2 <span class="op"><</span> colormapfile</span></code></pre></div>
|
||
<p>Mode may be a value from 0 to 12.</p>
|
||
<h2 id="try">Try:</h2>
|
||
<div class="sourceCode" id="cb4"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb4-1"><a href="#cb4-1" aria-hidden="true" tabindex="-1"></a><span class="ex">./try.color.sh</span> <span class="co"># for colour displays</span></span>
|
||
<span id="cb4-2"><a href="#cb4-2" aria-hidden="true" tabindex="-1"></a><span class="ex">./try.bw.sh</span> <span class="co"># for Black & White displays</span></span></code></pre></div>
|
||
<h2 id="alternate-code">Alternate code:</h2>
|
||
<p>The author provided us a spoiler version that might be of interest to
|
||
some.</p>
|
||
<h3 id="alternate-build">Alternate build:</h3>
|
||
<div class="sourceCode" id="cb5"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb5-1"><a href="#cb5-1" aria-hidden="true" tabindex="-1"></a><span class="fu">make</span> alt</span></code></pre></div>
|
||
<h3 id="alternate-use">Alternate use:</h3>
|
||
<div class="sourceCode" id="cb6"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb6-1"><a href="#cb6-1" aria-hidden="true" tabindex="-1"></a><span class="ex">./tvr.alt</span> altmode screensize/2 <span class="op"><</span> colormapfile</span></code></pre></div>
|
||
<p>where <code>altmode</code> <code>1</code> - <code>4</code> correspond
|
||
to mode <code>0</code> - <code>3</code> in the original entry and
|
||
<code>altmode 0</code> calculates Mandelbrot/Julian sets correctly.</p>
|
||
<h2 id="alternate-try">Alternate try:</h2>
|
||
<div class="sourceCode" id="cb7"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb7-1"><a href="#cb7-1" aria-hidden="true" tabindex="-1"></a><span class="ex">./try.alt.color.sh</span> <span class="co"># for colour displays</span></span>
|
||
<span id="cb7-2"><a href="#cb7-2" aria-hidden="true" tabindex="-1"></a><span class="ex">./try.alt.bw.sh</span> <span class="co"># for Black & White displays</span></span></code></pre></div>
|
||
<h2 id="judges-remarks">Judges’ remarks:</h2>
|
||
<p>This entry requires the use of X11. It will form two windows
|
||
(hopefully your window manager will ask you where to place these in your
|
||
display) which you should place side by side. Move the cursor around in
|
||
one of the two windows and watch what happens.</p>
|
||
<p>The fractally minded may be able to detect that mode 0 does not
|
||
calculate Mandelbrot/Julian sets correctly. Can you find the bug? Better
|
||
still, can you fix it without breaking something else?</p>
|
||
<h2 id="authors-remarks">Author’s remarks:</h2>
|
||
<h3 id="interactive-fractals-for-x-window-system">Interactive Fractals
|
||
for X Window System</h3>
|
||
<p>This program contains four pairs of fractals/effects and three
|
||
methods of animating them. There are two windows for a pair of fractals,
|
||
one of which contains static fractal (e.g. <a
|
||
href="https://en.wikipedia.org/wiki/Mandelbrot_set">Mandelbrot set</a>)
|
||
and the other an animating one (e.g. <a
|
||
href="https://en.wikipedia.org/wiki/Julia_set">Julia set</a>) which is
|
||
derived from the same formula as the static one. Only one pair of
|
||
fractals can be displayed in one process.</p>
|
||
<p>To animate the fractal, you must move your mouse on the static
|
||
fractal window and the animated fractal will be calculated based on
|
||
mouse coordinates. If you are on one of the two non-stable modes (more
|
||
about them later) you can stabilize the picture by pressing a mouse
|
||
button. Pressing it does nothing on stable mode.</p>
|
||
<p>The three modes are:</p>
|
||
<ul>
|
||
<li>non-stable mode with simple ‘attractor searcher’</li>
|
||
<li>non-stable mode</li>
|
||
<li>stable mode</li>
|
||
</ul>
|
||
<p>On Mandelbrot/Julia mode the stable mode calculates normal Julia set
|
||
according to the Mandelbrot coordinates (mouse position). On non-stable
|
||
modes the picture slowly transforms to the same picture as on the stable
|
||
mode but transformation can take some time. Usually, and especially if
|
||
changes are relatively small between mouse movements or frame rate is
|
||
high, the non-stable mode makes much more interesting effects IMHO. The
|
||
difference between the two non-stable modes is that the first tries to
|
||
stabilize the picture. It doesn’t stabilize much, but it helps in some
|
||
cases quite a lot. One notable case where help can be seen is when you
|
||
first move your mouse to non-black areas of the Mandelbrot set, then
|
||
back to near the center. In some cases ‘attractor searcher’ can be seen
|
||
as noise.</p>
|
||
<p>The first of the fractal pairs is Mandelbrot/Julia set as mentioned
|
||
before. The second is a variation of that. The third makes nice
|
||
3D-look-a-like effects and the fourth is a variation of that with more
|
||
nice effects.</p>
|
||
<h3 id="usage">Usage:</h3>
|
||
<div class="sourceCode" id="cb8"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb8-1"><a href="#cb8-1" aria-hidden="true" tabindex="-1"></a><span class="ex">./tvr</span> mode screensize/2 <span class="op"><</span> colormapfile</span></code></pre></div>
|
||
<p>The first parameter is the operating-mode of the program. There are 4
|
||
fractal pairs and 3 display modes, making total of 12 modes.
|
||
<code>screensize</code> is half of the actual
|
||
<code>screenlength/width</code>. I.e. if you use 128 as a second
|
||
parameter, you will get two 256x256 windows.</p>
|
||
<p>The program needs reasonable values for both of these parameters to
|
||
operate. A good first try could be <code>0 128</code> or
|
||
<code>8 128</code>. The <code>colormap</code> has to be redirected into
|
||
the programs standard input via the <code>colormapfile</code> parameter
|
||
as shown above.</p>
|
||
<p>Note that you will need approximately
|
||
<code>(second_parameter^2)*64</code> bytes of free main memory or the
|
||
machine will swap heavily (memory references are quite random and may
|
||
confuse paging algorithms easily). This means that for 512x512 windows
|
||
you will need 4M of memory.</p>
|
||
<h3 id="colormapfile"><code>colormapfile</code></h3>
|
||
<p>This is the file from which program reads colors for screen
|
||
<code>colormap</code>. The first line of the file must be a number
|
||
between <code>3..254</code>. This informs the program how many colors
|
||
there are to be expected. This is also the maximum number of iterations
|
||
used on picture calculations. Lines after that are X11 color names. The
|
||
program expects to find, and will use, the number of colors reported on
|
||
the first line.</p>
|
||
<p>There are two <code>colormapfile</code>s to start with. One with
|
||
colors and another with only black and white. If you have enough colors
|
||
on your display you can use the one with colors (even on
|
||
<code>grayscale</code>). The other is meant mainly for a one bit plane
|
||
display (on which the picture looks terrible compared to a 8 bit plane
|
||
display).</p>
|
||
<h3 id="compilation">Compilation</h3>
|
||
<p>You should compile this entry with an optimizing compiler with the
|
||
highest level of optimization possible. You will also need an ANSI
|
||
compatible compiler (<code>gcc -ansi -pedantic</code> will do fine).</p>
|
||
<p>This entry has been tested on wide variety of machines including:</p>
|
||
<pre><code>Machine OS
|
||
------- --
|
||
Decstation 5000/240 Ultrix 4.3A
|
||
DECAlpha 3000/300 OSF/1 v1.3 and v2.0
|
||
IBM RS6000 AIX v3
|
||
SPARCStation IPX SunOS 4.1.3
|
||
i486 Linux v1.1.8 (binarysize 3576 bytes
|
||
using `gcc -O6 -s -N` ;)
|
||
HP 9000/730 HP-UX</code></pre>
|
||
<p>Also, many of the X server and X library versions have been tested
|
||
and the program should be highly portable. The program may slow down
|
||
considerably on machines where table references are slow as the program
|
||
makes extensive use of them. Also, due to the huge amount of data sent
|
||
to the X server, considerable slowdown can be noticed if the X server is
|
||
slow or especially if the connection between the X server and the client
|
||
is slow. (Don’t try this on 9600 bps modem line. I did ;) )</p>
|
||
<h3 id="obfuscation">Obfuscation</h3>
|
||
<p>Obfuscation is done on different levels. Almost none of it is made at
|
||
the macro level, so <code>cpp</code>ing the code won’t give you much.
|
||
Perhaps most notable is the algorithmic obfuscation. Simple formula has
|
||
been turned into something completely different. Also it may be a
|
||
surprise to find out which piece of the code calculates non-stable
|
||
fractals and how it does that. Many obfuscations were left out of the
|
||
program because speed of animation was one of the key issues. Well,
|
||
obfuscated or not, some of the effects are very nice ;)</p>
|
||
<h3 id="memory-refreshment">Memory refreshment</h3>
|
||
<p>Mandelbrot set is calculated from the formula</p>
|
||
<pre><code>
|
||
2
|
||
Z = Z + Z
|
||
n+1 n 0</code></pre>
|
||
<p>and the Julia set is calculated from the formula</p>
|
||
<pre><code>
|
||
2
|
||
Z = Z + C
|
||
n+1 n
|
||
</code></pre>
|
||
<p>where <code>C</code> is the same throughout the picture. Both
|
||
calculation are finished when <code>|Z| >= 2.0</code>. For the other
|
||
fractals, the basic methods are the same but the formula is different
|
||
(look at the source ;) )</p>
|
||
<p>Note that Mandelbrot and Julia on this program aren’t exactly
|
||
correct. Find out why ;)</p>
|
||
<h3 id="bugs">Bugs</h3>
|
||
<ul>
|
||
<li>No error checking. If DISPLAY is not set program dumps core. This
|
||
may also happen if a request of some of the resources fails e.g. getting
|
||
colors.</li>
|
||
<li>No expose event handling.</li>
|
||
<li>It may be possible that the program starts drawing before window is
|
||
mapped as there is no <code>XSync()</code>. In that case drawn data is
|
||
lost. Also, some window manager configurations places the second window
|
||
on top of the first and again drawn data will be lost. By default,
|
||
windows are placed next to the other in the top left corner of the
|
||
screen.</li>
|
||
<li>Zooming is not possible.</li>
|
||
<li>Eats LOTS of memory on BIG pictures. Also lots of CPU resources.
|
||
Under mode 0, the boundary condition is not checked properly. The
|
||
condition <code>|Z| >= 2.0</code> should be checked exactly (by
|
||
comparing <code>x*x+y*y</code> with <code>2*2</code>), or else artifacts
|
||
are introduced. The result of this error is a “bubbly” appearance (at
|
||
least in mono).</li>
|
||
</ul>
|
||
<h2 id="copyright-and-cc-by-sa-4.0-license">Copyright and CC BY-SA 4.0
|
||
License:</h2>
|
||
<p>This file is Copyright (c) 2023 by Landon Curt Noll. All Rights
|
||
Reserved. You are free to share and adapt this file under the terms of
|
||
this license:</p>
|
||
<pre><code>Creative Commons Attribution-ShareAlike 4.0 International (CC BY-SA 4.0)</code></pre>
|
||
<p>For more information, see:
|
||
https://creativecommons.org/licenses/by-sa/4.0/</p>
|
||
<!-- START: this line starts content generated by: bin/output-index-inventory.sh -->
|
||
|
||
<h1 id="inventory-for-1994tvr"><a name="inventory"></a>Inventory for
|
||
1994/tvr</h1>
|
||
<h2 id="primary-files">Primary files</h2>
|
||
<ul>
|
||
<li><a href="index.html">index.html</a> - entry home page</li>
|
||
<li><a
|
||
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/1994/tvr/tvr.c">tvr.c</a>
|
||
- winning source</li>
|
||
<li><a
|
||
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/1994/tvr/Makefile">Makefile</a>
|
||
- entry Makefile</li>
|
||
<li><a
|
||
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/1994/tvr/tvr.alt.c">tvr.alt.c</a>
|
||
- alternative source</li>
|
||
<li><a
|
||
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/1994/tvr/tvr.orig.c">tvr.orig.c</a>
|
||
- original source</li>
|
||
<li><a
|
||
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/1994/tvr/try.alt.bw.sh">try.alt.bw.sh</a>
|
||
- demonstrate alt code in black and white mode</li>
|
||
<li><a
|
||
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/1994/tvr/try.alt.color.sh">try.alt.color.sh</a>
|
||
- demonstrate alt code in colour mode</li>
|
||
<li><a
|
||
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/1994/tvr/try.bw.sh">try.bw.sh</a>
|
||
- demonstrate code in black and white mode</li>
|
||
<li><a
|
||
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/1994/tvr/try.color.sh">try.color.sh</a>
|
||
- demonstrate alt code in colour mode</li>
|
||
<li><a
|
||
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/1994/tvr/tvr.bw">tvr.bw</a>
|
||
- black and white</li>
|
||
<li><a
|
||
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/1994/tvr/tvr.color">tvr.color</a>
|
||
- RGB values</li>
|
||
<li><a href="1994_tvr.tar.bz2">1994_tvr.tar.bz2</a> - download winning
|
||
source</li>
|
||
</ul>
|
||
<h2 id="secondary-files">Secondary files</h2>
|
||
<ul>
|
||
<li><a
|
||
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/1994/tvr/.entry.json">.entry.json</a>
|
||
- description of entry in JSON</li>
|
||
<li><a
|
||
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/1994/tvr/.gitignore">.gitignore</a>
|
||
- list of files that should not be committed under git</li>
|
||
<li><a href=".path">.path</a> - directory path from top directory</li>
|
||
<li><a
|
||
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/1994/tvr/README.md">README.md</a>
|
||
- markdown source for index.html</li>
|
||
</ul>
|
||
|
||
<!-- END: next line ends content generated by: bin/output-index-inventory.sh -->
|
||
<!-- START: this line starts content from: inc/after-content.default.html -->
|
||
|
||
<!-- END: this line ends content from: inc/after-content.default.html -->
|
||
<!-- START: this line starts content from: inc/end-rightcolumn.default.html -->
|
||
|
||
</div>
|
||
|
||
<!-- END: this line ends content from: inc/end-rightcolumn.default.html -->
|
||
<!-- START: this line starts content from: inc/end-row.default.html -->
|
||
|
||
</div>
|
||
|
||
<!-- END: this line ends content from: inc/end-row.default.html -->
|
||
<!-- START: this line starts content from: inc/footer.default.html -->
|
||
|
||
<div class="footer">
|
||
<hr>
|
||
<h2>Coda</h2>
|
||
<p><a href="https://validator.w3.org/nu/?doc=https%3A%2F%2Fioccc-src.github.io%2Ftemp-test-ioccc%2F1994%2Ftvr%2Findex.html">Nu HTML check this web page</a></p>
|
||
<p><a href="#top">Jump to top</a> <a href="#content">Jump to Content</a> <a href="#inventory">Jump to Inventory</a></p>
|
||
</div>
|
||
|
||
<!-- END: this line ends content from: inc/footer.default.html -->
|
||
<!-- START: this line starts content from: inc/bottom.default.html -->
|
||
|
||
</body>
|
||
</html>
|
||
|
||
<!-- END: this line ends content from: inc/bottom.default.html -->
|