build index.html for all winners

Updated manifest as per recent file changes.

Updated winner `.winner.json` to reflect the manifest changes.

Added [bin/all_run.sh](bin/all_run.sh) tool to run a command over
all winning entries.

These tools had slight improvements in the help usage message:

* bin/gen-author.sh VERSION="1.3.1 2024-01-16"
* bin/gen-inventory.sh VERSION="1.0.1 2024-01-16"
* bin/pandoc_wrapper.sh VERSION="1.3.1 2024-01-16"
* bin/subst.default.sh VERSION="1.1.1 2024-01-16"
* bin/subst.winner-index.sh VERSION="1.1.1 2024-01-16"

The `bin/readme2index.sh` tool was improved so that
if the `index.html` file exists and the tool forms
the exact same content, then the file `index.html`
file is NOT touched.

* bin/readme2index.sh VERSION="1.1 2024-01-16"

We used the following command to generate `index.html` files
for all winning entries:

```sh
bin/all_run.sh -v 3 bin/readme2index.sh
```

NOTE: We have not (yet) built HTML files above the winner directory
level (e.g., no year level nor top level HTML), nor have be built
non-index HTML files for winners.

NOTE: By default we are running `pandoc(1)` with:

```
--fail-if-warnings=true
```

This means that any problems with markdown to HTML
generates an error.  This is done to be sure that
the HTML conversion is clean.

We had to fix the following `README.md` files:

* `2000/rince/README.md`

The reference [^2] was never used.  We made a guess that [^2] applies
to the same spot as [^1].  Perhaps there is a better spot where
[^2] applies?

NOTE: For every reference, there MUST be some place where that
reference is used.

* 2012/vik/README.md

The string "$...$" is assumed to be a TeX encoded string.

NOTE: Every "$..$" needs to be backslashed as in "\$..\$".

* 2018/burton1/README.md

The reference [2] was duplicated.  We changed the
second [2] to [3].

NOTE: Every reference needs to have a unique number.

* 2020/carlini/README.md

The string "$...$" is assumed to be a TeX encoded string.

NOTE: Every "$..$" needs to be backslashed as in "\$..\$".

We also found 2 errors in the `author/author_handle.json` file set:

* author/Anonymous_2001.json

The `author/Anonymous_2001.json` file was missing.

* author/Jari_Arkko.json

The winner ID for `1989_jar.1` had a typo.
This commit is contained in:
Landon Curt Noll committed 2024-01-17 00:32:39 -08:00
1 parent 893cd915b6
commit c1466f5165
350 files changed
+95242 -4217

No files matched your search

+763 -13
View File
@@ -1,4 +1,6 @@
<!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 !!! -->
@@ -6,27 +8,775 @@
<!-- !!! DO NOT MODIFY THIS FILE - This file is generated by a tool !!! -->
<!-- !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<!-- -->
<!-- file: 2013/birken/index.html created by: fake.gen_index.sh version: 1.0.5 2023-10-31 -->
<html lang="en">
<!-- END: this line ends content from: inc/top.default.html -->
<!-- -->
<!-- This file was formed by the tool: bin/readme2index.sh version: 1.1 2024-01-16 -->
<!-- -->
<!-- START: this line starts content from: inc/head.default.html -->
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>2013 birken</title>
<meta name="description" content="IOCCC year: 2013 IOCCC winner: birken winner index page">
<meta name="keywords" content="IOCCC,2013,birken,winner index page">
<link rel="stylesheet" href="/temp-test-ioccc/ioccc.css">
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=yes">
<title>2013/birken</title>
<meta name="description" content="2013 IOCCC winner birken">
<meta name="keywords" content="IOCCC, 2013, IOCCC 2013, IOCCC winner, birken">
</head>
<!-- END: this line ends content from: inc/head.default.html -->
<!-- START: this line starts content from: inc/body.default.html -->
<body>
<h1>2013 birken</h1>
<!-- END: this line ends content from: inc/body.default.html -->
<!-- START: this line starts content from: inc/header.default.html -->
<p>XXX - fake content until readme2index is working - XXX</p>
<div class="header">
<img src="/temp-test-ioccc/png/ioccc.png" alt="IOCCC image by Matt Zucker" width=300 height=110>
<h1>The International Obfuscated C Code Contest</h1>
<h2>2013/birken</h2>
</div>
<hr style="width:50%;text-align:left;margin-left:0">
<!-- END: this line ends content from: inc/header.default.html -->
<!-- START: this line starts content from: inc/topnav.first.html -->
<!-- Start Nu Html Checker -->
<p><a href="https://validator.w3.org/nu/?doc=https%3A%2F%2Fioccc-src.github.io%2Ftemp-test-ioccc%2F2013%2Fbirken%2Findex.html">Nu Html check https://ioccc-src.github.io/temp-test-ioccc/2013/birken/index.html</a></p>
<!-- End Nu Html Checker -->
<div class="topnav">
<a class="Left Disabled" href="#">first entry</a>
<a class="Left" href="../index.html">&uarr; 2013 &uarr;</a>
<a class="Left" href="../cable1/index.html">cable1 &rarr;</a>
<a class="Right" href="#inventory">Inventory</a>
</div>
<!-- END: this line ends content from: inc/topnav.first.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="/temp-test-ioccc/index.html">IOCCC Home</a>
<a href="/temp-test-ioccc/years.html">Winning Entries</a>
<a href="/temp-test-ioccc/winners.html">People who have won</a>
</div>
<hr>
<div class="sidenav">
<a href="/temp-test-ioccc/news.html">IOCCC News</a>
<a href="/temp-test-ioccc/faq.html#submit">How to enter the IOCCC</a>
<a href="/temp-test-ioccc/faq.html">FAQ</a>
</div>
<hr>
<div class="sidenav">
<a href="/temp-test-ioccc/bugs.html">Bugs &amp; (mis)features</a>
<a href="/temp-test-ioccc/faq.html#fix_a_winner">Fixing IOCCC winners</a>
<a href="/temp-test-ioccc/faq.html#fix_web_site">Fixing the web site</a>
<a href="/temp-test-ioccc/faq.html#fix_author">Fixing winner info</a>
<a href="/temp-test-ioccc/thanks-for-help.html">Thanks for the help</a>
</div>
<hr>
<div class="sidenav">
<a href="/temp-test-ioccc/judges.html">The IOCCC Judges</a>
<a href="/temp-test-ioccc/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/gen-author.sh -->
<p><a name="author"><strong>Author:</strong></a> <br><br>Name: <a
href="/temp-test-ioccc/winners.html#Michael_Birken">Michael
Birken</a><br> Location: <a
href="/temp-test-ioccc/location.html#US">US</a></p>
<!-- END: next line ends content generated by: bin/gen-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> alt</span></code></pre></div>
<p>We recommend that you use the alt version first to see what this
entry looked like back in 2013 (with a configurable speed). If you wish
to use the original version see the <a href="#original-code">original
code</a> section below.</p>
<h2 id="to-use">To use:</h2>
<div class="sourceCode" id="cb2"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb2-1"><a href="#cb2-1" aria-hidden="true" tabindex="-1"></a><span class="ex">./birken.alt</span> <span class="op">&lt;</span> 17_columns_wide_paint_by_numbers_file</span></code></pre></div>
<p>NOTE: if your terminal is messed up after running this (perhaps from
exiting before it finishes) try using <code>reset</code> to restore the
terminal. This will clear the screen.</p>
<h2 id="try">Try:</h2>
<p>This alternate version, which we recommend that you use in order to
see what is happening with modern systems, and to not flash colours too
quickly, which can be problematic for some people, can be configured to
different speeds by way of the value used in <code>usleep(3)</code>. The
default is <code>13500</code> but you can reconfigure it should you wish
(see below).</p>
<p>To see the program run on each text file, try:</p>
<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">./try.alt.sh</span></span></code></pre></div>
<p>If you have perl installed it will also try a random run.</p>
<p>Finding the ‘right’ default value was a fine line; the default, 15000
microseconds (0.015 seconds), will take quite a while to finish but it
allows one to more easily see what is going on. Even easier to see would
be 25000 but these values make it quite slow and one could easily lose
interest. Like some other entries where this was made an alternate
version it is configurable at compile time. If you wish to speed it up
by 100% you can instead do:</p>
<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="fu">make</span> clobber SLEEP=7500 alt</span></code></pre></div>
<p>and then try <code>birken.alt</code> as above.</p>
<p>If you wish to speed that up 200% (300% total) you can use instead
try <code>SLEEP=3750</code>. Doing this you might find the right value
to your liking; use ctrl-c to terminate the program early but note that
the terminal is likely to be messed up. In that case try:</p>
<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="ex">reset</span></span></code></pre></div>
<p>to make it sane again (running to completion will do that for
you).</p>
<h2 id="original-code">Original code:</h2>
<p>The original code will run faster with modern systems which is likely
to make it hard to see the art of the entry but you may do so if you
wish.</p>
<h3 id="original-build">Original build:</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="fu">make</span> all</span></code></pre></div>
<h3 id="original-use">Original use:</h3>
<p>Use <code>birken</code> as you would <code>birken.alt</code>
above.</p>
<h3 id="original-try">Original try:</h3>
<p>To use the demo script with the original code, try:</p>
<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.sh</span></span></code></pre></div>
<p>PLEASE be careful if you are sensitive to flashing colours!</p>
<h2 id="judges-remarks">Judges’ remarks:</h2>
<p>This program also wins the “Most amusing abuse of the iocccsize tool”
award; although not the absolute best: it is possible to achieve 0 by
writing:</p>
<div class="sourceCode" id="cb8"><pre class="sourceCode c"><code class="sourceCode c"><span id="cb8-1"><a href="#cb8-1" aria-hidden="true" tabindex="-1"></a> <span class="co">/* *\</span></span>
<span id="cb8-2"><a href="#cb8-2" aria-hidden="true" tabindex="-1"></a><span class="co"> /....</span></span></code></pre></div>
<p>The game of Tetris had been used in many endeavors, from studying <a
href="http://arxiv.org/abs/cs/0210020">algorithmic complexity</a> to <a
href="http://www.livescience.com/19894-tetris-treat-ptsd-flashbacks.html">treating
PTSD</a> and it’s even been <a
href="http://hacks.mit.edu/Hacks/by_year/2012/tetris/">put on MIT’s
Green Building</a>. Using it for painting by numbers looks like a novel
idea.</p>
<h2 id="authors-remarks">Author’s remarks:</h2>
<h3 id="about-this-document">About This Document</h3>
<p>This document is best viewed as an HTML file in a browser that
supports animated <a
href="https://en.wikipedia.org/wiki/GIF">GIF</a>s.</p>
<p>See the files: <code>*.txt</code>, <code>*.png</code> and
<code>*.gif</code>.</p>
<h3 id="abstract">Abstract</h3>
<p>By rotating, positioning and dropping a predetermined sequence of
pieces, this program exploits the mechanics of Tetris to generate
arbitrary images.</p>
<h3 id="algorithm-overview">Algorithm Overview</h3>
<p>The algorithm converts pixels from a source image into squares in the
<a href="https://en.wikipedia.org/wiki/Tetris">Tetris</a> play-field,
one row at a time from the bottom up. To generate an individual square,
the algorithm assembles a structure consisting of a rectangular region
fully supported by a single square protruding from the bottom. When the
rectangular region is completed, its rows are cleared, leaving behind
the protruding square. Three examples of the process appear below.</p>
<p><img src="pen0.gif" /></p>
<p><img src="pen1.gif" /></p>
<p><img src="pen2.gif" /></p>
<p>During construction of a row, all of the squares produced by this
method must be supported. In the images above, the generated squares are
supported by the floor of the play-field. However, if an arbitrary row
contains holes, it may not provide the support necessary for the
construction of the row above it. The algorithm solves this problem by
constructing a flat platform on top of the row with holes. In the
animation below, a platform is built above a row comprising of a single
red square. The platform is a temporary structure and inserting the
final piece removes it.</p>
<p><img src="platform0.gif" /></p>
<p>Below, a row containing 5 red squares is deposited above a row
containing 3 red squares. This is accomplished by building a flat
platform on top of the lower row. The platform provides the support
necessary to generate the 5 red squares. Finally, the platform is
removed by inserting its final piece and the new row drops into place.
Note, if the algorithm needed to generate the rows in the opposite order
(a row of 3 red squares above a row of 5 red squares), a platform would
not be necessary.</p>
<p><img src="platform1.gif" /></p>
<h3 id="single-square-emitters">Single Square Emitters</h3>
<p>For reference, the names of the 7 <a
href="https://en.wikipedia.org/wiki/Tetromino">tetriminos</a> (the game
pieces or actually a kind of geometric shape used in <a
href="https://en.wikipedia.org/wiki/Tetris">Tetris</a>) appear in the
table below.</p>
<p><img src="names.png" /></p>
<p>This algorithm was tailored specifically to render sprites from early
video games. Those games packed graphics into 8x8 tiles where 2 bits
were dedicated to each pixel. Consequentially, sprites usually contained
only 3 colors plus transparent regions and they were typically sized
either 16x16 or 16x32 pixels.</p>
<p>The animation below depicts all the patterns used to emit single
squares. <code>J</code>, <code>T</code> and <code>L</code> <a
href="https://en.wikipedia.org/wiki/Tetromino">tetriminos</a> are used
interchangeably within each pattern to produce the protruding square at
the bottom. The algorithm assigns those tetriminos to the 3 colors
present in the sprite. The remaining tetriminos are assigned arbitrary
colors. And, all the colors remain constant during gameplay.</p>
<p><img src="pen4.gif" /></p>
<p>It is not possible to emit a square of all 3 colors in the first 2
and the last 2 columns due to the shapes of the 3 <a
href="https://en.wikipedia.org/wiki/Tetromino">tetriminos</a>. As a
result, the minimal width of a play-field to accommodate a 16 pixel wide
sprite is <code>2 + 16 + 2 = 20</code> squares. However, it turns out
that 20 is too small.</p>
<p>As illustrated below, the region above the protruding square cannot
exclusively consist of a single row because the only pieces that could
fit, the <code>I</code> <a
href="https://en.wikipedia.org/wiki/Tetromino">tetriminos</a>, are
unsupported.</p>
<p><img src="pen5.gif" /></p>
<p>With 2 rows, the only means of spanning the full play-field width in
a way that remains supported is to use <code>S</code> and <code>Z</code>
<a href="https://en.wikipedia.org/wiki/Tetromino">tetriminos</a>. But,
that will always leave holes in the upper row.</p>
<p><img src="pen6.gif" /></p>
<p>The minimal number of rows required above the protruding square is 3
and as shown repeatedly above, such patterns do exist. 20 squares is the
minimal width required to fit a 16 pixel wide sprite. But,
<code>20 * 3 + 1 = 61</code>, which is not evenly divisible by 4 and
hence not constructible out of <a
href="https://en.wikipedia.org/wiki/Tetromino">tetriminos</a>. However,
a width of 21 yields <code>21 * 3 + 1 = 64</code>, which can be built
with 16 tetriminos. That width actually enables the algorithm to render
sprites up to 17 pixels wide.</p>
<p>The original <a
href="https://en.wikipedia.org/wiki/Tetris">Tetris</a> play-field is 10
x 20 squares, a 1:2 ratio. The program maintains that ratio by using a
play-field of 21 x 42 squares.</p>
<p>Since <code>J</code>, <code>T</code> and <code>L</code> <a
href="https://en.wikipedia.org/wiki/Tetromino">tetriminos</a> are used
interchangeably to produce the emitted square and 3 squares of those
tetriminos contribute to the row above it, there are
<code>21 - 3 + 1 = 19</code> single square emitting patterns. However,
due to mirror symmetry, there are really only 10 patterns. Clearing 3
rows works for the majority of them. But, an exhaustive computer search
revealed that 2 of the patterns require more. The next possible option
is 7 rows since <code>21 * 7 + 1 = 148</code>, requiring 37 tetriminos.
As the images below show, those patterns do exist.</p>
<p><img src="pen7.gif" /></p>
<p><img src="pen8.gif" /></p>
<h3 id="platforms">Platforms</h3>
<p>Before a row is constructed, the algorithm inspects the row below it.
If the row below fails to provide support for all of the squares to be
deposited above it, then a temporary platform is required. When that
platform is removed, the new row will drop, leaving some of the squares
apparently floating above empty space due to the way that gravity works
in the original <a
href="https://en.wikipedia.org/wiki/Tetris">Tetris</a>.</p>
<p>The illustration below depicts the 10 platform patterns (really only
5 considering mirror symmetry). The construction of a platform begins by
dropping a <code>T</code> <a
href="https://en.wikipedia.org/wiki/Tetromino">tetrimino</a> on top one
of the squares of the last generated row. The remaining tetriminos
support each other down to that first <code>T</code>. Meaning, as long
as the previously generated row contains at least 1 square, like the red
square below, then it is possible to construct a flat platform above it
for the generation of the next row.</p>
<p><img src="platform2.gif" /></p>
<p>In the middle of platform construction, the bottom row gets completed
and cleared, leaving 3 rows above it. The final <code>J</code> or
<code>L</code> <a
href="https://en.wikipedia.org/wiki/Tetromino">tetrimino</a> that will
remove those rows is not inserted until the square emitters are done
generating the next row of the sprite on top of the platform. That final
piece precludes square emission in the first and last 2 columns. But, as
discussed above, the square emitters are limited to the 17 inner columns
due to the geometry of the <code>J</code>, <code>T</code> and
<code>L</code> tetriminos used in the process.</p>
<p>Also, of the 19 possible ways to start constructing a platform on top
of a <code>T</code> <a
href="https://en.wikipedia.org/wiki/Tetromino">tetrimino</a>, only the
10 patterns shown above exist.</p>
<h3 id="program-input">Program Input</h3>
<p>The input sprite is represented textually. Digit characters
<code>0</code> to <code>7</code> correspond to pixels with colors from
the palette below.</p>
<figure>
<img src="palette.png" alt="ANSI color palette" />
<figcaption aria-hidden="true">ANSI color palette</figcaption>
</figure>
<p>As discussed above, sprites are limited to a maximum of 3 colors from
this palette.</p>
<p>All other characters are interpreted as transparent pixels.</p>
<p>The maximum permissible size of the input text is 32 rows by 17
columns. Row length can vary as long as no single row exceeds 17
characters.</p>
<p>Every row must contain at least one palette digit character.</p>
<p>The <code>*.txt</code> files contain different sprites in this
textual format that can be fed into standard input. Several examples
take advantage of the <a
href="https://en.wikipedia.org/wiki/Tetris">Tetris</a> play-field
background color. Instead of using character <code>0</code>, internal
regions marked as transparent are effectively rendered as black.</p>
<h3 id="program-output">Program Output</h3>
<p>The program conceptually uses <a
href="https://en.wikipedia.org/wiki/Tetris">Tetris</a> as an output
device similar to a <a
href="https://en.wikipedia.org/wiki/Line_printer">line printer</a>. It
restricts itself to those operations that can be performed on the Tetris
play-field: spawning, rotating, positioning and dropping <a
href="https://en.wikipedia.org/wiki/Tetromino">tetriminos</a>. This
process is visually represented using ANSI escape sequences.</p>
<h3 id="ansimation">ANSImation</h3>
<p>The rate at which the program plays <a
href="https://en.wikipedia.org/wiki/Tetris">Tetris</a> is completely
determined by the rate in which the terminal application receives and
displays the <a
href="https://en.wikipedia.org/wiki/ANSI_escape_code">ANSI escape</a>
sequences.</p>
<p>To slow down the output programmatically, introduce a delay
immediately after the call to <code>fflush(3)</code> (N.B: see <a
href="birken.alt.c">birken.alt.c</a>).</p>
<h3 id="ioccc-size-tool-bug">IOCCC Size Tool Bug</h3>
<p>This program demonstrates how to exploit a bug in IOCCC size tool
version <code>2013-07-30-v17</code>. The first line of the program is
reproduced below.</p>
<pre><code>char*_ = &quot;&#39;&quot;&quot;/*&quot;;</code></pre>
<p>If that line is added to the top of any program, the tool will report
a size of 8.</p>
<div class="sourceCode" id="cb10"><pre
class="sourceCode sh"><code class="sourceCode bash"><span id="cb10-1"><a href="#cb10-1" aria-hidden="true" tabindex="-1"></a><span class="ex">$</span> ./iocccsize <span class="at">-i</span> <span class="op">&lt;</span> prog.c</span>
<span id="cb10-2"><a href="#cb10-2" aria-hidden="true" tabindex="-1"></a><span class="ex">8</span></span></code></pre></div>
<p>When that line is deleted from this program, the tool properly
reports the secondary size limit of the program as 2048.</p>
<div class="sourceCode" id="cb11"><pre
class="sourceCode sh"><code class="sourceCode bash"><span id="cb11-1"><a href="#cb11-1" aria-hidden="true" tabindex="-1"></a><span class="ex">$</span> ./iocccsize <span class="at">-i</span> <span class="op">&lt;</span> birken.c</span>
<span id="cb11-2"><a href="#cb11-2" aria-hidden="true" tabindex="-1"></a><span class="ex">2048</span></span></code></pre></div>
<p>Although this bug provides an easy means of circumventing contest
rule 2, as demonstrated from the size value, this entry is not
necessarily striving for a ‘worst abuse of the rules’ award.</p>
<h3 id="obfuscations">Obfuscations</h3>
<p>This program is almost, but not quite, entirely unlike a
demonstration of good programming practices. Contrary to other programs,
an inspection of this one will certainly reveal that it possesses tea,
not to mention an affinity for the constant 42.</p>
<p>Variables are named and ordered to spell out, <code>"Tetris"</code>,
<code>"ELORG"</code>, <code>"DVK"</code> and the aforementioned
<code>"Tea"</code>. <a
href="https://en.wikipedia.org/wiki/Elektronorgtechnica">ELORG</a> is
the abbreviation for <code>Elektronorgtechnica</code>, the former Soviet
state owned computer organization that handled the worldwide Tetris
intellectual property rights. DVK is the line of Soviet
PDP-11-compatible personal computers capable of running <a
href="https://en.wikipedia.org/wiki/Alexey_Pajitnov">Alexey
Pajitnov</a>’s original 1984 <a
href="https://en.wikipedia.org/wiki/Tetris">Tetris</a> prototype.</p>
<p>Carefully selected variable names also yielded wonderful expressions
like <code>l=0</code>, <code>O=0</code>, <code>O=1</code> and
<code>while(O)</code>. <code>"Tetris"</code> also makes a second
appearance of sorts:</p>
<div class="sourceCode" id="cb12"><pre class="sourceCode c"><code class="sourceCode c"><span id="cb12-1"><a href="#cb12-1" aria-hidden="true" tabindex="-1"></a><span class="op">[</span>T<span class="op">][</span>e<span class="op">][</span>t<span class="op">]--;</span> <span class="cf">while</span><span class="op">(</span>R<span class="op">+</span>i<span class="op">)</span> <span class="op">{</span> s</span></code></pre></div>
<p>The source is formatted to resemble the <a
href="https://en.wikipedia.org/wiki/Tetris">Tetris</a> play-field
mid-game. It is also an homage to all the <a href="/years.html">past
IOCCC entries</a> formatted as a compact block of text; the
<code>T</code>, orientated appropriately to reflect its name and the
first letter in the title of the game, is just a moment away from
producing such a text block.</p>
<p>Three tables are encoded as separate strings within the program:</p>
<p>The first string stores the coordinates of the squares of the 19
distinct rotations of <a
href="https://en.wikipedia.org/wiki/Tetromino">tetriminos</a> (see
below). Since a tetrimino is a chain of 4 squares, all tetriminos fit
within a 4x4 matrix. To determine the coordinates of the squares, the
tetrimino is pushed to the upper-left of the matrix. Each coordinate
value requires 2 bits of storage. Consequentially, the four
x-coordinates and the four y-coordinates were packed into separate
octets. To convert the octets into valid ASCII characters, the squares
were sorted such that the least significant bits stored the largest
coordinate values. The results were offset by 35, the <code>#</code>
character, which is 1 beyond the ASCII value of <code>"</code>, making
it easier to pack into a string. None of the resultant values are beyond
ASCII 127. The coordinates for all 19 rotations fit in a string of
length 38.</p>
<p><img src="rotations.png" /></p>
<p>The second string stores the single square emitter patterns and the
platform patterns. Each pattern is a sequence of pairs,
<code>{ tetrimino index, drop x-coordinate }</code>. As mentioned, there
are 19 distinct rotations, requiring 5 bits of storage for the <a
href="https://en.wikipedia.org/wiki/Tetromino">tetrimino</a> index.
Another 5 bits is required for the drop x-coordinate since there are 21
columns in the play-field. Necessarily, the pair is stored as 2 separate
characters. By offsetting them by 40, the <code>(</code> character, the
resultant string almost resembles a long and complex mathematical
expression. The program takes advantage of mirror symmetry by only
storing 10 single square emitter patterns and 5 platform patterns. The
pattern lengths are not encoded within the string. Rather, they are
embedded within the string decoding logic.</p>
<p>The third string conceptually stores the default colors of the 19
rotations. A 3-bit value is assigned to each, covering the 7 possible
colors. In addition, when a mirrored pattern is executed, <code>J</code>
exchanges with <code>L</code> and <code>S</code> exchanges with
<code>Z</code>, necessitating a second list of 3-bit color values. Pairs
of color values (6 bits) fit comfortably into a character that is offset
by <code>#</code>. The result is a string of length 19.</p>
<h3 id="obfuscations-1">Obfuscations</h3>
<p>The program is full of subtle obfuscations:</p>
<ul>
<li><p>The unary decrement operator is used in conjunction with global
variable automatic zero initialization to set variables to
<code>-1</code>.</p></li>
<li><p>The boolean expression of the form, <code>x + 1</code>, is used
multiple times to determine if a value is not <code>-1</code>.
Similarly, expressions of the form <code>x - y</code> are used to
determine if <code>x != y</code>.</p></li>
<li><p>Several arrays store unrelated data in segments throughout the
array to reduce named variables..</p></li>
<li><p>The <code>x["..."]</code> trick appears once.</p></li>
<li><p>Variable <code>i</code> is less than necessary.</p></li>
<li><p>A cursorily glance at the expressions <code>4&amp;&amp;L</code>
and <code>m&amp;&amp;e==m</code> suggests that they always evaluate to
true.</p></li>
<li><p>The varying single square emitter pattern lengths are resolved
during string decoding using the clever expression,
<code>(i &amp; 3) - 3</code>, which identifies pattern 3 and 7 as
longer.</p></li>
<li><p>The file size of <a href="birken.c">birken.c</a> is a prime
number. Deleting the first line also produces a prime-sized program.
These properties do not qualify the program as a prime number
generator.</p></li>
</ul>
<h3 id="beyond-obfuscation">Beyond Obfuscation</h3>
<p>Due to the contest code size constraint, some optimizations
reluctantly had to be omitted. For example, multi-square emitters are
possible:</p>
<p><img src="multi2.gif" /></p>
<p><img src="multi3.gif" /></p>
<p><img src="multi4.gif" /></p>
<p><img src="multi5.gif" /></p>
<p>In fact, using dynamic programming and creative heuristics, real-time
search is possible, enabling patterns like this:</p>
<p><img src="triple0.gif" /></p>
<p>And, even this:</p>
<p><img src="triple1.gif" /></p>
<p>In addition, it is possible to extend the algorithm to 6 colors
instead of just 3. This is achieved using <code>I</code>, <code>S</code>
and <code>Z</code> to produce the protruding square. A series of
rectangular regions are constructed above those <a
href="https://en.wikipedia.org/wiki/Tetromino">tetriminos</a> to erode
them down to a single emitted square.</p>
<p>The details of these enhancements are left as an exercise to the
reader.</p>
<h3 id="example-files">Example Files</h3>
<p>The following example files were created by the program author. They
can be freely used and distributed.</p>
<ul>
<li><a href="format.txt">format.txt</a> - The layout of the
program.</li>
<li><a href="helloworld.txt">helloworld.txt</a> - Hello World,
Tetris-style.</li>
<li><a href="hilbert.txt">hilbert.txt</a> - A graphic based on the
Hilbert curve.</li>
<li><a href="ioccc.txt">ioccc.txt</a> - IOCCC.</li>
<li><a href="landon.txt">landon.txt</a> - Portrait of a man with
glasses.</li>
<li><a href="leo.txt">leo.txt</a> - Portrait of a man without
glasses.</li>
<li><a href="rhino.txt">rhino.txt</a> - A purple rhinoceros.</li>
<li><a href="simon.txt">simon.txt</a> - Portrait of a man without
hair.</li>
</ul>
<p>The following files are based on graphics from non-free, copyrighted
video games. The use of a limited number of textual representations of
the graphics for the demonstration of this program qualifies as fair use
as such files do not significantly impede the right of the copyright
holder to sell the copyrighted material and it is not being used to
generate profit in this context. The origin of each file is detailed
below (character, game, company, year).</p>
<ul>
<li><p><a href="belmont.txt">belmont.txt</a> - <a
href="https://en.wikipedia.org/wiki/Simon_Belmont">Simon Belmont</a>, <a
href="https://en.wikipedia.org/wiki/Castlevania_(1986_video_game)">Castlevania</a>,
<a href="https://en.wikipedia.org/wiki/Konami">Konami</a>,
1986.</p></li>
<li><p><a href="bloober.txt">bloober.txt</a> - Bloober, <a
href="https://www.mariowiki.com/Super_Mario_Bros.">Super Mario
Brothers</a>, <a
href="https://en.wikipedia.org/wiki/Nintendo">Nintendo</a>,
1985.</p></li>
<li><p><a href="bomberman.txt">bomberman.txt</a> - <a
href="https://en.wikipedia.org/wiki/Bomberman">Bomberman</a>, Bomberman,
<a href="https://en.wikipedia.org/wiki/Hudson_Soft">Hudson</a>,
1983.</p></li>
<li><p><a href="boo.txt">boo.txt</a> - <a
href="https://www.mariowiki.com/Boo">Boo</a>, <a
href="https://www.mariowiki.com/Super_Mario_Bros._3">Super Mario
Brothers 3</a>, Nintendo, 1988.</p></li>
<li><p><a href="bub.txt">bub.txt</a> - <a
href="https://bubblebobble.fandom.com/wiki/Bub">Bub</a>, <a
href="https://en.wikipedia.org/wiki/Bubble_Bobble">Bubble Bobble</a>,
Taito, 1986.</p></li>
<li><p><a href="cheepcheep.txt">cheepcheep.txt</a> - <a
href="https://www.mariowiki.com/Cheep_Cheep">Cheep Cheep</a>, Super
Mario Brothers, Nintendo,</p></li>
</ul>
<ol start="1985" type="1">
<li></li>
</ol>
<ul>
<li><p><a href="gurin.txt">gurin.txt</a> - Gurin, <a
href="https://en.wikipedia.org/wiki/Binary_Land">Binary Land</a>,
Hudson, 1983.</p></li>
<li><p><a href="koopaparatroopa.txt">koopaparatroopa.txt</a> - <a
href="https://www.mariowiki.com/Koopa_Paratroopa">Koopa Paratroopa</a>,
Super Mario Brothers, Nintendo, 1985.</p></li>
<li><p><a href="lakitu.txt">lakitu.txt</a> - <a
href="https://www.mariowiki.com/Lakitu">Lakitu</a>, Super Mario
Brothers, Nintendo, 1985.</p></li>
<li><p><a href="mario.txt">mario.txt</a> - <a
href="https://www.mariowiki.com/Fire_Mario">Fire Mario</a>, Super Mario
Brothers, Nintendo, 1985.</p></li>
<li><p><a href="mspacman.txt">mspacman.txt</a> - <a
href="https://pacman.fandom.com/wiki/Ms._Pac-Man">Ms. Pac-Man</a> and
Ghost, Ms. Pac-Man, <a
href="https://en.wikipedia.org/wiki/Midway_Games">Midway</a>,
1982.</p></li>
<li><p><a href="paranaplant.txt">paranaplant.txt</a> - <a
href="https://www.mariowiki.com/Piranha_Plant">Piranha Plant</a>, Super
Mario Brothers, Nintendo,</p></li>
</ul>
<ol start="1985" type="1">
<li></li>
</ol>
<ul>
<li><p><a href="samus.txt">samus.txt</a> - <a
href="https://metroid.fandom.com/wiki/Samus_Aran">Samus Aran</a>, <a
href="https://metroid.fandom.com/wiki/Metroid_(game)">Metroid</a>,
Nintendo/<a
href="https://en.wikipedia.org/wiki/Intelligent_Systems">Intelligent
Systems</a>, 1986.</p></li>
<li><p><a href="toad.txt">toad.txt</a> - <a
href="https://www.mariowiki.com/Toad">Toad</a>, Super Mario Brothers 2,
Nintendo, 1987.</p></li>
</ul>
<p>The origin of the remaining files are described below:</p>
<ul>
<li><p><a href="happyface.txt">happyface.txt</a> - Based on a <a
href="https://en.wikipedia.org/wiki/Smiley">smiley</a>; original
trademark of smiley <a
href="https://en.wikipedia.org/wiki/The_Smiley_Company">Smiley
Company</a>.</p></li>
<li><p><a href="snoo.txt">snoo.txt</a> - 8-bit version of <a
href="https://www.reddit.com/r/Snoo/">Snoo</a>, <a
href="https://www.reddit.com">Reddit</a>’s alien mascot.</p></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/gen-inventory.sh -->
<h1 id="inventory-for-2013birken"><a name="inventory"></a>Inventory for
2013/birken</h1>
<h2 id="primary-files">Primary files</h2>
<ul>
<li><a href="index.html">index.html</a> - winner home page</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2013/birken/birken.c">birken.c</a>
- winning source</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2013/birken/Makefile">Makefile</a>
- winner Makefile</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2013/birken/birken.alt.c">birken.alt.c</a>
- alternative source</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2013/birken/birken.orig.c">birken.orig.c</a>
- original source</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2013/birken/belmont.txt">belmont.txt</a>
- sprites in this textual format</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2013/birken/bloober.txt">bloober.txt</a>
- sprites in this textual format</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2013/birken/bomberman.txt">bomberman.txt</a>
- sprites in this textual format</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2013/birken/boo.txt">boo.txt</a>
- sprites in this textual format</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2013/birken/bub.txt">bub.txt</a>
- sprites in this textual format</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2013/birken/cheepcheep.txt">cheepcheep.txt</a>
- sprites in this textual format</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2013/birken/format.txt">format.txt</a>
- sprites in this textual format</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2013/birken/gurin.txt">gurin.txt</a>
- sprites in this textual format</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2013/birken/happyface.txt">happyface.txt</a>
- sprites in this textual format</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2013/birken/helloworld.txt">helloworld.txt</a>
- sprites in this textual format</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2013/birken/hilbert.txt">hilbert.txt</a>
- sprites in this textual format</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2013/birken/ioccc.txt">ioccc.txt</a>
- sprites in this textual format</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2013/birken/koopaparatroopa.txt">koopaparatroopa.txt</a>
- sprites in this textual format</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2013/birken/lakitu.txt">lakitu.txt</a>
- sprites in this textual format</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2013/birken/landon.txt">landon.txt</a>
- sprites in this textual format</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2013/birken/leo.txt">leo.txt</a>
- sprites in this textual format</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2013/birken/mario.txt">mario.txt</a>
- sprites in this textual format</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2013/birken/mspacman.txt">mspacman.txt</a>
- sprites in this textual format</li>
<li><a href="names.png">names.png</a> - sprites in this textual
format</li>
<li><a href="palette.png">palette.png</a> - sprites in this textual
format</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2013/birken/paranaplant.txt">paranaplant.txt</a>
- sprites in this textual format</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2013/birken/rhino.txt">rhino.txt</a>
- sprites in this textual format</li>
<li><a href="rotations.png">rotations.png</a> - sprites in this textual
format</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2013/birken/samus.txt">samus.txt</a>
- sprites in this textual format</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2013/birken/simon.txt">simon.txt</a>
- sprites in this textual format</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2013/birken/snoo.txt">snoo.txt</a>
- sprites in this textual format</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2013/birken/toad.txt">toad.txt</a>
- sprites in this textual format</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2013/birken/try.alt.sh">try.alt.sh</a>
- how to run alternative code</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2013/birken/try.sh">try.sh</a>
- how to run</li>
<li><a href="2013_birken.tar.bz2">2013_birken.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/2013/birken/.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/2013/birken/.winner.json">.winner.json</a>
- description of winner in JSON</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2013/birken/README.md">README.md</a>
- markdown source for index.html</li>
<li><a href="multi2.gif">multi2.gif</a> - stages of multi-square
emitters</li>
<li><a href="multi3.gif">multi3.gif</a> - stages showing multi-square
emitters</li>
<li><a href="multi4.gif">multi4.gif</a> - stages showing multi-square
emitters</li>
<li><a href="multi5.gif">multi5.gif</a> - stages of multi-square
emitters</li>
<li><a href="pen0.gif">pen0.gif</a> - stages of single square rotruding
from the bottom</li>
<li><a href="pen1.gif">pen1.gif</a> - stages of single square rotruding
from the bottom</li>
<li><a href="pen2.gif">pen2.gif</a> - stages of single square rotruding
from the bottom</li>
<li><a href="pen4.gif">pen4.gif</a> - stages of single square rotruding
from the bottom</li>
<li><a href="pen5.gif">pen5.gif</a> - stages of single square rotruding
from the bottom</li>
<li><a href="pen6.gif">pen6.gif</a> - stages of single square rotruding
from the bottom</li>
<li><a href="pen7.gif">pen7.gif</a> - stages of single square rotruding
from the bottom</li>
<li><a href="pen8.gif">pen8.gif</a> - stages of single square rotruding
from the bottom</li>
<li><a href="platform0.gif">platform0.gif</a> - stages of 5 red squares
above a row of 3 red squares</li>
<li><a href="platform1.gif">platform1.gif</a> - stages of 5 red squares
above a row of 3 red squares</li>
<li><a href="platform2.gif">platform2.gif</a> - stages of 5 red squares
above a row of 3 red squares</li>
<li><a href="triple0.gif">triple0.gif</a> - stages of constructed of
rectangular regions</li>
<li><a href="triple1.gif">triple1.gif</a> - stages of constructed of
rectangular regions</li>
</ul>
<!-- END: next line ends content generated by: bin/gen-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%2F2013%2Fbirken%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 -->
+245 -13
View File
@@ -1,4 +1,6 @@
<!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 !!! -->
@@ -6,27 +8,257 @@
<!-- !!! DO NOT MODIFY THIS FILE - This file is generated by a tool !!! -->
<!-- !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<!-- -->
<!-- file: 2013/cable1/index.html created by: fake.gen_index.sh version: 1.0.5 2023-10-31 -->
<html lang="en">
<!-- END: this line ends content from: inc/top.default.html -->
<!-- -->
<!-- This file was formed by the tool: bin/readme2index.sh version: 1.1 2024-01-16 -->
<!-- -->
<!-- START: this line starts content from: inc/head.default.html -->
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>2013 cable1</title>
<meta name="description" content="IOCCC year: 2013 IOCCC winner: cable1 winner index page">
<meta name="keywords" content="IOCCC,2013,cable1,winner index page">
<link rel="stylesheet" href="/temp-test-ioccc/ioccc.css">
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=yes">
<title>2013/cable1</title>
<meta name="description" content="2013 IOCCC winner cable1">
<meta name="keywords" content="IOCCC, 2013, IOCCC 2013, IOCCC winner, cable1">
</head>
<!-- END: this line ends content from: inc/head.default.html -->
<!-- START: this line starts content from: inc/body.default.html -->
<body>
<h1>2013 cable1</h1>
<!-- END: this line ends content from: inc/body.default.html -->
<!-- START: this line starts content from: inc/header.default.html -->
<p>XXX - fake content until readme2index is working - XXX</p>
<div class="header">
<img src="/temp-test-ioccc/png/ioccc.png" alt="IOCCC image by Matt Zucker" width=300 height=110>
<h1>The International Obfuscated C Code Contest</h1>
<h2>2013/cable1</h2>
</div>
<hr style="width:50%;text-align:left;margin-left:0">
<!-- END: this line ends content from: inc/header.default.html -->
<!-- START: this line starts content from: inc/topnav.mid.html -->
<!-- Start Nu Html Checker -->
<p><a href="https://validator.w3.org/nu/?doc=https%3A%2F%2Fioccc-src.github.io%2Ftemp-test-ioccc%2F2013%2Fcable1%2Findex.html">Nu Html check https://ioccc-src.github.io/temp-test-ioccc/2013/cable1/index.html</a></p>
<!-- End Nu Html Checker -->
<div class="topnav">
<a class="Left" href="../birken/index.html">&larr; birken</a>
<a class="Left" href="../index.html">&uarr; 2013 &uarr;</a>
<a class="Left" href="../cable2/index.html">cable2 &rarr;</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="/temp-test-ioccc/index.html">IOCCC Home</a>
<a href="/temp-test-ioccc/years.html">Winning Entries</a>
<a href="/temp-test-ioccc/winners.html">People who have won</a>
</div>
<hr>
<div class="sidenav">
<a href="/temp-test-ioccc/news.html">IOCCC News</a>
<a href="/temp-test-ioccc/faq.html#submit">How to enter the IOCCC</a>
<a href="/temp-test-ioccc/faq.html">FAQ</a>
</div>
<hr>
<div class="sidenav">
<a href="/temp-test-ioccc/bugs.html">Bugs &amp; (mis)features</a>
<a href="/temp-test-ioccc/faq.html#fix_a_winner">Fixing IOCCC winners</a>
<a href="/temp-test-ioccc/faq.html#fix_web_site">Fixing the web site</a>
<a href="/temp-test-ioccc/faq.html#fix_author">Fixing winner info</a>
<a href="/temp-test-ioccc/thanks-for-help.html">Thanks for the help</a>
</div>
<hr>
<div class="sidenav">
<a href="/temp-test-ioccc/judges.html">The IOCCC Judges</a>
<a href="/temp-test-ioccc/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/gen-author.sh -->
<p><a name="author"><strong>Author:</strong></a> <br><br>Name: <a
href="/temp-test-ioccc/winners.html#Adrian_Cable">Adrian Cable</a><br>
Location: <a href="/temp-test-ioccc/location.html#US">US</a></p>
<!-- END: next line ends content generated by: bin/gen-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></span></code></pre></div>
<h2 id="to-use">To use:</h2>
<div class="sourceCode" id="cb2"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb2-1"><a href="#cb2-1" aria-hidden="true" tabindex="-1"></a><span class="ex">./cable1</span> name group1 group2</span></code></pre></div>
<h2 id="try">Try:</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">./try.sh</span></span></code></pre></div>
<h2 id="judges-remarks">Judges’ remarks:</h2>
<p>Partisan may be defined as a strong supporter of a cause, party or
person. We need not limit ourselves to the two major political parties
in the US today.</p>
<p>Let us consider:</p>
<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">./cable1</span> Cooper Mac PC</span></code></pre></div>
<p>Simon works for Apple, so you would expect Mac. :-) Landon is a long
time Mac user:</p>
<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="ex">./cable1</span> Noll Mac PC</span></code></pre></div>
<p>That works too! Now Leo brings PCs to the IOCCC judging for
cross-platform testing:</p>
<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">./cable1</span> Broukhis Mac PC</span></code></pre></div>
<p>We can test other people. The late Steve Jobs:</p>
<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">./cable1</span> Jobs Mac PC</span></code></pre></div>
<p>That works! How about Bill?</p>
<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">./cable1</span> Gates Mac PC</span></code></pre></div>
<p>A PC guy as expected. What about that other Steve?</p>
<div class="sourceCode" id="cb9"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb9-1"><a href="#cb9-1" aria-hidden="true" tabindex="-1"></a><span class="ex">./cable1</span> Ballmer Mac PC</span></code></pre></div>
<p>Humm .. maybe there is a hidden reason he is leaving the late
Micro$oft? :-) Why late? Because:</p>
<figure>
<img src="dead-ms-tweet.jpg" alt="tweet about M$ being dead" />
<figcaption aria-hidden="true">tweet about M$ being dead</figcaption>
</figure>
<p>-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- An important 2023
update about twitter:</p>
<p>The IOCCC no longer uses twitter. Today the IOCCC uses Mastodon. For
more information and to see our IOCCC Mastodon posts, see:</p>
<pre><code>https://fosstodon.org/@ioccc</code></pre>
<p>End of important 2023 update to this historic note.
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-</p>
<p>So how does a one line C source know so much? Hint: it doesn’t.</p>
<h2 id="authors-remarks">Author’s remarks:</h2>
<h3 id="presidents-of-the-united-states-of-america">Presidents of the
United States of America!</h3>
<p>Politics is full of memorable <a
href="https://rationalwiki.org/wiki/Politics#Famous_quotes">one-liners</a>.
Without wishing to <a
href="https://www.youtube.com/watch?v=JhmdEq3JhoY">misunderestimate</a>
the taste of the judges, nor prejudge the past, the author hopes you
enjoy this contribution to the genre.</p>
<p>This one-line C program accepts as a first command-line argument the
last name of any of the last 31 US Presidents (from Franklin Pierce
onwards), in lower case, and prints out their political affiliation.</p>
<p>Use <code>republican</code> as the 2nd command-line argument, and
<code>democrat</code> as the 3rd (or equivalent strings of your
choice).</p>
<h3 id="why-is-this-entry-obfuscatedinteresting">Why is this entry
obfuscated/interesting?</h3>
<p>The program looks up the name supplied on the command line against a
list of Presidents’ names, and matches names to political affiliations
using a look-up table. But where in the source is the list of names, and
where is the look-up table?</p>
<h3 id="notes">Notes</h3>
<ul>
<li><p>For Theodore Roosevelt, use:
<code>./cable1 roosevelt republican democrat</code>.</p></li>
<li><p>But, for Franklin D Roosevelt, use:
<code>./cable1 fdr republican democrat</code>.</p></li>
<li><p>This program needs a little endian CPU to work properly.</p></li>
</ul>
<h3 id="compiler-warnings">Compiler warnings</h3>
<p><code>clang</code> warns about a missing type specifier for
<code>main()</code>, and that implicit function declarations are invalid
in C99 (but still accepts them).</p>
<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/gen-inventory.sh -->
<h1 id="inventory-for-2013cable1"><a name="inventory"></a>Inventory for
2013/cable1</h1>
<h2 id="primary-files">Primary files</h2>
<ul>
<li><a href="index.html">index.html</a> - winner home page</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2013/cable1/cable1.c">cable1.c</a>
- winning source</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2013/cable1/Makefile">Makefile</a>
- winner Makefile</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2013/cable1/cable1.orig.c">cable1.orig.c</a>
- original source</li>
<li><a href="dead-ms-tweet.jpg">dead-ms-tweet.jpg</a> - tweet image</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2013/cable1/try.sh">try.sh</a>
- how to run</li>
<li><a href="2013_cable1.tar.bz2">2013_cable1.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/2013/cable1/.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/2013/cable1/.winner.json">.winner.json</a>
- description of winner in JSON</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2013/cable1/README.md">README.md</a>
- markdown source for index.html</li>
</ul>
<!-- END: next line ends content generated by: bin/gen-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%2F2013%2Fcable1%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 -->
+301 -13
View File
@@ -1,4 +1,6 @@
<!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 !!! -->
@@ -6,27 +8,313 @@
<!-- !!! DO NOT MODIFY THIS FILE - This file is generated by a tool !!! -->
<!-- !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<!-- -->
<!-- file: 2013/cable2/index.html created by: fake.gen_index.sh version: 1.0.5 2023-10-31 -->
<html lang="en">
<!-- END: this line ends content from: inc/top.default.html -->
<!-- -->
<!-- This file was formed by the tool: bin/readme2index.sh version: 1.1 2024-01-16 -->
<!-- -->
<!-- START: this line starts content from: inc/head.default.html -->
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>2013 cable2</title>
<meta name="description" content="IOCCC year: 2013 IOCCC winner: cable2 winner index page">
<meta name="keywords" content="IOCCC,2013,cable2,winner index page">
<link rel="stylesheet" href="/temp-test-ioccc/ioccc.css">
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=yes">
<title>2013/cable2</title>
<meta name="description" content="2013 IOCCC winner cable2">
<meta name="keywords" content="IOCCC, 2013, IOCCC 2013, IOCCC winner, cable2">
</head>
<!-- END: this line ends content from: inc/head.default.html -->
<!-- START: this line starts content from: inc/body.default.html -->
<body>
<h1>2013 cable2</h1>
<!-- END: this line ends content from: inc/body.default.html -->
<!-- START: this line starts content from: inc/header.default.html -->
<p>XXX - fake content until readme2index is working - XXX</p>
<div class="header">
<img src="/temp-test-ioccc/png/ioccc.png" alt="IOCCC image by Matt Zucker" width=300 height=110>
<h1>The International Obfuscated C Code Contest</h1>
<h2>2013/cable2</h2>
</div>
<hr style="width:50%;text-align:left;margin-left:0">
<!-- END: this line ends content from: inc/header.default.html -->
<!-- START: this line starts content from: inc/topnav.mid.html -->
<!-- Start Nu Html Checker -->
<p><a href="https://validator.w3.org/nu/?doc=https%3A%2F%2Fioccc-src.github.io%2Ftemp-test-ioccc%2F2013%2Fcable2%2Findex.html">Nu Html check https://ioccc-src.github.io/temp-test-ioccc/2013/cable2/index.html</a></p>
<!-- End Nu Html Checker -->
<div class="topnav">
<a class="Left" href="../cable1/index.html">&larr; cable1</a>
<a class="Left" href="../index.html">&uarr; 2013 &uarr;</a>
<a class="Left" href="../cable3/index.html">cable3 &rarr;</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="/temp-test-ioccc/index.html">IOCCC Home</a>
<a href="/temp-test-ioccc/years.html">Winning Entries</a>
<a href="/temp-test-ioccc/winners.html">People who have won</a>
</div>
<hr>
<div class="sidenav">
<a href="/temp-test-ioccc/news.html">IOCCC News</a>
<a href="/temp-test-ioccc/faq.html#submit">How to enter the IOCCC</a>
<a href="/temp-test-ioccc/faq.html">FAQ</a>
</div>
<hr>
<div class="sidenav">
<a href="/temp-test-ioccc/bugs.html">Bugs &amp; (mis)features</a>
<a href="/temp-test-ioccc/faq.html#fix_a_winner">Fixing IOCCC winners</a>
<a href="/temp-test-ioccc/faq.html#fix_web_site">Fixing the web site</a>
<a href="/temp-test-ioccc/faq.html#fix_author">Fixing winner info</a>
<a href="/temp-test-ioccc/thanks-for-help.html">Thanks for the help</a>
</div>
<hr>
<div class="sidenav">
<a href="/temp-test-ioccc/judges.html">The IOCCC Judges</a>
<a href="/temp-test-ioccc/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/gen-author.sh -->
<p><a name="author"><strong>Author:</strong></a> <br><br>Name: <a
href="/temp-test-ioccc/winners.html#Adrian_Cable">Adrian Cable</a><br>
Location: <a href="/temp-test-ioccc/location.html#US">US</a></p>
<!-- END: next line ends content generated by: bin/gen-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></span></code></pre></div>
<h3 id="bugs-and-misfeatures">Bugs and (Mis)features:</h3>
<p>The current status of this entry is:</p>
<pre><code>STATUS: INABIAF - please **DO NOT** fix</code></pre>
<p>For more detailed information see <a href="/bugs.md#2013-cable2">2013
cable2 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">./cable2</span> file.bmp <span class="pp">[</span><span class="ss">color</span><span class="pp">]</span></span></code></pre></div>
<h2 id="try">Try:</h2>
<p>For different OCR examples:</p>
<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.sh</span></span></code></pre></div>
<h2 id="judges-remarks">Judges’ remarks:</h2>
<p>We can confirm that this is the first time the IOCCC has been used to
peer-review a new research. We had quite a bit of fun with a sharpie and
a scanner.</p>
<h2 id="authors-remarks">Author’s remarks:</h2>
<h3 id="ocr---obfuscated-character-recognition-of-handwritten-text">OCR
- Obfuscated Character Recognition of Handwritten Text</h3>
<p>This entry takes a BMP image file of hand-drawn (mouse-drawn?) text,
specified as the first command-line parameter, and converts it to an
ASCII text document. Magic!</p>
<p>BMP files created by most paint programs should work. The author
recommends Paint.NET.</p>
<h3 id="features">Features</h3>
<ul>
<li>Every printable ASCII character is recognized (94 characters plus
space), plus a special bonus character.</li>
<li>Input images can be any size (limited only by memory), containing
any number of lines of text.</li>
<li>BMP is really a mess of different formats, but the program supports
most of them from Windows 3.1 and later.</li>
<li>Hand-drawn characters in the input image can be variably spaced and
positioned and be of any width or height, but the bigger the better for
accurate recognition (300 pixels tall or more is recommended).
Characters must be drawn with a stroke width of around 9 pixels, and
separated from adjacent characters. (In Paint.NET a brush of width 9
works well, with anti-aliasing turned off.)</li>
<li>You can use any colors you like for the text and background, even
different colors for different text characters.</li>
<li>If “color” is specified as the second command line parameter, the
program’s output will also be in color, on ANSI/VTxxx terminals.</li>
</ul>
<h3 id="why-is-this-entry-obfuscatedinteresting">Why is this entry
obfuscated/interesting?</h3>
<ul>
<li>The source is presented as a beautiful moonlit scene, in which a
quick brown fox jumps over a lazy dog. Far too often in software
development is aesthetic nuance lost in the name of serious-sounding
conventions like “GNU style”, but not here.</li>
<li>Newcomers to C find it hard to learn all those different ways to
control flow: <code>for</code>, <code>while</code>, <code>if</code>,
<code>do</code>, <code>goto</code>, <code>continue</code>,
<code>break</code> and heaven knows what else! So, in this program we
only use <code>for</code>, so absolute beginners can get into the code
straight away.</li>
<li>To teach newcomers all the important features of C, we demonstrate
the importance of the liberal use of short circuits, sequence points,
the ternary operator, using <code>x^y</code> or <code>x-y</code> instead
of <code>x!=y</code>, using <code>~x</code> in place of
<code>x!=-1</code> for conciseness, mixing <code>x[y]</code> and
<code>y[x]</code> for variety, educational <code>#define</code>s, and so
on.</li>
<li><code>main()</code> is the most useful function in all of C - so it
is a mystery to the author why most programs use it only once. Here we
use it over and over for maximum benefit.</li>
<li>The number <a href="https://hitchhikers.fandom.com/wiki/42">42</a>
is featured in the source to provide an answer to the judges’ deeper
questions.</li>
<li>How are character colors converted from RGB in the input image to
ANSI escape sequences? Clue: the weird macro <code>P</code> does the
interesting part of it, but how?</li>
<li>The program prints a string when the bonus character is detected.
How does it do this? Clue: the string to print is defined in the macro
<code>$</code>, but how can a string defined in that way ever get
printed?</li>
</ul>
<h3 id="other-notes">Other notes</h3>
<ul>
<li>The novel character recognition algorithm used has not been
previously published and was developed by the author specifically for
the contest. Should this entry win the IOCCC, it will be the first time
(to the author’s knowledge) that the IOCCC has been used for peer
review/publication of original research.</li>
<li>OCR in general is a hard problem. Here, we only recognise one
possible form for each character. You can see what the supported
character shapes look like by looking at the examples in <a
href="ascii.bmp">ascii.bmp</a>. If you copy the shape of the character
forms you find in there, recognition accuracy should be very good
(95%+). A more “useful” version would extend the character stroke table
to support multiple different commonly-used forms for each
character.</li>
<li>Despite being the largest possible IOCCC entry at 4096 bytes, it is
also probably the smallest general-purpose OCR program ever written
(including the character stroke data), maybe by several orders of
magnitude.</li>
<li>The author used an interesting compression algorithm (suggested by
Gareth McCaughan - thank you!) to squeeze the character stroke table
(containing around 2000 strokes for the whole ASCII character set) into
a string constant of just 472 characters.</li>
</ul>
<h3 id="bugsfeatures">Bugs/features</h3>
<ul>
<li>The width of input images must be a multiple of 4.</li>
<li>Input images can be 8-bit greyscale, 24-bit color or 32-bit color
only. 8-bit color and 16-bit color are not supported. If you use the
“color” command-line feature, do not use a greyscale input file!</li>
<li>Normal Windows BMP files are stored “upside-down”, i.e. the bottom
line in the image is written first. Some (old) graphics programs
actually write BMP files “top-to-bottom” and the program does not
support such files.</li>
<li>Using anti-aliased brush strokes to draw your letters is fine;
however, antialiasing interferes with color detection in “color”
mode.</li>
<li>Only runs on little endian machines (since the BMP format is little
endian, and endianness conversion would make the source too large for
IOCCC rule 2).</li>
</ul>
<h3 id="compiler-warnings">Compiler warnings</h3>
<p><code>clang</code> warns about unused expression results, missing
type specifiers, and incompatible pointer conversions - all just a fun
consequence of the obfuscations.</p>
<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/gen-inventory.sh -->
<h1 id="inventory-for-2013cable2"><a name="inventory"></a>Inventory for
2013/cable2</h1>
<h2 id="primary-files">Primary files</h2>
<ul>
<li><a href="index.html">index.html</a> - winner home page</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2013/cable2/cable2.c">cable2.c</a>
- winning source</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2013/cable2/Makefile">Makefile</a>
- winner Makefile</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2013/cable2/cable2.orig.c">cable2.orig.c</a>
- original source</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2013/cable2/try.sh">try.sh</a>
- how to run</li>
<li><a href="ascii.bmp">ascii.bmp</a> - PC bitmap image</li>
<li><a href="bonus.bmp">bonus.bmp</a> - PC bitmap image</li>
<li><a href="hello_world.bmp">hello_world.bmp</a> - PC bitmap image</li>
<li><a href="mixed_sizes.bmp">mixed_sizes.bmp</a> - PC bitmap image</li>
<li><a href="multi_color.bmp">multi_color.bmp</a> - PC bitmap image</li>
<li><a href="typeset.bmp">typeset.bmp</a> - PC bitmap image</li>
<li><a href="2013_cable2.tar.bz2">2013_cable2.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/2013/cable2/.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/2013/cable2/.winner.json">.winner.json</a>
- description of winner in JSON</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2013/cable2/README.md">README.md</a>
- markdown source for index.html</li>
</ul>
<!-- END: next line ends content generated by: bin/gen-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%2F2013%2Fcable2%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 -->
+622 -13
View File
@@ -1,4 +1,6 @@
<!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 !!! -->
@@ -6,27 +8,634 @@
<!-- !!! DO NOT MODIFY THIS FILE - This file is generated by a tool !!! -->
<!-- !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<!-- -->
<!-- file: 2013/cable3/index.html created by: fake.gen_index.sh version: 1.0.5 2023-10-31 -->
<html lang="en">
<!-- END: this line ends content from: inc/top.default.html -->
<!-- -->
<!-- This file was formed by the tool: bin/readme2index.sh version: 1.1 2024-01-16 -->
<!-- -->
<!-- START: this line starts content from: inc/head.default.html -->
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>2013 cable3</title>
<meta name="description" content="IOCCC year: 2013 IOCCC winner: cable3 winner index page">
<meta name="keywords" content="IOCCC,2013,cable3,winner index page">
<link rel="stylesheet" href="/temp-test-ioccc/ioccc.css">
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=yes">
<title>2013/cable3</title>
<meta name="description" content="2013 IOCCC winner cable3">
<meta name="keywords" content="IOCCC, 2013, IOCCC 2013, IOCCC winner, cable3">
</head>
<!-- END: this line ends content from: inc/head.default.html -->
<!-- START: this line starts content from: inc/body.default.html -->
<body>
<h1>2013 cable3</h1>
<!-- END: this line ends content from: inc/body.default.html -->
<!-- START: this line starts content from: inc/header.default.html -->
<p>XXX - fake content until readme2index is working - XXX</p>
<div class="header">
<img src="/temp-test-ioccc/png/ioccc.png" alt="IOCCC image by Matt Zucker" width=300 height=110>
<h1>The International Obfuscated C Code Contest</h1>
<h2>2013/cable3</h2>
</div>
<hr style="width:50%;text-align:left;margin-left:0">
<!-- END: this line ends content from: inc/header.default.html -->
<!-- START: this line starts content from: inc/topnav.mid.html -->
<!-- Start Nu Html Checker -->
<p><a href="https://validator.w3.org/nu/?doc=https%3A%2F%2Fioccc-src.github.io%2Ftemp-test-ioccc%2F2013%2Fcable3%2Findex.html">Nu Html check https://ioccc-src.github.io/temp-test-ioccc/2013/cable3/index.html</a></p>
<!-- End Nu Html Checker -->
<div class="topnav">
<a class="Left" href="../cable2/index.html">&larr; cable2</a>
<a class="Left" href="../index.html">&uarr; 2013 &uarr;</a>
<a class="Left" href="../dlowe/index.html">dlowe &rarr;</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="/temp-test-ioccc/index.html">IOCCC Home</a>
<a href="/temp-test-ioccc/years.html">Winning Entries</a>
<a href="/temp-test-ioccc/winners.html">People who have won</a>
</div>
<hr>
<div class="sidenav">
<a href="/temp-test-ioccc/news.html">IOCCC News</a>
<a href="/temp-test-ioccc/faq.html#submit">How to enter the IOCCC</a>
<a href="/temp-test-ioccc/faq.html">FAQ</a>
</div>
<hr>
<div class="sidenav">
<a href="/temp-test-ioccc/bugs.html">Bugs &amp; (mis)features</a>
<a href="/temp-test-ioccc/faq.html#fix_a_winner">Fixing IOCCC winners</a>
<a href="/temp-test-ioccc/faq.html#fix_web_site">Fixing the web site</a>
<a href="/temp-test-ioccc/faq.html#fix_author">Fixing winner info</a>
<a href="/temp-test-ioccc/thanks-for-help.html">Thanks for the help</a>
</div>
<hr>
<div class="sidenav">
<a href="/temp-test-ioccc/judges.html">The IOCCC Judges</a>
<a href="/temp-test-ioccc/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/gen-author.sh -->
<p><a name="author"><strong>Author:</strong></a> <br><br>Name: <a
href="/temp-test-ioccc/winners.html#Adrian_Cable">Adrian Cable</a><br>
Location: <a href="/temp-test-ioccc/location.html#US">US</a></p>
<!-- END: next line ends content generated by: bin/gen-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></span></code></pre></div>
<p>An alternate version that should compile in Windows/MS Visual Studio
is available. See the <a href="#alternate-code">Alternate code</a>
section below.</p>
<h2 id="to-use">To use:</h2>
<div class="sourceCode" id="cb2"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb2-1"><a href="#cb2-1" aria-hidden="true" tabindex="-1"></a><span class="ex">./cable3</span> bios-image-file floppy-image-file <span class="pp">[</span><span class="ss">harddisk</span><span class="pp">-</span><span class="ss">image</span><span class="pp">-</span><span class="ss">file</span><span class="pp">]</span></span></code></pre></div>
<h2 id="try">Try:</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">./runme</span></span></code></pre></div>
<p>NOTE: to quit the program type <code>QUITEMU</code>. You might have
to be at the top level directory of the drive, <code>A:</code> or
<code>C:</code>.</p>
<p>To send an <code>Alt+XXX</code> key combination, press
(<code>^A</code> / <code>Ctrl+A</code>) then the key, so for example to
type <code>Alt+F</code>, press (<code>^A</code> / <code>Ctrl+A</code>)
then <code>F</code>.</p>
<p>To send an <code>Fxx</code> key, press <code>^F</code> /
<code>Ctrl+F</code> then a number key. For example, to get the
<code>F4</code> key, press <code>^F</code> / <code>Ctrl+F</code> then
<code>4</code>. To get <code>F10</code>, press <code>^F</code> /
<code>Ctrl+F</code> then <code>0</code>.</p>
<p>To send a <code>Page Down</code> key, press <code>^F</code> /
<code>Ctrl+F</code> then <code>O</code> (letter O, not digit zero). To
send a <code>Page Up</code> key, press <code>^F</code> /
<code>Ctrl+F</code> then <code>E</code>. Other key combinations are left
for the discovery of the user.</p>
<h2 id="alternate-code">Alternate code:</h2>
<p>An alternate version, which should compile in Windows, is
provided.</p>
<h3 id="alternate-build">Alternate build:</h3>
<p>Assuming <code>make</code> is available and will function:</p>
<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="fu">make</span> alt</span></code></pre></div>
<h3 id="alternate-use">Alternate use:</h3>
<p>Use <code>cable3.alt</code> as you would <code>cable3</code>
above.</p>
<h2 id="judges-remarks">Judges’ remarks:</h2>
<p>This entry weighs in at a magical 4043 bytes (8086 nibbles, 28,301
bits). It manages to implement most of the hardware in a 1980’s era
IBM-PC using a few hundred fewer bits than the total number of
transistors used to implement the original 8086 CPU.</p>
<p>If you are using macOS, the included <a
href="sc-ioccc.terminal">sc-ioccc.terminal</a> configuration file will
correctly display console applications that use ANSI graphics.</p>
<p>NOTE: the author remarked that in some systems one might need to
<code>#include &lt;unistd.h&gt;</code>. This has been done in the entry
but not the alternate version. This should not affect the usability of
the program but will trigger a warning which we have disabled in the
Makefile.</p>
<p>Update: This entry now has its own website: <a
href="https://github.com/adriancable/8086tiny"
class="uri">https://github.com/adriancable/8086tiny</a></p>
<h2 id="authors-remarks">Author’s remarks:</h2>
<h3 id="a-tiny-but-highly-functional-pc-emulatorvirtual-machine">A tiny
but highly functional PC emulator/virtual machine</h3>
<p>The author hereby presents, for the delectation (?) of the judges, a
portable PC emulator/VM written specifically for the IOCCC which runs
DOS, Windows 3.0, Excel, MS Flight Simulator, AutoCAD, Lotus 1-2-3 …</p>
<p>In just 4043 bytes of C source, you get a complete mid-late 1980s-era
IBM-compatible PC, consisting of:</p>
<ul>
<li>Intel 8086/186 CPU</li>
<li>1MB RAM</li>
<li>8072A 3.5” floppy disk controller (1.44MB/720KB)</li>
<li>Fixed disk controller (supports a single hard drive up to
528MB)</li>
<li>Hercules graphics card with 720x348 2-color graphics (64KB video
RAM), and <a
href="https://en.wikipedia.org/wiki/Color_Graphics_Adapter">CGA</a>
80x25 16-color text mode support</li>
<li>8253 programmable interval timer (PIT)</li>
<li>8259 programmable interrupt controller (PIC)</li>
<li>8042 keyboard controller with 83-key XT-style keyboard</li>
<li>MC146818 real-time clock</li>
<li>PC speaker</li>
</ul>
<p>The emulator uses the <a href="https://www.libsdl.org">SDL graphics
library</a> for portability, and compiles for Windows, macOS, Linux and
probably most other 32-bit/64-bit systems too.</p>
<p>If you like living on the edge you can try building the emulator on a
big endian machine, and you will get an emulation of a big endian 8086,
a rather bizarre and somewhat useless beast. For everyone else, please
run the emulator on a little endian machine.</p>
<h3 id="rule-2-abuse-disclaimer">RULE 2 ABUSE DISCLAIMER</h3>
<ul>
<li><a href="cable3.c">cable3.c</a> is 4043 bytes in length (half an
8086).</li>
<li><code>iocccsize -i &lt; cable3.c</code> returns 1977 (the year the
4.77 MHz 8086 CPU was announced)</li>
<li>Therefore, any suspicions the judges may have regarding rule 2
non-compliance might be well-intentioned but are groundless.</li>
<li>Nonetheless, the author would like to apologise to the judges for
the one-big-block-of-code nature of this entry, which turned out to be
unavoidable. Hopefully the joys of this entry will make up for its
shortcomings.</li>
</ul>
<h3 id="why-is-this-entry-obfuscatedinteresting">Why is this entry
obfuscated/interesting?</h3>
<ul>
<li>First of all the 8086 is a nightmare processor to emulate.
Instruction codings are complex and irregular in size and structure,
with multiple addressing modes and no consistent memory placement for
operands, very often multiple possible encodings for the same
instruction, and the bizarre segment:offset memory model. In addition,
the 8086 has a number of bugs (e.g. PUSH SP), undocumented behaviours
and instructions (e.g. AAM/AAD + imm8, SALC, flag behaviour for MUL/DIV,
etc. etc.), and archaic features (e.g. parity/auxiliary flags) which all
need to be emulated properly. Here we emulate every feature of the CPU
pretty exactly (in fact better than most commercial clones of the
processor e.g. the NEC V30), with the exception of the trap flag which
no real software uses except for debuggers (although support for the TF
can be added if deemed important, without exceeding the IOCCC size
limit).</li>
<li>In addition to the CPU we also emulate all the standard PC
peripheral hardware. Parts of it are somewhat complete, much is rather
dysfunctional (like the 8253/8259) but enough to support most real
software.</li>
<li>Nonetheless the source, while large for the IOCCC, is rather tiny
for a functional PC emulator - around 2% of the size of the source of
other open-source 8086 PC emulators with comparable functionality.</li>
<li>In fact, this entry is just like happy hour - at 4043 bytes long,
you pay for half the 8086, but you get served the whole one.</li>
<li>Getting the code down to &lt;= 4096 characters to meet the IOCCC
rule 2 overall size limit required a good deal of effort (and
appreciable risk of divorce), with obfuscation being a pretty
unavoidable consequence in most places … for the rest, I use short
circuit operators whenever possible, mix <code>x[y]</code> and
<code>y[x]</code>, don’t use any flow control keywords except for
<code>for</code>, use K&amp;R-style declarations to honor the C
language’s rich cultural heritage (plus it saves a byte), and
occasionally go overboard with nasty nested indexes to give things like
this:
<code>--64[T=1[O=32[L=(X=*Y&amp;7)&amp;1,o=X/2&amp;1,l]=0,t=(c=y)&amp;7,a=c/8&amp;7,Y]&gt;&gt;6,g=~-T?y:(n)y,d=BX=y,l]</code>.</li>
<li>This entry highlights the importance of comments in C.</li>
<li>This entry might result in an adjustment to the IOCCC size tool for
the 2014 competition (see above).</li>
</ul>
<h3 id="compiling-on-different-platforms">Compiling on different
platforms</h3>
<p>This entry has been tested on Windows (compiled with MS Visual Studio
2010 and 2013), Mac OS X (clang and gcc), and Linux (clang and gcc). The
Makefile supplied is good for Mac OS X, Linux and probably other Unices.
I have received reports that the emulator works on Raspberry
Pi/Android/ARM (you will need to compile with
<code>-fsigned-char</code>) and iOS. You will need to adjust the <a
href="Makefile">Makefile</a> if your system lacks
<code>sdl-config</code> to correctly point to the SDL libraries and
header files.</p>
<p>On UNIX-based systems we can get raw keystrokes using
<code>stty</code>. However Windows has no <code>stty</code>. Therefore
the Makefile includes a <code>-D</code> option to define a “keyboard
driver” <code>KB</code> which as it stands is suitable for Unices, but
maybe not non-UNIX platforms. For example, for Windows/MS Visual Studio,
instead of the Makefile definition of KB, use something slightly
different - add the following entry to the Preprocessor Definitions list
in the Project Properties page:</p>
<div class="sourceCode" id="cb5"><pre class="sourceCode c"><code class="sourceCode c"><span id="cb5-1"><a href="#cb5-1" aria-hidden="true" tabindex="-1"></a>KB<span class="op">=(</span>kb<span class="op">=</span>H<span class="op">(</span><span class="dv">8</span><span class="op">),</span>kbhit<span class="op">())&amp;&amp;(</span>r<span class="op">[</span><span class="dv">1190</span><span class="op">]=</span>getch<span class="op">(),</span>H<span class="op">(</span><span class="dv">7</span><span class="op">))</span></span></code></pre></div>
<p>NOTE: this is done in the <a href="#alternate-code">Alternate
code</a>.</p>
<h3 id="posix-portability-note">POSIX portability note</h3>
<p>The code as supplied uses implicit function declarations for POSIX
file I/O and in doing so assumes that file offsets are the same bit
width as your architecture. For some systems (e.g. 32-bit Mac OS X,
which uses 64-bit file offsets) this is not the case, and to run
successfully on these systems, you will need to explicitly declare these
functions by adding the appropriate include to the top of the
source:</p>
<div class="sourceCode" id="cb6"><pre class="sourceCode c"><code class="sourceCode c"><span id="cb6-1"><a href="#cb6-1" aria-hidden="true" tabindex="-1"></a><span class="pp">#include </span><span class="im">&lt;unistd.h&gt;</span></span></code></pre></div>
<p>NOTE: this has been done in <a href="cable3.c">cable3.c</a>.</p>
<h3 id="usage">Usage</h3>
<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">./cable3</span> bios-image-file floppy-image-file <span class="pp">[</span><span class="ss">harddisk</span><span class="pp">-</span><span class="ss">image</span><span class="pp">-</span><span class="ss">file</span><span class="pp">]</span></span></code></pre></div>
<p>PLEASE NOTE that under Unices the keyboard must be in raw mode for
the emulator to work properly. Therefore the emulator is best run from a
shell script that looks something like:</p>
<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="fu">stty</span> cbreak raw <span class="at">-echo</span> min 0</span>
<span id="cb8-2"><a href="#cb8-2" aria-hidden="true" tabindex="-1"></a><span class="ex">./cable3</span> bios floppy.img harddisk.img</span>
<span id="cb8-3"><a href="#cb8-3" aria-hidden="true" tabindex="-1"></a><span class="fu">stty</span> cooked echo</span></code></pre></div>
<p>See the <a href="runme">runme</a> script.</p>
<h2 id="to-use-the-emulator---floppy-mode-only">To use the emulator -
floppy mode only</h2>
<p>The simplest use of the emulator is with a single floppy boot disk
image, like the <code>fd.img</code> provided, which is a FreeDOS boot
disk.</p>
<p>Before running the emulator on a Unix-type system, <code>stty</code>
needs to be used to put the keyboard into raw mode (and afterwards it
needs to be put back to cooked). So, run the emulator using something
like this script (provided as <a href="runme">runme</a>):</p>
<div class="sourceCode" id="cb9"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb9-1"><a href="#cb9-1" aria-hidden="true" tabindex="-1"></a><span class="fu">stty</span> cbreak raw <span class="at">-echo</span> min 0</span>
<span id="cb9-2"><a href="#cb9-2" aria-hidden="true" tabindex="-1"></a><span class="ex">./cable3</span> bios fd.img</span>
<span id="cb9-3"><a href="#cb9-3" aria-hidden="true" tabindex="-1"></a><span class="fu">stty</span> cooked echo</span></code></pre></div>
<h2 id="to-use-the-emulator---floppy-hd-mode">To use the emulator -
floppy + HD mode</h2>
<p>Easiest to start with is to try a ready-made 40MB hard disk image
containing a whole bunch of software which is in the included file
<code>hd.img</code>.</p>
<p>For the more adventurous, you can start off with (for example) a
blank 40MB image file called hd.img made using e.g. Makefile. Then
use:</p>
<div class="sourceCode" id="cb10"><pre
class="sourceCode sh"><code class="sourceCode bash"><span id="cb10-1"><a href="#cb10-1" aria-hidden="true" tabindex="-1"></a><span class="fu">stty</span> cbreak raw <span class="at">-echo</span> min 0</span>
<span id="cb10-2"><a href="#cb10-2" aria-hidden="true" tabindex="-1"></a><span class="ex">./cable3</span> bios fd.img hd.img</span>
<span id="cb10-3"><a href="#cb10-3" aria-hidden="true" tabindex="-1"></a><span class="fu">stty</span> cooked echo</span></code></pre></div>
<p>Preparing the hard disk for use in the emulator is done just like a
real PC. Boot the emulator, and use <code>FDISK</code> to partition the
hard disk. When it’s done <code>FDISK</code> will reboot the emulator.
Then you can use <code>FORMAT C:</code> and you are done. The resulting
disk image is in the right format to be mounted on a real Windows PC
using e.g. <code>OSFMount</code> (Windows), <code>hdiutil</code>
(macOS), or <code>mount</code> (linux/unix), providing an easy way to
copy files and programs to and from the disk image. Or, you can install
programs from regular floppy disk images (see <a
href="#floppy-disk-support">Floppy disk support</a> below).</p>
<h3 id="keyboard-emulation">Keyboard emulation</h3>
<p>The emulator emulates an XT-style keyboard controlled by an Intel
8042 chip on I/O port 0x60, generating IRQ1 and then interrupt 9 on each
key press. This is harder than it sounds because a real 8042 returns
scan codes rather than the ASCII characters which the C standard I/O
functions return. Rather than make the emulator less portable and use
<code>ioctl(2)</code> or platform-dependent equivalents to obtain real
scan codes from the keyboard, the emulator BIOS does the reverse of a
real PC BIOS and converts ASCII characters to scan codes, simulating
depress/release of the modifier keys (e.g. shift) as necessary to work
like a “real” keyboard. The OS (DOS/Windows) then converts them back to
ASCII characters and although this process normally works seamlessly
don’t be surprised if there are issues, for example, with non-QWERTY
e.g. international keyboards.</p>
<p>Most of the time you can just type normally, but there are special
sequences to get <code>Alt+xxx</code> and <code>Fxxx</code>.</p>
<p>To send an <code>Alt+XXX</code> key combination, press
(<code>^A</code> / <code>Ctrl+A</code>) then the key, so for example to
type <code>Alt+F</code>, press (<code>^A</code> / <code>Ctrl+A</code>)
then <code>F</code>.</p>
<p>To send an <code>Fxx</code> key, press <code>^F</code> /
<code>Ctrl+F</code> then a number key. For example, to get the
<code>F4</code> key, press <code>^F</code> / <code>Ctrl+F</code> then
<code>4</code>. To get <code>F10</code>, press <code>^F</code> /
<code>Ctrl+F</code> then <code>0</code>.</p>
<p>To send a <code>Page Down</code> key, press <code>^F</code> /
<code>Ctrl+F</code> then <code>O</code> (letter O, not digit zero). To
send a <code>Page Up</code> key, press <code>^F</code> /
<code>Ctrl+F</code> then <code>E</code>. Other key combinations are left
for the discovery of the user.</p>
<h3 id="text-mode-support">Text mode support</h3>
<p>The emulator supports both text output via the standard BIOS
interrupt 0x10 interface, and also direct video memory access (one page,
4KB video RAM at segment <code>B800</code>) in
<code>80x25 CGA 16-color</code> text mode.</p>
<p>BIOS text output calls are converted to simple writes to
<code>stdout</code>. Direct video memory accesses for the
<code>80x25 CGA color</code> text mode are converted to ANSI terminal
escape sequences. If you are using a terminal which does not support
ANSI (e.g. you are compiling the emulator with <code>MS VC++</code> and
running in a Windows console window) then PC applications that directly
write to video memory in text mode might be unusable.</p>
<p>Most <code>CGA I/O</code> ports are not supported except for the
<code>CGA refresh</code> register at <code>0x3DA</code>, which some
applications use for timing or synchronisation.</p>
<p>The regular PC character code page (<code>437</code>) includes
various extended ASCII characters for things like line drawing. You
might want to set the font in your terminal program to something that
includes these (e.g. on Mac OS X there is a freeware font called <a
href="https://www.dafont.com/perfect-dos-vga-437.font">Perfect DOS VGA
437</a> which does the trick).</p>
<p>Occasionally a DOS application on exit will leave the video hardware
in an odd state which confuses the emulator, resulting in subsequent
text output being invisible. If this happens, just use the DOS
<code>CLS</code> command to clear the screen and all will be well
again.</p>
<h3 id="graphics-mode-support">Graphics mode support</h3>
<p><a
href="https://en.wikipedia.org/wiki/Hercules_Graphics_Card">Hercules
720x348 monochrome graphics mode</a> emulation is implemented using SDL.
Most Hercules features are supported via the normal I/O interface on
ports <code>0x3B8</code> and <code>0x3BA</code> including video memory
bank switching (segments <code>B000</code>/<code>B800</code>), which
some games use for double-buffered graphics. CGA graphics modes are not
supported.</p>
<p>When an application enters graphics mode, the emulator will open an
SDL window (which will be closed when the application goes back to text
mode). Including code to redirect keystrokes from the SDL window to the
main terminal window would have busted the IOCCC size limits, so you
need to keep the main emulator terminal window in focus at all times
even when you are doing graphics (sounds a little odd but you will get
used to it).</p>
<p>On Unices, SDL will automatically output graphics via X11 if the
DISPLAY environment variable is set up.</p>
<h3 id="dual-graphics-card-support">Dual graphics card support</h3>
<p>Some applications (e.g. AutoCAD) support a PC configuration with a
CGA card and a Hercules card, for simultaneous text and graphics output
on different displays. The emulator simulates this configuration, too,
using separate windows for the (terminal) text and (SDL) graphics
displays.</p>
<h3 id="bios">BIOS</h3>
<p>Like a real PC, the emulator needs a BIOS to do anything useful. Here
we use a custom BIOS, written from scratch specifically for the
emulator. Source code for the BIOS (written in 8086 assembly language)
which compiles with the freely-available NASM x86 assembler is in <a
href="bios.asm">bios.asm</a>.</p>
<p>The BIOS implements the standard interrupt interfaces for video,
disk, timer, clock and so on, much as a “real” PC BIOS does, and also a
small timer-controlled video driver to convert video memory formatting
into ANSI escape sequences when the emulator is in text mode.</p>
<h3 id="cpu-and-memory-emulation">CPU and memory emulation</h3>
<p>Memory map is largely as per a real PC, with interrupt vector table
at <code>0:0</code>, BIOS data area including keyboard buffer at
<code>40:0</code>, CGA text video memory at <code>B800:0</code>,
Hercules dual-bank graphics memory at
<code>B000</code>/<code>B800:0</code>, and BIOS at
<code>F000:100</code>. Unlike a real PC, in the emulator the CPU
registers are memory-mapped (at <code>F000:0</code>), which enables
considerable optimisation of the emulator’s instruction execution unit
by permitting the unification of memory and register operations, while
remaining invisible to the running software.</p>
<p>The CPU supports the full 8086/186 instruction set. Due to the
complexities of the 8086’s arbitrary-length instruction decoding and
flags, 8086 instructions are first converted to a simpler intermediate
format before being executed. This conversion, along with instruction
lengths and how each instruction modifies the flags, is assisted by some
lookup tables which form part of the BIOS binary.</p>
<p>The CPU also implements some “special” two-byte opcodes to help the
emulator talk with the outside world. These are:</p>
<ul>
<li><code>0F 00</code> - output character in register <code>AL</code> to
terminal.</li>
<li><code>0F 01</code> - write real-time clock data (as returned by
<code>localtime()</code>) to memory location <code>ES:BX</code>.</li>
<li><code>0F 02</code> - read <code>AX</code> bytes from disk at offset
<code>512*(16*SI+BP)</code> into memory location <code>ES:BX</code>.
Disk is specified in <code>DL</code> (<code>0</code> = hard disk,
<code>1</code> = floppy disk).</li>
<li><code>0F 03</code> - write <code>AX</code> bytes at memory location
<code>ES:BX</code> to disk at offset <code>512*(16*SI+BP)</code>. Disk
is specified in <code>DL</code> as per <code>0F 02</code>.</li>
</ul>
<p>Emulator exit is triggered if <code>CS:IP == 0:0</code> (which would
be nonsensical in real software since this is where the interrupt vector
table lives). The supplied <code>fd.img</code> disk includes a small
program <code>QUITEMU.COM</code> which contains a single
<code>JMP 0:0</code> instruction, to allow the user to easily quit the
emulator without shutting down the terminal.</p>
<h3 id="floppy-disk-support">Floppy disk support</h3>
<p>Emulates a 3.5” high-density floppy drive. Can read, write and format
1.44MB disks (18 sectors per track, 2 heads) and 720KB disks (9 sectors
per track, 2 heads).</p>
<p>If you want to install your own software from floppy images
(downloaded from e.g. <a href="https://vetusware.com">Vetusware</a>),
the easiest way to “change disks” is to copy each disk image in turn
over the floppy image file you specify on the command line. Don’t forget
to put your original boot disk back at the end!</p>
<h3 id="hard-disk-support">Hard disk support</h3>
<p>Supports up to 1023 cylinders, 63 sectors per track, 63 heads for
disks up to 528MB.</p>
<p>Disk image format used is a subset of the standard “raw” format used
by most disk image mount tools. In general, disk images prepared by the
emulator will work with disk image tools and other emulators, but not
the other way around.</p>
<p>The emulator uses a particularly dumb algorithm to derive a simulated
cylinder/sector/head geometry from the disk image file’s size. This
algorithm often results in not all the space in the image file being
available for disk partitions. For example, creating a 40,000,000 byte
image file results in <code>DOS FDISK</code> seeing only 31.9MB as the
volume size.</p>
<p>Note that unlike a real PC, the emulator cannot boot from a hard disk
(image). Therefore, you will always need to use a bootable floppy image,
even if after boot everything runs from the HD.</p>
<h3 id="mouse">Mouse</h3>
<p>No mouse is emulated.</p>
<h3 id="real-time-clock">Real-time clock</h3>
<p>Reading the <a
href="https://en.wikipedia.org/wiki/Real-time_clock">RTC</a> (both time
and date) is emulated via the standard BIOS clock interface, pulling the
time/date from the host computer. Setting the time or date is not
supported.</p>
<h3 id="timers">Timers</h3>
<p>A countdown timer on I/O port <code>0x40</code> is simulated in a
broken way which is good enough for most software. On a real PC this has
a default period of 55ms and is programmable. No programmability is
supported in the emulator and the period may be about right or
completely wrong depending on the actual speed of your computer.</p>
<p>On a real PC, IRQ 0 and interrupt 8 are fired every 55ms. The
emulator tries to do the same but again, the delay period is not
calibrated so you get what you get.</p>
<h3 id="pc-speaker">PC speaker</h3>
<p>Beeps only, through the console.</p>
<h3 id="software-supported">Software supported</h3>
<p>The emulator will run practically any software a real PC (of the spec
listed at the top of this file) can. The author has tested a number of
OSes/GUIs (MS-DOS 6.22, FreeDOS 0.82pl3, Windows 3.0, DESQview 2.8),
professional software (Lotus 1-2-3 2.4 and AsEasyAs 5.7 for DOS, Excel
2.1 for Windows, AutoCAD 2.5, WordStar 4), programming languages
(QBASIC, GWBASIC, Turbo C++), games (Carrier Command, Police Quest, and
a bunch of freeware Windows games), and diagnostic/benchmark software
(Manifest, Microsoft MSD, InfoSpot, CheckIt) and all of them run
well.</p>
<p>Screenshots of some of these applications running (on Mac OS X) are
provided for the impatient.</p>
<figure>
<img src="screenshot_autocad.png" alt="AutoCAD" />
<figcaption aria-hidden="true">AutoCAD</figcaption>
</figure>
<figure>
<img src="screenshot_flightsim4.png" alt="Flight Simulator 4" />
<figcaption aria-hidden="true">Flight Simulator 4</figcaption>
</figure>
<figure>
<img src="screenshot_lotus123.png" alt="Lotus 123" />
<figcaption aria-hidden="true">Lotus 123</figcaption>
</figure>
<figure>
<img src="screenshot_qbasic.png" alt="QBASIC" />
<figcaption aria-hidden="true">QBASIC</figcaption>
</figure>
<figure>
<img src="screenshot_simcity.png" alt="SimCity" />
<figcaption aria-hidden="true">SimCity</figcaption>
</figure>
<figure>
<img src="screenshot_win3_on_macosx.png" alt="Windows 3 on macOS" />
<figcaption aria-hidden="true">Windows 3 on macOS</figcaption>
</figure>
<h3 id="compiler-warnings">Compiler warnings</h3>
<p>A lot of compiler warnings are produced by clang. Missing type
specifiers, control reaching the end of functions without returning
values, incompatible pointer type assignments, and some precedence
warnings, all necessary to keep the source size down. Other compilers
are likely to produce similar warnings.</p>
<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/gen-inventory.sh -->
<h1 id="inventory-for-2013cable3"><a name="inventory"></a>Inventory for
2013/cable3</h1>
<h2 id="primary-files">Primary files</h2>
<ul>
<li><a href="index.html">index.html</a> - winner home page</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2013/cable3/cable3.c">cable3.c</a>
- winning source</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2013/cable3/Makefile">Makefile</a>
- winner Makefile</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2013/cable3/cable3.alt.c">cable3.alt.c</a>
- alternative source</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2013/cable3/cable3.orig.c">cable3.orig.c</a>
- original source</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2013/cable3/runme">runme</a>
- how to run</li>
<li><a href="screenshot_autocad.png">screenshot_autocad.png</a> -
Screenshots of some applications running on macOS</li>
<li><a href="screenshot_flightsim4.png">screenshot_flightsim4.png</a> -
Screenshots of some applications running on macOS</li>
<li><a href="screenshot_lotus123.png">screenshot_lotus123.png</a> -
Screenshots of some applications running on macOS</li>
<li><a href="screenshot_qbasic.png">screenshot_qbasic.png</a> -
Screenshots of some applications running on macOS</li>
<li><a href="screenshot_simcity.png">screenshot_simcity.png</a> -
Screenshots of some applications running on macOS</li>
<li><a
href="screenshot_win3_on_macosx.png">screenshot_win3_on_macosx.png</a> -
Screenshots of some applications running on macOS</li>
<li><a href="sc-ioccc.terminal">sc-ioccc.terminal</a> - configuration
file will correctly display console apps</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2013/cable3/bios.asm">bios.asm</a>
- BIOS source in assembly</li>
<li><a href="2013_cable3.tar.bz2">2013_cable3.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/2013/cable3/.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/2013/cable3/.winner.json">.winner.json</a>
- description of winner in JSON</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2013/cable3/README.md">README.md</a>
- markdown source for index.html</li>
<li><a href="bios">bios</a> - custom BIOS</li>
<li><a href="fd.img">fd.img</a> - DOS boot sector</li>
<li><a href="hd.img">hd.img</a> - disk image</li>
</ul>
<!-- END: next line ends content generated by: bin/gen-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%2F2013%2Fcable3%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 -->
+271 -13
View File
@@ -1,4 +1,6 @@
<!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 !!! -->
@@ -6,27 +8,283 @@
<!-- !!! DO NOT MODIFY THIS FILE - This file is generated by a tool !!! -->
<!-- !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<!-- -->
<!-- file: 2013/dlowe/index.html created by: fake.gen_index.sh version: 1.0.5 2023-10-31 -->
<html lang="en">
<!-- END: this line ends content from: inc/top.default.html -->
<!-- -->
<!-- This file was formed by the tool: bin/readme2index.sh version: 1.1 2024-01-16 -->
<!-- -->
<!-- START: this line starts content from: inc/head.default.html -->
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>2013 dlowe</title>
<meta name="description" content="IOCCC year: 2013 IOCCC winner: dlowe winner index page">
<meta name="keywords" content="IOCCC,2013,dlowe,winner index page">
<link rel="stylesheet" href="/temp-test-ioccc/ioccc.css">
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=yes">
<title>2013/dlowe</title>
<meta name="description" content="2013 IOCCC winner dlowe">
<meta name="keywords" content="IOCCC, 2013, IOCCC 2013, IOCCC winner, dlowe">
</head>
<!-- END: this line ends content from: inc/head.default.html -->
<!-- START: this line starts content from: inc/body.default.html -->
<body>
<h1>2013 dlowe</h1>
<!-- END: this line ends content from: inc/body.default.html -->
<!-- START: this line starts content from: inc/header.default.html -->
<p>XXX - fake content until readme2index is working - XXX</p>
<div class="header">
<img src="/temp-test-ioccc/png/ioccc.png" alt="IOCCC image by Matt Zucker" width=300 height=110>
<h1>The International Obfuscated C Code Contest</h1>
<h2>2013/dlowe</h2>
</div>
<hr style="width:50%;text-align:left;margin-left:0">
<!-- END: this line ends content from: inc/header.default.html -->
<!-- START: this line starts content from: inc/topnav.mid.html -->
<!-- Start Nu Html Checker -->
<p><a href="https://validator.w3.org/nu/?doc=https%3A%2F%2Fioccc-src.github.io%2Ftemp-test-ioccc%2F2013%2Fdlowe%2Findex.html">Nu Html check https://ioccc-src.github.io/temp-test-ioccc/2013/dlowe/index.html</a></p>
<!-- End Nu Html Checker -->
<div class="topnav">
<a class="Left" href="../cable3/index.html">&larr; cable3</a>
<a class="Left" href="../index.html">&uarr; 2013 &uarr;</a>
<a class="Left" href="../endoh1/index.html">endoh1 &rarr;</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="/temp-test-ioccc/index.html">IOCCC Home</a>
<a href="/temp-test-ioccc/years.html">Winning Entries</a>
<a href="/temp-test-ioccc/winners.html">People who have won</a>
</div>
<hr>
<div class="sidenav">
<a href="/temp-test-ioccc/news.html">IOCCC News</a>
<a href="/temp-test-ioccc/faq.html#submit">How to enter the IOCCC</a>
<a href="/temp-test-ioccc/faq.html">FAQ</a>
</div>
<hr>
<div class="sidenav">
<a href="/temp-test-ioccc/bugs.html">Bugs &amp; (mis)features</a>
<a href="/temp-test-ioccc/faq.html#fix_a_winner">Fixing IOCCC winners</a>
<a href="/temp-test-ioccc/faq.html#fix_web_site">Fixing the web site</a>
<a href="/temp-test-ioccc/faq.html#fix_author">Fixing winner info</a>
<a href="/temp-test-ioccc/thanks-for-help.html">Thanks for the help</a>
</div>
<hr>
<div class="sidenav">
<a href="/temp-test-ioccc/judges.html">The IOCCC Judges</a>
<a href="/temp-test-ioccc/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/gen-author.sh -->
<p><a name="author"><strong>Author:</strong></a> <br><br>Name: <a
href="/temp-test-ioccc/winners.html#J_David_Lowe">J. David Lowe</a><br>
Location: <a href="/temp-test-ioccc/location.html#US">US</a></p>
<!-- END: next line ends content generated by: bin/gen-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></span></code></pre></div>
<h3 id="bugs-and-misfeatures">Bugs and (Mis)features:</h3>
<p>The current status of this entry is:</p>
<pre><code>STATUS: INABIAF - please **DO NOT** fix</code></pre>
<p>For more detailed information see <a href="/bugs.md#2013-dlowe">2013
dlowe 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">./dlowe</span> <span class="pp">[</span><span class="ss">number...</span><span class="pp">]</span></span></code></pre></div>
<p>where <code>[number...]</code> is one or more number, space
separated.</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.sh</span></span></code></pre></div>
<p>What is different about the above if you do something like:</p>
<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="bu">echo</span> <span class="st">&#39;IOCCC winning entry 2013/dlowe&#39;</span> <span class="op">&gt;</span> ioccc.txt</span>
<span id="cb5-2"><a href="#cb5-2" aria-hidden="true" tabindex="-1"></a><span class="ex">./try.sh</span></span>
<span id="cb5-3"><a href="#cb5-3" aria-hidden="true" tabindex="-1"></a><span class="fu">rm</span> <span class="at">-f</span> ioccc.txt</span></code></pre></div>
<p>?</p>
<p>To make it simpler to see try showing just the different line
like:</p>
<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">./diff.sh</span></span></code></pre></div>
<h2 id="judges-remarks">Judges’ remarks:</h2>
<p>We liked how this entry used Unicode, specifically UTF-8, in a
somewhat obfuscated way.</p>
<p>Also, why doesn’t it crash but instead produces a correct output when
called with one argument or when all arguments are equal?</p>
<p>For extra fun, compile and run <a href="fun.c">fun.c</a>:</p>
<div class="sourceCode" id="cb7"><pre class="sourceCode c"><code class="sourceCode c"><span id="cb7-1"><a href="#cb7-1" aria-hidden="true" tabindex="-1"></a><span class="pp">#include </span><span class="im">&lt;stdio.h&gt;</span></span>
<span id="cb7-2"><a href="#cb7-2" aria-hidden="true" tabindex="-1"></a><span class="dt">int</span> main<span class="op">()</span> <span class="op">{</span></span>
<span id="cb7-3"><a href="#cb7-3" aria-hidden="true" tabindex="-1"></a> printf<span class="op">(</span><span class="st">&quot;</span><span class="sc">%d</span><span class="st"> </span><span class="sc">%d</span><span class="st"> </span><span class="sc">%d\n</span><span class="st">&quot;</span><span class="op">,</span> <span class="op">(</span><span class="dt">int</span><span class="op">)(-</span><span class="fl">1.0</span><span class="op">/</span><span class="fl">0.0</span><span class="op">),</span> <span class="op">(</span><span class="dt">int</span><span class="op">)(</span><span class="fl">0.0</span><span class="op">/</span><span class="fl">0.0</span><span class="op">),</span> <span class="op">(</span><span class="dt">int</span><span class="op">)(</span><span class="fl">1.0</span><span class="op">/</span><span class="fl">0.0</span><span class="op">));</span></span>
<span id="cb7-4"><a href="#cb7-4" aria-hidden="true" tabindex="-1"></a><span class="op">}</span></span></code></pre></div>
<p>with gcc and clang.</p>
<p>With GCC (4.7.2), we get</p>
<pre><code>-2147483648 -2147483648 -2147483648</code></pre>
<p>and with clang (3.3), we get</p>
<pre><code>-2147483648 0 2147483647</code></pre>
<p>and with Apple clang version 15.0.0 (clang-1500.0.40.1) in 2023, we
get:</p>
<pre><code>1840985120 -2033041452 35979112</code></pre>
<p>Which one is correct? :)</p>
<p>NOTE: <code>make all</code> will compile <a href="fun.c">fun.c</a>
but to provide a different compiler you can do something like:</p>
<div class="sourceCode" id="cb11"><pre
class="sourceCode sh"><code class="sourceCode bash"><span id="cb11-1"><a href="#cb11-1" aria-hidden="true" tabindex="-1"></a><span class="fu">make</span> CC=clang fun</span></code></pre></div>
<h2 id="authors-remarks">Author’s remarks:</h2>
<h3 id="sparkl">sparkl</h3>
<p>A tiny implementation of command-line <a
href="https://en.wikipedia.org/wiki/Sparkline">sparkline</a> data
visualization.</p>
<h3 id="synopsis">Synopsis</h3>
<div class="sourceCode" id="cb12"><pre
class="sourceCode sh"><code class="sourceCode bash"><span id="cb12-1"><a href="#cb12-1" aria-hidden="true" tabindex="-1"></a><span class="ex">$</span> ./sparkl 0 1 2 3 4 5 6 7</span>
<span id="cb12-2"><a href="#cb12-2" aria-hidden="true" tabindex="-1"></a><span class="ex">▁▂▃▄▅▆▇▉</span></span>
<span id="cb12-3"><a href="#cb12-3" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb12-4"><a href="#cb12-4" aria-hidden="true" tabindex="-1"></a><span class="ex">$</span> echo <span class="st">&quot;sparkline of file lengths: </span><span class="va">$(</span><span class="fu">wc</span> <span class="at">-c</span> <span class="pp">*</span> <span class="kw">|</span> <span class="fu">awk</span> <span class="st">&#39;{print $1}&#39;</span> <span class="kw">|</span> <span class="fu">xargs</span> ./sparkl<span class="va">)</span><span class="st">&quot;</span></span>
<span id="cb12-5"><a href="#cb12-5" aria-hidden="true" tabindex="-1"></a><span class="ex">sparkline</span> of file sizes: ▁▁▁▃▃▂▁▂▁▁▉</span></code></pre></div>
<p>NOTE: this has been provided in <a href="slflen.sh">slflen.sh</a> so
you can try:</p>
<div class="sourceCode" id="cb13"><pre
class="sourceCode sh"><code class="sourceCode bash"><span id="cb13-1"><a href="#cb13-1" aria-hidden="true" tabindex="-1"></a><span class="ex">./slflen.sh</span></span></code></pre></div>
<p>instead (which <a href="try.sh">try.sh</a> also uses).</p>
<h3 id="description">Description</h3>
<p>This is a handy little tool for visualizing numeric series from the
command line, using sparklines. Pass it a numeric series as arguments,
and <code>sparkl</code> will display a sparkline graph, which you can
use to very quickly get a sense of the shape of your data.</p>
<h3 id="limitations">Limitations</h3>
<ul>
<li>Crashes with 0 arguments. It’d be trivial to fix, but adds a few
bytes to the code.</li>
<li>Produces bogus graphs when given &gt; about 5000 arguments.</li>
<li>Only works if your terminal is UTF-8 and your font supports the 8
glyphs used.</li>
<li>Produces a few harmless compiler warnings.</li>
</ul>
<h3 id="obfuscation">Obfuscation</h3>
<p>The code is very terse. I was torn between submitting this version,
and a one-line version compressed using a couple more <code>-D</code>
flags.</p>
<p>Hand-rolled UTF-8 sequence, magic numbers (what’s that 7 for?),
meaningless variable names, reused variables, and so on.</p>
<h3 id="acknowledgements">Acknowledgements</h3>
<p>Edward Tufte invented sparklines (among other things.) Brilliant.</p>
<p>Zach Holman’s <a href="https://github.com/holman/spark">‘spark’
utility</a> was absolutely an inspiration.</p>
<p>As I was writing up this description, I discovered I’m not the first
person to write an obfuscated C sparkline utility! Vicent Martí created
<a href="https://gist.github.com/vmg/1368661">this one</a> years (!)
ago. (My implementation is completely independent.)</p>
<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/gen-inventory.sh -->
<h1 id="inventory-for-2013dlowe"><a name="inventory"></a>Inventory for
2013/dlowe</h1>
<h2 id="primary-files">Primary files</h2>
<ul>
<li><a href="index.html">index.html</a> - winner home page</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2013/dlowe/dlowe.c">dlowe.c</a>
- winning source</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2013/dlowe/Makefile">Makefile</a>
- winner Makefile</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2013/dlowe/dlowe.orig.c">dlowe.orig.c</a>
- original source</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2013/dlowe/diff.sh">diff.sh</a>
- difference tool</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2013/dlowe/fun.c">fun.c</a>
- compile and run for extra run</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2013/dlowe/slflen.sh">slflen.sh</a>
- generate sparkline of file lengths</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2013/dlowe/try.sh">try.sh</a>
- how to run</li>
<li><a href="2013_dlowe.tar.bz2">2013_dlowe.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/2013/dlowe/.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/2013/dlowe/.winner.json">.winner.json</a>
- description of winner in JSON</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2013/dlowe/README.md">README.md</a>
- markdown source for index.html</li>
</ul>
<!-- END: next line ends content generated by: bin/gen-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%2F2013%2Fdlowe%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 -->
+342 -13
View File
@@ -1,4 +1,6 @@
<!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 !!! -->
@@ -6,27 +8,354 @@
<!-- !!! DO NOT MODIFY THIS FILE - This file is generated by a tool !!! -->
<!-- !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<!-- -->
<!-- file: 2013/endoh1/index.html created by: fake.gen_index.sh version: 1.0.5 2023-10-31 -->
<html lang="en">
<!-- END: this line ends content from: inc/top.default.html -->
<!-- -->
<!-- This file was formed by the tool: bin/readme2index.sh version: 1.1 2024-01-16 -->
<!-- -->
<!-- START: this line starts content from: inc/head.default.html -->
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>2013 endoh1</title>
<meta name="description" content="IOCCC year: 2013 IOCCC winner: endoh1 winner index page">
<meta name="keywords" content="IOCCC,2013,endoh1,winner index page">
<link rel="stylesheet" href="/temp-test-ioccc/ioccc.css">
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=yes">
<title>2013/endoh1</title>
<meta name="description" content="2013 IOCCC winner endoh1">
<meta name="keywords" content="IOCCC, 2013, IOCCC 2013, IOCCC winner, endoh1">
</head>
<!-- END: this line ends content from: inc/head.default.html -->
<!-- START: this line starts content from: inc/body.default.html -->
<body>
<h1>2013 endoh1</h1>
<!-- END: this line ends content from: inc/body.default.html -->
<!-- START: this line starts content from: inc/header.default.html -->
<p>XXX - fake content until readme2index is working - XXX</p>
<div class="header">
<img src="/temp-test-ioccc/png/ioccc.png" alt="IOCCC image by Matt Zucker" width=300 height=110>
<h1>The International Obfuscated C Code Contest</h1>
<h2>2013/endoh1</h2>
</div>
<hr style="width:50%;text-align:left;margin-left:0">
<!-- END: this line ends content from: inc/header.default.html -->
<!-- START: this line starts content from: inc/topnav.mid.html -->
<!-- Start Nu Html Checker -->
<p><a href="https://validator.w3.org/nu/?doc=https%3A%2F%2Fioccc-src.github.io%2Ftemp-test-ioccc%2F2013%2Fendoh1%2Findex.html">Nu Html check https://ioccc-src.github.io/temp-test-ioccc/2013/endoh1/index.html</a></p>
<!-- End Nu Html Checker -->
<div class="topnav">
<a class="Left" href="../dlowe/index.html">&larr; dlowe</a>
<a class="Left" href="../index.html">&uarr; 2013 &uarr;</a>
<a class="Left" href="../endoh2/index.html">endoh2 &rarr;</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="/temp-test-ioccc/index.html">IOCCC Home</a>
<a href="/temp-test-ioccc/years.html">Winning Entries</a>
<a href="/temp-test-ioccc/winners.html">People who have won</a>
</div>
<hr>
<div class="sidenav">
<a href="/temp-test-ioccc/news.html">IOCCC News</a>
<a href="/temp-test-ioccc/faq.html#submit">How to enter the IOCCC</a>
<a href="/temp-test-ioccc/faq.html">FAQ</a>
</div>
<hr>
<div class="sidenav">
<a href="/temp-test-ioccc/bugs.html">Bugs &amp; (mis)features</a>
<a href="/temp-test-ioccc/faq.html#fix_a_winner">Fixing IOCCC winners</a>
<a href="/temp-test-ioccc/faq.html#fix_web_site">Fixing the web site</a>
<a href="/temp-test-ioccc/faq.html#fix_author">Fixing winner info</a>
<a href="/temp-test-ioccc/thanks-for-help.html">Thanks for the help</a>
</div>
<hr>
<div class="sidenav">
<a href="/temp-test-ioccc/judges.html">The IOCCC Judges</a>
<a href="/temp-test-ioccc/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/gen-author.sh -->
<p><a name="author"><strong>Author:</strong></a> <br><br>Name: <a
href="/temp-test-ioccc/winners.html#Yusuke_Endoh">Yusuke Endoh</a><br>
Location: <a href="/temp-test-ioccc/location.html#JP">JP</a></p>
<!-- END: next line ends content generated by: bin/gen-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></span></code></pre></div>
<h3 id="bugs-and-misfeatures">Bugs and (Mis)features:</h3>
<p>The current status of this entry is:</p>
<pre><code>STATUS: INABIAF - please **DO NOT** fix</code></pre>
<p>For more detailed information see <a href="/bugs.md#2013-endoh1">2013
endoh1 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">./endoh1</span> <span class="pp">[</span><span class="ss">file.lazy</span><span class="pp">]</span></span></code></pre></div>
<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.sh</span></span></code></pre></div>
<p>You might also enjoy running:</p>
<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">cc</span> <span class="at">-E</span> endoh1.c <span class="kw">|</span> <span class="fu">less</span></span></code></pre></div>
<h2 id="judges-remarks">Judges’ remarks:</h2>
<p>We liked this entry because it can serve as a standalone program as
well as an include file; and, as usual, because its input data is at
least as obfuscated as the program itself.</p>
<p>This entry can be considered an abuse of the GCC’s optimizer; it
takes GCC about 4x longer to compile it with -O3 than without, compared
to clang’s 2x.</p>
<h2 id="authors-remarks">Author’s remarks:</h2>
<h3 id="remarks">Remarks</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="fu">less</span> endoh1.c</span>
<span id="cb6-2"><a href="#cb6-2" aria-hidden="true" tabindex="-1"></a><span class="fu">gcc</span> <span class="at">-o</span> endoh1 endoh1.c</span>
<span id="cb6-3"><a href="#cb6-3" aria-hidden="true" tabindex="-1"></a><span class="ex">./endoh1</span></span></code></pre></div>
<p>… Isn’t there any more to it?</p>
<p>Yes, of course.</p>
<p>This is a tool <em>for C programmers</em> to play the <a
href="http://en.wikipedia.org/wiki/SKI_combinator_calculus">SKI
combinator calculus</a>, especially, <a
href="https://tromp.github.io/cl/lazy-k.html">Lazy K</a>.</p>
<p>This program will shine when it is used as a library. For example, <a
href="hello.lazy">hello.lazy</a> is a “Hello world” program written in
Lazy K.</p>
<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">$</span> lazy hello.lazy</span>
<span id="cb7-2"><a href="#cb7-2" aria-hidden="true" tabindex="-1"></a><span class="ex">Hello,</span> world!</span></code></pre></div>
<p>where <code>lazy</code> is <a href="https://github.com/irori/lazyk">a
reference implementation of Lazy K</a>. At the same time, <a
href="hello.lazy">hello.lazy</a> is <em>a valid C program</em> that uses
<a href="endoh1.c">endoh1.c</a> as a library.</p>
<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">$</span> gcc <span class="at">-o</span> hello <span class="at">-xc</span> hello.lazy</span>
<span id="cb8-2"><a href="#cb8-2" aria-hidden="true" tabindex="-1"></a><span class="ex">$</span> ./hello</span>
<span id="cb8-3"><a href="#cb8-3" aria-hidden="true" tabindex="-1"></a><span class="ex">Hello,</span> world!</span></code></pre></div>
<p>In other words, this program is a kind of <a
href="http://en.wikipedia.org/wiki/Polyglot_%28computing%29">polyglot</a>.</p>
<p>The usage is simple: you just have to wrap Lazy K program with
<code>#include "endoh1.c"</code>. Note that <code>#</code> is a comment
in Lazy K.</p>
<h3 id="obfuscation">Obfuscation</h3>
<p>… is inherent in SKI combinator calculus :-)</p>
<p>In addition, it uses various hacks to parse SKI code as C, and to
satisfy IOCCC’s size rule.</p>
<ul>
<li>Abuse of function pointers.</li>
<li>Code duplication by macros.</li>
<li>Short coding.</li>
</ul>
<p>These led to the good obfuscation.</p>
<p>See <a href="#spoiler">Spoiler section</a> in detail, if you
need.</p>
<h3 id="limitation">Limitation</h3>
<p>This program supports only “Combinator-calculus style notation” of
Lazy K. “Unlambda style” and “Iota and Jot” style are not supported.</p>
<p>Also, it requires a space between identifiers. In short, use
<code>(S K)</code> instead of <code>(SK)</code>, “`sk”,
<code>**i*i*i*ii*i*i*ii</code>, or <code>11111100011100</code>.</p>
<p>Huge memory may be required to compile the program (about 300 MB on
my machine).</p>
<p>In addition, there are some limitations (and workarounds) mentioned
in <a href="#spoiler">Spoiler section</a>.</p>
<p>But I think it would only matter when you run the attached
programs.</p>
<h3 id="portability">Portability</h3>
<p>I confirmed that the program successfully worked with the following
compilers:</p>
<ul>
<li>gcc 4.6.3 [Linux, Mac OS X]</li>
<li>clang 3.0 [Linux, Mac OS X]</li>
<li>tcc 0.9.26 [Linux]
<ul>
<li>N.B. tcc 0.9.25 seems to have a bug and fails to run it.</li>
</ul></li>
</ul>
<p>Recent compilers with <code>-Wall -W -Wextra -pedantic</code> say
nothing.</p>
<div class="sourceCode" id="cb9"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb9-1"><a href="#cb9-1" aria-hidden="true" tabindex="-1"></a><span class="fu">gcc</span> <span class="at">-Wall</span> <span class="at">-W</span> <span class="at">-Wextra</span> <span class="at">-pedantic</span> prog.c</span>
<span id="cb9-2"><a href="#cb9-2" aria-hidden="true" tabindex="-1"></a><span class="fu">clang</span> <span class="at">-Wall</span> <span class="at">-W</span> <span class="at">-Wextra</span> <span class="at">-pedantic</span> prog.c</span>
<span id="cb9-3"><a href="#cb9-3" aria-hidden="true" tabindex="-1"></a><span class="ex">tcc</span> <span class="at">-Wall</span> <span class="at">-W</span> <span class="at">-Wextra</span> <span class="at">-pedantic</span> prog.c</span></code></pre></div>
<p>I think it will work on almost all platforms. I confirmed:</p>
<ul>
<li>Ubuntu Linux</li>
<li>Mac OS X</li>
<li>Raspberry PI</li>
</ul>
<p>To check whether the program is specified on the command line or
included from another source file, the program uses a predefined macro
<code>__INCLUDE_LEVEL__</code>. It is a gcc extension, and also
supported by clang. If your compiler does not support it, you cannot use
the program as a library. But you can compile and run it as a standalone
program, at least. In fact, tcc does not support the macro, but does
work.</p>
<h3 id="spoiler">Spoiler</h3>
<p>The whole program is interpreted by macro expansion. For example,
<code>S (K I)</code> is translated to a normal C code,
<code>(s)((k)(i))</code>, or simply <code>s(k(i))</code>.</p>
<p>This expression returns an abstract syntax tree, and <a
href="endoh1.c">endoh1.c</a> evaluates it.</p>
<p>This program uses a very simple “term rewriting” approach for
evaluating SKI combinator calculus. The rewriting rules are shown in the
shape of the code.</p>
<h4 id="abuse-of-function-pointers">Abuse of function pointers</h4>
<p>Consider a sequence of function applications in C:</p>
<div class="sourceCode" id="cb10"><pre class="sourceCode c"><code class="sourceCode c"><span id="cb10-1"><a href="#cb10-1" aria-hidden="true" tabindex="-1"></a>s<span class="op">(</span>x<span class="op">)(</span>x<span class="op">)(</span>x<span class="op">)(</span>x<span class="op">)...</span></span></code></pre></div>
<p>What type should <code>s</code> have? Unfortunately, C does
<em>not</em> provide a “recursive type”, such as
<code>typedef f (*f)();</code>.</p>
<p>So, I used a heavily nested function pointer type:</p>
<div class="sourceCode" id="cb11"><pre class="sourceCode c"><code class="sourceCode c"><span id="cb11-1"><a href="#cb11-1" aria-hidden="true" tabindex="-1"></a><span class="kw">typedef</span> <span class="dt">void</span> <span class="op">*(*(*(*...(*(</span>f<span class="op">))()...)())())</span></span></code></pre></div>
<p>This limits how many arguments one function can be consecutively
applied to. But you can increase the number by tweaking the definition
of macro <code>p</code>.</p>
<h4 id="code-duplication-by-macros">Code duplication by macros</h4>
<p>Next, we need to encode “closures”. A closure is a function together
with an environment which is a reference to non-local variable.</p>
<p>In this case, we need something that meets all of the following
criteria:</p>
<ul>
<li>Is callable itself.</li>
<li>Internally possesses a reference to another closure as a non-local
variable.</li>
<li>Applies the internal closure to an argument when it is called.</li>
</ul>
<p>However, no type in C is callable and has a reference at the same
time. (It is feasible by dynamic code generation, but it is far from
portable.)</p>
<p>So, I addressed this issue by generating many function definitions
statically by (ab)using macros:</p>
<div class="sourceCode" id="cb12"><pre class="sourceCode c"><code class="sourceCode c"><span id="cb12-1"><a href="#cb12-1" aria-hidden="true" tabindex="-1"></a><span class="dt">void</span> <span class="op">*</span>x1<span class="op">;</span> <span class="dt">void</span> f1<span class="op">(</span><span class="dt">void</span> <span class="op">*</span>y<span class="op">)</span> <span class="op">{</span> <span class="cf">return</span> apply<span class="op">(</span>x1<span class="op">,</span> y<span class="op">);</span> <span class="op">}</span></span>
<span id="cb12-2"><a href="#cb12-2" aria-hidden="true" tabindex="-1"></a><span class="dt">void</span> <span class="op">*</span>x2<span class="op">;</span> <span class="dt">void</span> f2<span class="op">(</span><span class="dt">void</span> <span class="op">*</span>y<span class="op">)</span> <span class="op">{</span> <span class="cf">return</span> apply<span class="op">(</span>x2<span class="op">,</span> y<span class="op">);</span> <span class="op">}</span></span>
<span id="cb12-3"><a href="#cb12-3" aria-hidden="true" tabindex="-1"></a><span class="dt">void</span> <span class="op">*</span>x3<span class="op">;</span> <span class="dt">void</span> f3<span class="op">(</span><span class="dt">void</span> <span class="op">*</span>y<span class="op">)</span> <span class="op">{</span> <span class="cf">return</span> apply<span class="op">(</span>x3<span class="op">,</span> y<span class="op">);</span> <span class="op">}</span></span>
<span id="cb12-4"><a href="#cb12-4" aria-hidden="true" tabindex="-1"></a><span class="op">...</span></span>
<span id="cb12-5"><a href="#cb12-5" aria-hidden="true" tabindex="-1"></a><span class="dt">void</span> <span class="op">*(</span>h<span class="op">[])</span> <span class="op">=</span> <span class="op">{</span> f1<span class="op">,</span> f2<span class="op">,</span> f3<span class="op">,</span> <span class="op">...</span> <span class="op">}</span></span></code></pre></div>
<p>and by allotting each of them when a closure is needed.</p>
<p>This leads to another limitation: the number of pre-defined closures
limits how many identifiers (<code>S</code> <code>K</code>
<code>I</code>) one program can use.</p>
<p>But you can increase this number by tweaking the definition of macro
<code>A</code> <code>B</code> <code>C</code> and <code>D</code>. (Note
that closures are allotted only when parsing; after the evaluation
starts, “out of closure” cannot occur.)</p>
<h4 id="short-cording">Short cording</h4>
<p>This margin is too narrow to contain a detailed explanation. Instead,
I just ask you one question. Can you tell what
<code>v s[]={0,0,s+6,s+2,s+4,s,s+3,s+5,s+1};</code> is? I found this by
using an <a
href="https://en.wikipedia.org/wiki/Satisfiability_modulo_theories">SMT
solver</a>.</p>
<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/gen-inventory.sh -->
<h1 id="inventory-for-2013endoh1"><a name="inventory"></a>Inventory for
2013/endoh1</h1>
<h2 id="primary-files">Primary files</h2>
<ul>
<li><a href="index.html">index.html</a> - winner home page</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2013/endoh1/endoh1.c">endoh1.c</a>
- winning source</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2013/endoh1/Makefile">Makefile</a>
- winner Makefile</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2013/endoh1/endoh1.orig.c">endoh1.orig.c</a>
- original source</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2013/endoh1/try.sh">try.sh</a>
- how to run</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2013/endoh1/echo.lazy">echo.lazy</a>
- lazy input</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2013/endoh1/hello.lazy">hello.lazy</a>
- lazy input</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2013/endoh1/rot13.ed">rot13.ed</a>
- ed script</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2013/endoh1/tac.lazy">tac.lazy</a>
- lazy input</li>
<li><a href="2013_endoh1.tar.bz2">2013_endoh1.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/2013/endoh1/.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/2013/endoh1/.winner.json">.winner.json</a>
- description of winner in JSON</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2013/endoh1/README.md">README.md</a>
- markdown source for index.html</li>
</ul>
<!-- END: next line ends content generated by: bin/gen-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%2F2013%2Fendoh1%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 -->
+241 -13
View File
@@ -1,4 +1,6 @@
<!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 !!! -->
@@ -6,27 +8,253 @@
<!-- !!! DO NOT MODIFY THIS FILE - This file is generated by a tool !!! -->
<!-- !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<!-- -->
<!-- file: 2013/endoh2/index.html created by: fake.gen_index.sh version: 1.0.5 2023-10-31 -->
<html lang="en">
<!-- END: this line ends content from: inc/top.default.html -->
<!-- -->
<!-- This file was formed by the tool: bin/readme2index.sh version: 1.1 2024-01-16 -->
<!-- -->
<!-- START: this line starts content from: inc/head.default.html -->
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>2013 endoh2</title>
<meta name="description" content="IOCCC year: 2013 IOCCC winner: endoh2 winner index page">
<meta name="keywords" content="IOCCC,2013,endoh2,winner index page">
<link rel="stylesheet" href="/temp-test-ioccc/ioccc.css">
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=yes">
<title>2013/endoh2</title>
<meta name="description" content="2013 IOCCC winner endoh2">
<meta name="keywords" content="IOCCC, 2013, IOCCC 2013, IOCCC winner, endoh2">
</head>
<!-- END: this line ends content from: inc/head.default.html -->
<!-- START: this line starts content from: inc/body.default.html -->
<body>
<h1>2013 endoh2</h1>
<!-- END: this line ends content from: inc/body.default.html -->
<!-- START: this line starts content from: inc/header.default.html -->
<p>XXX - fake content until readme2index is working - XXX</p>
<div class="header">
<img src="/temp-test-ioccc/png/ioccc.png" alt="IOCCC image by Matt Zucker" width=300 height=110>
<h1>The International Obfuscated C Code Contest</h1>
<h2>2013/endoh2</h2>
</div>
<hr style="width:50%;text-align:left;margin-left:0">
<!-- END: this line ends content from: inc/header.default.html -->
<!-- START: this line starts content from: inc/topnav.mid.html -->
<!-- Start Nu Html Checker -->
<p><a href="https://validator.w3.org/nu/?doc=https%3A%2F%2Fioccc-src.github.io%2Ftemp-test-ioccc%2F2013%2Fendoh2%2Findex.html">Nu Html check https://ioccc-src.github.io/temp-test-ioccc/2013/endoh2/index.html</a></p>
<!-- End Nu Html Checker -->
<div class="topnav">
<a class="Left" href="../endoh1/index.html">&larr; endoh1</a>
<a class="Left" href="../index.html">&uarr; 2013 &uarr;</a>
<a class="Left" href="../endoh3/index.html">endoh3 &rarr;</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="/temp-test-ioccc/index.html">IOCCC Home</a>
<a href="/temp-test-ioccc/years.html">Winning Entries</a>
<a href="/temp-test-ioccc/winners.html">People who have won</a>
</div>
<hr>
<div class="sidenav">
<a href="/temp-test-ioccc/news.html">IOCCC News</a>
<a href="/temp-test-ioccc/faq.html#submit">How to enter the IOCCC</a>
<a href="/temp-test-ioccc/faq.html">FAQ</a>
</div>
<hr>
<div class="sidenav">
<a href="/temp-test-ioccc/bugs.html">Bugs &amp; (mis)features</a>
<a href="/temp-test-ioccc/faq.html#fix_a_winner">Fixing IOCCC winners</a>
<a href="/temp-test-ioccc/faq.html#fix_web_site">Fixing the web site</a>
<a href="/temp-test-ioccc/faq.html#fix_author">Fixing winner info</a>
<a href="/temp-test-ioccc/thanks-for-help.html">Thanks for the help</a>
</div>
<hr>
<div class="sidenav">
<a href="/temp-test-ioccc/judges.html">The IOCCC Judges</a>
<a href="/temp-test-ioccc/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/gen-author.sh -->
<p><a name="author"><strong>Author:</strong></a> <br><br>Name: <a
href="/temp-test-ioccc/winners.html#Yusuke_Endoh">Yusuke Endoh</a><br>
Location: <a href="/temp-test-ioccc/location.html#JP">JP</a></p>
<!-- END: next line ends content generated by: bin/gen-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></span></code></pre></div>
<h2 id="to-use">To use:</h2>
<div class="sourceCode" id="cb2"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb2-1"><a href="#cb2-1" aria-hidden="true" tabindex="-1"></a><span class="fu">make</span> check</span></code></pre></div>
<p>You’ll need to have both <a href="https://www.ruby-lang.org">Ruby</a>
and <a href="https://imagemagick.org/">ImageMagick</a> installed to run
all the automated checks.</p>
<p>If you do not have both, however, you can still do the below in the
<a href="#try">try</a> section to enjoy the entry. The <a
href="Makefile">Makefile</a> <code>check</code> rule will check if you
have both and if either is not found it will report it and tell you
where to download one or both before exiting.</p>
<h2 id="try">Try:</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="fu">cat</span> jpeg.c</span></code></pre></div>
<p>Next look at <code>jpeg.jpg</code> in an image viewer program.</p>
<h2 id="judges-remarks">Judges’ remarks:</h2>
<p>This is a program which, when fed its own source, generates a program
that almost is its whitespace inverse, which, in its order, generates a
JPEG file (speaking of file size abuse, that is about 16.4 times larger
than a PBM file with the same image, but the source was also abusing the
size counting program…)</p>
<p>Don’t pay attention to the OCR <del>behind the ruby curtain</del> —
it’s a straightforward bitmap comparison.</p>
<h2 id="authors-remarks">Author’s remarks:</h2>
<h3 id="highlights">Highlights</h3>
<ul>
<li>LZ77-like compression for font and template data</li>
<li>tiny JPEG encoder
<ul>
<li>Zig-zag space-filling curve</li>
<li>Discrete cosine transform</li>
<li>JPEG Huffman encoding (cheating)</li>
</ul></li>
</ul>
<h3 id="notes">Notes</h3>
<p>I picked JPEG instead of PNG, GIF, or BMP because it is the most
difficult to generate. I believe that the JPEG encoder is the world’s
smallest ever.</p>
<p>Nevertheless, the program was too big to meet the IOCCC’s size rule.
So I created a smaller bootstrap program that generates the main
program. <code>endoh2.c</code> contains fragments of the main program
<em>as a comment</em> which <code>iocccsize -i</code> does <em>not</em>
count. I gratefully thank the judges for spoiling the size rule this
year.</p>
<p>I think the program will work on any major platforms and
compilers.</p>
<h3 id="legal">Legal</h3>
<p>This program uses (a part of) Proggy Tiny Fonts which is distributed
in MIT License:</p>
<pre><code>Copyright (c) 2004, 2005 Tristan Grimmer
Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the &quot;Software&quot;),
to deal in the Software without restriction, including without limitation
the rights to use, copy, modify, merge, publish, distribute, sublicense,
and/or sell copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED &quot;AS IS&quot;, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.</code></pre>
<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/gen-inventory.sh -->
<h1 id="inventory-for-2013endoh2"><a name="inventory"></a>Inventory for
2013/endoh2</h1>
<h2 id="primary-files">Primary files</h2>
<ul>
<li><a href="index.html">index.html</a> - winner home page</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2013/endoh2/endoh2.c">endoh2.c</a>
- winning source</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2013/endoh2/Makefile">Makefile</a>
- winner Makefile</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2013/endoh2/endoh2.orig.c">endoh2.orig.c</a>
- original source</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2013/endoh2/ocr.rb">ocr.rb</a>
- test suite support file</li>
<li><a href="2013_endoh2.tar.bz2">2013_endoh2.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/2013/endoh2/.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/2013/endoh2/.winner.json">.winner.json</a>
- description of winner in JSON</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2013/endoh2/README.md">README.md</a>
- markdown source for index.html</li>
</ul>
<!-- END: next line ends content generated by: bin/gen-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%2F2013%2Fendoh2%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 -->
+353 -13
View File
@@ -1,4 +1,6 @@
<!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 !!! -->
@@ -6,27 +8,365 @@
<!-- !!! DO NOT MODIFY THIS FILE - This file is generated by a tool !!! -->
<!-- !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<!-- -->
<!-- file: 2013/endoh3/index.html created by: fake.gen_index.sh version: 1.0.5 2023-10-31 -->
<html lang="en">
<!-- END: this line ends content from: inc/top.default.html -->
<!-- -->
<!-- This file was formed by the tool: bin/readme2index.sh version: 1.1 2024-01-16 -->
<!-- -->
<!-- START: this line starts content from: inc/head.default.html -->
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>2013 endoh3</title>
<meta name="description" content="IOCCC year: 2013 IOCCC winner: endoh3 winner index page">
<meta name="keywords" content="IOCCC,2013,endoh3,winner index page">
<link rel="stylesheet" href="/temp-test-ioccc/ioccc.css">
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=yes">
<title>2013/endoh3</title>
<meta name="description" content="2013 IOCCC winner endoh3">
<meta name="keywords" content="IOCCC, 2013, IOCCC 2013, IOCCC winner, endoh3">
</head>
<!-- END: this line ends content from: inc/head.default.html -->
<!-- START: this line starts content from: inc/body.default.html -->
<body>
<h1>2013 endoh3</h1>
<!-- END: this line ends content from: inc/body.default.html -->
<!-- START: this line starts content from: inc/header.default.html -->
<p>XXX - fake content until readme2index is working - XXX</p>
<div class="header">
<img src="/temp-test-ioccc/png/ioccc.png" alt="IOCCC image by Matt Zucker" width=300 height=110>
<h1>The International Obfuscated C Code Contest</h1>
<h2>2013/endoh3</h2>
</div>
<hr style="width:50%;text-align:left;margin-left:0">
<!-- END: this line ends content from: inc/header.default.html -->
<!-- START: this line starts content from: inc/topnav.mid.html -->
<!-- Start Nu Html Checker -->
<p><a href="https://validator.w3.org/nu/?doc=https%3A%2F%2Fioccc-src.github.io%2Ftemp-test-ioccc%2F2013%2Fendoh3%2Findex.html">Nu Html check https://ioccc-src.github.io/temp-test-ioccc/2013/endoh3/index.html</a></p>
<!-- End Nu Html Checker -->
<div class="topnav">
<a class="Left" href="../endoh2/index.html">&larr; endoh2</a>
<a class="Left" href="../index.html">&uarr; 2013 &uarr;</a>
<a class="Left" href="../endoh4/index.html">endoh4 &rarr;</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="/temp-test-ioccc/index.html">IOCCC Home</a>
<a href="/temp-test-ioccc/years.html">Winning Entries</a>
<a href="/temp-test-ioccc/winners.html">People who have won</a>
</div>
<hr>
<div class="sidenav">
<a href="/temp-test-ioccc/news.html">IOCCC News</a>
<a href="/temp-test-ioccc/faq.html#submit">How to enter the IOCCC</a>
<a href="/temp-test-ioccc/faq.html">FAQ</a>
</div>
<hr>
<div class="sidenav">
<a href="/temp-test-ioccc/bugs.html">Bugs &amp; (mis)features</a>
<a href="/temp-test-ioccc/faq.html#fix_a_winner">Fixing IOCCC winners</a>
<a href="/temp-test-ioccc/faq.html#fix_web_site">Fixing the web site</a>
<a href="/temp-test-ioccc/faq.html#fix_author">Fixing winner info</a>
<a href="/temp-test-ioccc/thanks-for-help.html">Thanks for the help</a>
</div>
<hr>
<div class="sidenav">
<a href="/temp-test-ioccc/judges.html">The IOCCC Judges</a>
<a href="/temp-test-ioccc/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/gen-author.sh -->
<p><a name="author"><strong>Author:</strong></a> <br><br>Name: <a
href="/temp-test-ioccc/winners.html#Yusuke_Endoh">Yusuke Endoh</a><br>
Location: <a href="/temp-test-ioccc/location.html#JP">JP</a></p>
<!-- END: next line ends content generated by: bin/gen-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></span></code></pre></div>
<h3 id="bugs-and-misfeatures">Bugs and (Mis)features:</h3>
<p>The current status of this entry is:</p>
<pre><code>STATUS: INABIAF - please **DO NOT** fix</code></pre>
<p>For more detailed information see <a href="/bugs.md#2013-endoh3">2013
endoh3 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">./endoh3</span></span></code></pre></div>
<h2 id="try">Try:</h2>
<p>Trying this out will depend on how your system can play sounds. The
author’s remarks include some options for different operating
systems.</p>
<p>The simplest way is to create a .wav file and have your system play
that.</p>
<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="bu">echo</span> <span class="st">&#39;CDEFGABc&#39;</span> <span class="kw">|</span> <span class="ex">./endoh3</span> <span class="kw">|</span> <span class="ex">ruby</span> wavify.rb <span class="op">&gt;</span> cde.wav</span></code></pre></div>
<p>Observe how you will need ruby installed.</p>
<p>There are also some other musical samples, twinkle.abc and
menuet.abc.</p>
<h2 id="judges-remarks">Judges’ remarks:</h2>
<p>This program can toot out a tune that is small enough to posted to
most social media platforms that have small message length limits.</p>
<p>This endoh3ram can toot out a tune that is small enough.</p>
<h3
id="a-modern-day-2023-note-about-the-award-most-tweetable-1-liner-and-twitter">A
modern day (2023) note about the award ‘Most tweetable 1-liner’ and
twitter:</h3>
<p>The IOCCC no longer endorses the use of what was once twitter, or
whatever it might be called today. We recommend that you pick a
responsible social media platform to post the program’s output on.
Nevertheless the award of this entry will remain the same for historical
purposes.</p>
<h2 id="authors-remarks">Author’s remarks:</h2>
<h3 id="remarks">Remarks</h3>
<p>This is a sound synthesizer for a subset of <a
href="http://en.wikipedia.org/wiki/ABC_notation">ABC music
notation</a>.</p>
<p>Try:</p>
<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">cc</span> <span class="at">-o</span> endoh3 endoh3.c</span>
<span id="cb5-2"><a href="#cb5-2" aria-hidden="true" tabindex="-1"></a><span class="bu">echo</span> <span class="st">&quot;CDEFGABc&quot;</span> <span class="kw">|</span> <span class="ex">./endoh3</span> <span class="op">&gt;</span> /dev/dsp</span></code></pre></div>
<p>If <code>/dev/dsp</code> is not available on your system, use an OSS
sound wrapper such as <code>padsp</code> or <code>aoss</code>:</p>
<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="bu">echo</span> <span class="st">&quot;CDEFGABc&quot;</span> <span class="kw">|</span> <span class="ex">./endoh3</span> <span class="kw">|</span> <span class="ex">padsp</span> tee /dev/dsp <span class="op">&gt;</span> /dev/null</span></code></pre></div>
<p>If you are using Mac OS X, try <a
href="http://sox.sourceforge.net/">sox</a> like so:</p>
<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="bu">echo</span> <span class="st">&quot;CDEFGABc&quot;</span> <span class="kw">|</span> <span class="ex">./endoh3</span> <span class="kw">|</span> <span class="fu">sox</span> <span class="at">-q</span> <span class="at">-traw</span> <span class="at">-r8000</span> <span class="at">-b8</span> <span class="at">-e</span> unsigned-integer <span class="at">-</span> <span class="at">-tcoreaudio</span></span></code></pre></div>
<p>If that does not work, use the attached script to convert the output
into a wave file format:</p>
<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="bu">echo</span> <span class="st">&quot;CDEFGABc&quot;</span> <span class="kw">|</span> <span class="ex">./endoh3</span> <span class="kw">|</span> <span class="ex">ruby</span> wavify.rb <span class="op">&gt;</span> cde.wav</span></code></pre></div>
<p>and play <code>cde.wav</code>.</p>
<p>You can also enjoy some music scores that I attached. With
<code>/dev/dsp</code> you can do so like:</p>
<div class="sourceCode" id="cb9"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb9-1"><a href="#cb9-1" aria-hidden="true" tabindex="-1"></a><span class="fu">cat</span> twinkle.abc <span class="kw">|</span> <span class="ex">./endoh3</span> <span class="op">&gt;</span> /dev/dsp</span>
<span id="cb9-2"><a href="#cb9-2" aria-hidden="true" tabindex="-1"></a><span class="fu">cat</span> menuet.abc <span class="kw">|</span> <span class="ex">./endoh3</span> <span class="op">&gt;</span> /dev/dsp</span></code></pre></div>
<p>but you should be able to modify it a way to meet your system
requirements as described above.</p>
<h3 id="obfuscation">Obfuscation</h3>
<p>The following sequence of questions may be helpful to understand the
<code>endoh3ram</code> program:</p>
<ul>
<li>How does it convert ABC notes into the frequency?</li>
<li>What is <code>89/84.</code>? I found it by using the <a
href="https://en.wikipedia.org/wiki/Stern-Brocot_tree">Stern-Brocot
tree</a>.</li>
<li>How does it generate a wave? Hint: it generates a saw wave.</li>
</ul>
<h3 id="limitation">Limitation</h3>
<p>The following features are supported:</p>
<ul>
<li>Notes:
<ul>
<li><code>C</code> <code>D</code> <code>E</code> <code>F</code>
<code>G</code> <code>A</code> <code>B</code> (in low octave)</li>
<li><code>c</code> <code>d</code> <code>e</code> <code>f</code>
<code>g</code> <code>a</code> <code>b</code> (in high octave)</li>
</ul></li>
<li>Rests: <code>z</code></li>
<li>Note lengths:
<ul>
<li><code>A</code> (an eighth note)</li>
<li><code>A2</code> (a quarter note)</li>
<li><code>A3</code> (a dotted quarter note)</li>
<li><code>A4</code> (a half note)</li>
</ul></li>
</ul>
<p>The following features are <em>NOT</em> supported:</p>
<ul>
<li>Sharp and flat: <code>^C</code> <code>_C</code>
<ul>
<li>But it is possible to emit the half tones. Do you see how?</li>
</ul></li>
<li>Shorter note lengths than 1: <code>C1/2</code>
<ul>
<li>But you can use <code>C0.5</code> instead.</li>
</ul></li>
<li>Higher and lower notes: <code>c'</code> <code>C,</code></li>
<li>Any meta fields: <code>T:title</code> <code>L:1/4</code></li>
<li>Bar line, repeat, ties and slurs, and everything else.</li>
</ul>
<h3 id="known-bugs">Known Bugs</h3>
<p>You can <em>NOT</em> write a note length immediately followed by a
note <code>E</code>, such as <code>C2E2</code>.</p>
<p>Can you figure out why?</p>
<p>A workaround is inserting a whitespace: <code>C2 E2</code>.</p>
<h3 id="portability">Portability</h3>
<p>I tested it on:</p>
<ul>
<li>Ubuntu 13.10 with gcc 4.7.3, clang 3.2, and tcc 0.9.25.</li>
<li>Mac OS X 10.6 with gcc 4.2.1 and clang 1.7.</li>
</ul>
<h3 id="legal">Legal</h3>
<p>I believe that all the scores that I attached are
out-of-copyright.</p>
<p>I did write a score of the Happy Birthday song too. (It does not
matter because the song is out-of-copyright in my country.) But I do not
attach it to protect you from W****r.</p>
<p>For the same reason, do not post a score that contains only
<code>z1092</code>. You know, it is <a
href="http://en.wikipedia.org/wiki/4%E2%80%B233%E2%80%B3">“the famous
song”</a>.</p>
<h3 id="spoiler">Spoiler</h3>
<p>Here is a magical expression which I found by brute-force:</p>
<div class="sourceCode" id="cb10"><pre class="sourceCode c"><code class="sourceCode c"><span id="cb10-1"><a href="#cb10-1" aria-hidden="true" tabindex="-1"></a><span class="op">(</span>c <span class="op">%</span> <span class="dv">32</span> <span class="op">+</span> <span class="dv">5</span><span class="op">)</span> <span class="op">*</span> <span class="dv">9</span> <span class="op">/</span> <span class="dv">5</span> <span class="op">%</span> <span class="dv">13</span> <span class="op">+</span> n <span class="op">/</span> <span class="dv">32</span> <span class="op">*</span> <span class="dv">12</span> <span class="op">-</span> <span class="dv">22</span></span></code></pre></div>
<p>Interestingly, it converts an ASCII number of ABC notes to the
corresponding tone number.</p>
<pre><code>&#39;C&#39; (ASCII 67) =&gt; 3
&#39;D&#39; (ASCII 68) =&gt; 5
&#39;E&#39; (ASCII 69) =&gt; 7
&#39;F&#39; (ASCII 70) =&gt; 9
&#39;G&#39; (ASCII 71) =&gt; 10
&#39;A&#39; (ASCII 65) =&gt; 12
&#39;B&#39; (ASCII 66) =&gt; 14
&#39;c&#39; (ASCII 99) =&gt; 15
&#39;d&#39; (ASCII 100) =&gt; 17
&#39;e&#39; (ASCII 101) =&gt; 19
&#39;f&#39; (ASCII 102) =&gt; 20
&#39;g&#39; (ASCII 103) =&gt; 22
&#39;a&#39; (ASCII 97) =&gt; 24
&#39;b&#39; (ASCII 98) =&gt; 26</code></pre>
<p>By the way, you can write a half-tone by the following
characters.</p>
<pre><code>&#39;K&#39; =&gt; 4 (= C#)
&#39;L&#39; =&gt; 6 (= D#)
&#39;U&#39; =&gt; 8 (= F#)
&#39;V&#39; =&gt; 11 (= G#)
&#39;P&#39; =&gt; 13 (= A#)</code></pre>
<p>Note that the tone numbers simply enumerate the semi-tone steps. So
we can calculate the frequency easily: <code>pow(2, n / 12.0)</code>.
Then, how can we calculate <code>pow</code> without <code>math.h</code>?
<code>pow(2, 1.0 / 12.0)</code> is approximated by <code>89/84.</code>.
(I found this approximation by using the <a
href="http://en.wikipedia.org/wiki/Stern%E2%80%93Brocot_tree">Stern-Brocot
tree</a>.) We can gain the frequency by multiplying the value by
<code>n</code> times.</p>
<p>Finally, the following code generates a saw wave:</p>
<div class="sourceCode" id="cb13"><pre class="sourceCode c"><code class="sourceCode c"><span id="cb13-1"><a href="#cb13-1" aria-hidden="true" tabindex="-1"></a><span class="cf">for</span><span class="op">(</span>c <span class="op">=</span> <span class="dv">0</span><span class="op">;</span> c <span class="op">&lt;</span> len<span class="op">;</span> c<span class="op">++)</span> putchar<span class="op">(</span>a <span class="op">=</span> n <span class="op">*</span> D<span class="op">);</span></span></code></pre></div>
<p>where <code>D</code> is a frequency and <code>a</code> is a variable
whose type is <code>char</code>. By assigning <code>float</code> to
<code>char</code> variable, the implicit type conversion is performed
from <code>float</code> to <code>char</code> (modulo 256).</p>
<p>(Strictly speaking, this behavior is undefined according to 6.3.1.4
in C99; you can replace it with <code>(long)(n*D)</code> if you are
pedantic.)</p>
<p>All that was left was to combine and condense the components. The key
is squashing them into just one <code>for</code>-loop.</p>
<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/gen-inventory.sh -->
<h1 id="inventory-for-2013endoh3"><a name="inventory"></a>Inventory for
2013/endoh3</h1>
<h2 id="primary-files">Primary files</h2>
<ul>
<li><a href="index.html">index.html</a> - winner home page</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2013/endoh3/endoh3.c">endoh3.c</a>
- winning source</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2013/endoh3/Makefile">Makefile</a>
- winner Makefile</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2013/endoh3/endoh3.orig.c">endoh3.orig.c</a>
- original source</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2013/endoh3/flea-waltz.abc">flea-waltz.abc</a>
- sample input</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2013/endoh3/menuet.abc">menuet.abc</a>
- sample input</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2013/endoh3/test.abc">test.abc</a>
- sample input</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2013/endoh3/twinkle.abc">twinkle.abc</a>
- sample input</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2013/endoh3/wavify.rb">wavify.rb</a>
- post process output to form a WAV sound file</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2013/endoh3/yankee.abc">yankee.abc</a>
- sample input</li>
<li><a href="2013_endoh3.tar.bz2">2013_endoh3.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/2013/endoh3/.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/2013/endoh3/.winner.json">.winner.json</a>
- description of winner in JSON</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2013/endoh3/README.md">README.md</a>
- markdown source for index.html</li>
</ul>
<!-- END: next line ends content generated by: bin/gen-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%2F2013%2Fendoh3%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 -->
+703 -13
View File
@@ -1,4 +1,6 @@
<!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 !!! -->
@@ -6,27 +8,715 @@
<!-- !!! DO NOT MODIFY THIS FILE - This file is generated by a tool !!! -->
<!-- !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<!-- -->
<!-- file: 2013/endoh4/index.html created by: fake.gen_index.sh version: 1.0.5 2023-10-31 -->
<html lang="en">
<!-- END: this line ends content from: inc/top.default.html -->
<!-- -->
<!-- This file was formed by the tool: bin/readme2index.sh version: 1.1 2024-01-16 -->
<!-- -->
<!-- START: this line starts content from: inc/head.default.html -->
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>2013 endoh4</title>
<meta name="description" content="IOCCC year: 2013 IOCCC winner: endoh4 winner index page">
<meta name="keywords" content="IOCCC,2013,endoh4,winner index page">
<link rel="stylesheet" href="/temp-test-ioccc/ioccc.css">
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=yes">
<title>2013/endoh4</title>
<meta name="description" content="2013 IOCCC winner endoh4">
<meta name="keywords" content="IOCCC, 2013, IOCCC 2013, IOCCC winner, endoh4">
</head>
<!-- END: this line ends content from: inc/head.default.html -->
<!-- START: this line starts content from: inc/body.default.html -->
<body>
<h1>2013 endoh4</h1>
<!-- END: this line ends content from: inc/body.default.html -->
<!-- START: this line starts content from: inc/header.default.html -->
<p>XXX - fake content until readme2index is working - XXX</p>
<div class="header">
<img src="/temp-test-ioccc/png/ioccc.png" alt="IOCCC image by Matt Zucker" width=300 height=110>
<h1>The International Obfuscated C Code Contest</h1>
<h2>2013/endoh4</h2>
</div>
<hr style="width:50%;text-align:left;margin-left:0">
<!-- END: this line ends content from: inc/header.default.html -->
<!-- START: this line starts content from: inc/topnav.mid.html -->
<!-- Start Nu Html Checker -->
<p><a href="https://validator.w3.org/nu/?doc=https%3A%2F%2Fioccc-src.github.io%2Ftemp-test-ioccc%2F2013%2Fendoh4%2Findex.html">Nu Html check https://ioccc-src.github.io/temp-test-ioccc/2013/endoh4/index.html</a></p>
<!-- End Nu Html Checker -->
<div class="topnav">
<a class="Left" href="../endoh3/index.html">&larr; endoh3</a>
<a class="Left" href="../index.html">&uarr; 2013 &uarr;</a>
<a class="Left" href="../hou/index.html">hou &rarr;</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="/temp-test-ioccc/index.html">IOCCC Home</a>
<a href="/temp-test-ioccc/years.html">Winning Entries</a>
<a href="/temp-test-ioccc/winners.html">People who have won</a>
</div>
<hr>
<div class="sidenav">
<a href="/temp-test-ioccc/news.html">IOCCC News</a>
<a href="/temp-test-ioccc/faq.html#submit">How to enter the IOCCC</a>
<a href="/temp-test-ioccc/faq.html">FAQ</a>
</div>
<hr>
<div class="sidenav">
<a href="/temp-test-ioccc/bugs.html">Bugs &amp; (mis)features</a>
<a href="/temp-test-ioccc/faq.html#fix_a_winner">Fixing IOCCC winners</a>
<a href="/temp-test-ioccc/faq.html#fix_web_site">Fixing the web site</a>
<a href="/temp-test-ioccc/faq.html#fix_author">Fixing winner info</a>
<a href="/temp-test-ioccc/thanks-for-help.html">Thanks for the help</a>
</div>
<hr>
<div class="sidenav">
<a href="/temp-test-ioccc/judges.html">The IOCCC Judges</a>
<a href="/temp-test-ioccc/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/gen-author.sh -->
<p><a name="author"><strong>Author:</strong></a> <br><br>Name: <a
href="/temp-test-ioccc/winners.html#Yusuke_Endoh">Yusuke Endoh</a><br>
Location: <a href="/temp-test-ioccc/location.html#JP">JP</a></p>
<!-- END: next line ends content generated by: bin/gen-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></span></code></pre></div>
<h2 id="to-use">To use:</h2>
<div class="sourceCode" id="cb2"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb2-1"><a href="#cb2-1" aria-hidden="true" tabindex="-1"></a><span class="ex">./endoh4</span> <span class="op">&lt;</span> file</span>
<span id="cb2-2"><a href="#cb2-2" aria-hidden="true" tabindex="-1"></a><span class="ex">./run.sh</span> file</span></code></pre></div>
<p>The second form is preferable as it will temporarily make the cursor
invisible as recommended by the author. If no file is specified in
<code>run.sh</code> command line it will feed to the program <a
href="endoh4.c">endoh4.c</a>.</p>
<h2 id="try">Try:</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">./run.sh</span> cube.txt</span></code></pre></div>
<p>Hit ctrl-c to end the program.</p>
<p>The author recommends the use of xterm.</p>
<p>For an example, if you are a football/soccer fan, try:</p>
<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">./run.sh</span> solids/archimedian-solid/a11-truncated-icosahedron.txt</span></code></pre></div>
<h2 id="judges-remarks">Judges’ remarks:</h2>
<p>This program is formatted as the net for a tetrahedron (hint: try
feeding the program it’s own source code like <code>./run.sh</code>).
When it runs there is an animation for the computation to work out the
convex hull.</p>
<h2 id="authors-remarks">Author’s remarks:</h2>
<h3 id="spec">Spec</h3>
<p>This is a convex polyhedron viewer, which:</p>
<ol type="1">
<li>reads three-dimensional vertices (3N float values) from
<code>stdin</code>,</li>
<li>calculates a convex hull of them, and</li>
<li>renders it.</li>
</ol>
<p>This simple spec involves many details.</p>
<ul>
<li>3D convex hull calculation
<ul>
<li>recursive gift wrapping algorithm</li>
<li>automatic merging of (almost) co-planar faces (i.e., faces are not
triangulated)</li>
<li>random perturbation for robustness</li>
</ul></li>
<li>3D rendering
<ul>
<li>perspective projection</li>
<li>ASCII line drawing: <code>"',;;;,;'"</code></li>
<li>camera in a spherical spiral orbit</li>
</ul></li>
</ul>
<p>(Note that this program does not use <code>math.h</code>.)</p>
<h3 id="portability">Portability</h3>
<p>I think it conforms with both C89 and C99. I confirmed that it worked
on gcc, clang, and tcc. It should not be warned with
<code>-pedantic</code> and <code>-Wextra</code>.</p>
<h3 id="tips">Tips</h3>
<p>You may want to use <code>tput</code> to hide the terminal
cursor.</p>
<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">tput</span> civis</span>
<span id="cb5-2"><a href="#cb5-2" aria-hidden="true" tabindex="-1"></a><span class="ex">./endoh4</span> <span class="op">&lt;</span> cube.txt</span>
<span id="cb5-3"><a href="#cb5-3" aria-hidden="true" tabindex="-1"></a><span class="fu">tput</span> cnorm</span></code></pre></div>
<p>or</p>
<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">./run.sh</span> cube.txt</span></code></pre></div>
<h3 id="bonuses">Bonuses</h3>
<p>You can change the screen size. Let the aspect ratio be about
3:1.</p>
<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="fu">cc</span> <span class="at">-DS</span><span class="op">=</span>120,40 <span class="at">-o</span> endoh4 endoh4.c</span></code></pre></div>
<p>The shape of this code is the geometric net of a regular tetrahedron.
So, try:</p>
<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">./endoh4</span> <span class="op">&lt;</span> endoh4.c <span class="co"># or ./run.sh</span></span></code></pre></div>
<p>The <a href="solids/">solids/</a> directory includes various solid
data:</p>
<ul>
<li><a href="http://en.wikipedia.org/wiki/Platonic_solid">Platonic
solids</a></li>
<li><a href="http://en.wikipedia.org/wiki/Archimedean_solid">Archimedean
solids</a></li>
<li><a
href="http://en.wikipedia.org/wiki/Prism_%28geometry%29">Prisms</a></li>
<li><a href="http://en.wikipedia.org/wiki/Antiprism">Antiprisms</a></li>
<li><a href="http://en.wikipedia.org/wiki/Bipyramid">Bipyramids</a></li>
<li><a
href="http://en.wikipedia.org/wiki/Trapezohedron">Trapezohedrons</a></li>
<li><a href="http://en.wikipedia.org/wiki/Johnson_solid">Johnson
solids</a></li>
</ul>
<p>I created the files by using the POV-Ray scripts (<a
href="http://en.wikipedia.org/wiki/File:Poly.pov">1</a> and <a
href="http://en.wikipedia.org/wiki/User:AndrewKepert/poly.pov">2</a>) in
Wikipedia. They are copyrighted in CC BY-SA 3.0 by “User:Cyp” and
“User:AndrewKepert”.</p>
<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/gen-inventory.sh -->
<h1 id="inventory-for-2013endoh4"><a name="inventory"></a>Inventory for
2013/endoh4</h1>
<h2 id="primary-files">Primary files</h2>
<ul>
<li><a href="index.html">index.html</a> - winner home page</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2013/endoh4/endoh4.c">endoh4.c</a>
- winning source</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2013/endoh4/Makefile">Makefile</a>
- winner Makefile</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2013/endoh4/endoh4.orig.c">endoh4.orig.c</a>
- original source</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2013/endoh4/cube.txt">cube.txt</a>
- 3D object coordinates</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2013/endoh4/try.sh">try.sh</a>
- how to run</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2013/endoh4/solids/antiprism/a04-square-antiprism.txt">solids/antiprism/a04-square-antiprism.txt</a>
- 3D object coordinates</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2013/endoh4/solids/antiprism/a05-pentagonal-antiprism.txt">solids/antiprism/a05-pentagonal-antiprism.txt</a>
- 3D object coordinates</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2013/endoh4/solids/antiprism/a06-hexagonal-antiprism.txt">solids/antiprism/a06-hexagonal-antiprism.txt</a>
- 3D object coordinates</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2013/endoh4/solids/antiprism/a07-heptagonal-antiprism.txt">solids/antiprism/a07-heptagonal-antiprism.txt</a>
- 3D object coordinates</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2013/endoh4/solids/antiprism/a08-octagonal-antiprism.txt">solids/antiprism/a08-octagonal-antiprism.txt</a>
- 3D object coordinates</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2013/endoh4/solids/antiprism/a09-enneagonal-antiprism.txt">solids/antiprism/a09-enneagonal-antiprism.txt</a>
- 3D object coordinates</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2013/endoh4/solids/antiprism/a10-decagonal-antiprism.txt">solids/antiprism/a10-decagonal-antiprism.txt</a>
- 3D object coordinates</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2013/endoh4/solids/archimedian-solid/a01-cuboctahedron.txt">solids/archimedian-solid/a01-cuboctahedron.txt</a>
- 3D object coordinates</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2013/endoh4/solids/archimedian-solid/a02-great-rhombicosidodecahedron.txt">solids/archimedian-solid/a02-great-rhombicosidodecahedron.txt</a>
- 3D object coordinates</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2013/endoh4/solids/archimedian-solid/a03-great-rhombicuboctahedron.txt">solids/archimedian-solid/a03-great-rhombicuboctahedron.txt</a>
- 3D object coordinates</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2013/endoh4/solids/archimedian-solid/a04-icosidodecahedron.txt">solids/archimedian-solid/a04-icosidodecahedron.txt</a>
- 3D object coordinates</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2013/endoh4/solids/archimedian-solid/a05-small-rhombicosidodecahedron.txt">solids/archimedian-solid/a05-small-rhombicosidodecahedron.txt</a>
- 3D object coordinates</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2013/endoh4/solids/archimedian-solid/a06-small-rhombicuboctahedron.txt">solids/archimedian-solid/a06-small-rhombicuboctahedron.txt</a>
- 3D object coordinates</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2013/endoh4/solids/archimedian-solid/a07-snub-cube.txt">solids/archimedian-solid/a07-snub-cube.txt</a>
- 3D object coordinates</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2013/endoh4/solids/archimedian-solid/a08-snub-dodecahedron.txt">solids/archimedian-solid/a08-snub-dodecahedron.txt</a>
- 3D object coordinates</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2013/endoh4/solids/archimedian-solid/a09-truncated-cube.txt">solids/archimedian-solid/a09-truncated-cube.txt</a>
- 3D object coordinates</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2013/endoh4/solids/archimedian-solid/a10-truncated-dodecahedron.txt">solids/archimedian-solid/a10-truncated-dodecahedron.txt</a>
- 3D object coordinates</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2013/endoh4/solids/archimedian-solid/a11-truncated-icosahedron.txt">solids/archimedian-solid/a11-truncated-icosahedron.txt</a>
- 3D object coordinates</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2013/endoh4/solids/archimedian-solid/a12-truncated-octahedron.txt">solids/archimedian-solid/a12-truncated-octahedron.txt</a>
- 3D object coordinates</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2013/endoh4/solids/archimedian-solid/a13-truncated-tetrahedron.txt">solids/archimedian-solid/a13-truncated-tetrahedron.txt</a>
- 3D object coordinates</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2013/endoh4/solids/bipyramid/b06-hexagonal-bipyramid.txt">solids/bipyramid/b06-hexagonal-bipyramid.txt</a>
- 3D object coordinates</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2013/endoh4/solids/bipyramid/b07-heptagonal-bipyramid.txt">solids/bipyramid/b07-heptagonal-bipyramid.txt</a>
- 3D object coordinates</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2013/endoh4/solids/bipyramid/b08-octagonal-bipyramid.txt">solids/bipyramid/b08-octagonal-bipyramid.txt</a>
- 3D object coordinates</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2013/endoh4/solids/bipyramid/b09-enneagonal-bipyramid.txt">solids/bipyramid/b09-enneagonal-bipyramid.txt</a>
- 3D object coordinates</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2013/endoh4/solids/bipyramid/b10-decagonal-bipyramid.txt">solids/bipyramid/b10-decagonal-bipyramid.txt</a>
- 3D object coordinates</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2013/endoh4/solids/catalan-solid/c01-rhombic-dodecahedron.txt">solids/catalan-solid/c01-rhombic-dodecahedron.txt</a>
- 3D object coordinates</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2013/endoh4/solids/catalan-solid/c02-disdyakis-triacontahedron.txt">solids/catalan-solid/c02-disdyakis-triacontahedron.txt</a>
- 3D object coordinates</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2013/endoh4/solids/catalan-solid/c03-disdyakis-dodecahedron.txt">solids/catalan-solid/c03-disdyakis-dodecahedron.txt</a>
- 3D object coordinates</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2013/endoh4/solids/catalan-solid/c04-rhombic-triacontahedron.txt">solids/catalan-solid/c04-rhombic-triacontahedron.txt</a>
- 3D object coordinates</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2013/endoh4/solids/catalan-solid/c05-deltoidal-hexecontahedron.txt">solids/catalan-solid/c05-deltoidal-hexecontahedron.txt</a>
- 3D object coordinates</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2013/endoh4/solids/catalan-solid/c06-deltoidal-icositetrahedron.txt">solids/catalan-solid/c06-deltoidal-icositetrahedron.txt</a>
- 3D object coordinates</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2013/endoh4/solids/catalan-solid/c07-pentagonal-icositetrahedron.txt">solids/catalan-solid/c07-pentagonal-icositetrahedron.txt</a>
- 3D object coordinates</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2013/endoh4/solids/catalan-solid/c08-pentagonal-hexecontahedron.txt">solids/catalan-solid/c08-pentagonal-hexecontahedron.txt</a>
- 3D object coordinates</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2013/endoh4/solids/catalan-solid/c09-small-triakis-octahedron.txt">solids/catalan-solid/c09-small-triakis-octahedron.txt</a>
- 3D object coordinates</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2013/endoh4/solids/catalan-solid/c10-triakis-icosahedron.txt">solids/catalan-solid/c10-triakis-icosahedron.txt</a>
- 3D object coordinates</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2013/endoh4/solids/catalan-solid/c11-pentakis-dodecahedron.txt">solids/catalan-solid/c11-pentakis-dodecahedron.txt</a>
- 3D object coordinates</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2013/endoh4/solids/catalan-solid/c12-tetrakis-hexahedron.txt">solids/catalan-solid/c12-tetrakis-hexahedron.txt</a>
- 3D object coordinates</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2013/endoh4/solids/catalan-solid/c13-triakis-tetrahedron.txt">solids/catalan-solid/c13-triakis-tetrahedron.txt</a>
- 3D object coordinates</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2013/endoh4/solids/johnson-solid/j01-square-pyramid.txt">solids/johnson-solid/j01-square-pyramid.txt</a>
- 3D object coordinates</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2013/endoh4/solids/johnson-solid/j02-pentagonal-pyramid.txt">solids/johnson-solid/j02-pentagonal-pyramid.txt</a>
- 3D object coordinates</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2013/endoh4/solids/johnson-solid/j03-triangular-cupola.txt">solids/johnson-solid/j03-triangular-cupola.txt</a>
- 3D object coordinates</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2013/endoh4/solids/johnson-solid/j04-square-cupola.txt">solids/johnson-solid/j04-square-cupola.txt</a>
- 3D object coordinates</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2013/endoh4/solids/johnson-solid/j05-pentagonal-cupola.txt">solids/johnson-solid/j05-pentagonal-cupola.txt</a>
- 3D object coordinates</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2013/endoh4/solids/johnson-solid/j06-pentagonal-rotunda.txt">solids/johnson-solid/j06-pentagonal-rotunda.txt</a>
- 3D object coordinates</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2013/endoh4/solids/johnson-solid/j07-elongated-triangular-pyramid.txt">solids/johnson-solid/j07-elongated-triangular-pyramid.txt</a>
- 3D object coordinates</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2013/endoh4/solids/johnson-solid/j08-elongated-square-pyramid.txt">solids/johnson-solid/j08-elongated-square-pyramid.txt</a>
- 3D object coordinates</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2013/endoh4/solids/johnson-solid/j09-elongated-pentagonal-pyramid.txt">solids/johnson-solid/j09-elongated-pentagonal-pyramid.txt</a>
- 3D object coordinates</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2013/endoh4/solids/johnson-solid/j10-gyroelongated-square-pyramid.txt">solids/johnson-solid/j10-gyroelongated-square-pyramid.txt</a>
- 3D object coordinates</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2013/endoh4/solids/johnson-solid/j11-gyroelongated-pentagonal-pyramid.txt">solids/johnson-solid/j11-gyroelongated-pentagonal-pyramid.txt</a>
- 3D object coordinates</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2013/endoh4/solids/johnson-solid/j12-triangular-dipyramid.txt">solids/johnson-solid/j12-triangular-dipyramid.txt</a>
- 3D object coordinates</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2013/endoh4/solids/johnson-solid/j13-pentagonal-dipyramid.txt">solids/johnson-solid/j13-pentagonal-dipyramid.txt</a>
- 3D object coordinates</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2013/endoh4/solids/johnson-solid/j14-elongated-triangular-dipyramid.txt">solids/johnson-solid/j14-elongated-triangular-dipyramid.txt</a>
- 3D object coordinates</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2013/endoh4/solids/johnson-solid/j15-elongated-square-dipyramid.txt">solids/johnson-solid/j15-elongated-square-dipyramid.txt</a>
- 3D object coordinates</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2013/endoh4/solids/johnson-solid/j16-elongated-pentagonal-dipyramid.txt">solids/johnson-solid/j16-elongated-pentagonal-dipyramid.txt</a>
- 3D object coordinates</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2013/endoh4/solids/johnson-solid/j17-gyroelongated-square-dipyramid.txt">solids/johnson-solid/j17-gyroelongated-square-dipyramid.txt</a>
- 3D object coordinates</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2013/endoh4/solids/johnson-solid/j18-elongated-triangular-cupola.txt">solids/johnson-solid/j18-elongated-triangular-cupola.txt</a>
- 3D object coordinates</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2013/endoh4/solids/johnson-solid/j19-elongated-square-cupola.txt">solids/johnson-solid/j19-elongated-square-cupola.txt</a>
- 3D object coordinates</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2013/endoh4/solids/johnson-solid/j20-elongated-pentagonal-cupola.txt">solids/johnson-solid/j20-elongated-pentagonal-cupola.txt</a>
- 3D object coordinates</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2013/endoh4/solids/johnson-solid/j21-elongated-pentagonal-rotunda.txt">solids/johnson-solid/j21-elongated-pentagonal-rotunda.txt</a>
- 3D object coordinates</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2013/endoh4/solids/johnson-solid/j22-gyroelongated-triangular-cupola.txt">solids/johnson-solid/j22-gyroelongated-triangular-cupola.txt</a>
- 3D object coordinates</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2013/endoh4/solids/johnson-solid/j23-gyroelongated-square-cupola.txt">solids/johnson-solid/j23-gyroelongated-square-cupola.txt</a>
- 3D object coordinates</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2013/endoh4/solids/johnson-solid/j24-gyroelongated-pentagonal-cupola.txt">solids/johnson-solid/j24-gyroelongated-pentagonal-cupola.txt</a>
- 3D object coordinates</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2013/endoh4/solids/johnson-solid/j25-gyroelongated-pentagonal-rotunda.txt">solids/johnson-solid/j25-gyroelongated-pentagonal-rotunda.txt</a>
- 3D object coordinates</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2013/endoh4/solids/johnson-solid/j26-gyrobifastigium.txt">solids/johnson-solid/j26-gyrobifastigium.txt</a>
- 3D object coordinates</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2013/endoh4/solids/johnson-solid/j27-triangular-orthobicupola.txt">solids/johnson-solid/j27-triangular-orthobicupola.txt</a>
- 3D object coordinates</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2013/endoh4/solids/johnson-solid/j28-square-orthobicupola.txt">solids/johnson-solid/j28-square-orthobicupola.txt</a>
- 3D object coordinates</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2013/endoh4/solids/johnson-solid/j29-square-gyrobicupola.txt">solids/johnson-solid/j29-square-gyrobicupola.txt</a>
- 3D object coordinates</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2013/endoh4/solids/johnson-solid/j30-pentagonal-orthobicupola.txt">solids/johnson-solid/j30-pentagonal-orthobicupola.txt</a>
- 3D object coordinates</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2013/endoh4/solids/johnson-solid/j31-pentagonal-gyrobicupola.txt">solids/johnson-solid/j31-pentagonal-gyrobicupola.txt</a>
- 3D object coordinates</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2013/endoh4/solids/johnson-solid/j32-pentagonal-orthocupolarotunda.txt">solids/johnson-solid/j32-pentagonal-orthocupolarotunda.txt</a>
- 3D object coordinates</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2013/endoh4/solids/johnson-solid/j33-pentagonal-gyrocupolarotunda.txt">solids/johnson-solid/j33-pentagonal-gyrocupolarotunda.txt</a>
- 3D object coordinates</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2013/endoh4/solids/johnson-solid/j34-pentagonal-orthobirotunda.txt">solids/johnson-solid/j34-pentagonal-orthobirotunda.txt</a>
- 3D object coordinates</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2013/endoh4/solids/johnson-solid/j35-elongated-triangular-orthobicupola.txt">solids/johnson-solid/j35-elongated-triangular-orthobicupola.txt</a>
- 3D object coordinates</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2013/endoh4/solids/johnson-solid/j36-elongated-triangular-gyrobicupola.txt">solids/johnson-solid/j36-elongated-triangular-gyrobicupola.txt</a>
- 3D object coordinates</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2013/endoh4/solids/johnson-solid/j37-elongated-square-gyrobicupola.txt">solids/johnson-solid/j37-elongated-square-gyrobicupola.txt</a>
- 3D object coordinates</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2013/endoh4/solids/johnson-solid/j38-elongated-pentagonal-orthobicupola.txt">solids/johnson-solid/j38-elongated-pentagonal-orthobicupola.txt</a>
- 3D object coordinates</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2013/endoh4/solids/johnson-solid/j39-elongated-pentagonal-gyrobicupola.txt">solids/johnson-solid/j39-elongated-pentagonal-gyrobicupola.txt</a>
- 3D object coordinates</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2013/endoh4/solids/johnson-solid/j40-elongated-pentagonal-orthocupolarotunda.txt">solids/johnson-solid/j40-elongated-pentagonal-orthocupolarotunda.txt</a>
- 3D object coordinates</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2013/endoh4/solids/johnson-solid/j41-elongated-pentagonal-gyrocupolarotunda.txt">solids/johnson-solid/j41-elongated-pentagonal-gyrocupolarotunda.txt</a>
- 3D object coordinates</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2013/endoh4/solids/johnson-solid/j42-elongated-pentagonal-orthobirotunda.txt">solids/johnson-solid/j42-elongated-pentagonal-orthobirotunda.txt</a>
- 3D object coordinates</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2013/endoh4/solids/johnson-solid/j43-elongated-pentagonal-gyrobirotunda.txt">solids/johnson-solid/j43-elongated-pentagonal-gyrobirotunda.txt</a>
- 3D object coordinates</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2013/endoh4/solids/johnson-solid/j44-gyroelongated-triangular-bicupola.txt">solids/johnson-solid/j44-gyroelongated-triangular-bicupola.txt</a>
- 3D object coordinates</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2013/endoh4/solids/johnson-solid/j45-gyroelongated-square-bicupola.txt">solids/johnson-solid/j45-gyroelongated-square-bicupola.txt</a>
- 3D object coordinates</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2013/endoh4/solids/johnson-solid/j46-gyroelongated-pentagonal-bicupola.txt">solids/johnson-solid/j46-gyroelongated-pentagonal-bicupola.txt</a>
- 3D object coordinates</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2013/endoh4/solids/johnson-solid/j47-gyroelongated-pentagonal-cupolarotunda.txt">solids/johnson-solid/j47-gyroelongated-pentagonal-cupolarotunda.txt</a>
- 3D object coordinates</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2013/endoh4/solids/johnson-solid/j48-gyroelongated-pentagonal-birotunda.txt">solids/johnson-solid/j48-gyroelongated-pentagonal-birotunda.txt</a>
- 3D object coordinates</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2013/endoh4/solids/johnson-solid/j49-augmented-triangular-prism.txt">solids/johnson-solid/j49-augmented-triangular-prism.txt</a>
- 3D object coordinates</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2013/endoh4/solids/johnson-solid/j50-biaugmented-triangular-prism.txt">solids/johnson-solid/j50-biaugmented-triangular-prism.txt</a>
- 3D object coordinates</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2013/endoh4/solids/johnson-solid/j51-triaugmented-triangular-prism.txt">solids/johnson-solid/j51-triaugmented-triangular-prism.txt</a>
- 3D object coordinates</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2013/endoh4/solids/johnson-solid/j52-augmented-pentagonal-prism.txt">solids/johnson-solid/j52-augmented-pentagonal-prism.txt</a>
- 3D object coordinates</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2013/endoh4/solids/johnson-solid/j53-biaugmented-pentagonal-prism.txt">solids/johnson-solid/j53-biaugmented-pentagonal-prism.txt</a>
- 3D object coordinates</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2013/endoh4/solids/johnson-solid/j54-augmented-hexagonal-prism.txt">solids/johnson-solid/j54-augmented-hexagonal-prism.txt</a>
- 3D object coordinates</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2013/endoh4/solids/johnson-solid/j55-parabiaugmented-hexagonal-prism.txt">solids/johnson-solid/j55-parabiaugmented-hexagonal-prism.txt</a>
- 3D object coordinates</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2013/endoh4/solids/johnson-solid/j56-metabiaugmented-hexagonal-prism.txt">solids/johnson-solid/j56-metabiaugmented-hexagonal-prism.txt</a>
- 3D object coordinates</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2013/endoh4/solids/johnson-solid/j57-triaugmented-hexagonal-prism.txt">solids/johnson-solid/j57-triaugmented-hexagonal-prism.txt</a>
- 3D object coordinates</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2013/endoh4/solids/johnson-solid/j58-augmented-dodecahedron.txt">solids/johnson-solid/j58-augmented-dodecahedron.txt</a>
- 3D object coordinates</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2013/endoh4/solids/johnson-solid/j59-parabiaugmented-dodecahedron.txt">solids/johnson-solid/j59-parabiaugmented-dodecahedron.txt</a>
- 3D object coordinates</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2013/endoh4/solids/johnson-solid/j60-metabiaugmented-dodecahedron.txt">solids/johnson-solid/j60-metabiaugmented-dodecahedron.txt</a>
- 3D object coordinates</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2013/endoh4/solids/johnson-solid/j61-triaugmented-dodecahedron.txt">solids/johnson-solid/j61-triaugmented-dodecahedron.txt</a>
- 3D object coordinates</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2013/endoh4/solids/johnson-solid/j62-metabidiminished-icosahedron.txt">solids/johnson-solid/j62-metabidiminished-icosahedron.txt</a>
- 3D object coordinates</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2013/endoh4/solids/johnson-solid/j63-tridiminished-icosahedron.txt">solids/johnson-solid/j63-tridiminished-icosahedron.txt</a>
- 3D object coordinates</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2013/endoh4/solids/johnson-solid/j64-augmented-tridiminished-icosahedron.txt">solids/johnson-solid/j64-augmented-tridiminished-icosahedron.txt</a>
- 3D object coordinates</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2013/endoh4/solids/johnson-solid/j65-augmented-truncated-tetrahedron.txt">solids/johnson-solid/j65-augmented-truncated-tetrahedron.txt</a>
- 3D object coordinates</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2013/endoh4/solids/johnson-solid/j66-augmented-truncated-cube.txt">solids/johnson-solid/j66-augmented-truncated-cube.txt</a>
- 3D object coordinates</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2013/endoh4/solids/johnson-solid/j67-biaugmented-truncated-cube.txt">solids/johnson-solid/j67-biaugmented-truncated-cube.txt</a>
- 3D object coordinates</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2013/endoh4/solids/johnson-solid/j68-augmented-truncated-dodecahedron.txt">solids/johnson-solid/j68-augmented-truncated-dodecahedron.txt</a>
- 3D object coordinates</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2013/endoh4/solids/johnson-solid/j69-parabiaugmented-truncated-dodecahedron.txt">solids/johnson-solid/j69-parabiaugmented-truncated-dodecahedron.txt</a>
- 3D object coordinates</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2013/endoh4/solids/johnson-solid/j70-metabiaugmented-truncated-dodecahedron.txt">solids/johnson-solid/j70-metabiaugmented-truncated-dodecahedron.txt</a>
- 3D object coordinates</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2013/endoh4/solids/johnson-solid/j71-triaugmented-truncated-dodecahedron.txt">solids/johnson-solid/j71-triaugmented-truncated-dodecahedron.txt</a>
- 3D object coordinates</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2013/endoh4/solids/johnson-solid/j72-gyrate-rhombicosidodecahedron.txt">solids/johnson-solid/j72-gyrate-rhombicosidodecahedron.txt</a>
- 3D object coordinates</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2013/endoh4/solids/johnson-solid/j73-parabigyrate-rhombicosidodecahedron.txt">solids/johnson-solid/j73-parabigyrate-rhombicosidodecahedron.txt</a>
- 3D object coordinates</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2013/endoh4/solids/johnson-solid/j74-metabigyrate-rhombicosidodecahedron.txt">solids/johnson-solid/j74-metabigyrate-rhombicosidodecahedron.txt</a>
- 3D object coordinates</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2013/endoh4/solids/johnson-solid/j75-trigyrate-rhombicosidodecahedron.txt">solids/johnson-solid/j75-trigyrate-rhombicosidodecahedron.txt</a>
- 3D object coordinates</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2013/endoh4/solids/johnson-solid/j76-diminished-rhombicosidodecahedron.txt">solids/johnson-solid/j76-diminished-rhombicosidodecahedron.txt</a>
- 3D object coordinates</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2013/endoh4/solids/johnson-solid/j77-paragyrate-diminished-rhombicosidodecahedron.txt">solids/johnson-solid/j77-paragyrate-diminished-rhombicosidodecahedron.txt</a>
- 3D object coordinates</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2013/endoh4/solids/johnson-solid/j78-metagyrate-diminished-rhombicosidodecahedron.txt">solids/johnson-solid/j78-metagyrate-diminished-rhombicosidodecahedron.txt</a>
- 3D object coordinates</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2013/endoh4/solids/johnson-solid/j79-bigyrate-diminished-rhombicosidodecahedron.txt">solids/johnson-solid/j79-bigyrate-diminished-rhombicosidodecahedron.txt</a>
- 3D object coordinates</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2013/endoh4/solids/johnson-solid/j80-parabidiminished-rhombicosidodecahedron.txt">solids/johnson-solid/j80-parabidiminished-rhombicosidodecahedron.txt</a>
- 3D object coordinates</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2013/endoh4/solids/johnson-solid/j81-metabidiminished-rhombicosidodecahedron.txt">solids/johnson-solid/j81-metabidiminished-rhombicosidodecahedron.txt</a>
- 3D object coordinates</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2013/endoh4/solids/johnson-solid/j82-gyrate-bidiminished-rhombicosidodecahedron.txt">solids/johnson-solid/j82-gyrate-bidiminished-rhombicosidodecahedron.txt</a>
- 3D object coordinates</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2013/endoh4/solids/johnson-solid/j83-tridiminished-rhombicosidodecahedron.txt">solids/johnson-solid/j83-tridiminished-rhombicosidodecahedron.txt</a>
- 3D object coordinates</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2013/endoh4/solids/johnson-solid/j84-snub-disphenoid.txt">solids/johnson-solid/j84-snub-disphenoid.txt</a>
- 3D object coordinates</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2013/endoh4/solids/johnson-solid/j85-snub-square-antiprism.txt">solids/johnson-solid/j85-snub-square-antiprism.txt</a>
- 3D object coordinates</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2013/endoh4/solids/johnson-solid/j86-sphenocorona.txt">solids/johnson-solid/j86-sphenocorona.txt</a>
- 3D object coordinates</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2013/endoh4/solids/johnson-solid/j87-augmented-sphenocorona.txt">solids/johnson-solid/j87-augmented-sphenocorona.txt</a>
- 3D object coordinates</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2013/endoh4/solids/johnson-solid/j88-sphenomegacorona.txt">solids/johnson-solid/j88-sphenomegacorona.txt</a>
- 3D object coordinates</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2013/endoh4/solids/johnson-solid/j89-hebesphenomegacorona.txt">solids/johnson-solid/j89-hebesphenomegacorona.txt</a>
- 3D object coordinates</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2013/endoh4/solids/johnson-solid/j90-disphenocingulum.txt">solids/johnson-solid/j90-disphenocingulum.txt</a>
- 3D object coordinates</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2013/endoh4/solids/johnson-solid/j91-bilunabirotunda.txt">solids/johnson-solid/j91-bilunabirotunda.txt</a>
- 3D object coordinates</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2013/endoh4/solids/johnson-solid/j92-triangular-hebesphenorotunda.txt">solids/johnson-solid/j92-triangular-hebesphenorotunda.txt</a>
- 3D object coordinates</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2013/endoh4/solids/platonic-solid/p01-tetrahedron.txt">solids/platonic-solid/p01-tetrahedron.txt</a>
- 3D object coordinates</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2013/endoh4/solids/platonic-solid/p02-cube.txt">solids/platonic-solid/p02-cube.txt</a>
- 3D object coordinates</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2013/endoh4/solids/platonic-solid/p03-octahedron.txt">solids/platonic-solid/p03-octahedron.txt</a>
- 3D object coordinates</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2013/endoh4/solids/platonic-solid/p04-dodecahedron.txt">solids/platonic-solid/p04-dodecahedron.txt</a>
- 3D object coordinates</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2013/endoh4/solids/platonic-solid/p05-icosahedron.txt">solids/platonic-solid/p05-icosahedron.txt</a>
- 3D object coordinates</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2013/endoh4/solids/prism/p03-triangular-prism.txt">solids/prism/p03-triangular-prism.txt</a>
- 3D object coordinates</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2013/endoh4/solids/prism/p05-pentagonal-prism.txt">solids/prism/p05-pentagonal-prism.txt</a>
- 3D object coordinates</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2013/endoh4/solids/prism/p06-hexagonal-prism.txt">solids/prism/p06-hexagonal-prism.txt</a>
- 3D object coordinates</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2013/endoh4/solids/prism/p07-heptagonal-prism.txt">solids/prism/p07-heptagonal-prism.txt</a>
- 3D object coordinates</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2013/endoh4/solids/prism/p08-octagonal-prism.txt">solids/prism/p08-octagonal-prism.txt</a>
- 3D object coordinates</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2013/endoh4/solids/prism/p09-enneagonal-prism.txt">solids/prism/p09-enneagonal-prism.txt</a>
- 3D object coordinates</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2013/endoh4/solids/prism/p10-decagonal-prism.txt">solids/prism/p10-decagonal-prism.txt</a>
- 3D object coordinates</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2013/endoh4/solids/trapezohedron/t04-tetragonal-trapezohedron.txt">solids/trapezohedron/t04-tetragonal-trapezohedron.txt</a>
- 3D object coordinates</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2013/endoh4/solids/trapezohedron/t05-pentagonal-trapezohedron.txt">solids/trapezohedron/t05-pentagonal-trapezohedron.txt</a>
- 3D object coordinates</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2013/endoh4/solids/trapezohedron/t06-hexagonal-trapezohedron.txt">solids/trapezohedron/t06-hexagonal-trapezohedron.txt</a>
- 3D object coordinates</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2013/endoh4/solids/trapezohedron/t08-octagonal-trapezohedron.txt">solids/trapezohedron/t08-octagonal-trapezohedron.txt</a>
- 3D object coordinates</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2013/endoh4/solids/trapezohedron/t10-decagonal-trapezohedron.txt">solids/trapezohedron/t10-decagonal-trapezohedron.txt</a>
- 3D object coordinates</li>
<li><a href="2013_endoh4.tar.bz2">2013_endoh4.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/2013/endoh4/.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/2013/endoh4/.winner.json">.winner.json</a>
- description of winner in JSON</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2013/endoh4/README.md">README.md</a>
- markdown source for index.html</li>
</ul>
<!-- END: next line ends content generated by: bin/gen-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%2F2013%2Fendoh4%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 -->
+423 -13
View File
@@ -1,4 +1,6 @@
<!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 !!! -->
@@ -6,27 +8,435 @@
<!-- !!! DO NOT MODIFY THIS FILE - This file is generated by a tool !!! -->
<!-- !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<!-- -->
<!-- file: 2013/hou/index.html created by: fake.gen_index.sh version: 1.0.5 2023-10-31 -->
<html lang="en">
<!-- END: this line ends content from: inc/top.default.html -->
<!-- -->
<!-- This file was formed by the tool: bin/readme2index.sh version: 1.1 2024-01-16 -->
<!-- -->
<!-- START: this line starts content from: inc/head.default.html -->
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>2013 hou</title>
<meta name="description" content="IOCCC year: 2013 IOCCC winner: hou winner index page">
<meta name="keywords" content="IOCCC,2013,hou,winner index page">
<link rel="stylesheet" href="/temp-test-ioccc/ioccc.css">
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=yes">
<title>2013/hou</title>
<meta name="description" content="2013 IOCCC winner hou">
<meta name="keywords" content="IOCCC, 2013, IOCCC 2013, IOCCC winner, hou">
</head>
<!-- END: this line ends content from: inc/head.default.html -->
<!-- START: this line starts content from: inc/body.default.html -->
<body>
<h1>2013 hou</h1>
<!-- END: this line ends content from: inc/body.default.html -->
<!-- START: this line starts content from: inc/header.default.html -->
<p>XXX - fake content until readme2index is working - XXX</p>
<div class="header">
<img src="/temp-test-ioccc/png/ioccc.png" alt="IOCCC image by Matt Zucker" width=300 height=110>
<h1>The International Obfuscated C Code Contest</h1>
<h2>2013/hou</h2>
</div>
<hr style="width:50%;text-align:left;margin-left:0">
<!-- END: this line ends content from: inc/header.default.html -->
<!-- START: this line starts content from: inc/topnav.mid.html -->
<!-- Start Nu Html Checker -->
<p><a href="https://validator.w3.org/nu/?doc=https%3A%2F%2Fioccc-src.github.io%2Ftemp-test-ioccc%2F2013%2Fhou%2Findex.html">Nu Html check https://ioccc-src.github.io/temp-test-ioccc/2013/hou/index.html</a></p>
<!-- End Nu Html Checker -->
<div class="topnav">
<a class="Left" href="../endoh4/index.html">&larr; endoh4</a>
<a class="Left" href="../index.html">&uarr; 2013 &uarr;</a>
<a class="Left" href="../mills/index.html">mills &rarr;</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="/temp-test-ioccc/index.html">IOCCC Home</a>
<a href="/temp-test-ioccc/years.html">Winning Entries</a>
<a href="/temp-test-ioccc/winners.html">People who have won</a>
</div>
<hr>
<div class="sidenav">
<a href="/temp-test-ioccc/news.html">IOCCC News</a>
<a href="/temp-test-ioccc/faq.html#submit">How to enter the IOCCC</a>
<a href="/temp-test-ioccc/faq.html">FAQ</a>
</div>
<hr>
<div class="sidenav">
<a href="/temp-test-ioccc/bugs.html">Bugs &amp; (mis)features</a>
<a href="/temp-test-ioccc/faq.html#fix_a_winner">Fixing IOCCC winners</a>
<a href="/temp-test-ioccc/faq.html#fix_web_site">Fixing the web site</a>
<a href="/temp-test-ioccc/faq.html#fix_author">Fixing winner info</a>
<a href="/temp-test-ioccc/thanks-for-help.html">Thanks for the help</a>
</div>
<hr>
<div class="sidenav">
<a href="/temp-test-ioccc/judges.html">The IOCCC Judges</a>
<a href="/temp-test-ioccc/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/gen-author.sh -->
<p><a name="author"><strong>Author:</strong></a> <br><br>Name: <a
href="/temp-test-ioccc/winners.html#Qiming_HOU">Qiming HOU</a><br>
Location: <a href="/temp-test-ioccc/location.html#CN">CN</a></p>
<!-- END: next line ends content generated by: bin/gen-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>
<h3 id="bugs-and-misfeatures">Bugs and (Mis)features:</h3>
<p>The current status of this entry is:</p>
<pre><code>STATUS: INABIAF - please **DO NOT** fix</code></pre>
<p>For more detailed information see <a href="/bugs.md#2013-hou">2013
hou 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">./hou</span> <span class="pp">[</span><span class="ss">scene</span><span class="pp">-</span><span class="ss">file</span><span class="pp">-</span><span class="ss">name</span><span class="pp">]</span> <span class="pp">[</span><span class="ss">options</span><span class="pp">]</span></span></code></pre></div>
<p>Follow the instructions in <code>stdout</code>, preferably with an
auto-refreshing PPM image viewer ready. Refresh the image every time the
output refreshes, all effects should be more or less recognizable when
you see 16.</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">./hou</span> BIG</span>
<span id="cb4-2"><a href="#cb4-2" aria-hidden="true" tabindex="-1"></a><span class="ex">./hou</span> old_default.scene BIG</span>
<span id="cb4-3"><a href="#cb4-3" aria-hidden="true" tabindex="-1"></a><span class="ex">./hou</span> otherroom.scene</span>
<span id="cb4-4"><a href="#cb4-4" aria-hidden="true" tabindex="-1"></a><span class="ex">./hou</span> otherroom.scene NAIVE</span></code></pre></div>
<p>Try opening the file and then let the program run a while and every
so often reopen the file, to see how it changes. The author suggests
that you leave the program running overnight to see what happens. If
however you do not have all night :-) then the following JPEG files
should show you what happens with some of the invocations above:</p>
<figure>
<img src="luna.jpg" alt="./hou BIG - Luna" />
<figcaption aria-hidden="true">./hou BIG - Luna</figcaption>
</figure>
<figure>
<img src="old_default.jpg"
alt="./hou old_default.scene - Old default" />
<figcaption aria-hidden="true">./hou old_default.scene - Old
default</figcaption>
</figure>
<figure>
<img src="otherroom.jpg" alt="./hou otherroom.scene - Other room" />
<figcaption aria-hidden="true">./hou otherroom.scene - Other
room</figcaption>
</figure>
<p>This program does not terminate by itself: you must kill
<code>hou</code> (but not Qiming Hou :-) ) in order to end the
program.</p>
<h2 id="judges-remarks">Judges’ remarks:</h2>
<p>You could consider that this program violates the source code size
limit. This is because the first compilation of this program is really
just a decompressor to generate the real source code of the program.</p>
<p>This program will loop infinitely while progressively refining a <a
href="https://en.wikipedia.org/wiki/Ray_tracing_(graphics)">raytraced</a>
image.</p>
<p>NOTE: the author refers to <a href="a.c">a.c</a>, placed in a gzipped
file <code>a.c.gz</code>. We do not include it but it can be generated
like:</p>
<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">cc</span> <span class="at">-Wall</span> hou.c <span class="at">-o</span> hou <span class="at">-lm</span></span>
<span id="cb5-2"><a href="#cb5-2" aria-hidden="true" tabindex="-1"></a><span class="ex">./hou</span> <span class="op">&gt;</span> a.c</span></code></pre></div>
<p>but there is no need to do this as the Makefile takes care of it
without even needing to create a temporary file.</p>
<h2 id="authors-remarks">Author’s remarks:</h2>
<h3 id="using-hou">Using hou</h3>
<p>This program is a programmable rendering engine with a built-in
default scene. The standard command line is:</p>
<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">./hou</span> <span class="pp">[</span><span class="ss">scene</span><span class="pp">-</span><span class="ss">file</span><span class="pp">-</span><span class="ss">name</span><span class="pp">]</span> <span class="pp">[</span><span class="ss">options</span><span class="pp">]</span></span></code></pre></div>
<p>As <code>hou</code> runs, it writes a progressively refining image to
a ppm file specified in the scene. The initialization may take a while,
but once it’s done, a rough preview should be available in seconds.
Leave <code>hou</code> running for the night, and you get a high quality
result like the attached <code>*.jpg</code> files. Kill <code>hou</code>
manually after you’re satisfied with the image quality.</p>
<p>To save time and energy for the judges, rendered images for all
provided scenes are provided as attached files.</p>
<h3 id="features">Features</h3>
<ul>
<li>Fully programmable: Almost every stage of the renderer is
programmable with a shader, i.e., a short script that does something
rendering-related. In particular, each scene consists of one or more
geometry shaders, a camera shader, and one or more material shaders.
Shaders are written in an interpreted language that supports basic
arithmetic, a few math functions, variables and procedural calls in the
CPS (Continuation Passing Style).</li>
<li>Fast preview: This renderer isn’t just a naive path tracer, it
actually uses a modern global illumination algorithm which is robust
against challenging scene configurations. You can mostly place light
sources and specify surface properties as you please without worrying
too much about the convergence speed; you always get a nice fast preview
within one or two minutes. As proof, there is a comparison:
<code>./hou otherroom.scene</code> gives a rough idea about the overall
illumination at 16 samples per pixel (i.e., when the program prints 16),
whereas the naive approach <code>./hou otherroom.scene NAIVE</code> only
produces a mess of white dots.</li>
<li>Rich visual effects: The algorithm samples all light path types so
most physically based effects can be produced. The default scene
demonstrates quite a few of them: reflection, area light, soft shadows,
color bleeding, caustics, and depth-of-field blur. Of course, one can
also get programmable-shading effects like procedural texturing and
approximated Fresnel terms.</li>
<li>Accelerated ray tracing: The ray tracing part uses an algorithm
better than the brute-force intersection of everything. The renderer
even builds an acceleration data structure! Despite the double precision
and the single-threadedness, it still runs at about 0.5 million rays per
second on the author’s machine.</li>
<li>Pause and resume: Can’t run <code>./hou</code> overnight? No
problem! You can kill and resume a rendering session whenever you want.
The renderer automatically saves the progress every 16 samples and
resumes where it’s left off when restarted. Also, each scene/parameter
combination gets a different saved session so you don’t have to worry
about conflicts.</li>
</ul>
<h3 id="abuse-of-the-rules">Abuse of the rules</h3>
<ul>
<li><a href="hou.c">hou.c</a> uses compression to get around the size
limit. The compression fully complies with the rules and the guidelines
(at least the portion that shows up in <code>grep</code> “size limit”).
Please see the <a href="self-imposed-restrictions">Self-imposed
restrictions</a> section below for more details.</li>
<li><code>hou</code> does not terminate (as suggested by the second line
of rule 6).</li>
</ul>
<h3 id="self-imposed-restrictions">Self-imposed restrictions</h3>
<ul>
<li>The building process does not involve any OS tool beyond
<code>cc(1)</code> and <code>make(1)</code>. No <code>gzip(1)</code>
compression! <code>a.c.gz</code> doesn’t fit in 2053 bytes, anyway.</li>
<li>Neither <a href="hou.c">hou.c</a> nor <a href="a.c">a.c</a> (the
<em>real</em> decompressed source) uses <code>#define</code> (or
<code>cc -D</code>) at all.</li>
<li>The source code is not required at runtime.</li>
<li><a href="a.c">a.c</a> does not drop optional features to reduce
size. There are pure optimization code that can be dropped without
affecting the converged output (only affecting the ray tracing speed /
convergence rate). All files are properly <code>fopen()</code>ed with
<code>"rb"</code> / <code>"wb"</code> for Windows compatibility. The PPM
header has a comment line for non-standard-compliant viewers
(specifically, my old HDRShop 1.0). And there is a nice text message
saying “please wait…”. Despite the messy look, <a href="a.c">a.c</a> and
<a href="hou.c">hou.c</a> compile warning-free (<a
href="hou.c">hou.c</a> even wastes 18 bytes on
<code>#include&lt;stdio.h&gt;</code> just for <code>putchar(3)</code>).
<a href="a.c">a.c</a> compiles mostly clean in the C99/ANSI modes of
clang and gcc (with <code>-Wall --pedantic</code>). The only warning
generated is a pedantic one:
<code>"string constant too long"</code>.</li>
</ul>
<h3 id="comments-and-why-obfuscated">Comments and why obfuscated</h3>
<ul>
<li>Both the compression and the rendering use mathematically involved
algorithms. Understanding the C doesn’t help much if one isn’t familiar
with the math.</li>
<li>Modern renderers provide shader access to just about any internal
state. This one follows suit and reuses the same shader-accessible array
for all important internal states.</li>
<li>Infinity and NaN (not-a-number) are used during normal course of
execution.</li>
<li>Previous image-generating entries may take care to hide the “IOCCC”
string in the code, but they leave the text clear in the
<em>result</em>. This entry takes it further and obfuscates the output
image as well. Can you find the text in the image? Hint: look up.</li>
<li><a href="a.c">a.c</a> leaves all shaders in plain text, but the
plain text shader code can’t be taken for its face value; the arithmetic
rules subtly diverge from our common sense.</li>
<li><a href="a.c">a.c</a> is less portable than <a
href="hou.c">hou.c</a> itself. <a href="hou.c">hou.c</a> only depends on
ASCII and should run just fine on 16-bit, small memory, or
floating-point-incapable machines. <a href="a.c">a.c</a>, while still
reasonably portable, is quite memory consuming, requires
IEEE754-compliant <code>double</code>, and assumes <code>int</code> to
be 32-bits.</li>
<li>Though technically endian-dependent, <a href="a.c">a.c</a> remains
portable providing that one doesn’t copy saved sessions across different
endianness.</li>
</ul>
<h3 id="spoiler">Spoiler</h3>
<pre><code> 3225 3225 3225 9 9 3225 3225
1 1 1 1 1 1 1 1 1 1
4225 1226 1 1 1 1 1222 1226
1 1 1 1 1 1 1 1 1
4226 1 4226 8 4222 4226 1 1</code></pre>
<p>The program consists of a recursive-descent interpreter, a
<code>3DDDA</code> (3D Discrete Differential Analysis) ray tracer, a
<code>PSSMLT</code> (Primary Sample Space Metropolis Light Transport)
light path sampler, all squeezed into the size limit using a
<code>PPM</code> compressor (Prediction by Partial Matching, and yes,
the output format is chosen for the pun..).</p>
<p><code>PSSMLT</code> uses the Metropolis-Hasting algorithm to sample a
32D unit hypercube. Each point in the hypercube is interpreted as a
sequence of random numbers, and is sent to a path tracer to generate a
light path. The point’s Metropolis-Hasting energy is then defined as the
corresponding path’s contribution value to the final image. Since each
path is sampled with a probability proportional to its energy, the
sample distribution directly corresponds to the final image, which can
then be produced as a simple per-pixel histogram of all generated paths.
The robustness comes from a state mutation strategy that actively tries
to explore the neighborhood of high energy peaks (e.g. paths that happen
to hit the light source in <a
href="otherroom.scene">otherroom.scene</a>). In addition, a rudimentary
form of lens path stratification is added to balance the attention each
pixel receives. The Metropolis-Hasting process completely avoids the
tell-tale pixel sampling loop required in most other image generation
methods.</p>
<p>The <code>3DDDA</code> tracer is chosen for scalability: its
performance doesn’t get much worse as scene complexity increases.
Another benefit is that with the <code>DDA</code> code in place one can
naturally use hierarchical grids as an acceleration structure. The
downside, of course, is that the setup involves quite a few divisions,
which naturally turns into divisions-by-zero. Fortunately, the IEEE754
standard has a nice set of rules just for this purpose and the
arithmetics are organized in a specific way to take advantage of this.
The shader interpreter component is relatively straightforward, just an
expression evaluator stripped to the bare minimum – it doesn’t even
support numerical constants natively. A final little bit is a
just-good-enough PRNG (Pseudo Random Number Generator) to replace the
low precision Windows <code>rand()</code> and the non-C99 Unix
<code>drand48(3)</code>. An overnight session would run through its
short period many times, but that doesn’t necessarily map to the same
set of paths in <code>PSSMLT</code>. After all, Metropolis-Hasting used
an even worse PRNG in their 1953 paper.</p>
<p>The <code>PPM</code> compressor uses statically weighted fixed order
contexts with an arithmetic encoder tweaked for <a
href="../iocccsize.c">iocccsize.c</a>. The encoder emits octet-space
pairs where each octet encodes ~6.5 bits of information and each space
encodes 2 bits (thanks to the generous definition of “space” in <a
href="../iocccsize.c">iocccsize.c</a>). The compressor actively shuffles
the variable names around until the compressed string happens to contain
enough <code>{};</code>s to pass the final <a
href="../iocccsize.c">iocccsize.c</a> test. There are a few other
tweaks:</p>
<ul>
<li><p>The <code>PPM</code> model uses mostly whitespace characters for
weights.</p></li>
<li><p>The encoder never emits <code>'"'</code> and
<code>'\\'</code>.</p></li>
<li><p>The decoder uses an O(n^2) algorithm to avoid the gigabytes-sized
hash table frequently found in other <code>PPM</code>
implementations.</p></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/gen-inventory.sh -->
<h1 id="inventory-for-2013hou"><a name="inventory"></a>Inventory for
2013/hou</h1>
<h2 id="primary-files">Primary files</h2>
<ul>
<li><a href="index.html">index.html</a> - winner home page</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2013/hou/hou.c">hou.c</a>
- winning source</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2013/hou/Makefile">Makefile</a>
- winner Makefile</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2013/hou/hou.orig.c">hou.orig.c</a>
- original source</li>
<li><a href="doc/example.html">doc/example.html</a> - detailed
information about entry</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2013/hou/old_default.scene">old_default.scene</a>
- sample input</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2013/hou/otherroom.scene">otherroom.scene</a>
- sample input</li>
<li><a href="luna.jpg">luna.jpg</a> - sample image data</li>
<li><a href="old_default.jpg">old_default.jpg</a> - sample image
data</li>
<li><a href="otherroom.jpg">otherroom.jpg</a> - sample image data</li>
<li><a href="2013_hou.tar.bz2">2013_hou.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/2013/hou/.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/2013/hou/.winner.json">.winner.json</a>
- description of winner in JSON</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2013/hou/README.md">README.md</a>
- markdown source for index.html</li>
<li><a href="doc/camera.png">doc/camera.png</a> - documentation support
image</li>
<li><a href="doc/cosine.png">doc/cosine.png</a> - documentation support
image</li>
<li><a href="doc/draft.png">doc/draft.png</a> - documentation support
image</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2013/hou/doc/example.md">doc/example.md</a>
- markdown source for doc/example.html</li>
</ul>
<!-- END: next line ends content generated by: bin/gen-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%2F2013%2Fhou%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 -->
+273 -13
View File
@@ -1,4 +1,6 @@
<!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 !!! -->
@@ -6,27 +8,285 @@
<!-- !!! DO NOT MODIFY THIS FILE - This file is generated by a tool !!! -->
<!-- !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<!-- -->
<!-- file: 2013/mills/index.html created by: fake.gen_index.sh version: 1.0.5 2023-10-31 -->
<html lang="en">
<!-- END: this line ends content from: inc/top.default.html -->
<!-- -->
<!-- This file was formed by the tool: bin/readme2index.sh version: 1.1 2024-01-16 -->
<!-- -->
<!-- START: this line starts content from: inc/head.default.html -->
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>2013 mills</title>
<meta name="description" content="IOCCC year: 2013 IOCCC winner: mills winner index page">
<meta name="keywords" content="IOCCC,2013,mills,winner index page">
<link rel="stylesheet" href="/temp-test-ioccc/ioccc.css">
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=yes">
<title>2013/mills</title>
<meta name="description" content="2013 IOCCC winner mills">
<meta name="keywords" content="IOCCC, 2013, IOCCC 2013, IOCCC winner, mills">
</head>
<!-- END: this line ends content from: inc/head.default.html -->
<!-- START: this line starts content from: inc/body.default.html -->
<body>
<h1>2013 mills</h1>
<!-- END: this line ends content from: inc/body.default.html -->
<!-- START: this line starts content from: inc/header.default.html -->
<p>XXX - fake content until readme2index is working - XXX</p>
<div class="header">
<img src="/temp-test-ioccc/png/ioccc.png" alt="IOCCC image by Matt Zucker" width=300 height=110>
<h1>The International Obfuscated C Code Contest</h1>
<h2>2013/mills</h2>
</div>
<hr style="width:50%;text-align:left;margin-left:0">
<!-- END: this line ends content from: inc/header.default.html -->
<!-- START: this line starts content from: inc/topnav.mid.html -->
<!-- Start Nu Html Checker -->
<p><a href="https://validator.w3.org/nu/?doc=https%3A%2F%2Fioccc-src.github.io%2Ftemp-test-ioccc%2F2013%2Fmills%2Findex.html">Nu Html check https://ioccc-src.github.io/temp-test-ioccc/2013/mills/index.html</a></p>
<!-- End Nu Html Checker -->
<div class="topnav">
<a class="Left" href="../hou/index.html">&larr; hou</a>
<a class="Left" href="../index.html">&uarr; 2013 &uarr;</a>
<a class="Left" href="../misaka/index.html">misaka &rarr;</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="/temp-test-ioccc/index.html">IOCCC Home</a>
<a href="/temp-test-ioccc/years.html">Winning Entries</a>
<a href="/temp-test-ioccc/winners.html">People who have won</a>
</div>
<hr>
<div class="sidenav">
<a href="/temp-test-ioccc/news.html">IOCCC News</a>
<a href="/temp-test-ioccc/faq.html#submit">How to enter the IOCCC</a>
<a href="/temp-test-ioccc/faq.html">FAQ</a>
</div>
<hr>
<div class="sidenav">
<a href="/temp-test-ioccc/bugs.html">Bugs &amp; (mis)features</a>
<a href="/temp-test-ioccc/faq.html#fix_a_winner">Fixing IOCCC winners</a>
<a href="/temp-test-ioccc/faq.html#fix_web_site">Fixing the web site</a>
<a href="/temp-test-ioccc/faq.html#fix_author">Fixing winner info</a>
<a href="/temp-test-ioccc/thanks-for-help.html">Thanks for the help</a>
</div>
<hr>
<div class="sidenav">
<a href="/temp-test-ioccc/judges.html">The IOCCC Judges</a>
<a href="/temp-test-ioccc/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/gen-author.sh -->
<p><a name="author"><strong>Author:</strong></a> <br><br>Name: <a
href="/temp-test-ioccc/winners.html#Christopher_Mills">Christopher
Mills</a><br> Location: <a
href="/temp-test-ioccc/location.html#US">US</a></p>
<!-- END: next line ends content generated by: bin/gen-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></span></code></pre></div>
<h3 id="bugs-and-misfeatures">Bugs and (Mis)features:</h3>
<p>The current status of this entry is:</p>
<pre><code>STATUS: INABIAF - please **DO NOT** fix</code></pre>
<p>For more detailed information see <a href="/bugs.md#2013-mills">2013
mills 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">./mills</span></span></code></pre></div>
<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">./mills</span> <span class="kw">&amp;</span></span></code></pre></div>
<p>While that is running, point your favorite browser at: <a
href="http://localhost:8224">http://localhost:8224</a>.</p>
<h2 id="judges-remarks">Judges’ remarks:</h2>
<p>Who will be the first to post an image rendered during a
leap-second?</p>
<h2 id="authors-remarks">Author’s remarks:</h2>
<h3 id="the-program">The Program</h3>
<p>This program is a handy graphical clock. Simply run the program,
click <em>OK</em> to any annoying security dialog that pop up (aren’t
those annoying?), then fire up your web browser and type in the
following URL: <a href="http://localhost:8224"
class="uri">http://localhost:8224</a>.</p>
<p>You will soon be presented with a lovely dynamically rendered 3D
scene that also conveniently tells you the current time!</p>
<h3 id="usage-notes">Usage Notes</h3>
<p>The program will continue to give you the time of day as it changes
by reloading the page as often as it can render. If you grow tired of
watching your life slip by, hit <code>Control-C</code> in the original
window. Note that if you want to restart the program again, you should
wait a minute or two before doing so. For details as to why this is
necessary, feel free to Google <code>"TIME_WAIT"</code>,
<code>"SO_REUSEADDR"</code> and <code>"SO_REUSEPORT"</code> (with the
quotes). And while you are there, click on an ad. They could use the
money.</p>
<p>It would be possible to fix this by adding</p>
<div class="sourceCode" id="cb5"><pre class="sourceCode c"><code class="sourceCode c"><span id="cb5-1"><a href="#cb5-1" aria-hidden="true" tabindex="-1"></a>n<span class="op">=</span><span class="dv">1</span><span class="op">,</span>setsockopt<span class="op">(</span>s<span class="op">,</span>SOL_SOCKET<span class="op">,</span>SO_REUSEADDR<span class="op">,&amp;</span>n<span class="op">,</span><span class="kw">sizeof</span> n<span class="op">),</span></span></code></pre></div>
<p>at an appropriate spot in the code (an exercise left to the reader).
However, as this limitation is documented, it is not technically a
bug.</p>
<h3 id="details-of-operation">Details of Operation</h3>
<p>The program wears many hats (not literally). It is</p>
<ul>
<li>a web server</li>
<li>a PNG encoder</li>
<li>a ray tracer</li>
<li>a clock</li>
</ul>
<p>It replies to web requests with a PNG image that uses the <a
href="http://en.wikipedia.org/wiki/Adam7_algorithm">Adam7</a> encoding
to return data progressively. Since the data is returned in Adam7
format, the scene is displayed initially at a lower resolution and
allowed to be progressively refined as time goes on. The ray tracer is
integrally tied to the PNG encoder, casting rays in the Adam7 order. The
web server uses PNG primarily because of PNG’s ability to return data
progressively, and not as you might think it being because the PNG
standard is so obfuscated as to require both little and big-endian
encodings at different spec layers.</p>
<p>Since ray-tracing was an obvious choice to return to a web server, I
needed something to ray-trace. A static scene would be uninteresting. I
took inspiration (as I often do) from the IOCCC remarks file which
says</p>
<blockquote>
<p>At least one judge prefers to maintain the use of the leap-second as
part of the world’s time standard.</p>
</blockquote>
<p>Then it was obvious; the code should display the time. It is believed
(but not confirmed) that the code will, in fact, display leap seconds
correctly.</p>
<p>To display the time, of course we would need a font. This font is
encoded as a string, using only the C whitespace characters. Clearly,
the judges intended this use of whitespace for data compression, since
their tool doesn’t count whitespace in strings differently than
whitespace outside of them.</p>
<h3 id="user-modifiable-features">User-modifiable Features</h3>
<p>The code can be user-modified simply by changing the build command
line. The following symbols are defined in the <a
href="Makefile">Makefile</a>:</p>
<ul>
<li><p><code>-DLT=x1,y1,z1,x2,y2,z2,...</code> defines the coordinates
of the lights in the scene. It should be a comma-separated list of
coordinates <code>(x, y, z)</code>, three per light.</p></li>
<li><p><code>-DNL=n</code> defines the number of lights. It should be
equal to the length of the list above (three times the number of
lights).</p></li>
<li><p><code>-DEY=x,y,z</code> defines the position of the viewer (the
eye point) for the scene. The eye is looking at the origin
<code>(0, 0, 0)</code>.</p></li>
</ul>
<h3 id="other-build-flags">Other Build Flags</h3>
<p>The original program bound the server to <code>INADDR_ANY</code> to
allow everyone to experience the server’s output. The Judges suggested
that I instead restrict the bind to <code>INADDR_LOOPBACK</code> to
reduce security alarms. As a compliant veteran of innumerable post-ship
late feature additions, I have modified the <a
href="Makefile">Makefile</a> to inject the new code without destroying
the beautiful spherical symmetry of the source code. In addition, I have
altered the word <code>sin_port</code> to the more family-friendly
version <code>win_port</code> (via
<code>-Dwin_port="sin_addr.s_addr=htonl(2130706433),R.sin_port"</code>)
to protect against curious impressionable youth trying to learn about
sockets on the Internet.</p>
<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/gen-inventory.sh -->
<h1 id="inventory-for-2013mills"><a name="inventory"></a>Inventory for
2013/mills</h1>
<h2 id="primary-files">Primary files</h2>
<ul>
<li><a href="index.html">index.html</a> - winner home page</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2013/mills/mills.c">mills.c</a>
- winning source</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2013/mills/Makefile">Makefile</a>
- winner Makefile</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2013/mills/mills.orig.c">mills.orig.c</a>
- original source</li>
<li><a href="2013_mills.tar.bz2">2013_mills.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/2013/mills/.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/2013/mills/.winner.json">.winner.json</a>
- description of winner in JSON</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2013/mills/README.md">README.md</a>
- markdown source for index.html</li>
</ul>
<!-- END: next line ends content generated by: bin/gen-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%2F2013%2Fmills%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 -->
+382 -13
View File
@@ -1,4 +1,6 @@
<!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 !!! -->
@@ -6,27 +8,394 @@
<!-- !!! DO NOT MODIFY THIS FILE - This file is generated by a tool !!! -->
<!-- !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<!-- -->
<!-- file: 2013/misaka/index.html created by: fake.gen_index.sh version: 1.0.5 2023-10-31 -->
<html lang="en">
<!-- END: this line ends content from: inc/top.default.html -->
<!-- -->
<!-- This file was formed by the tool: bin/readme2index.sh version: 1.1 2024-01-16 -->
<!-- -->
<!-- START: this line starts content from: inc/head.default.html -->
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>2013 misaka</title>
<meta name="description" content="IOCCC year: 2013 IOCCC winner: misaka winner index page">
<meta name="keywords" content="IOCCC,2013,misaka,winner index page">
<link rel="stylesheet" href="/temp-test-ioccc/ioccc.css">
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=yes">
<title>2013/misaka</title>
<meta name="description" content="2013 IOCCC winner misaka">
<meta name="keywords" content="IOCCC, 2013, IOCCC 2013, IOCCC winner, misaka">
</head>
<!-- END: this line ends content from: inc/head.default.html -->
<!-- START: this line starts content from: inc/body.default.html -->
<body>
<h1>2013 misaka</h1>
<!-- END: this line ends content from: inc/body.default.html -->
<!-- START: this line starts content from: inc/header.default.html -->
<p>XXX - fake content until readme2index is working - XXX</p>
<div class="header">
<img src="/temp-test-ioccc/png/ioccc.png" alt="IOCCC image by Matt Zucker" width=300 height=110>
<h1>The International Obfuscated C Code Contest</h1>
<h2>2013/misaka</h2>
</div>
<hr style="width:50%;text-align:left;margin-left:0">
<!-- END: this line ends content from: inc/header.default.html -->
<!-- START: this line starts content from: inc/topnav.mid.html -->
<!-- Start Nu Html Checker -->
<p><a href="https://validator.w3.org/nu/?doc=https%3A%2F%2Fioccc-src.github.io%2Ftemp-test-ioccc%2F2013%2Fmisaka%2Findex.html">Nu Html check https://ioccc-src.github.io/temp-test-ioccc/2013/misaka/index.html</a></p>
<!-- End Nu Html Checker -->
<div class="topnav">
<a class="Left" href="../mills/index.html">&larr; mills</a>
<a class="Left" href="../index.html">&uarr; 2013 &uarr;</a>
<a class="Left" href="../morgan1/index.html">morgan1 &rarr;</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="/temp-test-ioccc/index.html">IOCCC Home</a>
<a href="/temp-test-ioccc/years.html">Winning Entries</a>
<a href="/temp-test-ioccc/winners.html">People who have won</a>
</div>
<hr>
<div class="sidenav">
<a href="/temp-test-ioccc/news.html">IOCCC News</a>
<a href="/temp-test-ioccc/faq.html#submit">How to enter the IOCCC</a>
<a href="/temp-test-ioccc/faq.html">FAQ</a>
</div>
<hr>
<div class="sidenav">
<a href="/temp-test-ioccc/bugs.html">Bugs &amp; (mis)features</a>
<a href="/temp-test-ioccc/faq.html#fix_a_winner">Fixing IOCCC winners</a>
<a href="/temp-test-ioccc/faq.html#fix_web_site">Fixing the web site</a>
<a href="/temp-test-ioccc/faq.html#fix_author">Fixing winner info</a>
<a href="/temp-test-ioccc/thanks-for-help.html">Thanks for the help</a>
</div>
<hr>
<div class="sidenav">
<a href="/temp-test-ioccc/judges.html">The IOCCC Judges</a>
<a href="/temp-test-ioccc/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/gen-author.sh -->
<p><a name="author"><strong>Author:</strong></a> <br><br>Name: <a
href="/temp-test-ioccc/winners.html#Don_Yang">Don Yang</a><br> Location:
<a href="/temp-test-ioccc/location.html#US">US</a></p>
<!-- END: next line ends content generated by: bin/gen-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></span></code></pre></div>
<p>This will build a bunch of versions of the code. See the author’s
details for information on all of these builds.</p>
<h2 id="to-use">To use:</h2>
<div class="sourceCode" id="cb2"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb2-1"><a href="#cb2-1" aria-hidden="true" tabindex="-1"></a><span class="ex">./horizontal_cat</span> <span class="pp">[</span><span class="ss">files...</span><span class="pp">]</span> <span class="op">&gt;</span> <span class="pp">[</span><span class="ss">output</span><span class="pp">]</span></span>
<span id="cb2-2"><a href="#cb2-2" aria-hidden="true" tabindex="-1"></a><span class="ex">./vertical_cat</span> <span class="pp">[</span><span class="ss">files...</span><span class="pp">]</span> <span class="op">&gt;</span> <span class="pp">[</span><span class="ss">output</span><span class="pp">]</span></span></code></pre></div>
<h2 id="try">Try:</h2>
<p>To understand the various intermediate source files that are built,
try:</p>
<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="fu">make</span> understanding</span></code></pre></div>
<p>Also try:</p>
<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.sh</span></span></code></pre></div>
<p>NOTE: Use - for standard input. For example:</p>
<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="ex">./vertical_cat</span> <span class="at">-</span> <span class="at">-</span></span></code></pre></div>
<h2 id="judges-remarks">Judges’ remarks:</h2>
<p>There is more to cat than <a
href="http://cheezburger.com/1680494336">mere cats</a>. Be they tall,
fat, long or squat, this source code is sure to amuse.</p>
<h4 id="slight-diversion">Slight diversion</h4>
<p>While one of the judges was reviewing this entry on the stern of the
<a
href="http://www.noble-caledonia.co.uk/information/detail.asp?id=2&amp;spid=76">Island
Sky</a> in the middle of the Atlantic Ocean waiting for the <a
href="http://en.wikipedia.org/wiki/Solar_eclipse_of_November_3,_2013">total
solar eclipse of 2013</a> the judge was struck by a <a
href="http://en.wikipedia.org/wiki/Flying_fish">flying fish</a>. While
the result of the impact was that the <a
href="http://en.wikipedia.org/wiki/Port_wine">Port</a> from Portugal was
lost, the <a
href="https://web.archive.org/web/20130702003043/http://www.travelforpassion.com/grog-factory-cape-verde-santo-antao-cape-verde-1602-photo">Grog</a>
from Cape Verde and the laptop containing this entry was saved.</p>
<p>While I’m sure most <a
href="https://rationalwiki.org/wiki/Fun:Cat">cats</a> would have
preferred otherwise, the flying fish was returned to <em>swim with the
fishes</em>. :-) No <a
href="https://rationalwiki.org/wiki/Fun:Cat">cats</a> were harmed in the
process of judging this entry.</p>
<h2 id="authors-remarks">Author’s remarks:</h2>
<h3 id="overview">Overview</h3>
<p><code>Misaka</code> is a file concatenation utility, with at least
two modes of operation:</p>
<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="fu">cc</span> misaka.c <span class="at">-o</span> horizontal_cat</span>
<span id="cb6-2"><a href="#cb6-2" aria-hidden="true" tabindex="-1"></a><span class="ex">./horizontal_cat</span> <span class="pp">[</span><span class="ss">files...</span><span class="pp">]</span> <span class="op">&gt;</span> <span class="pp">[</span><span class="ss">output</span><span class="pp">]</span></span>
<span id="cb6-3"><a href="#cb6-3" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb6-4"><a href="#cb6-4" aria-hidden="true" tabindex="-1"></a><span class="ex">./horizontal_cat</span> misaka.c misaka.c <span class="op">&gt;</span> misaka2.c</span>
<span id="cb6-5"><a href="#cb6-5" aria-hidden="true" tabindex="-1"></a><span class="fu">cc</span> misaka2.c <span class="at">-o</span> vertical_cat</span>
<span id="cb6-6"><a href="#cb6-6" aria-hidden="true" tabindex="-1"></a><span class="ex">./vertical_cat</span> <span class="pp">[</span><span class="ss">files...</span><span class="pp">]</span> <span class="op">&gt;</span> <span class="pp">[</span><span class="ss">output</span><span class="pp">]</span></span></code></pre></div>
<p>Where <code>[files...]</code> is a list of text file names. Use
<code>-</code> to read from <code>stdin</code>.</p>
<h3 id="details">Details</h3>
<h3 id="horizontal-cat">Horizontal cat</h3>
<p>One of my favorite unix utilities is <code>cat</code>. The best thing
about it was that it was named “<a
href="https://rationalwiki.org/wiki/Fun:Cat">cat</a>”. That, and it’s
useful for quickly showing contents of a file. Though it was primary
meant for concatenating files, that function only seem to work if I
wanted to concatenate files vertically.</p>
<p>I thought the lack of horizontal concatenation must have been an
oversight, so I implemented this utility:</p>
<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="fu">cc</span> misaka.c <span class="at">-o</span> horizontal_cat</span>
<span id="cb7-2"><a href="#cb7-2" aria-hidden="true" tabindex="-1"></a><span class="ex">./horizontal_cat</span> files...</span></code></pre></div>
<p><code>horizontal_cat</code> concatenates files horizontally and write
the output to <code>stdout</code>. Each input file is padded with spaces
on the right so that the original text alignments are preserved.</p>
<p>If <code>-</code> is specified as a file name,
<code>horizontal_cat</code> will read from <code>stdin</code>. Unlike
<code>cat</code>, <code>horizontal_cat</code> loads all input to memory
first. Thus you can specify <code>-</code> multiple times to get
<code>stdin</code> multiplied horizontally. For example, if you have
<code>seq(1)</code> in your shell, you can add line numbers to both
sides of <a href="misaka.c">misaka.c</a> like this:</p>
<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="fu">seq</span> <span class="at">-f</span> <span class="st">&#39; %.0f &#39;</span> 45 <span class="kw">|</span> <span class="ex">./horizontal_cat</span> <span class="at">-</span> misaka.c <span class="at">-</span></span></code></pre></div>
<h3 id="vertical-cat">Vertical cat</h3>
<p>Because <code>horizontal_cat</code> must know the maximum width of
all files before writing any output, all files must be processed at
least twice. To support <code>stdin</code>, file must be buffered to
memory. This lead to the feature that <code>horizontal_cat</code> can be
used to duplicate <code>stdin</code>.</p>
<p>Seems like the <code>stdin</code> doubling feature might be useful
even for concatenating files vertically, so I included a vertical mode.
But supporting vertical mode with command line options would be no fun.
Instead, vertical mode is enabled by concatenating the source code
horizontally:</p>
<div class="sourceCode" id="cb9"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb9-1"><a href="#cb9-1" aria-hidden="true" tabindex="-1"></a><span class="ex">./horizontal_cat</span> misaka.c misaka.c <span class="op">&gt;</span> misaka2.c</span>
<span id="cb9-2"><a href="#cb9-2" aria-hidden="true" tabindex="-1"></a><span class="fu">gcc</span> misaka2.c <span class="at">-o</span> vertical_cat</span>
<span id="cb9-3"><a href="#cb9-3" aria-hidden="true" tabindex="-1"></a><span class="ex">./vertical_cat</span> files...</span></code></pre></div>
<p><code>vertical_cat</code> works more or less like <code>cat</code>,
except you can use <code>vertical_cat</code> to duplicate
<code>stdin</code>:</p>
<div class="sourceCode" id="cb10"><pre
class="sourceCode sh"><code class="sourceCode bash"><span id="cb10-1"><a href="#cb10-1" aria-hidden="true" tabindex="-1"></a><span class="ex">./vertical_cat</span> <span class="at">-</span> <span class="at">-</span></span></code></pre></div>
<h3 id="long-cat">Long cat</h3>
<p>After <code>horizontal_cat</code> and <code>vertical_cat</code>, I
thought, maybe all I really wanted was just more <a
href="https://rationalwiki.org/wiki/Fun:Cat">cats</a>. So I implemented
one more mode, this one is enabled by concatenating <a
href="misaka.c">misaka.c</a> vertically:</p>
<div class="sourceCode" id="cb11"><pre
class="sourceCode sh"><code class="sourceCode bash"><span id="cb11-1"><a href="#cb11-1" aria-hidden="true" tabindex="-1"></a><span class="ex">./vertical_cat</span> misaka.c misaka.c <span class="op">&gt;</span> misaka3.c</span>
<span id="cb11-2"><a href="#cb11-2" aria-hidden="true" tabindex="-1"></a><span class="fu">gcc</span> misaka3.c <span class="at">-o</span> long_cat</span>
<span id="cb11-3"><a href="#cb11-3" aria-hidden="true" tabindex="-1"></a><span class="ex">./long_cat</span></span></code></pre></div>
<p><code>long_cat</code> outputs ASCII art of a cat to
<code>stdout</code>. You can make this cat exponentially longer by
concatenating more files vertically (up to 31 levels high, depending on
<code>sizeof(int)</code> for your compiler):</p>
<div class="sourceCode" id="cb12"><pre
class="sourceCode sh"><code class="sourceCode bash"><span id="cb12-1"><a href="#cb12-1" aria-hidden="true" tabindex="-1"></a><span class="ex">./vertical_cat</span> misaka.c misaka.c misaka.c <span class="op">&gt;</span> misaka4.c</span>
<span id="cb12-2"><a href="#cb12-2" aria-hidden="true" tabindex="-1"></a><span class="fu">gcc</span> misaka4.c <span class="at">-o</span> loong_cat</span>
<span id="cb12-3"><a href="#cb12-3" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb12-4"><a href="#cb12-4" aria-hidden="true" tabindex="-1"></a><span class="ex">./vertical_cat</span> misaka.c misaka.c misaka.c misaka.c <span class="op">&gt;</span> misaka5.c</span>
<span id="cb12-5"><a href="#cb12-5" aria-hidden="true" tabindex="-1"></a><span class="fu">gcc</span> misaka5.c <span class="at">-o</span> loooong_cat</span>
<span id="cb12-6"><a href="#cb12-6" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb12-7"><a href="#cb12-7" aria-hidden="true" tabindex="-1"></a><span class="ex">./vertical_cat</span> misaka.c misaka.c misaka.c misaka.c misaka.c <span class="op">&gt;</span> misaka6.c</span>
<span id="cb12-8"><a href="#cb12-8" aria-hidden="true" tabindex="-1"></a><span class="fu">gcc</span> misaka6.c <span class="at">-o</span> loooooooong_cat</span></code></pre></div>
<p>If your terminal has really thin fonts, you can also make this output
fatter by concatenating files horizontally:</p>
<div class="sourceCode" id="cb13"><pre
class="sourceCode sh"><code class="sourceCode bash"><span id="cb13-1"><a href="#cb13-1" aria-hidden="true" tabindex="-1"></a><span class="ex">./vertical_cat</span> misaka.c misaka.c <span class="kw">|</span> <span class="ex">./horizontal_cat</span> <span class="at">-</span> <span class="at">-</span> <span class="op">&gt;</span> misaka7.c</span>
<span id="cb13-2"><a href="#cb13-2" aria-hidden="true" tabindex="-1"></a><span class="fu">gcc</span> misaka7.c <span class="at">-o</span> long_fat_cat</span>
<span id="cb13-3"><a href="#cb13-3" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb13-4"><a href="#cb13-4" aria-hidden="true" tabindex="-1"></a><span class="ex">./vertical_cat</span> misaka.c misaka.c <span class="kw">|</span> <span class="ex">./horizontal_cat</span> <span class="at">-</span> <span class="at">-</span> <span class="at">-</span> <span class="op">&gt;</span> misaka8.c</span>
<span id="cb13-5"><a href="#cb13-5" aria-hidden="true" tabindex="-1"></a><span class="fu">gcc</span> misaka8.c <span class="at">-o</span> long_faat_cat</span></code></pre></div>
<p>Output width is determined by the first level of stacked programs, so
a triangle like the following will not have horizontally expanded
output:</p>
<div class="sourceCode" id="cb14"><pre
class="sourceCode sh"><code class="sourceCode bash"><span id="cb14-1"><a href="#cb14-1" aria-hidden="true" tabindex="-1"></a><span class="ex">./horizontal_cat</span> misaka.c misaka.c <span class="kw">|</span> <span class="ex">./vertical_cat</span> misaka.c <span class="at">-</span> <span class="op">&gt;</span> misaka9.c</span>
<span id="cb14-2"><a href="#cb14-2" aria-hidden="true" tabindex="-1"></a><span class="fu">gcc</span> misaka9.c <span class="at">-o</span> same_as_long_cat</span></code></pre></div>
<p>Finally, if you lost track of how many <a
href="misaka.c">misaka.c</a> you have stacked together, you can feed the
source to a <a
href="https://en.wikipedia.org/wiki/Brainfuck">brainfuck</a> interpreter
to get an overview of how the programs are stacked. Example:</p>
<div class="sourceCode" id="cb15"><pre
class="sourceCode sh"><code class="sourceCode bash"><span id="cb15-1"><a href="#cb15-1" aria-hidden="true" tabindex="-1"></a><span class="fu">perl</span> bf.pl misaka9.c</span></code></pre></div>
<p>This outputs:</p>
<pre><code>MISAKA
MISAKA MISAKA</code></pre>
<h3 id="return-value">Return value</h3>
<p><code>horizontal_cat</code> and <code>vertical_cat</code> will exit
with zero status on success.</p>
<p>If any input file fails to open, <code>horizontal_cat</code> and
<code>vertical_cat</code> will report the offending file name to
<code>stdout</code>, and exit with nonzero status.</p>
<p>If <code>horizontal_cat</code> and <code>vertical_cat</code> ran out
of memory, they will exit with nonzero status without outputting
anything.</p>
<h3 id="compatibility">Compatibility</h3>
<p><code>horizontal_cat</code> makes the following assumptions about
input files:</p>
<ul>
<li>ASCII with LF end of line sequences. If CR-LF sequences are used, CR
characters will appear in the middle of output lines.</li>
<li>All characters are of equal width, even tab characters.</li>
</ul>
<p><code>Misaka</code> has been verified to work on these following
compiler+OS combinations:</p>
<ul>
<li>gcc 4.6.3 on Linux 3.5.0-41</li>
<li>gcc 4.4.5 on Linux 2.6.32-5</li>
<li>gcc 4.3.5 on JS/Linux 2.6.20</li>
<li>gcc 4.8.1 on Windows (Cygwin and MingW)</li>
</ul>
<p><code>Misaka</code> requires a C99 compiler due to the use of single
line comments. <code>Misaka</code> does not depend on any other C99
features.</p>
<h3 id="obfuscation">Obfuscation</h3>
<p>Main obfuscation is in having a C program that compiles when tiled
horizontally and vertically, while using single line comments in less
than half of the lines <em>and</em> maintaining a meaningful layout
while doing that.</p>
<p>There are other challenges too, of course, like getting a Brainfuck
program to tile horizontally and vertically. Really, tiling code of any
sort horizontally is an interesting exercise, I encourage everyone to
try this once.</p>
<p>Other features to look for:</p>
<ul>
<li>Peculiar bits that switches horizontal cat to vertical cat.</li>
<li>Run-length encoded long cat.</li>
<li>Symmetric and recycled variable names.</li>
<li>CRC of the source code in the source code.</li>
</ul>
<p><code>gcc -Wall</code> should provide a hint to where the mode switch
happens, it does not output any irrelevant other warnings (verified on
4.6.3).</p>
<h3 id="extra-files">Extra files</h3>
<p>Extra files included in my submission are informational only, they
are not needed for the program to work.</p>
<ul>
<li><a href="bf.pl">bf.pl</a> - a perl brainfuck interpreter, in case
you don’t have one handy.</li>
<li><a href="spoiler.html">spoiler.html</a> - making of this
program.</li>
</ul>
<h3 id="about-misaka">About <code>Misaka</code></h3>
<p>The name, layout, and functionality of <code>Misaka</code> is
inspired by a particular stackable figure:</p>
<ul>
<li><a
href="http://google.co.jp/search?q=%E3%83%9F%E3%82%B5%E3%82%AB%E7%9B%9B%E3%82%8A&amp;tbm=isch">Google
images</a></li>
<li><a
href="https://web.archive.org/web/20140325175014/http://main.kotobukiya.co.jp/figure/tsubucole_tmi_misakamori/">Kotobukiya</a></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/gen-inventory.sh -->
<h1 id="inventory-for-2013misaka"><a name="inventory"></a>Inventory for
2013/misaka</h1>
<h2 id="primary-files">Primary files</h2>
<ul>
<li><a href="index.html">index.html</a> - winner home page</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2013/misaka/misaka.c">misaka.c</a>
- winning source</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2013/misaka/Makefile">Makefile</a>
- winner Makefile</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2013/misaka/misaka.orig.c">misaka.orig.c</a>
- original source</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2013/misaka/bf.pl">bf.pl</a>
- BF interpreter</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2013/misaka/try.sh">try.sh</a>
- how to run</li>
<li><a href="spoiler.html">spoiler.html</a> - SPOILER WARNING</li>
<li><a href="2013_misaka.tar.bz2">2013_misaka.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/2013/misaka/.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/2013/misaka/.winner.json">.winner.json</a>
- description of winner in JSON</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2013/misaka/README.md">README.md</a>
- markdown source for index.html</li>
</ul>
<!-- END: next line ends content generated by: bin/gen-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%2F2013%2Fmisaka%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 -->
+272 -13
View File
@@ -1,4 +1,6 @@
<!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 !!! -->
@@ -6,27 +8,284 @@
<!-- !!! DO NOT MODIFY THIS FILE - This file is generated by a tool !!! -->
<!-- !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<!-- -->
<!-- file: 2013/morgan1/index.html created by: fake.gen_index.sh version: 1.0.5 2023-10-31 -->
<html lang="en">
<!-- END: this line ends content from: inc/top.default.html -->
<!-- -->
<!-- This file was formed by the tool: bin/readme2index.sh version: 1.1 2024-01-16 -->
<!-- -->
<!-- START: this line starts content from: inc/head.default.html -->
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>2013 morgan1</title>
<meta name="description" content="IOCCC year: 2013 IOCCC winner: morgan1 winner index page">
<meta name="keywords" content="IOCCC,2013,morgan1,winner index page">
<link rel="stylesheet" href="/temp-test-ioccc/ioccc.css">
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=yes">
<title>2013/morgan1</title>
<meta name="description" content="2013 IOCCC winner morgan1">
<meta name="keywords" content="IOCCC, 2013, IOCCC 2013, IOCCC winner, morgan1">
</head>
<!-- END: this line ends content from: inc/head.default.html -->
<!-- START: this line starts content from: inc/body.default.html -->
<body>
<h1>2013 morgan1</h1>
<!-- END: this line ends content from: inc/body.default.html -->
<!-- START: this line starts content from: inc/header.default.html -->
<p>XXX - fake content until readme2index is working - XXX</p>
<div class="header">
<img src="/temp-test-ioccc/png/ioccc.png" alt="IOCCC image by Matt Zucker" width=300 height=110>
<h1>The International Obfuscated C Code Contest</h1>
<h2>2013/morgan1</h2>
</div>
<hr style="width:50%;text-align:left;margin-left:0">
<!-- END: this line ends content from: inc/header.default.html -->
<!-- START: this line starts content from: inc/topnav.mid.html -->
<!-- Start Nu Html Checker -->
<p><a href="https://validator.w3.org/nu/?doc=https%3A%2F%2Fioccc-src.github.io%2Ftemp-test-ioccc%2F2013%2Fmorgan1%2Findex.html">Nu Html check https://ioccc-src.github.io/temp-test-ioccc/2013/morgan1/index.html</a></p>
<!-- End Nu Html Checker -->
<div class="topnav">
<a class="Left" href="../misaka/index.html">&larr; misaka</a>
<a class="Left" href="../index.html">&uarr; 2013 &uarr;</a>
<a class="Left" href="../morgan2/index.html">morgan2 &rarr;</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="/temp-test-ioccc/index.html">IOCCC Home</a>
<a href="/temp-test-ioccc/years.html">Winning Entries</a>
<a href="/temp-test-ioccc/winners.html">People who have won</a>
</div>
<hr>
<div class="sidenav">
<a href="/temp-test-ioccc/news.html">IOCCC News</a>
<a href="/temp-test-ioccc/faq.html#submit">How to enter the IOCCC</a>
<a href="/temp-test-ioccc/faq.html">FAQ</a>
</div>
<hr>
<div class="sidenav">
<a href="/temp-test-ioccc/bugs.html">Bugs &amp; (mis)features</a>
<a href="/temp-test-ioccc/faq.html#fix_a_winner">Fixing IOCCC winners</a>
<a href="/temp-test-ioccc/faq.html#fix_web_site">Fixing the web site</a>
<a href="/temp-test-ioccc/faq.html#fix_author">Fixing winner info</a>
<a href="/temp-test-ioccc/thanks-for-help.html">Thanks for the help</a>
</div>
<hr>
<div class="sidenav">
<a href="/temp-test-ioccc/judges.html">The IOCCC Judges</a>
<a href="/temp-test-ioccc/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/gen-author.sh -->
<p><a name="author"><strong>Author:</strong></a> <br><br>Name: <a
href="/temp-test-ioccc/winners.html#Yves-Marie_Morgan">Yves-Marie
Morgan</a><br> Location: <a
href="/temp-test-ioccc/location.html#FR">FR</a></p>
<!-- END: next line ends content generated by: bin/gen-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></span></code></pre></div>
<h2 id="to-use">To use:</h2>
<div class="sourceCode" id="cb2"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb2-1"><a href="#cb2-1" aria-hidden="true" tabindex="-1"></a><span class="bu">echo</span> <span class="st">&quot;2013/10/03&quot;</span> <span class="kw">|</span> <span class="ex">./morgan1</span></span></code></pre></div>
<h2 id="try">Try:</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="bu">echo</span> <span class="st">&quot;1985/10/28&quot;</span> <span class="kw">|</span> <span class="ex">./morgan1</span></span>
<span id="cb3-2"><a href="#cb3-2" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb3-3"><a href="#cb3-3" aria-hidden="true" tabindex="-1"></a><span class="bu">echo</span> <span class="st">&quot;1996/12/31&quot;</span> <span class="kw">|</span> <span class="ex">./morgan1</span></span>
<span id="cb3-4"><a href="#cb3-4" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb3-5"><a href="#cb3-5" aria-hidden="true" tabindex="-1"></a><span class="bu">echo</span> <span class="st">&quot;1986/03/31&quot;</span> <span class="kw">|</span> <span class="ex">./morgan1</span> <span class="co"># Comet Halley (look for &#39;Ha&#39;)</span></span>
<span id="cb3-6"><a href="#cb3-6" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb3-7"><a href="#cb3-7" aria-hidden="true" tabindex="-1"></a><span class="bu">echo</span> <span class="st">&quot;1997/04/01&quot;</span> <span class="kw">|</span> <span class="ex">./morgan1</span> <span class="co"># Comet Hale-Bopp (look for &#39;Hb&#39;)</span></span></code></pre></div>
<p>Try pressing the arrow keys when your focus is in the window.</p>
<h2 id="judges-remarks">Judges’ remarks:</h2>
<p>To verify the output, try echoing the date of an evening with a clear
sky. Use binoculars and/or telescope as needed. In some cases you may
need to wait for a better time of the evening. In a few cases, such as
the South Pole in the summer, you may need to move to a different
observing site.</p>
<h2 id="authors-remarks">Author’s remarks:</h2>
<h3 id="instructions">Instructions</h3>
<p>It displays the position of the 8 planets of the solar system around
the Sun. The date given in the command line is in the format YYYY/MM/DD
(year, month and day). The direction keys can be used to move in time
:</p>
<ul>
<li>Left : go back 1 day.</li>
<li>Right : go forward 1 day.</li>
<li>Down : go back 20 days.</li>
<li>Up : go forward 20 days.</li>
</ul>
<p>It handles correctly all leap years and the switch between <a
href="https://en.wikipedia.org/wiki/Julian_calendar">Julian calendar</a>
and <a href="https://en.wikipedia.org/wiki/Gregorian_calendar">Gregorian
calendar</a> (10 days missing between 1582/10/04 and 1582/10/15).</p>
<p>The scale is logarithmic to be able to display the <a
href="http://news.bbc.co.uk/2/hi/5282440.stm">8 planets</a> without
having <a href="https://science.nasa.gov/mercury">Mercury</a>, <a
href="https://science.nasa.gov/venus/">Venus</a>, <a
href="https://science.nasa.gov/earth/facts">Earth</a> and <a
href="https://science.nasa.gov/mars">Mars</a> squeezed around the <a
href="https://science.nasa.gov/sun/">Sun</a>.</p>
<p>The size is not proportional either.</p>
<h3 id="bonus">Bonus</h3>
<p>It also displays the position of 2 famous comets during their last
approach:</p>
<ul>
<li>The <a
href="https://science.nasa.gov/solar-system/comets/1p-halley/">first
one</a> around the <a href="/years.html#1986">third IOCCC</a>.</li>
<li>The <a
href="https://science.nasa.gov/solar-system/comets/c-1995-o1-hale-bopp/">second
one</a> between the <a href="/years.html#1996">thirteenth</a> and <a
href="/years.html#1998">fourteenth</a> IOCCC.</li>
</ul>
<h3 id="limitations">Limitations</h3>
<ul>
<li>ASCII character set is assumed.</li>
<li>A C99 compiler is required (for some <code>math.h</code>
functions).</li>
<li>The position should be correct for years between (-1000; +3000)</li>
<li>The approximations done in the formula are OK for displaying the
position around the <a href="https://science.nasa.gov/sun/">Sun</a> but
not for other applications like <a
href="https://en.wikipedia.org/wiki/Ephemeris">ephemeride</a> or sky
view from <a href="https://science.nasa.gov/earth/facts">Earth</a>
(angles may be off by 1 or 2 degrees sometimes).</li>
</ul>
<h3 id="obfuscation">Obfuscation</h3>
<ul>
<li>Reuse of 1 letter variables.</li>
<li>Only the <code>main()</code> function with some <code>for</code>
loops.</li>
<li>Constants for orbital elements encoded in a string.</li>
<li>Hexadecimal and decimal values used inconsistently.</li>
<li>Comparisons order are not consistent.</li>
<li>A lot of stuff is done in the different parts of the
<code>for</code> loop.</li>
</ul>
<h3 id="compilation-warnings">Compilation warnings</h3>
<p>With gcc 4.7.2 on Linux Ubuntu 12.10:</p>
<pre><code>morgan1.c:38:3: warning: suggest parentheses around ‘&amp;&amp;’ within ‘||’ [-Wparentheses]
morgan1.c:40:34: warning: value computed is not used [-Wunused-value]
morgan1.c:56:6: warning: suggest parentheses around ‘&amp;&amp;’ within ‘||’ [-Wparentheses]
morgan1.c:58:50: warning: value computed is not used [-Wunused-value]
morgan1.c:61:5: warning: suggest parentheses around ‘-’ inside ‘&gt;&gt;’ [-Wparentheses]</code></pre>
<p>With clang 3.1 on Linux Ubuntu 12.10 :</p>
<pre><code>morgan1.c:38:49: warning: &#39;&amp;&amp;&#39; within &#39;||&#39; [-Wlogical-op-parentheses]
morgan1.c:38:27: warning: &#39;&amp;&amp;&#39; within &#39;||&#39; [-Wlogical-op-parentheses]
morgan1.c:55:13: warning: &#39;&amp;&amp;&#39; within &#39;||&#39; [-Wlogical-op-parentheses]
morgan1.c:56:14: warning: &#39;&amp;&amp;&#39; within &#39;||&#39; [-Wlogical-op-parentheses]</code></pre>
<p>This is due to most of the parentheses and braces being removed when
unnecessary.</p>
<p>To verify the display, you can look at one of these programs : *
xephem : <a
href="https://web.archive.org/web/20130310133219/http://www.clearskyinstitute.com/xephem/"
class="uri">https://web.archive.org/web/20130310133219/http://www.clearskyinstitute.com/xephem/</a>
* homeplanet : <a href="https://www.fourmilab.ch/homeplanet/"
class="uri">https://www.fourmilab.ch/homeplanet/</a> * <a
href="https://www.theplanetstoday.com"
class="uri">https://www.theplanetstoday.com</a></p>
<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/gen-inventory.sh -->
<h1 id="inventory-for-2013morgan1"><a name="inventory"></a>Inventory for
2013/morgan1</h1>
<h2 id="primary-files">Primary files</h2>
<ul>
<li><a href="index.html">index.html</a> - winner home page</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2013/morgan1/morgan1.c">morgan1.c</a>
- winning source</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2013/morgan1/Makefile">Makefile</a>
- winner Makefile</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2013/morgan1/morgan1.orig.c">morgan1.orig.c</a>
- original source</li>
<li><a href="2013_morgan1.tar.bz2">2013_morgan1.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/2013/morgan1/.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/2013/morgan1/.winner.json">.winner.json</a>
- description of winner in JSON</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2013/morgan1/README.md">README.md</a>
- markdown source for index.html</li>
</ul>
<!-- END: next line ends content generated by: bin/gen-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%2F2013%2Fmorgan1%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 -->
+273 -13
View File
@@ -1,4 +1,6 @@
<!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 !!! -->
@@ -6,27 +8,285 @@
<!-- !!! DO NOT MODIFY THIS FILE - This file is generated by a tool !!! -->
<!-- !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<!-- -->
<!-- file: 2013/morgan2/index.html created by: fake.gen_index.sh version: 1.0.5 2023-10-31 -->
<html lang="en">
<!-- END: this line ends content from: inc/top.default.html -->
<!-- -->
<!-- This file was formed by the tool: bin/readme2index.sh version: 1.1 2024-01-16 -->
<!-- -->
<!-- START: this line starts content from: inc/head.default.html -->
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>2013 morgan2</title>
<meta name="description" content="IOCCC year: 2013 IOCCC winner: morgan2 winner index page">
<meta name="keywords" content="IOCCC,2013,morgan2,winner index page">
<link rel="stylesheet" href="/temp-test-ioccc/ioccc.css">
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=yes">
<title>2013/morgan2</title>
<meta name="description" content="2013 IOCCC winner morgan2">
<meta name="keywords" content="IOCCC, 2013, IOCCC 2013, IOCCC winner, morgan2">
</head>
<!-- END: this line ends content from: inc/head.default.html -->
<!-- START: this line starts content from: inc/body.default.html -->
<body>
<h1>2013 morgan2</h1>
<!-- END: this line ends content from: inc/body.default.html -->
<!-- START: this line starts content from: inc/header.default.html -->
<p>XXX - fake content until readme2index is working - XXX</p>
<div class="header">
<img src="/temp-test-ioccc/png/ioccc.png" alt="IOCCC image by Matt Zucker" width=300 height=110>
<h1>The International Obfuscated C Code Contest</h1>
<h2>2013/morgan2</h2>
</div>
<hr style="width:50%;text-align:left;margin-left:0">
<!-- END: this line ends content from: inc/header.default.html -->
<!-- START: this line starts content from: inc/topnav.mid.html -->
<!-- Start Nu Html Checker -->
<p><a href="https://validator.w3.org/nu/?doc=https%3A%2F%2Fioccc-src.github.io%2Ftemp-test-ioccc%2F2013%2Fmorgan2%2Findex.html">Nu Html check https://ioccc-src.github.io/temp-test-ioccc/2013/morgan2/index.html</a></p>
<!-- End Nu Html Checker -->
<div class="topnav">
<a class="Left" href="../morgan1/index.html">&larr; morgan1</a>
<a class="Left" href="../index.html">&uarr; 2013 &uarr;</a>
<a class="Left" href="../robison/index.html">robison &rarr;</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="/temp-test-ioccc/index.html">IOCCC Home</a>
<a href="/temp-test-ioccc/years.html">Winning Entries</a>
<a href="/temp-test-ioccc/winners.html">People who have won</a>
</div>
<hr>
<div class="sidenav">
<a href="/temp-test-ioccc/news.html">IOCCC News</a>
<a href="/temp-test-ioccc/faq.html#submit">How to enter the IOCCC</a>
<a href="/temp-test-ioccc/faq.html">FAQ</a>
</div>
<hr>
<div class="sidenav">
<a href="/temp-test-ioccc/bugs.html">Bugs &amp; (mis)features</a>
<a href="/temp-test-ioccc/faq.html#fix_a_winner">Fixing IOCCC winners</a>
<a href="/temp-test-ioccc/faq.html#fix_web_site">Fixing the web site</a>
<a href="/temp-test-ioccc/faq.html#fix_author">Fixing winner info</a>
<a href="/temp-test-ioccc/thanks-for-help.html">Thanks for the help</a>
</div>
<hr>
<div class="sidenav">
<a href="/temp-test-ioccc/judges.html">The IOCCC Judges</a>
<a href="/temp-test-ioccc/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/gen-author.sh -->
<p><a name="author"><strong>Author:</strong></a> <br><br>Name: <a
href="/temp-test-ioccc/winners.html#Yves-Marie_Morgan">Yves-Marie
Morgan</a><br> Location: <a
href="/temp-test-ioccc/location.html#FR">FR</a></p>
<!-- END: next line ends content generated by: bin/gen-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></span></code></pre></div>
<h2 id="to-use">To use:</h2>
<p>For the console version (ncurses):</p>
<div class="sourceCode" id="cb2"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb2-1"><a href="#cb2-1" aria-hidden="true" tabindex="-1"></a><span class="ex">./morgan2</span></span></code></pre></div>
<p>For the graphical version (X11):</p>
<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">./morgan2</span> X</span></code></pre></div>
<h2 id="judges-remarks">Judges’ remarks:</h2>
<p>The judges enjoyed playing the game almost to completion; if we
remember correctly, we managed to place 59 or 60 dominoes. We wonder,
what would be faster: to play the game to completion or to write an
unobfuscated version of it?</p>
<h2 id="authors-remarks">Author’s remarks:</h2>
<p>This program is a domino game. The goal is to place dominoes on the
8x8 grid. Each domino is made of 6 squares of the colour red or green.
To place a domino, at least one of its side shall match the other side
of another domino.</p>
<h3 id="how-to-play">How to play</h3>
<h3 id="start-of-the-game">Start of the game</h3>
<p>At the start of the game, the first domino is placed randomly on the
grid. You get another domino to place by selecting one empty position in
the stack on the right. You can have up to 8 dominoes pending at any
time.</p>
<h3 id="moving-in-the-stack">Moving in the stack</h3>
<p>Use <code>Up</code> and <code>Down</code> key to move the cursor in
the stack. Press <code>Enter</code> to either:</p>
<ul>
<li>Reveal a new domino if the position was empty.</li>
<li>Select the domino to try to place it if the position was not
empty.</li>
</ul>
<p>The currently selected domino is indicated on the top right.</p>
<h3 id="placing-a-domino">Placing a domino</h3>
<p>Once a domino has been selected, the cursor moves to the grid. Use
<code>Up</code>, <code>Down</code>, <code>Left</code> and
<code>Right</code> keys to move in the grid. Press <code>Enter</code> on
an empty position to place the domino.</p>
<p>To go back to selection mode, press <code>Enter</code> on an occupied
position.</p>
<p>The domino can be placed in an empty position if all its neighbours
have matching sides and the domino has at least one neighbour.</p>
<h3 id="scoring">Scoring</h3>
<p>First, depending on the number of dominoes pending in the stack, a
bonus is accorded:</p>
<ul>
<li>1 domino in the stack: 8 points.</li>
<li>2 dominoes in the stack: 4 points.</li>
<li>3 or 4 dominoes in the stack: 2 points.</li>
<li>5 or more dominoes in the stack: 0 points.</li>
</ul>
<p>Then the bonus is multiplied by the number of matching neighbours the
placed domino has (1, 2, 3 or 4). This is added to the score.</p>
<p>Finally, the total score is divided by the number of dominoes placed
(1 - 64).</p>
<p>The 3 numbers on display represent: the total score, the fill count
and the final score (total score divided by fill count).</p>
<h3 id="end-of-the-game">End of the game</h3>
<p>The game is finished when no more dominoes can be placed and if one
of the following occurs:</p>
<ul>
<li>You have completely filled the grid.</li>
<li>You have 8 pending dominoes in the stack.</li>
<li>No more dominoes can be revealed in the stack (more than 56 dominoes
placed on the grid).</li>
</ul>
<p><strong>Note</strong>: There is no real end of game detection
implemented in the program, simply press <code>q</code> when you have
finished…</p>
<h3 id="strategy">Strategy</h3>
<ul>
<li>Try to minimize the number of dominoes revealed in the stack. The
lower the number, the higher the bonus.</li>
<li>Each domino is unique and all combination of colours exists, so keep
track of what is already placed and what is left.</li>
<li>Make sure you don’t render dead some positions by preventing a
future placement. If the corner of a domino does not match another
corner diagonally, the move is valid but will prevent some future
moves.</li>
</ul>
<h3 id="limitations">Limitations</h3>
<ul>
<li>ASCII character set is assumed.</li>
<li>Requires both ncurses and X11 at compilation and runtime, but
selection could be done at compilation with some extra code (mainly
empty stubs).</li>
</ul>
<h3 id="obfuscation">Obfuscation</h3>
<ul>
<li>1 letter identifiers, reused when possible.</li>
<li>1 algorithm, 2 different kinds of display (ncurses and X11)
mixed.</li>
<li>No parameters to functions, all variables are global and
shared.</li>
<li>Some variables are not initialized if they have a known value at the
time of use.</li>
</ul>
<h3 id="compilation-warnings">Compilation warnings</h3>
<p>With gcc 4.7.2 on Linux Ubuntu 12.10 :</p>
<pre><code>morgan2.c:46:65: warning: value computed is not used [-Wunused-value]</code></pre>
<p>With clang 3.1 on Linux Ubuntu 12.10 :</p>
<pre><code>morgan2.c:23:24: warning: adding &#39;int&#39; to a string does not append to the string [-Wstring-plus-int]</code></pre>
<p><strong>!!!!! HAVE FUN !!!!!</strong></p>
<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/gen-inventory.sh -->
<h1 id="inventory-for-2013morgan2"><a name="inventory"></a>Inventory for
2013/morgan2</h1>
<h2 id="primary-files">Primary files</h2>
<ul>
<li><a href="index.html">index.html</a> - winner home page</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2013/morgan2/morgan2.c">morgan2.c</a>
- winning source</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2013/morgan2/Makefile">Makefile</a>
- winner Makefile</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2013/morgan2/morgan2.orig.c">morgan2.orig.c</a>
- original source</li>
<li><a href="2013_morgan2.tar.bz2">2013_morgan2.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/2013/morgan2/.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/2013/morgan2/.winner.json">.winner.json</a>
- description of winner in JSON</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2013/morgan2/README.md">README.md</a>
- markdown source for index.html</li>
</ul>
<!-- END: next line ends content generated by: bin/gen-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%2F2013%2Fmorgan2%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 -->
+255 -13
View File
@@ -1,4 +1,6 @@
<!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 !!! -->
@@ -6,27 +8,267 @@
<!-- !!! DO NOT MODIFY THIS FILE - This file is generated by a tool !!! -->
<!-- !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<!-- -->
<!-- file: 2013/robison/index.html created by: fake.gen_index.sh version: 1.0.5 2023-10-31 -->
<html lang="en">
<!-- END: this line ends content from: inc/top.default.html -->
<!-- -->
<!-- This file was formed by the tool: bin/readme2index.sh version: 1.1 2024-01-16 -->
<!-- -->
<!-- START: this line starts content from: inc/head.default.html -->
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>2013 robison</title>
<meta name="description" content="IOCCC year: 2013 IOCCC winner: robison winner index page">
<meta name="keywords" content="IOCCC,2013,robison,winner index page">
<link rel="stylesheet" href="/temp-test-ioccc/ioccc.css">
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=yes">
<title>2013/robison</title>
<meta name="description" content="2013 IOCCC winner robison">
<meta name="keywords" content="IOCCC, 2013, IOCCC 2013, IOCCC winner, robison">
</head>
<!-- END: this line ends content from: inc/head.default.html -->
<!-- START: this line starts content from: inc/body.default.html -->
<body>
<h1>2013 robison</h1>
<!-- END: this line ends content from: inc/body.default.html -->
<!-- START: this line starts content from: inc/header.default.html -->
<p>XXX - fake content until readme2index is working - XXX</p>
<div class="header">
<img src="/temp-test-ioccc/png/ioccc.png" alt="IOCCC image by Matt Zucker" width=300 height=110>
<h1>The International Obfuscated C Code Contest</h1>
<h2>2013/robison</h2>
</div>
<hr style="width:50%;text-align:left;margin-left:0">
<!-- END: this line ends content from: inc/header.default.html -->
<!-- START: this line starts content from: inc/topnav.last.html -->
<!-- Start Nu Html Checker -->
<p><a href="https://validator.w3.org/nu/?doc=https%3A%2F%2Fioccc-src.github.io%2Ftemp-test-ioccc%2F2013%2Frobison%2Findex.html">Nu Html check https://ioccc-src.github.io/temp-test-ioccc/2013/robison/index.html</a></p>
<!-- End Nu Html Checker -->
<div class="topnav">
<a class="Left" href="../morgan2/index.html">&larr; morgan2</a>
<a class="Left" href="../index.html">&uarr; 2013 &uarr;</a>
<a class="Left Disabled" href="#">last entry</a>
<a class="Right" href="#inventory">Inventory</a>
</div>
<!-- END: this line ends content from: inc/topnav.last.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="/temp-test-ioccc/index.html">IOCCC Home</a>
<a href="/temp-test-ioccc/years.html">Winning Entries</a>
<a href="/temp-test-ioccc/winners.html">People who have won</a>
</div>
<hr>
<div class="sidenav">
<a href="/temp-test-ioccc/news.html">IOCCC News</a>
<a href="/temp-test-ioccc/faq.html#submit">How to enter the IOCCC</a>
<a href="/temp-test-ioccc/faq.html">FAQ</a>
</div>
<hr>
<div class="sidenav">
<a href="/temp-test-ioccc/bugs.html">Bugs &amp; (mis)features</a>
<a href="/temp-test-ioccc/faq.html#fix_a_winner">Fixing IOCCC winners</a>
<a href="/temp-test-ioccc/faq.html#fix_web_site">Fixing the web site</a>
<a href="/temp-test-ioccc/faq.html#fix_author">Fixing winner info</a>
<a href="/temp-test-ioccc/thanks-for-help.html">Thanks for the help</a>
</div>
<hr>
<div class="sidenav">
<a href="/temp-test-ioccc/judges.html">The IOCCC Judges</a>
<a href="/temp-test-ioccc/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/gen-author.sh -->
<p><a name="author"><strong>Author:</strong></a> <br><br>Name: <a
href="/temp-test-ioccc/winners.html#Arch_D_Robison">Arch D.
Robison</a><br> Location: <a
href="/temp-test-ioccc/location.html#US">US</a></p>
<!-- END: next line ends content generated by: bin/gen-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></span></code></pre></div>
<h2 id="to-use">To use:</h2>
<div class="sourceCode" id="cb2"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb2-1"><a href="#cb2-1" aria-hidden="true" tabindex="-1"></a><span class="ex">./robison</span></span>
<span id="cb2-2"><a href="#cb2-2" aria-hidden="true" tabindex="-1"></a><span class="co"># enter an expression</span></span>
<span id="cb2-3"><a href="#cb2-3" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb2-4"><a href="#cb2-4" aria-hidden="true" tabindex="-1"></a><span class="bu">echo</span> expression <span class="kw">|</span> <span class="ex">./robison</span></span></code></pre></div>
<h2 id="try">Try:</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">./try.sh</span></span></code></pre></div>
<h2 id="judges-remarks">Judges’ remarks:</h2>
<p>Of integers this prog does a lot,<br />
plus minus, div times (and what not).</p>
<p>And modulus if remainders the needing,<br />
on standard input percent be feeding.</p>
<p>More than one line can thru give input,<br />
when interactive one values more than throughput.</p>
<p>With cut and paste and some time,<br />
one can compute M(23209).</p>
<h2 id="authors-remarks">Author’s remarks:</h2>
<h3 id="oh-the-strings-you-can-c">Oh, The Strings You Can C!</h3>
<p>I love the C language; its terseness is tops.<br />
But the thing I abhor is numerical ops!</p>
<p>No shifting, division, remainder, or times.<br />
No increment, decrement, or subscripting blech,<br />
No addition, subtraction, or bitwise bool glop.<br />
As for pointer arithmetic – totally yech!</p>
<p>But I do have a pref’rence, for pointer deref’rence.<br />
I find NOTS are a bang, and relations a ball.<br />
I like calling routines, and recursions in essence.<br />
But the thing I like MOST is a string dot h CALL!</p>
<p>With mem copy I copy, and mem set I clear.<br />
Take string len of this, and string copy that.<br />
From my keyboard I pause, to hear subroutines dear:<br />
The bark of string chrr, and the purr of string CAT!</p>
<p>One tiny detail that could lead to defeat.<br />
From where an arg points: string calls only go forth,<br />
So how to go back, to be Turing complete?<br />
From standard dot H, to the rescue, q SORT!</p>
<p>My fixation might hint at a textual bent.<br />
Does my program compose a tattoo for your shin?<br />
Play crosswords or translate from Urdu to Tzouby?<br />
To give it a whirl, just punch 2 + 2 in.</p>
<p>You can add, do division, and multiply too.<br />
Take unary minus and also subtract.<br />
Summing hairs of a walrus? No longer a fuss.<br />
Parenthetical grouping – no pushing a stack!</p>
<p>Try dividing a <a
href="https://en.wikipedia.org/wiki/Googol">googol</a> by one forty
three,<br />
Subtract an <a
href="https://en.wikipedia.org/wiki/Names_of_large_numbers">octillion</a>
- it’s simply divine.<br />
To compute a remainder, inscribe a percent.<br />
For the sign of the answer, see C ninety nine!</p>
<p>A hundred and twenty five digits or so,<br />
Are the lengthiest figures the program can gnash.<br />
Go over that limit, by even a digit:<br />
Risk incorrect answers, or witness a crash!</p>
<p>Say, say, does it have octal or binary zen?<br />
What about duodecimal, ternary, hex?<br />
Try the base as an option (of course in base ten)<br />
Any base two to twenty – for that is the specs.</p>
<p>Use lowercase in trans-decimal radix,<br />
Divide <em>babbage</em> (in base seventeen) by <em>cafe</em> –<br />
a nice <em>fad</em>, but avoid a division by nix:<br />
No errant result, but you could wait all day!</p>
<p>To grok the internals, ask <a
href="https://en.wikipedia.org/wiki/Cleopatra">Queen
Cleopatra</a>,<br />
or <a href="https://en.wikipedia.org/wiki/Tutankhamun">King
Tutankhamun</a>; for him it’s a romp.<br />
Addition by cats, and if given two figures,<br />
to tell which is bigger, sort down and string CMP!</p>
<p>Unlawful subtraction, a grade school infraction,<br />
starts at the left and works to the right.<br />
Yet more innovation: like <a
href="https://en.wikipedia.org/wiki/Ford_Motor_Company">Henry Ford’s
cars</a>,<br />
With a pound and define, mass production of vars!</p>
<p>The moral is clear, for programmers out there:<br />
With the C lib for strings, you can hack with a flair.</p>
<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/gen-inventory.sh -->
<h1 id="inventory-for-2013robison"><a name="inventory"></a>Inventory for
2013/robison</h1>
<h2 id="primary-files">Primary files</h2>
<ul>
<li><a href="index.html">index.html</a> - winner home page</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2013/robison/robison.c">robison.c</a>
- winning source</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2013/robison/Makefile">Makefile</a>
- winner Makefile</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2013/robison/robison.orig.c">robison.orig.c</a>
- original source</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2013/robison/try.sh">try.sh</a>
- how to run</li>
<li><a href="2013_robison.tar.bz2">2013_robison.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/2013/robison/.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/2013/robison/.winner.json">.winner.json</a>
- description of winner in JSON</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2013/robison/README.md">README.md</a>
- markdown source for index.html</li>
</ul>
<!-- END: next line ends content generated by: bin/gen-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%2F2013%2Frobison%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 -->