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

+366 -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,378 @@
<!-- !!! DO NOT MODIFY THIS FILE - This file is generated by a tool !!! -->
<!-- !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<!-- -->
<!-- file: 2015/burton/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>2015 burton</title>
<meta name="description" content="IOCCC year: 2015 IOCCC winner: burton winner index page">
<meta name="keywords" content="IOCCC,2015,burton,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>2015/burton</title>
<meta name="description" content="2015 IOCCC winner burton">
<meta name="keywords" content="IOCCC, 2015, IOCCC 2015, IOCCC winner, burton">
</head>
<!-- END: this line ends content from: inc/head.default.html -->
<!-- START: this line starts content from: inc/body.default.html -->
<body>
<h1>2015 burton</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>2015/burton</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%2F2015%2Fburton%2Findex.html">Nu Html check https://ioccc-src.github.io/temp-test-ioccc/2015/burton/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; 2015 &uarr;</a>
<a class="Left" href="../dogon/index.html">dogon &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#Dave_Burton">Dave Burton</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">./prog</span> <span class="st">&quot;expression&quot;</span></span></code></pre></div>
<p>or:</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">./prog</span></span></code></pre></div>
<p>Type in expressions on standard input.</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>Notice how the script reads in from a file. If you type just:</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">./prog</span></span></code></pre></div>
<p>it will prompt you in the same way. Send ctrl-c to exit.</p>
<p>Finally, if you wish to read the man page:</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">man</span> ./calc.1</span></code></pre></div>
<h2 id="alternate-code">Alternate code:</h2>
<p>An alternate version of this entry, <a
href="prog.alt.c">prog.alt.c</a>, is provided. This alternate code is
discussed in the “prog.c vs prog.alt.c” section of the author’s remarks
below.</p>
<h3 id="alternate-build">Alternate build:</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="fu">make</span> alt</span></code></pre></div>
<h3 id="alternate-use">Alternate use:</h3>
<p>Use <code>prog.alt</code> as you would <code>prog</code> above.</p>
<h2 id="judges-remarks">Judges’ remarks:</h2>
<p>“Look, Ma, no <del>hands</del> digits!”</p>
<p>The place where some arithmetic operations are done, for example,
division or modulo, are easy to find. Where are addition and
subtraction?</p>
<p>We were impressed with the level of detail the author “blogged” the
obfuscation process.</p>
<h2 id="authors-remarks">Author’s remarks:</h2>
<h3
id="calc---an-integer-expression-calculator-that-outputs-in-both-hex-and-decimal">calc
- an integer expression calculator that outputs in both hex and
decimal</h3>
<p>All useful tools should include sufficient documentation. See the
included man page. ;-)</p>
<h3 id="notes">Notes</h3>
<p>This program is named <code>calc</code>. Onomatopoeia of sorts, in
the visual realm. The formatting was easier: Form Follows Function
(although <a href="https://www.ioccc.org/2011/hou/hint.html"
title="Hou Qiming">Hou</a> did this better). It was tempting to call it
iCalc, with <code>i</code> for integer (and it was written on an
<code>iDevice</code>), but sanity prevailed.</p>
<p>Printed in 8 pt Courier, it makes aesthetically pleasing 8.5 x 11
wall art.</p>
<h3 id="prog.c-vs-prog.alt.c">prog.c vs prog.alt.c</h3>
<p><a href="/winners.html#Dominik_Muth">Dominik Muth</a> observed a
syntax error on <code>1+1</code>, <code>1-1</code>, <code>1|1</code>,
and <code>1^1</code> when using an ARM based computer, although
<code>1*1</code> and others worked correctly. This occurs because some
platforms by default treat <code>char</code> as
<code>unsigned char</code>. The original code has this weakness, which
can be corrected by adding <code>-fsigned-char</code> to the compile
line.</p>
<p>The modified code is agnostic to <code>char</code> signedness.</p>
<h3 id="why-is-this-entry-obfuscatedinteresting">Why is this entry
obfuscated/interesting?</h3>
<p>Yes, this is another calculator program.</p>
<p>However, unlike any other calculator source code the author is aware
of, this one contains no digits. At all. Anywhere. As in</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">grep</span> <span class="st">&#39;[0-9]&#39;</span> prog.c <span class="kw">||</span> <span class="bu">echo</span> no digits!</span></code></pre></div>
<p>Nor are the digits simply obfuscated. There are no character
constants. There is only one single, short string, and it does not
contain any obfuscated digits. And yet the output is in decimal and
hexadecimal, and it accepts octal, decimal, and hex input.</p>
<p>Flow control is by <code>for</code> and <code>return</code>. It is
<code>if</code>-less, <code>switch</code>-less, <code>while</code>-less,
and hopeless. Literally, if not figuratively. ;-)</p>
<p>The code size is intentionally 2015, as stated by
<code>iocccsize -i</code>, and can be reformatted without changes (as in
<a href="rule2.c">rule2.c</a>) to exactly 4096 octets.</p>
<p>Finally, <code>calc</code> is interesting, if for no other reason
than it is practically useful: Hex/decimal conversion, arithmetic,
byte-swapping, bit-shifting, and logical operations with memory, on the
command line, or interactively.</p>
<h3 id="but-the-question-is-why-is-the-entry-obfuscated">But the
question is why is the entry obfuscated?</h3>
<p>The code follows many industry best-practices:</p>
<ul>
<li><p>You know what it does just by looking at it.</p></li>
<li><p>Numbers and digits have often been used for obfuscation, so in a
bid for better clarity, this code has no digits at all.</p></li>
<li><p>In the spirit of clarity, most of the variables are declared
before use, so they are readily visible, with single letter names that
don’t clutter the screen, in a tautological arrangement.</p></li>
<li><p>More helpful is the use of <code>typedef</code>s instead of
<code>#define</code>, so the types remain useful even in the debugger,
and source code beautifiers will not undo careful presentation.</p></li>
<li><p><code>#defines</code> are used here in the best spirit of the
preprocessor: to shorten repetitive constructs, not for
obscurity.</p></li>
<li><p>All functions are short (and therefore easy to understand?) and
do only one thing, well, ….</p></li>
<li><p>Curly braces invite endless holy wars over readability. This code
only uses them for function definitions, thereby greatly improving
readability, and reducing arguments about said readability.</p></li>
<li><p>One of C’s many blessings (until recently) is a modicum of
keywords, of which only 8 are used: <code>for</code>,
<code>return</code>, <code>typedef</code>, <code>void</code>,
<code>char</code>, <code>short</code>, <code>unsigned</code> and
<code>long</code>; 10 if <code>#include</code> and <code>#define</code>
are counted.</p></li>
<li><p>The code helpfully declares <code>"syntax_error!"</code> right up
front, filling the reader with confidence.</p></li>
<li><p>In spite of its inherent clarity, the code was presented to both
<code>indent(1)</code> and <code>clang-format(1)</code>, after running
it through the preprocessor, sustaining its better qualities.</p></li>
<li><p>That the code is obfuscated is spelled out two different ways in
the source; it helps to reformat the code to see the second
spelling.</p></li>
<li><p>The author is overly fond of the code that handles input. There
is no memory allocation, nor pre-allocation of arrays, so where does the
memory come from? The multi-base <code>strtol(3)</code> code is pretty
tricky. No special attempt was made to replace operations with obscure
mathematical relations, as the (lack of) beauty is in the parsing – ask
not where is the modulus operation, but how does it know when to mod –
okay, but where is add and subtract? And really, who doesn’t enjoy a
<code>setjmp(3)</code> in the argument list?</p></li>
<li><p>Finally, documentation of the source code structure is helpfully
provided in rot13 format. But isn’t it unsportsmanlike to rely upon it?
However, even with this helpful guide, things like reading input lines
remain as tricky to read as they are to write.</p></li>
</ul>
<h3 id="compiler-warnings">Compiler warnings</h3>
<p><code>calc</code> is C99 compliant, and is ANSI/C90 compliant except
for wanting 64-bit <code>long long</code>. Changing the two
<code>long long</code> typedefs to <code>long</code>, and compiling with
<code>gcc -m32</code> yields a program that operates on 32-bit values,
with wrap-around of shifts mod 32:</p>
<pre><code>1&lt;&lt;48
65536 0x00010000</code></pre>
<p>gcc 4.2.1 without arguments compiles cleanly
(e.g. <code>cc prog.c -o prog</code>). This is my workaday compiler. gcc
is also clean with <code>-ansi</code>, and <code>-std=c99</code>.</p>
<p>clang 3.6.0 lives up to its namesake, resounding on non-problems. To
stifle these complaints:</p>
<pre><code>-Wno-return-type -Wno-parentheses -Wno-empty-body</code></pre>
<p>When invoked with <code>-ansi -pedantic</code>, there are two
warnings, which can be ignored:</p>
<ul>
<li><code>ISO C90 does not support 'long long'</code></li>
</ul>
<p>With <code>-Wall -std=c99</code>, both are quite noisy, and all can
be ignored:</p>
<ul>
<li><code>array subscript has type 'char' [-Wchar-subscripts]</code></li>
<li><code>value computed is not used [-Wunused-value]</code></li>
<li><code>operation on 'j' may be undefined [-Wsequence-point]</code></li>
</ul>
<h3 id="test-suite">Test Suite:</h3>
<p>If the program name begins with an <code>e</code>, it echoes
<code>stdin</code> to <code>stdout</code>. This allows for a convenient
test suite:</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">ln</span> <span class="at">-sf</span> prog eprog</span>
<span id="cb11-2"><a href="#cb11-2" aria-hidden="true" tabindex="-1"></a><span class="va">PATH</span><span class="op">=</span>. <span class="ex">eprog</span> <span class="op">&lt;</span> test.in <span class="kw">|</span> <span class="fu">diff</span> <span class="at">-</span> test.out</span></code></pre></div>
<h3 id="spoilers">Spoilers:</h3>
<p>If you do not want to puzzle out how it works, see <a
href="spoilers.md">spoilers.md</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-2015burton"><a name="inventory"></a>Inventory for
2015/burton</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/2015/burton/prog.c">prog.c</a>
- winning source</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2015/burton/Makefile">Makefile</a>
- winner Makefile</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2015/burton/prog.alt.c">prog.alt.c</a>
- alternative source</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2015/burton/prog.orig.c">prog.orig.c</a>
- original source</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2015/burton/try.sh">try.sh</a>
- how to run</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2015/burton/try.this.txt">try.this.txt</a>
- try.sh input</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2015/burton/calc.1">calc.1</a>
- man page for integer expression calculator</li>
<li><a href="road.to.obscurity.html">road.to.obscurity.html</a> -
obfuscated calculator development notes</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2015/burton/road.to.obscurity.md">road.to.obscurity.md</a>
- obfuscated calculator development notes</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2015/burton/rule2.c">rule2.c</a>
- iocccsize reformatted to exactly 4096 octets</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2015/burton/test.in">test.in</a>
- test suite input data</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2015/burton/test.out">test.out</a>
- test suite comparison data</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2015/burton/test32.out">test32.out</a>
- test suite comparison data for 32-bit systems</li>
<li><a href="spoilers.html">spoilers.html</a> - SPOILER WARNING</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2015/burton/src.doc.txt">src.doc.txt</a>
- SPOILER WARNING hints about the source</li>
<li><a href="2015_burton.tar.bz2">2015_burton.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/2015/burton/.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/2015/burton/.winner.json">.winner.json</a>
- description of winner in JSON</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2015/burton/README.md">README.md</a>
- markdown source for index.html</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2015/burton/spoilers.md">spoilers.md</a>
- markdown source for spoilers.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%2F2015%2Fburton%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 -->
+346 -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,358 @@
<!-- !!! DO NOT MODIFY THIS FILE - This file is generated by a tool !!! -->
<!-- !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<!-- -->
<!-- file: 2015/dogon/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>2015 dogon</title>
<meta name="description" content="IOCCC year: 2015 IOCCC winner: dogon winner index page">
<meta name="keywords" content="IOCCC,2015,dogon,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>2015/dogon</title>
<meta name="description" content="2015 IOCCC winner dogon">
<meta name="keywords" content="IOCCC, 2015, IOCCC 2015, IOCCC winner, dogon">
</head>
<!-- END: this line ends content from: inc/head.default.html -->
<!-- START: this line starts content from: inc/body.default.html -->
<body>
<h1>2015 dogon</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>2015/dogon</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%2F2015%2Fdogon%2Findex.html">Nu Html check https://ioccc-src.github.io/temp-test-ioccc/2015/dogon/index.html</a></p>
<!-- End Nu Html Checker -->
<div class="topnav">
<a class="Left" href="../burton/index.html">&larr; burton</a>
<a class="Left" href="../index.html">&uarr; 2015 &uarr;</a>
<a class="Left" href="../duble/index.html">duble &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#Gil_Dogon">Gil Dogon</a><br>
Location: <a href="/temp-test-ioccc/location.html#IL">IL</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>To change the dimensions you can use the <code>WIDTH</code> and
<code>HEIGHT</code> variables when compiling (default 1024 x 800):</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="fu">make</span> clobber WIDTH=640 HEIGHT=480</span></code></pre></div>
<p>to make the game 640 x 480. Obviously changing it to non numbers or
negative numbers or too large numbers will cause problems.</p>
<p>There is an alternate version that is based on the author’s
suggestion to change a value in order to see a bug that they avoided in
their entry. See <a href="#alternate-code">Alternate code</a> below.</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">./prog</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">./prog</span></span></code></pre></div>
<p>Press and hold the Left Arrow key until you turn 90-degrees to the
left.</p>
<p>When you see a long tunnel, press the function key F2.</p>
<p>Use the Up, Down, Left and Right keys to change your path.</p>
<p>Press function higher numbered function keys (F3, F4, …) to go
faster.</p>
<p>Press F1 to stop.</p>
<p>Turn 90-degrees to one side.</p>
<p>Press F4 to drill into some blocks for a bit.</p>
<p>Press F1 to stop.</p>
<p>Turn 180-degrees to face the way you came.</p>
<p>Press F2 and navigate back down the new hole until you reach the long
tunnel again.</p>
<p>Press F1 to stop.</p>
<p>etc.</p>
<p>Press the ESC key.</p>
<h2 id="alternate-code">Alternate code:</h2>
<p>The author suggested that one change <code>q</code> to
<code>0x82000820000000</code> instead of <code>0x820008202625a0</code>
to see a bug that they avoided, writing:</p>
<pre><code>To see this bug in action change the assignment above
to q=0x82000820000000`, and look towards the negative
direction of the main tunnel.</code></pre>
<p>This alt version does this for you.</p>
<h3 id="alternate-build">Alternate 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> alt</span></code></pre></div>
<h3 id="alternate-use">Alternate use:</h3>
<p>Use <code>prog.alt</code> as you would <code>prog</code> above.</p>
<h3 id="alternate-try">Alternate try:</h3>
<p>Try locating the issue the author suggested exists.</p>
<h2 id="judges-remarks">Judges’ remarks:</h2>
<p>You are in a twisty maze blocks, almost all alike.</p>
<p>Those blocks are generated by twisty maze of code blocks, almost all
different.</p>
<p>Can you find your way around either and understand where you are?</p>
<p>How many function keys does your keyboard have? Can you generate very
high number function keys such as F30 or F31? :-)</p>
<p><em>Textures? We don’t need no stinking textures.</em></p>
<h2 id="authors-remarks">Author’s remarks:</h2>
<h3 id="what-is-it">What is it?</h3>
<p>Just run <code>./prog</code> with no arguments on an X11-compatible
system. The scenery, though pseudo-randomly generated should be
strangely familiar, especially to those still in their teenage years.
You can navigate using the keyboard arrow keys and the function keys.
Your speed is a linear function of <code>(n-1)</code> where
<code>Fn</code> is the last function key you have pressed, and you
always move in the direction you are looking at. Be aware that you are
probably some kind of a Creeper as is obvious from looking at the
program, hence your movement is destructive to the environment. So after
pressing F12 for warp speed, and moving around randomly, you might find
yourself in a 3D maze of twisty little passages, from which there is
only one Esc(ape) key. Note that in theory if you have a specialty
keyboard with 32 function keys you may even press F31 to reach infinite
improbability drive speed, though the author had never tested this
feature. However a hidden comment in <code>keysymdef.h</code> suggests
the existence of a mythical Sun Keyboard with 35 function keys :)</p>
<h3 id="full-disclosure">Full disclosure:</h3>
<p>This entry, though pretty thoroughly obfuscated, is not entirely
original, nor am I Notch. The inspiration for this entry is a demo code
written by the Notch himself, which was released with the following
license: “you may use the code in here for any purpose in any way you
want, at your own risk”. That version will henceforth be referred to as
the original. Though the original in itself was quite nice and rather
dense piece of code, it was not written in C, nor entirely and
meticulously obfuscated, a state of things I hopefully rectified.</p>
<h3 id="some-extra-features">Some extra features:</h3>
<p>Basing it on the original which already had a wonderful simple and
concise ray casting through a generated voxel world rendering, I added a
few tweaks of my own device:</p>
<ul>
<li>Two pass optimized rendering. The program first calculates 1/16 of
the output image by ray casting and then, when possible, uses texture
interpolation on the voxel faces. It speeds up the rendering by at least
a factor of 4 on most scenes, but extra care must be taken when passing
rays through the leaves voxels …</li>
<li>Fixed a small omission in the original. When you looked though a
transparent leaves voxel, you did not see the leaves at voxel faces that
were far from you. In this version the rendering of those (far face
leaves) is correct.</li>
<li>Window rendering size specified in Makefile.</li>
<li>Added the keyboard controls for navigation (and destruction).</li>
</ul>
<h3 id="portability-issues">Portability issues:</h3>
<p>This entry is rather portable I think on modern platforms. It assumes
of course basic X-windows availability. There are several other salient
assumptions though:</p>
<ul>
<li>The entry assumes <code>sizeof(int)==4</code>. This seems to cover
pretty much everything that supports X-windows so would be broken only
on quite ancient machines, embedded processors, or some big iron 64 bit
system where <code>sizeof(int)=8</code>.</li>
<li>The entry assumes the default visual has 24 bit depth (RGB). This
seems to be the case on most X Servers these days.</li>
<li>The entry, does a thing which is an absolute No-No for X-windows
program, i.e. assuming it knows some numeric values for keysyms defined
in <code>keysymdef.h</code>. I have searched far and wide the lord
Google’s domain, yet was unable to find a version of the file where
those assumptions were broken. This enables the important support of up
to 32 function keys keyboards without spilling over the size limit, and
allows us to use such fun expression for arrow view control as the
following:</li>
</ul>
<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="op">*(</span>a<span class="op">&amp;</span><span class="dv">1</span><span class="op">?&amp;</span>C<span class="op">:&amp;</span>B<span class="op">)-=(</span><span class="fl">.05</span> <span class="op">-</span>a<span class="op">/</span><span class="dv">2</span><span class="op">%</span><span class="dv">2</span><span class="op">*</span><span class="fl">.1</span><span class="op">)*!(</span>a<span class="op">-</span><span class="dv">1</span><span class="op">&amp;</span><span class="dv">4092</span><span class="op">^</span><span class="dv">3920</span><span class="op">)</span></span></code></pre></div>
<h3 id="precision-issues">Precision issues:</h3>
<p>The entry, on purpose, (see the section about SIMD below) does not
use enough bits of precision, so sometimes the ray will miss the
intersection of two voxel faces and push on through. That’s why you may
notice some noise along close up voxel edges. Fixing this issue would
have taken the entry over the size limit regrettably.</p>
<h3 id="obfuscations">Obfuscations:</h3>
<p>Well, of course you have all the usual suspects, used for extreme
compression, and such a nice layout: not very informative identifiers,
which are being reused all over the place, some rather gruesome looking
expressions, a whole load of magic constants with apparently no rhyme or
reason (including a Lagrange polynomial), and a message from our
friendly Cetaceans. However it also includes some clever and not so
obvious though instructive techniques, to subtly make the code more
magical and efficient, at the same time.</p>
<p>Those techniques are about the use of 64 bit integers in order to do
SIMD work, in a portable way without ever using any SSE/AVX or other
non-portable compiler inline functions! The irony though, is that when
compiling the program on modern X86 architectures indeed SSE/AVX is used
for the long longs. Following is some “Spoiler” information, So if you
want to play tough, stop reading at this point.</p>
<h3 id="portable-simd-programming">Portable SIMD programming:</h3>
<p>So how is this done? Quite simply by using the whole
<code>long long</code> arithmetic’s capability. I think the C99 standard
assures us that <code>long long</code> has at least 64 bits. Most of
those bits are unused in normal programs, however here we use them more
wisely. For example, in the inner loop of the program you have the
innocent looking expression <code>i+=d</code>. What it does in fact, is
a SIMD addition of two vectors, each with three signed fixed point
coordinates, advancing our ray in 3D space!</p>
<p>To spell it out, the macro producing such vectors is <code>P</code>,
and the assignment <code>q=0x820008202625a0</code> sets our creeper
original position to about <code>(32.5, 32.5019, 2441.406)</code>.</p>
<p>Evidently when doing such arithmetics, care must me taken to avoid
overflow from one component to the other, but since our voxel world is a
torus of size 64 in each dimension this hardly matters. A subtle issue,
is how to deal with signed quantities. In the <code>i+=d</code>
expression above <code>i</code> has 3 positive components, but
<code>d</code> has arbitrary signed components, as our ray may face in
any direction. It seems things should not work, specially as we defined
both <code>i</code> and <code>d</code> as <code>unsigned</code>! However
notice that the <code>T</code> (and <code>P</code>) macros convert
<code>float</code> to <code>signed long long</code>s.</p>
<p>Once sign is extended from a least component into higher bits, it
seems at first to be recipe for disaster, however everything works
beautifully, and you get precise component results when the final
accumulation components in <code>i</code> are positive. This only gets
broken a bit when the final accumulation has a least significant
negative component. To see this bug in action change the assignment
above to <code>q=0x82000820000000</code>, and look towards the negative
direction of the main tunnel.</p>
<p>Similar technique is used on the RGB components so their brightness
can be adjusted simultaneously by the expression:
<code>o=o*b&gt;&gt;8</code>. Of course some spare bits are needed
between the components, so they are spread in the <code>long long</code>
and reordered as RBG.</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-2015dogon"><a name="inventory"></a>Inventory for
2015/dogon</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/2015/dogon/prog.c">prog.c</a>
- winning source</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2015/dogon/Makefile">Makefile</a>
- winner Makefile</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2015/dogon/prog.alt.c">prog.alt.c</a>
- alternative source</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2015/dogon/prog.orig.c">prog.orig.c</a>
- original source</li>
<li><a href="2015_dogon.tar.bz2">2015_dogon.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/2015/dogon/.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/2015/dogon/.winner.json">.winner.json</a>
- description of winner in JSON</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2015/dogon/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%2F2015%2Fdogon%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 -->
+321 -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,333 @@
<!-- !!! DO NOT MODIFY THIS FILE - This file is generated by a tool !!! -->
<!-- !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<!-- -->
<!-- file: 2015/duble/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>2015 duble</title>
<meta name="description" content="IOCCC year: 2015 IOCCC winner: duble winner index page">
<meta name="keywords" content="IOCCC,2015,duble,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>2015/duble</title>
<meta name="description" content="2015 IOCCC winner duble">
<meta name="keywords" content="IOCCC, 2015, IOCCC 2015, IOCCC winner, duble">
</head>
<!-- END: this line ends content from: inc/head.default.html -->
<!-- START: this line starts content from: inc/body.default.html -->
<body>
<h1>2015 duble</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>2015/duble</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%2F2015%2Fduble%2Findex.html">Nu Html check https://ioccc-src.github.io/temp-test-ioccc/2015/duble/index.html</a></p>
<!-- End Nu Html Checker -->
<div class="topnav">
<a class="Left" href="../dogon/index.html">&larr; dogon</a>
<a class="Left" href="../index.html">&uarr; 2015 &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#Etienne_Duble">Etienne Duble</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>
<p>There is an alternate version of this entry, discussed in the
author’s remarks. See <a href="#alternate-code">Alternate code</a>
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="bu">echo</span> Some text <span class="kw">|</span> <span class="ex">./prog</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="alternate-code">Alternate code:</h2>
<p>This alternate code, provided by the author, is discussed in more
detail by the author in the ‘<a href="prog.c">prog.c</a> vs <a
href="prog.alt.c">prog.alt.c</a>’ section of their remarks.</p>
<h3 id="alternate-build">Alternate build:</h3>
<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>prog.alt</code> as you would <code>prog</code> above.</p>
<h2 id="judges-remarks">Judges’ remarks:</h2>
<p>Beautiful penmanship! However, your fonts may vary.</p>
<p>How does this entry compress the font it uses? What’s the purpose of
<code>lrand48(3)</code>? Why does the program dump core, when it does :)
?</p>
<h2 id="authors-remarks">Author’s remarks:</h2>
<h3 id="introduction">Introduction</h3>
<p>This program <strong>prints text in your terminal with an interesting
hand-writing effect</strong>.</p>
<p>It uses the <em>Braille patterns</em> range of the unicode standard:
this allows to consider each terminal character as a tiny 2x4
bitmap.</p>
<p>Turning the Braille code into something visual might be considered
blasphemous. When I was fighting to make this program work, I started
wondering if it was not the reason for its very erratic behaviour.</p>
<h3 id="prog.c-vs-prog.alt.c"><a href="prog.c">prog.c</a> vs <a
href="prog.alt.c">prog.alt.c</a></h3>
<p>The file <a href="prog.alt.c">prog.alt.c</a> is the one I
submitted.</p>
<p><a href="/winners.html#Gil_Dogon">Gil Dogon</a> noted a few unsafe
statements (statements whose behaviour is undefined in the C standard
and, as such, could cause issues with other compilers or optimization
levels). These have been fixed in <a href="prog.c">prog.c</a>.</p>
<p>After this fix, in order to remain rule-2-compliant, a variable name
has also been shortened in this file.</p>
<h3 id="how-to-build">How to build</h3>
<p>If you have <code>clang</code>:</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="va">CC</span><span class="op">=</span>clang <span class="fu">make</span> <span class="at">-e</span></span></code></pre></div>
<p>Otherwise (gcc):</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">make</span></span></code></pre></div>
<p>(You will get a few warnings in this case.)</p>
<h3 id="how-to-use-it">How to use it</h3>
<p>You need a terminal configured to handle a <em>UTF-8</em> encoding
and a font including <em>Braille patterns</em>.</p>
<p>This is the default on most modern GNU/Linux operating systems.</p>
<p>The default terminal application (gnome-terminal) or even a simple
xterm should render things properly.</p>
<p>I tested this on several Debian and Ubuntu systems, 32 and 64bits and
no configuration was needed.</p>
<p>I also tested it on FreeBSD 9.3 32bits (font and encoding
configuration was needed in this case).</p>
<h4 id="basic-mode">Basic mode:</h4>
<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> echo <span class="st">&#39;I am testing this thing.&#39;</span> <span class="kw">|</span> <span class="ex">./prog</span></span>
<span id="cb7-2"><a href="#cb7-2" aria-hidden="true" tabindex="-1"></a><span class="ex">[...</span> rendering ...]</span>
<span id="cb7-3"><a href="#cb7-3" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb7-4"><a href="#cb7-4" aria-hidden="true" tabindex="-1"></a><span class="ex">$</span> ./prog <span class="op">&lt;</span> lorem-ipsum.txt</span>
<span id="cb7-5"><a href="#cb7-5" aria-hidden="true" tabindex="-1"></a><span class="ex">[...</span> rendering ...]</span></code></pre></div>
<h4 id="interactive-mode">Interactive mode:</h4>
<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> ./prog</span>
<span id="cb8-2"><a href="#cb8-2" aria-hidden="true" tabindex="-1"></a><span class="op">&gt;</span> hello <span class="ex">world!!!</span></span>
<span id="cb8-3"><a href="#cb8-3" aria-hidden="true" tabindex="-1"></a><span class="ex">[...</span> rendering ...]</span>
<span id="cb8-4"><a href="#cb8-4" aria-hidden="true" tabindex="-1"></a><span class="op">&gt;</span></span></code></pre></div>
<h3 id="obfuscation">Obfuscation:</h3>
<p>This entry is obfuscated in various ways:</p>
<ul>
<li>The structure is hidden by avoiding loops, <code>if</code>
statements, ternary conditionals, and jump-related instructions.
Instead, recursion is heavily used.</li>
<li>Merging all functions into one added even more recursion. ;)</li>
<li>The provided code does not contain the same number of opening and
closing parenthesis.</li>
<li>Preprocessing the code inflates it and adds lots of indents.
Removing some of the tricks involved without breaking the program will
be challenging.</li>
<li>The program ‘plays’ with standard input &amp; output streams, which
causes unusual side effects.</li>
<li>Some variables are re-used for unrelated processes.</li>
<li>Crucial data may be hidden in unexpected places (e.g. as the size of
a temporary buffer).</li>
<li>Some parts of the code may have no effect (but may have an effect in
a specific context, who knows?), and classical libc functions may not
act as usual.</li>
<li>And of course variable names are hard to read (or distracting).</li>
</ul>
<p>On the other hand, the following may help:</p>
<ul>
<li>The code layout should help to identify which part of the code is
obfuscated. ;)</li>
<li>File <a href="codes.txt">codes.txt</a> shows how each character is
drawn. This data is encoded in macro <code>O_o</code> at the top of the
source file.</li>
</ul>
<h3 id="limitations">Limitations:</h3>
<h4 id="charset">Charset</h4>
<p>In order to comply with the size rule, I encoded only a part of the
visible ASCII chars:</p>
<pre><code>a-z, A-Z, &#39;.&#39; &#39;:&#39; &#39;,&#39; &#39;;&#39; &#39;!&#39; and &#39;?&#39;.</code></pre>
<p>Uppercase and lowercase chars are rendered the same. The program also
understands space and linefeed (<code>\n</code>). Other chars are simply
ignored (most of the time ;)</p>
<h4 id="stack-size">Stack size</h4>
<p>This limitation is due to the heavy use of recursion. After having
processed a large number of characters, the process may exceed the stack
size and crash. (However I did not experience this myself. The top-level
recursion might be removed by the compiler as part of its
optimizations.)</p>
<h4 id="line-rendering">Line rendering</h4>
<p>The program does its best to avoid cutting words at the end of lines,
but it could still happen in case of long words.</p>
<h3 id="subtleties-and-extra-features">Subtleties and extra
features</h3>
<h4 id="handling-more-than-text-docs">Handling more than text docs?</h4>
<p>Given the limited set of characters handled, the program is mostly
limited to simple text documents.</p>
<p>Thus, if you try for example:</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> ./prog <span class="op">&lt;</span> prog.c</span></code></pre></div>
<p>You will not get something that looks like C code. (but you can still
try, if you are curious. :)</p>
<h4 id="a-draft-mode">A ‘draft’ mode</h4>
<p>Defining an environment variable called <code>DRAFT</code> will
enable the ‘draft-mode’. Try for example:</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> echo <span class="st">&#39;testing the draft mode&#39;</span> <span class="kw">|</span> <span class="va">DRAFT</span><span class="op">=</span>1 <span class="ex">./prog</span></span></code></pre></div>
<p>The program will run much faster but the rendering will be less
precise.</p>
<h4 id="the-subtle-interactive-mode">The subtle interactive mode</h4>
<p>I saved the best for last: usually, programs that handle an
“interactive mode” have to check whether their standard input is a
terminal or not (by using <code>isatty()</code>). Did you notice that
this program does not perform any such detection, but still behaves (or
seems to behave) appropriately?</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-2015duble"><a name="inventory"></a>Inventory for
2015/duble</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/2015/duble/prog.c">prog.c</a>
- winning source</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2015/duble/Makefile">Makefile</a>
- winner Makefile</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2015/duble/prog.alt.c">prog.alt.c</a>
- alternative source</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2015/duble/prog.orig.c">prog.orig.c</a>
- original source</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2015/duble/codes.txt">codes.txt</a>
- show how each character is drawn</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2015/duble/lorem-ipsum.txt">lorem-ipsum.txt</a>
- sample input</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2015/duble/try.sh">try.sh</a>
- how to run</li>
<li><a href="2015_duble.tar.bz2">2015_duble.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/2015/duble/.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/2015/duble/.winner.json">.winner.json</a>
- description of winner in JSON</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2015/duble/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%2F2015%2Fduble%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 -->
+387 -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,399 @@
<!-- !!! DO NOT MODIFY THIS FILE - This file is generated by a tool !!! -->
<!-- !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<!-- -->
<!-- file: 2015/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>2015 endoh1</title>
<meta name="description" content="IOCCC year: 2015 IOCCC winner: endoh1 winner index page">
<meta name="keywords" content="IOCCC,2015,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>2015/endoh1</title>
<meta name="description" content="2015 IOCCC winner endoh1">
<meta name="keywords" content="IOCCC, 2015, IOCCC 2015, 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>2015 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>2015/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%2F2015%2Fendoh1%2Findex.html">Nu Html check https://ioccc-src.github.io/temp-test-ioccc/2015/endoh1/index.html</a></p>
<!-- End Nu Html Checker -->
<div class="topnav">
<a class="Left" href="../duble/index.html">&larr; duble</a>
<a class="Left" href="../index.html">&uarr; 2015 &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>Authors:</strong></a> <br><br>Name: <a
href="/temp-test-ioccc/winners.html#Anonymous_2015">Anonymous
2015</a><br> Location: <a
href="/temp-test-ioccc/location.html#JP">JP</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>
<p>NOTE: this program requires the tool <code>tcpserver</code> to use.
If you do not have this program see <a href="/faq.md#tcpserver">FAQ 3.14
- How do I compile and install tcpserver for entries that require
it</a>.</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">tcpserver</span> <span class="at">-v</span> 127.0.0.1 10333 ./prog ioccc.txt</span></code></pre></div>
<p>Then connect to http://localhost:10333 with your browser.</p>
<h2 id="judges-remarks">Judges’ remarks:</h2>
<p><a href="https://www.livescience.com/950-leopard-spots.html">How did
the leopard get its spots</a>? Why are a <a
href="https://africafreak.com/zebra-stripes">zebra’s stripes</a>
unique?</p>
<p>In case you didn’t recognise the portrait of <a
href="https://en.wikipedia.org/wiki/Alan_Turing">Alan Turing</a>, there
are some pointers to his features like eyes with “<code>stdeye-o</code>”
and “<code>&lt;--mouth</code>”. Can you find any other tributes?</p>
<h2 id="authors-remarks">Author’s remarks:</h2>
<p>What does “<a href="https://en.wikipedia.org/wiki/Alan_Turing">Alan
Turing</a>” remind you of? <a
href="https://en.wikipedia.org/wiki/Cryptanalysis">Cryptanalysis</a> of
the <a href="https://en.wikipedia.org/wiki/Enigma_machine">Enigma
machine</a>? <a
href="https://en.wikipedia.org/wiki/Turing_machine">Turing machine</a>?
<a href="https://en.wikipedia.org/wiki/Turing_test">Turing test</a>?
This program is also based on his work.</p>
<h3 id="whirlwind-tour">Whirlwind tour</h3>
<p>Compile the program as follows:</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">cc</span> <span class="at">-O3</span> <span class="at">-std</span><span class="op">=</span>c99 <span class="dt">\</span></span>
<span id="cb3-2"><a href="#cb3-2" aria-hidden="true" tabindex="-1"></a> <span class="at">-Wall</span> <span class="at">-Wextra</span> <span class="at">-pedantic</span> <span class="at">-o</span> prog prog.c <span class="dt">\</span></span>
<span id="cb3-3"><a href="#cb3-3" aria-hidden="true" tabindex="-1"></a> <span class="at">-Delta_u</span><span class="op">=</span><span class="st">&quot;Du*laplacian(u)-u*v*v+F*(1-u)&quot;</span> <span class="dt">\</span></span>
<span id="cb3-4"><a href="#cb3-4" aria-hidden="true" tabindex="-1"></a> <span class="at">-Delta_v</span><span class="op">=</span><span class="st">&quot;Dv*laplacian(v)+u*v*v-v*(F+K)&quot;</span> <span class="dt">\</span></span>
<span id="cb3-5"><a href="#cb3-5" aria-hidden="true" tabindex="-1"></a> <span class="at">-DF</span><span class="op">=</span>0.040 <span class="at">-DK</span><span class="op">=</span>0.060 <span class="at">-DDu</span><span class="op">=</span>0.200 <span class="at">-DDv</span><span class="op">=</span>0.100 <span class="dt">\</span></span>
<span id="cb3-6"><a href="#cb3-6" aria-hidden="true" tabindex="-1"></a> <span class="at">-DUV_BACKGROUND</span><span class="op">=</span>1,0 <span class="at">-DUV_DROP</span><span class="op">=</span>-0.5,0.5 <span class="dt">\</span></span>
<span id="cb3-7"><a href="#cb3-7" aria-hidden="true" tabindex="-1"></a> <span class="at">-DTIMESTEP</span><span class="op">=</span>1.0 <span class="at">-DSPEED</span><span class="op">=</span>2 <span class="at">-DRGB</span><span class="op">=</span>255:128:192</span></code></pre></div>
<p>Then, run it with the <code>tcpserver</code> command in the <a
href="http://cr.yp.to/ucspi-tcp.html">ucspi-tcp</a> package, which was
created by <a href="/winners.html#Daniel_J._Bernstein">Daniel J.
Bernstein</a>, <a href="../../1991/brnstnd/brnstnd.c">IOCCC 1991 “Best
of Show”</a> (<a href="../../1991/brnstnd/README.md">README.md</a>).</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">tcpserver</span> <span class="at">-v</span> 127.0.0.1 10333 ./prog ioccc.txt</span></code></pre></div>
<p>Finally, open <code>http://127.0.0.1:10333/</code> in a modern
browser supporting HTML5. You can use the mouse cursor to place drops
into the <a href="https://en.wikipedia.org/wiki/Petri_dish">Petri
dish</a> interactively.</p>
<h3 id="description">Description</h3>
<p>This is a simulator of <a
href="https://en.wikipedia.org/wiki/Reaction-diffusion_system">reaction-diffusion
systems</a>.</p>
<p>Reaction-diffusion systems, proposed by Alan Turing in <a href="#fn1"
class="footnote-ref" id="fnref1" role="doc-noteref"><sup>1</sup></a>,
are mathematical models in which two chemical substances are transformed
into each other (<em>local chemical reactions</em>) and spread out
(<em>diffusion</em>). Their interactions sometimes form non-trivial
patterns, such as spots, spiral, dappling, and labyrinths.</p>
<p>The systems are generally formulated as follows:</p>
<pre><code>du/dt = F(u, v) + Du * laplacian(u)
dv/dt = G(u, v) + Dv * laplacian(v)</code></pre>
<p>The functions <code>F(u, v)</code> and <code>G(u, v)</code> represent
reactions of each substance, and the parameters <code>Du</code> and
<code>Dv</code> are diffusion coefficients. By changing the functions
and parameters, you can see a wide range of behaviors.</p>
<p>See <a
href="https://en.wikipedia.org/wiki/Reaction%E2%80%93diffusion_system">the
Wikipedia article of “Reaction-diffusion system”</a> in detail.</p>
<p>This program simulates the systems. The field consists of 128 x 128
cells. Each cell includes information of an amount of the two
substances, and interacts with neighbor cells (in terms of <a
href="https://en.wikipedia.org/wiki/Von_Neumann_neighborhood">von
Neumann neighborhood</a>) in each frame.</p>
<h3 id="configuration">Configuration</h3>
<p>You can change the model, initial pattern, simulation speed, and
color via macro definition.</p>
<h4 id="model--delta_uexpression--delta_vexpression">Model:
<code>-Delta_u=&lt;expression&gt; -Delta_v=&lt;expression&gt;</code></h4>
<p>The definitions represent the equations of reaction-diffusion system.
For example, the following is <a
href="http://groups.csail.mit.edu/mac/projects/amorphous/GrayScott/">the
Gray-Scott model</a> in TeX notation.</p>
<pre><code>\frac{\partial u}{\partial t} = D_u \Delta u - u v^2 + F (1 - u)
\frac{\partial v}{\partial t} = D_v \Delta v + u v^2 - v (F + K)</code></pre>
<p>You can specify this model as follows:</p>
<pre><code>-Delta_u=&quot;Du*laplacian(u)-u*v*v+F*(1-u)&quot; \
-Delta_v=&quot;Dv*laplacian(v)+u*v*v-v*(F+K)&quot;</code></pre>
<p><code>Du</code>, <code>Dv</code>, <code>F</code>, and <code>K</code>
are parameters of that model.</p>
<h4 id="initial-pattern--duv_backgroundu0v0--duv_dropu1v1">Initial
pattern:
<code>-DUV_BACKGROUND=&lt;u0&gt;,&lt;v0&gt; -DUV_DROP=&lt;u1&gt;,&lt;v1&gt;</code></h4>
<p>The definitions specifies the initial amount of the two substances
<code>u</code> and <code>v</code>. All cells have <code>(u0, v0)</code>
by default.</p>
<p>You can specify a pattern file when the executable is invoked (not
compile-time). The file should include a sequence of points, see <a
href="ioccc.txt">ioccc.txt</a>, <a href="center.txt">center.txt</a>, or
<a href="line.txt">line.txt</a> as examples. Each amount in cells near
to the point included in the file, will be added by
<code>(u1, v1)</code>.</p>
<h4 id="simulation-speed--dtimestepts--dspeedspd">Simulation speed:
<code>-DTIMESTEP=ts -DSPEED=spd</code></h4>
<p>The definitions are for changing the simulation speed.</p>
<p><code>TIMESTEP</code> is a simulation time step. The bigger, the
faster but more unstable.</p>
<p><code>SPEED</code> is a frame skip parameter. The bigger, the faster
but more sluggish.</p>
<h4 id="rendering-color--drgbrgb">Rendering color:
<code>-DRGB=r:g:b</code></h4>
<p>This specifies a color used for rendering.</p>
<h3 id="examples">Examples</h3>
<p>Some interesting parameters are included in <code>Makefile</code>. Do
one of the following commands and open
<code>http://127.0.0.1:10333</code>.</p>
<pre><code>make gray-scott-1 &amp;&amp; tcpserver -v 127.0.0.1 10333 ./gray-scott-1 ioccc.txt
make gray-scott-1 &amp;&amp; tcpserver -v 127.0.0.1 10333 ./gray-scott-1 center.txt
make gray-scott-1 &amp;&amp; tcpserver -v 127.0.0.1 10333 ./gray-scott-1 line.txt
make gray-scott-2 &amp;&amp; tcpserver -v 127.0.0.1 10333 ./gray-scott-2 ioccc.txt
make gray-scott-3 &amp;&amp; tcpserver -v 127.0.0.1 10333 ./gray-scott-3 ioccc.txt
make gray-scott-4 &amp;&amp; tcpserver -v 127.0.0.1 10333 ./gray-scott-4 ioccc.txt
make fitzhugh-nagumo-1 &amp;&amp; tcpserver -v 127.0.0.1 10333 ./fitzhugh-nagumo-1 ioccc.txt
make fitzhugh-nagumo-2 &amp;&amp; tcpserver -v 127.0.0.1 10333 ./fitzhugh-nagumo-2 ioccc.txt
make oregonator &amp;&amp; tcpserver -v 127.0.0.1 10333 ./oregonator ioccc.txt</code></pre>
<p>These examples are created by drawing (and modifying) the pattern
files of <a href="https://github.com/GollyGang/ready">Ready</a>, a
cross-platform implementation of various reaction-diffusion systems <a
href="#fn2" class="footnote-ref" id="fnref2"
role="doc-noteref"><sup>2</sup></a>.</p>
<h3 id="compatibility">Compatibility</h3>
<h4 id="c-part">C part</h4>
<p>This program compiles clean with no warnings under
<code>-std=c99 -Wall -Wextra -pedantic</code>. Since it uses
<code>long long</code> for 64bit integers, C99 is required.</p>
<h4 id="browser-part">Browser part</h4>
<p>You must use a modern browser that supports the latest specification
of WebSocket <a href="#fn3" class="footnote-ref" id="fnref3"
role="doc-noteref"><sup>3</sup></a>. All the following browsers worked
for me:</p>
<ul>
<li>Google Chrome 45</li>
<li>Mozilla Firefox 39</li>
<li>Microsoft Internet Explorer 11 (works but sluggish)</li>
</ul>
<p>I think Safari 6 will work but I haven’t tested. (I have no recent
macOS.)</p>
<p>NOTE from the judges in 2023: recent versions of Safari also
work.</p>
<h4 id="tcpserver-alternatives">tcpserver alternatives</h4>
<p>I think you may use <code>inetd</code> and <code>xinetd</code>
instead of <code>tcpserver</code>. Here is an example <code>inetd</code>
configuration.</p>
<pre><code>10333 stream tcp nowait nobody /path/to/prog /path/to/prog /path/to/initial-pattern.txt</code></pre>
<p>But note that I didn’t test well.</p>
<h3 id="internal">Internal</h3>
<ol type="1">
<li>The C program accepts HTTP connection from the browser, and sends a
HTML document.</li>
<li>The browser tries to upgrade the connection to WebSocket.</li>
<li>The C program accepts WebSocket upgrade. This negotiation process
requires SHA1 hash <a href="#fn4" class="footnote-ref" id="fnref4"
role="doc-noteref"><sup>4</sup></a> and Base64 encoding <a href="#fn5"
class="footnote-ref" id="fnref5" role="doc-noteref"><sup>5</sup></a>.
The C program calculates them without the aid of any external
libraries.</li>
<li>The C program simulates the reaction-diffusion system, and then send
the field data to the browser on each frame.</li>
<li>The browser receives and renders the field data onto the HTML5
canvas.</li>
</ol>
<h3 id="references">References</h3>
<ul>
<li></li>
<li></li>
<li></li>
<li></li>
<li></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>
<section id="footnotes" class="footnotes footnotes-end-of-document"
role="doc-endnotes">
<hr />
<ol>
<li id="fn1"><p>Turing, A. M., “The Chemical Basis of Morphogenesis”,
Philosophical Transactions of the Royal Society, 1952.<a href="#fnref1"
class="footnote-back" role="doc-backlink">↩︎</a></p></li>
<li id="fn2"><p>The Ready Bunch, “Ready”, A cross-platform
implementation of various reaction-diffusion systems, since 2011, <a
href="https://github.com/GollyGang/ready"
class="uri">https://github.com/GollyGang/ready</a>.<a href="#fnref2"
class="footnote-back" role="doc-backlink">↩︎</a></p></li>
<li id="fn3"><p>Fette, I. and A. Melnikov, “The WebSocket Protocol”, RFC
6455, DOI 10.17487/RFC6455, December 2011, <a
href="http://www.rfc-editor.org/info/rfc6455"
class="uri">http://www.rfc-editor.org/info/rfc6455</a>.<a href="#fnref3"
class="footnote-back" role="doc-backlink">↩︎</a></p></li>
<li id="fn4"><p>Eastlake 3rd, D. and P. Jones, “US Secure Hash Algorithm
1 (SHA1)”, RFC 3174, DOI 10.17487/RFC3174, September 2001, <a
href="http://www.rfc-editor.org/info/rfc3174"
class="uri">http://www.rfc-editor.org/info/rfc3174</a>.<a href="#fnref4"
class="footnote-back" role="doc-backlink">↩︎</a></p></li>
<li id="fn5"><p>Josefsson, S., “The Base16, Base32, and Base64 Data
Encodings”, RFC 4648, DOI 10.17487/RFC4648, October 2006, <a
href="http://www.rfc-editor.org/info/rfc4648"
class="uri">http://www.rfc-editor.org/info/rfc4648</a>.<a href="#fnref5"
class="footnote-back" role="doc-backlink">↩︎</a></p></li>
</ol>
</section>
<!-- START: this line starts content generated by: bin/gen-inventory.sh -->
<h1 id="inventory-for-2015endoh1"><a name="inventory"></a>Inventory for
2015/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/2015/endoh1/prog.c">prog.c</a>
- winning source</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2015/endoh1/Makefile">Makefile</a>
- winner Makefile</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2015/endoh1/prog.orig.c">prog.orig.c</a>
- original source</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2015/endoh1/center.txt">center.txt</a>
- sample input</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2015/endoh1/ioccc.txt">ioccc.txt</a>
- sample input</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2015/endoh1/line.txt">line.txt</a>
- sample input</li>
<li><a href="2015_endoh1.tar.bz2">2015_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/2015/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/2015/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/2015/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%2F2015%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 -->
+209 -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,221 @@
<!-- !!! DO NOT MODIFY THIS FILE - This file is generated by a tool !!! -->
<!-- !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<!-- -->
<!-- file: 2015/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>2015 endoh2</title>
<meta name="description" content="IOCCC year: 2015 IOCCC winner: endoh2 winner index page">
<meta name="keywords" content="IOCCC,2015,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>2015/endoh2</title>
<meta name="description" content="2015 IOCCC winner endoh2">
<meta name="keywords" content="IOCCC, 2015, IOCCC 2015, 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>2015 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>2015/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%2F2015%2Fendoh2%2Findex.html">Nu Html check https://ioccc-src.github.io/temp-test-ioccc/2015/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; 2015 &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="ex">./prog</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>At this point you might be wondering, <a
href="http://acronyms.thefreedictionary.com/WTF">WTF</a>?*</p>
<ul>
<li><p>What The Freak (polite form)</p></li>
<li><p>What’s This For? (you may be wondering)</p></li>
<li><p>What the Fish (python form)</p></li>
</ul>
<p>How is this code obfuscated? Well look again:</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">less</span> prog.c</span>
<span id="cb4-2"><a href="#cb4-2" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb4-3"><a href="#cb4-3" aria-hidden="true" tabindex="-1"></a><span class="fu">more</span> prog.c</span></code></pre></div>
<p>Where did those underscores come from? Well <a
href="http://acronyms.thefreedictionary.com/RTFS">RTFS</a>!**</p>
<p>** Read the Freaking Source (polite form) ** Read The Freaking Screen
(polite form)</p>
<p>If you are still puzzled, look at <a href="prog.c">prog.c</a> with
your favorite text editor.</p>
<h2 id="authors-remarks">Author’s remarks:</h2>
<p><strong>Follow these instructions literally!</strong></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">cat</span> prog.c</span>
<span id="cb5-2"><a href="#cb5-2" aria-hidden="true" tabindex="-1"></a><span class="fu">gcc</span> <span class="at">-w</span> <span class="at">-o</span> prog prog.c</span>
<span id="cb5-3"><a href="#cb5-3" aria-hidden="true" tabindex="-1"></a><span class="ex">./prog</span></span></code></pre></div>
<p>You will do a double take.</p>
<p>Hint 1: Do <code>less prog.c</code>. You will see an
<strong>emphasized</strong> string if your terminal supports bold.</p>
<p>Hint 2: Do <code>wc -c prog.c</code>. This is very long
one-liner.</p>
<p>Spoiler: Open the source with an editor like <code>vim</code> or
<code>emacs</code>.</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-2015endoh2"><a name="inventory"></a>Inventory for
2015/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/2015/endoh2/prog.c">prog.c</a>
- winning source</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2015/endoh2/Makefile">Makefile</a>
- winner Makefile</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2015/endoh2/prog.orig.c">prog.orig.c</a>
- original source</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2015/endoh2/try.sh">try.sh</a>
- how to run</li>
<li><a href="2015_endoh2.tar.bz2">2015_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/2015/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/2015/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/2015/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%2F2015%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 -->
+373 -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,385 @@
<!-- !!! DO NOT MODIFY THIS FILE - This file is generated by a tool !!! -->
<!-- !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<!-- -->
<!-- file: 2015/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>2015 endoh3</title>
<meta name="description" content="IOCCC year: 2015 IOCCC winner: endoh3 winner index page">
<meta name="keywords" content="IOCCC,2015,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>2015/endoh3</title>
<meta name="description" content="2015 IOCCC winner endoh3">
<meta name="keywords" content="IOCCC, 2015, IOCCC 2015, 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>2015 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>2015/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%2F2015%2Fendoh3%2Findex.html">Nu Html check https://ioccc-src.github.io/temp-test-ioccc/2015/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; 2015 &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>
<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">./prog</span></span></code></pre></div>
<h2 id="try">Try:</h2>
<p>To see the original <a href="mullender.c">mullender</a> in
action:</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.sh</span></span></code></pre></div>
<p>Observe what happens when you hit enter or another character! You
might even try typing out, one character at a time,
<code>1984/mullender</code>, and then see what it looks like at the end.
Send INTR to end the program.</p>
<p>More generally use:</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">cc</span> <span class="at">-o</span> prog prog.c foo.c</span>
<span id="cb4-2"><a href="#cb4-2" aria-hidden="true" tabindex="-1"></a><span class="ex">./prog</span></span>
<span id="cb4-3"><a href="#cb4-3" aria-hidden="true" tabindex="-1"></a><span class="ex">^C</span> <span class="co"># if necessary, where ^C is ctrl-C, interrrupt</span></span></code></pre></div>
<p>to compile and run <code>prog</code> as whatever foo.c is in the joke
PDP-11 emulator.</p>
<h2 id="judges-remarks">Judges’ remarks:</h2>
<p>Like <a href="https://en.wikipedia.org/wiki/Marty_McFly">Marty</a>
and <a href="https://en.wikipedia.org/wiki/Emmett_Brown">Doc</a>,
something nostalgic from 1984 appears live in October of 2015!</p>
<p>The author of this gem is a true <a
href="https://en.wikipedia.org/wiki/DeLorean_time_machine">DeLorean</a>!</p>
<p>A question for inquisitive readers: is the implemented subset of
PDP-11 instructions <a
href="https://en.wikipedia.org/wiki/Turing_completeness">Turing-complete</a>?
(For a clue, see the end of the author’s remarks.) If in doubt, use <a
href="https://github.com/DoctorWkt/Apout">APOUT</a>.</p>
<h2 id="authors-remarks">Author’s remarks:</h2>
<h3 id="hint-compatibility">Hint / Compatibility</h3>
<ul>
<li>A little-endian system is required due to an external factor.</li>
<li>Strictly speaking, this program does not comply with any C
specification for the same reason. But I believe it is reasonably
portable.</li>
<li>It uses a GCC extension but works with clang.</li>
<li>This is a kind of emulator. You may find its architecture name if
you look at the source code from all angles..</li>
<li>Find <code>main()</code> function.</li>
</ul>
<h3 id="spoiler">Spoiler</h3>
<p>This program is a joke PDP-11 emulator. (“ll-dpd” is embedded in the
code. Read it upside down.)</p>
<p>You got it? This program is supposed to be used in this way:</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">wget</span> https://www.ioccc.org/1984/mullender.c</span>
<span id="cb5-2"><a href="#cb5-2" aria-hidden="true" tabindex="-1"></a><span class="fu">clang</span> <span class="at">-o</span> prog prog.c mullender.c</span>
<span id="cb5-3"><a href="#cb5-3" aria-hidden="true" tabindex="-1"></a><span class="ex">./prog</span></span></code></pre></div>
<p>You can enjoy the legendary winner of the first IOCCC, again.</p>
<h3 id="internal">Internal</h3>
<p>This program uses <code>__attribute__((constructor))</code>, which is
a GCC extension, to hijack the <code>main()</code> function call. And
then it interprets <code>main()</code> as an instruction sequence.</p>
<p>It supports the minimal subset of instructions and addressing modes
which are needed for <a href="mullender.c">mullender.c</a> to work:</p>
<ul>
<li>Instructions
<ul>
<li>BR: branch</li>
<li>MOV: move</li>
<li>SOB: subtract one and branch</li>
<li>SUB: subtract</li>
<li>TRAP 4: write syscall</li>
<li>TST: test (no flag is supported, though)</li>
</ul></li>
<li>Addressing modes
<ul>
<li>0: Register</li>
<li>1: Register deferred</li>
<li>2: Auto-increment</li>
<li>4: Auto-decrement deferred</li>
<li>6: Index (incomplete)</li>
</ul></li>
</ul>
<h3 id="limitations">Limitations</h3>
<p>Non-trivial combination of instruction and addressing mode may cause
undefined behavior (unsequenced modification), such as attempting to
auto-increment a destination register. Index addressing mode works well
only for R7 (PC register).</p>
<h3 id="one-more-thing">One more thing</h3>
<p>Note: this program writes a binary file to <code>stdout</code>:</p>
<pre><code>short main[]={5568,1,-30460,12,2782,0,-29921,2056,-4864,6873,770,30054,11886,
24948,114,21716,-28851,14043,-8944,32691,-16187,-12247,22692,-9781,-20403,
-11771,16546,18710,17873,9233,31304,-32215,-24382,-28247,-25916,10466,24988,
-3404,-4177,-28528,-531,-3016,17300,-28552,-7708,-26180,-4297,-367,-2312,
-25611,28535,-8533,24004,25421,-1224,-5354,-20807,-21589,-6761,-5203,-1055,
-6715,-26673,-1433,-17732,-24198,14681,-3714,-6660,-14891,-25575,20349,-7701,
-8336,31433,16695,-14773,26819,3096,-12584,-28808,17825,-21200,-32399,15877,
-28890,-3728,-27126,21375,-32630,-7615,32004,-29230,-6611,-5508,-28921,12418,
27204,-5725,9643,3520,26836,-29347,2101,-29311,9320,29287,-29990,-6593,29825,
-29114,16232,25641,20672,-23501,-32127,-6546,-956,10474,-29647,1070,5516,13760,
-27814,-32488,-28006,-17968,-3146,10963,19234,22132,23988,7142,5523,9639,-6888,
-11428,7964,23099,-16822,16518,31109,-12958,10351,2434,3091,3625,2244,27512,
-28559,-10724,-19377,23625,30056,11478,-21176,27660,26517,-29037,-9390,12297,
-11903,5980,-21927,-7483,6671,11249,29638,-23827,-26358,-6856,-1063,-5303,
26636,25797,31818,26798,-4243,-18772,-13266,27472,-12005,-10642,-22524,24373,
-13111,-9062,6274,-20002,24150,22189,-14965,-31249,-13934,-6341,-18384,-32054,
-29246,10622,-9260,19428,-15485,2724,23810,16447,11627,18604,2739,27812,30295,
-21538,-31786,11355,-11308,-9006,-4987,25363,-18927,-21130,-31213,-27411,17231,
-19608,20232,27754,16476,11213,-19803,-24048,30918,-25329,21233,-10160,13519,
11828,26653,-6703,10893,6871,-12417,24471,20310,-12137,-19677,4457,-19530,
10147,17724,533,-10055,27076,10264,11274,-10511,4809,25208,16065,-5105,-19953,
3772,-12124,13475,-27559,-9955,26446,15133,15207,-23640,6425,-11010,28688,
-20064,26353,-889,-25008,10380,-14449,-6894,18920,-23900,16902,-31018,16093,
20875,-19576,4585,13126,18589,24789,19424,31274,-5059,-14538,-3125,-16527,
-25070,-9013,26628,15756,-7652,30841,-1283,17707,25717,-18315,-6342,6880,
-19176,6995,5672,2853,-9044,-3409,-14421,-7522,13108,20582,-25317,1376,-5648,
13821,17300,1220,-29437,-25832,-8332,-15575,-9744,28297,31995,-1217,23852,
14382,31059,9160,-3296,20287,-28357,24449,-10323,-21992,-4655,-32548,13237,
-15083,-25226,-21121,2015,-8996,-20247,-27551,-14771,-16089,-6920,-9645,21578,
7142,-5613,14029,24730,-29253,13931,-3862,-16634,-7388,16951,15771,31302,
-22186,-6716,18416,1698,-26200,-16231,9821,-10886,-4994,-30527,-9448,-16923,
29549,-11207,-14909,-3643,-27548,17865,28859,29753,17616,16874,-17733,9424,
21435,-31715,24544,8666,30844,25075,-18267,12027,-5346,2717,19615,-4548,-21763,
28514,11691,22268,-2338,1406,-27379,-23568,-24525,13633,11295,-14715,7877,
-27669,3475,20345,7779,-17849,2184,7132,4079,-24937,11585,22740,5810,-10855,
16203,-6371,23235,-7,-24828,-11205,-11006,-10,-17812,-14274,11504,-27517,463,
4498,-32180,-9775,-3190,-22435,-18662,-30146,-31834,-26449,-19374,-12616,
-10596,14341,-10089,-18449,-16535,21439,21191,-1651,7695,-30009,-23339,-8675,
-20774,21588,-2793,8218,-14337,-10866,14060,-15343,31712,25247,-8539,18074,
-28683,-7363,-7663,-3563,-30718,17771,28687,-30495,30584,14022,-28053,5292,
-31576,-32486,-15470,-1330,23551,-2185,-10829,-13216,-4825,-2964,-14668,24559,
-4930,23731,-1152,-11493,-2321,15987,-27073,-20305,-24065,-25048,32750,-27440,
-1169,-25633,-4356,-24993,30439,-17165,-4580,8662,22655,-4588,-6162,-3122,
31986,-2569,20371,-12320,-25613,-16133,-25644,23677,12254,5855,26325,-13425,
-15903,-1930,-28488,31222,31153,17607,-2758,7594,-8868,30434,-2518,27956,
-19424,7370,6199,-17602,17347,-14358,25588,11611,-25209,-23701,-27444,-29788,
2680,-27406,9318,22483,-28356,28482,4577,-14891,17323,-30152,2507,2977,5004,
-11696,-31623,-15149,13357,28938,-14048,19490,-19860,-26050,10842,-24922,
-20986,8847,-31184,28519,-29168,32195,10516,25713,-3493,670,31283,-12769,
-17461,11357,13180,26133,15944,18051,-32167,-27990,16813,17676,21787,-17578,
11173,19093,2836,656,-15239,4632,23937,4106,-21655,-7494,-21575,-17647,-18465,
-14654,-29990,-10707,-12440,21465,5822,26164,-1404,-14303,-26635,-6900,-23611,
11998,-18551,971,27579,13325,4579,23059,29281,22291,29880,-17546,25664,-14990,
-526,-35,28218,-3214,11965,11263,6633,30719,32400,-29,-3733,24383,32678,-27542,
-4444,6196,5975,-19722,11902,16840,-11680,11146,-26391,-8980,21573,-9043,2349,
-12887,5916,-2996,10410,-23374,26338,11867,-14518,18281,14450,-5815,13842,359,
25450,27043,3355,13423,-20880,-26311,-30720,-2503,-6046,-18156,-18558,-14774,
-15664,-29001,3365,-12689,10233,23608,24692,12039,15445,18411,-27469,3764,
-10841,22672,23844,2282,-12443,2851,-27163,13651,13738,17201,-29819,27414,
-29764,-5308,-16171,-32427,-26312,-7460,-27376,-6004,25717,29254,-15015,8754,
15493,22232,-28513,-23355,23676,7736,10571,-8120,-16677,7696,32549,-2646,25538,
3498,30960,-28459,24716,12655,-10496,402,26209,482,-16661,-20350,-3403,14015,
32299,11262,-25886,4092,-7843,-100,-1975,-58,-3729,-19269,-23583,-6929,20000,
-6089,17780,-3250,29830,19954,-29277,27896,10330,9277,-25358,31279,-14454,
24203,-30170,12872,-21973,-25773,-10502,-6647,-26143,6394,-13479,-24559,23007,
-21844,1505,24702,-23187,-24364,-20470,20765,-7107,15674,9404,17408,17964,
19820,18952,2154,-26052,30056,-3227,17770,-8557,-31018,-27700,-25974,9003,
18218,22730,-19981,6737,3532,1562,-23626,14990,28472,-5270,17358,-32204,-29197,
-3647,4296,8588,25302,-23906,30328,-29119,-24392,8992,-16557,31530,-31216,
14107,13041,-6976,7529,-8296,17865,-1462,8181,-21588,-131,-10177,-25931,-14627,
8301,3708,-32097,20808,13892,-21179,1192,20853,3249,-8774,20843,3520,24954,
-14215,-25170,-16170,2390,25964,-23923,-17464,-7177,-27568,-9880,-4647,-7323,
15388,2113,-12338,-7737,26255,26818,-22156,-19610,-911,-17057,-556,29935,27647,
31806,23676,-18132,-19234,-10869,-3715,24983,-10900,-29564,19856,-16392,-31860,
-25826,24077,12080,15383,-29852,-2266,-27217,31931,-3183,17385,-14211,19050,
-2449,-468,-2871,-11466,973,2866,649,1367,-8688,-24069,20992,25139,-25850,1184,
15851,785,16951,12160,22337,-21851,1849,-18801,14247,-429,-12682,30881,-11273,
-24819,-9794,8389,-27287,7525,16633,1328,-26650,32607,-8217,31912,7774,-16188,
-3546,-6550,-16279,-32696,1940,2577,-23723,-6484,2009,-424,27833,-21763,-13902,
7044,27360,-18450,27889,23987,3137,-7669,-5784,-7490,24946,32302,26464,-15513,
28898,2493,-17645,-4615,-13434,-20884,-4058,-29951,-22281,24784,21083,-8536,
22147,-11261,-15069,20659,2993,19029,21909,6748,-3263,1401,30960,11000,-16871,
-30566,-14959,-26356,-2885,21526,-26531,31063,12857,4992,-5067,3130,-17602,
-1732,-6593,30200,24679,3267,310,20733,24863,-15669,7875,-4577,-13821,-22325,
15548,29744,3733,-14547,21459,22122,3854,-2572,30197,-24770,-21263,8793,-8316,
1571,28191,-16143,-6446,31524,-26496,-17349,-29097,2806,11281,-7041,-683,14149,
19689,-22094,-1657,-30904,183,-15226,-6358,25461,461,1495,28345,-10554,-4004,
27119,13484,-21600,-12272,-7272,-14064,-299,10697,11280,19066,-9841,-7265,
-18002,19906,-17247,21482,-10939,-5897,-22300,-13978,27575,-8684,-6222,-19041,
5788,-30863,-10134,15142,2895,14705,-17713,12940,-21535,-11619,29416,18417,
-24973,24867,-26462,-24910,-32556,-26705,-7187,-7750,-758,-14809,20289,9260,
13778,-1422,30301,-1922,30646,27662,-15465,-912,29340,13846,-1263,28887,-20019,
32421,-29411,-27632,-7495,-8368,29230,-6386,-19536,-5235,2054,1854,23563,12348,
-15165,-2936,-28063,-15760,20126,-25531,4963,-5739,23182,16895,-17258,-10470,
-3969,-7742,-140,4475,-24014,-31961,19231,27153,-18551,20157,26443,11530,
-22214,2284,-24238,-31051,-26422,9088,29868,18458,8488,-9515,6799,-12507,54,
-19441,-32665,12561,23560,4725,-28617,-14800,-10224,-13503,-17636,-16823,
-24072,18735,-29798,-23658,-670,-21769,7489,-6468,-8961,-14785,22255,11582,
-29831,16303,-19652,2922,-4362,22966,16173,-18446,-6148,27381,-8493,-32289,
24005,-3027,-18665,-16472,-17793,-27027,-7443,17854,31365,-17726,-2510,-17546,
14893,21773,-23634,21117,32533,6637,-1106,-8152,-3672,-113,-2149,-34,-22700,
-4102,-28533,-14104,-10086,4378,13695,-15320,-28258,2246,7595,30021,13281,
-11968,-29983,14274,27152,26713,19434,17058,1142,-3043,-16496,18630,-11976,
29168,-3634,32746,27287,-268,16711,-8712,-471,12895,17406,-22548,-3969,-10733,
13128,10530,-31667,7929,-32277,30926,-1983,8401,-7705,6790,4532,1442,26728,
29600,-15358,21622,9744,11406,15989,-30741,-15044,29913,24534,6774,-3755,17623,
19647,18762,10042,9653,-5889,2408,-32579,-6285,-28559,-30655,6294,-21175,4390,
1668,25437,2821,21066,-13680,5274,-27253,-5248,-26307,29744,-26428,25358,17196,
15199,-29784,-4604,25653,-8048,-23131,-28995,31340,-9558,26186,11268,27916,
9646,-7389,-11384,-29116,-4100,160,18394,7856,738,-25920,12148,24713,-31664,
8203,-25556,13494,30352,29161,30898,1432,-5991,25411,1344,-4019,22299,15685,
-16401,-23136,-28110,11874,-18945,1879,2,0,-32256,-20996,-18169,29220,12,0,0,0,
335,-27277,-30776,20480,0};</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-2015endoh3"><a name="inventory"></a>Inventory for
2015/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/2015/endoh3/prog.c">prog.c</a>
- winning source</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2015/endoh3/Makefile">Makefile</a>
- winner Makefile</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2015/endoh3/prog.orig.c">prog.orig.c</a>
- original source</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2015/endoh3/try.sh">try.sh</a>
- how to run</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2015/endoh3/ioccc.c">ioccc.c</a>
- program as an array of shorts</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2015/endoh3/mullender.c">mullender.c</a>
- copy of 1984/mullender.c</li>
<li><a href="2015_endoh3.tar.bz2">2015_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/2015/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/2015/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/2015/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%2F2015%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 -->
+216 -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,228 @@
<!-- !!! DO NOT MODIFY THIS FILE - This file is generated by a tool !!! -->
<!-- !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<!-- -->
<!-- file: 2015/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>2015 endoh4</title>
<meta name="description" content="IOCCC year: 2015 IOCCC winner: endoh4 winner index page">
<meta name="keywords" content="IOCCC,2015,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>2015/endoh4</title>
<meta name="description" content="2015 IOCCC winner endoh4">
<meta name="keywords" content="IOCCC, 2015, IOCCC 2015, 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>2015 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>2015/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%2F2015%2Fendoh4%2Findex.html">Nu Html check https://ioccc-src.github.io/temp-test-ioccc/2015/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; 2015 &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>
<p>There is an alt version which is the originally submitted entry. See
<a href="#alternate-code">Alternate code</a> below for details.</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">./prog</span> <span class="op">&lt;</span>a number of arguments<span class="op">&gt;</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="alternate-code">Alternate code:</h2>
<p>An alternate version of this entry, <a
href="prog.alt.c">prog.alt.c</a>, is provided. This alternate code does
not contain improvements suggested by <a
href="/winners.html#Gil_Dogon">Gil Dogon</a>; it is the author’s
original entry.</p>
<h3 id="alternate-build">Alternate build:</h3>
<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>prog.alt</code> as you would <code>prog</code> above.</p>
<h2 id="judges-remarks">Judges’ remarks:</h2>
<p>For this one liner it is best to avoid prime numbers. The output
groups factors in the x-y dimensions. How many factors can be
represented before you run out of command line argument space? How could
you modify the program to experiment with numbers that have more or
larger factors?</p>
<h2 id="authors-remarks">Author’s remarks:</h2>
<p>Visual factorization 1-liner. 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">gcc</span> <span class="at">-o</span> prog prog.c</span>
<span id="cb5-2"><a href="#cb5-2" aria-hidden="true" tabindex="-1"></a><span class="ex">./prog</span> @</span>
<span id="cb5-3"><a href="#cb5-3" aria-hidden="true" tabindex="-1"></a><span class="ex">./prog</span> @ @</span>
<span id="cb5-4"><a href="#cb5-4" aria-hidden="true" tabindex="-1"></a><span class="ex">./prog</span> @ @ @</span>
<span id="cb5-5"><a href="#cb5-5" aria-hidden="true" tabindex="-1"></a><span class="ex">./prog</span> @ @ @ @</span>
<span id="cb5-6"><a href="#cb5-6" aria-hidden="true" tabindex="-1"></a><span class="ex">./prog</span> @ @ @ @ @ @</span>
<span id="cb5-7"><a href="#cb5-7" aria-hidden="true" tabindex="-1"></a><span class="ex">./prog</span> @ @ @ @ @ @ @ @</span>
<span id="cb5-8"><a href="#cb5-8" aria-hidden="true" tabindex="-1"></a><span class="ex">./prog</span> @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @</span></code></pre></div>
<p>Inspired by <a
href="http://www.datapointed.net/visualizations/math/factorization/animated-diagrams/">Animated
Factorization Diagrams</a>.</p>
<p><a href="prog.alt.c">prog.alt.c</a> is the original version that I
submitted. <a href="/winners.html#Gil_Dogon">Gil Dogon</a> kindly
improved it during the review. Thank you!</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-2015endoh4"><a name="inventory"></a>Inventory for
2015/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/2015/endoh4/prog.c">prog.c</a>
- winning source</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2015/endoh4/Makefile">Makefile</a>
- winner Makefile</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2015/endoh4/prog.alt.c">prog.alt.c</a>
- alternative source</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2015/endoh4/prog.orig.c">prog.orig.c</a>
- original source</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2015/endoh4/try.sh">try.sh</a>
- how to run</li>
<li><a href="2015_endoh4.tar.bz2">2015_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/2015/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/2015/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/2015/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%2F2015%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 -->
+258 -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,270 @@
<!-- !!! DO NOT MODIFY THIS FILE - This file is generated by a tool !!! -->
<!-- !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<!-- -->
<!-- file: 2015/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>2015 hou</title>
<meta name="description" content="IOCCC year: 2015 IOCCC winner: hou winner index page">
<meta name="keywords" content="IOCCC,2015,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>2015/hou</title>
<meta name="description" content="2015 IOCCC winner hou">
<meta name="keywords" content="IOCCC, 2015, IOCCC 2015, 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>2015 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>2015/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%2F2015%2Fhou%2Findex.html">Nu Html check https://ioccc-src.github.io/temp-test-ioccc/2015/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; 2015 &uarr;</a>
<a class="Left" href="../howe/index.html">howe &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></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#2015-hou">2015
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="bu">echo</span> something <span class="kw">|</span> <span class="ex">./prog</span></span>
<span id="cb3-2"><a href="#cb3-2" aria-hidden="true" tabindex="-1"></a><span class="ex">./prog</span> <span class="op">&lt;</span> file</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="bu">echo</span> <span class="st">&quot;&quot;</span> <span class="kw">|</span> <span class="ex">./prog</span></span></code></pre></div>
<h2 id="judges-remarks">Judges’ remarks:</h2>
<p>A good start for understanding this entry might be <a
href="rfc1321.txt">rfc1321.txt</a>. How does it compute this using only
a single looping construct? The original reference source code for this
algorithm is about 355 lines of code, yet this entry is only 199 lines
with one statement per line and it isn’t using lots of macro expansion
tricks like the reference code!</p>
<p>Some things that make you go, “huh?”</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">./prog</span> <span class="op">&lt;</span> prog.c <span class="kw">|</span> <span class="fu">cut</span> <span class="at">-c-5</span></span>
<span id="cb5-2"><a href="#cb5-2" aria-hidden="true" tabindex="-1"></a><span class="ex">./prog</span> <span class="op">&lt;</span> Makefile <span class="kw">|</span> <span class="fu">cut</span> <span class="at">-c-4</span></span></code></pre></div>
<p>How are those values magically returned?</p>
<p>What happens with a large file? Something over 256K.</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">./prog</span> <span class="op">&lt;</span> large_file</span></code></pre></div>
<p>Where does that message come from?</p>
<h2 id="authors-remarks">Author’s remarks:</h2>
<p>This looks like a normal C program.</p>
<p>Almost everything is a <code>double</code>.</p>
<p>There are tell-tale signs like <code>pow(2,(?/12))</code> and
<code>exp(-?*?)</code> (names redacted). You can also find a bunch of
cosines and polynomial evaluations.</p>
<p>It looks like a ????? ???????????, right?</p>
<p>Run and find out.</p>
<h3 id="why-obfuscated">Why obfuscated</h3>
<p>Some poor scripting folks only have access to doubles (Jav?script,
L?a, BA?IC, etc.).</p>
<p>As a C programmer, I feel obliged to show a gesture of sympathy, to
experience their pain and provide an answer.</p>
<p>Except when absolutely necessary (<code>printf</code>,
<code>int main()</code>, array indexing), there isn’t a single integer.
Even <code>getchar()</code> and <code>EOF</code> are immediately
converted.</p>
<p>Since <code>bool</code> counts as an integer type too, there is no
boolean either. No comparison, no <code>if</code>, no <code>?:</code>,
no <code>||</code> <code>&amp;&amp;</code>. Everything is done in a
single loop that terminates on <code>printf(3)</code>. Straight up
arithmetic.</p>
<p><code>floor(3)</code> and <code>ceil(3)</code> are technically
double-to-double functions, but they feel like cheating. Yes
<code>cos(3)</code>, no <code>floor(3)</code>.</p>
<h3 id="limitations">Limitations</h3>
<p>Hard requirements:</p>
<ul>
<li><p>The platform must implement the <code>double</code> type as
IEEE754-compliant 64-bit floating point numbers. The 80-bit intermediate
format used by x87 is considered as an violation of this. The code
should print an error message on such platforms.</p></li>
<li><p>The program must start with the CPU / FPU in round-to-nearest
mode.</p></li>
</ul>
<p>Soft requirements:</p>
<ul>
<li><p>The compiler must respect <code>volatile</code>. The code is
formatted to warn about that, though.</p></li>
<li><p>The printed result is only correct on little-endian machines. The
program takes care to warn about this issue after printing an incorrect
big-endian result. Error messages become garbled, though.</p></li>
</ul>
<p>Tested platforms:</p>
<ul>
<li>Linux 3.18.7, Rasperberry Pi 2, clang 3.0-6.2, (works)</li>
<li>Linux 3.18.7, Rasperberry Pi 2, gcc 4.6.3, (works)</li>
<li>Mac OS X 10, x64, Apple LLVM version 6.1.0 (clang-602.0.53),
(works)</li>
<li>Windows 8.1, x86, MSVC 2012 (works)<br />
</li>
<li>Windows 8.1, x64, MSVC 2012 (works)</li>
<li>Windows 8.1, x86, MinGW gcc 4.6.2 (fails, prints error message)</li>
<li>Windows 8.1, x86, MinGW gcc 4.6.2 with -msse2 -mfpmath=sse
(works)</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-2015hou"><a name="inventory"></a>Inventory for
2015/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/2015/hou/prog.c">prog.c</a>
- winning source</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2015/hou/Makefile">Makefile</a>
- winner Makefile</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2015/hou/prog.orig.c">prog.orig.c</a>
- original source</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2015/hou/try.sh">try.sh</a>
- how to run</li>
<li><a href="rfc1321.txt">rfc1321.txt</a> - RFC 1321 - MD5
Message-Digest Algorithm</li>
<li><a href="2015_hou.tar.bz2">2015_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/2015/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/2015/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/2015/hou/README.md">README.md</a>
- markdown source for index.html</li>
<li><a href="large">large</a> - large input data</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%2F2015%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 -->
+323 -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,335 @@
<!-- !!! DO NOT MODIFY THIS FILE - This file is generated by a tool !!! -->
<!-- !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<!-- -->
<!-- file: 2015/howe/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>2015 howe</title>
<meta name="description" content="IOCCC year: 2015 IOCCC winner: howe winner index page">
<meta name="keywords" content="IOCCC,2015,howe,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>2015/howe</title>
<meta name="description" content="2015 IOCCC winner howe">
<meta name="keywords" content="IOCCC, 2015, IOCCC 2015, IOCCC winner, howe">
</head>
<!-- END: this line ends content from: inc/head.default.html -->
<!-- START: this line starts content from: inc/body.default.html -->
<body>
<h1>2015 howe</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>2015/howe</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%2F2015%2Fhowe%2Findex.html">Nu Html check https://ioccc-src.github.io/temp-test-ioccc/2015/howe/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; 2015 &uarr;</a>
<a class="Left" href="../mills1/index.html">mills1 &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#Anthony_C_Howe">Anthony C.
Howe</a><br> Location: <a
href="/temp-test-ioccc/location.html#CA">CA</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>There is an alternate version provided. See <a
href="#alternate-code">Alternate code</a> 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">./prog</span> file1 file2</span>
<span id="cb2-2"><a href="#cb2-2" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb2-3"><a href="#cb2-3" aria-hidden="true" tabindex="-1"></a><span class="ex">./prog</span> <span class="at">-d</span> file1 file2</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="alternate-code">Alternate code:</h2>
<p>This alternate version does not use a 64-bit FNV hash. This was the
original entry but was changed to be the alt version.</p>
<h3 id="alternate-build">Alternate build:</h3>
<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>prog.alt</code> as you would <code>prog</code> above.</p>
<h2 id="judges-remarks">Judges’ remarks:</h2>
<p>This is the best use of the FNV that we have seen in the IOCCC so
far! The output, when used without <code>-d</code>, is compatible with
POSIX <code>diff(1)</code> and is suitable for use with
<code>patch(1)</code>.</p>
<p>We welcome back Canada to the list of nations from where winning
entries have been submitted.</p>
<p>Is this code a bug or a feature? :-) Or is this an attempt to corrupt
the programming of our youth? Should we heed Kyle’s mom words that she
uttered during a South Park P.T.A. Meeting?</p>
<p>“We must stop dirty (C) language from getting to our children’s
ears!”</p>
<p><a href="https://www.youtube.com/watch?v=bOR38552MJA">Blame
Canada</a></p>
<p>Or should we teach our youth to understand the intricacies of this
code? Ying Tong Iddle I Po! We suggest you read the source for yourself,
which might be easier than the academic papers it was inspired by.</p>
<p>NOTE: Unlike the original entry source, <a
href="prog.alt.c">prog.alt.c</a>, <a href="prog.c">prog.c</a> uses a 64
bit FNV hash and fixes a function call warning.</p>
<h2 id="authors-remarks">Author’s remarks:</h2>
<h3 id="features">Features</h3>
<ul>
<li><p>“An O(NP) Sequence Comparison Algorithm” by Wu, Manber, Myers,
Miller.</p></li>
<li><p>Output compatible with <code>patch(1)</code>.</p></li>
<li><p>Strokes one of the judge’s ego (I couldn’t email chocolate or
curry).</p></li>
</ul>
<h3 id="description">Description</h3>
<p>This is a functioning micro <code>diff(1)</code> tool using an <a
href="http://myerslab.mpi-cbg.de/wp-content/uploads/2014/06/np_diff.pdf">O(NP)
algorithm</a>, compared to the older <a
href="http://www.xmailserver.org/diff2.pdf">O(ND) difference
algorithm</a> used by some versions of <code>diff(1)</code>. Its output
is based on the default <code>diff(1)</code> output described by POSIX
and <a
href="http://pubs.opengroup.org/onlinepubs/9699919799/utilities/diff.html">the
Open Group Base Specifications</a>. The output is suitable for use with
<code>patch(1)</code>.</p>
<p>The <code>-d</code> option simply writes the edit distance between
<code>file1</code> and <code>file2</code>.</p>
<h3 id="observations">Observations</h3>
<p>The FNV1a hash is a little slow compared to the trivial hash <a
href="https://www.gnu.org/software/diffutils/">GNU diff</a> uses. I
downloaded a plain text copy of “War And Peace” from <a
href="https://www.gutenberg.org">Project Gutenberg</a>, used <a
href="makeholes.c">makeholes.c</a> to make 1000 random changes, then
profiled and timed the program verses GNU <code>diff(1)</code>. The
bottleneck appears to be in the file I/O and line hashing with an
average +0.05s slower. Using a huge file like “War And Peace” for
testing offsets the <code>diff(1)</code> optimised file I/O.</p>
<p>There is no hash collision checking, partly because FNV1a appears to
generate very <a
href="http://programmers.stackexchange.com/questions/49550/which-hashing-algorithm-is-best-for-uniqueness-and-speed">few
collisions</a> and an assumption that localised collisions within a
region of edits are highly unlikely.</p>
<h3 id="support-files">Support Files</h3>
<ul>
<li><p><a href="prog-test.sh">prog-test.sh</a> Basic test program
verifies known test edit distances and <code>patch(1)</code>
support.</p></li>
<li><p><a href="avgtime.sh">avgtime.sh</a></p></li>
<li><p><a href="makeholes.c">makeholes.c</a> Random edits (holes) made
to a file in-place.</p></li>
</ul>
<h3 id="references">References</h3>
<p>Wu, Manber, Myers, and Miller; August 1989;<br />
“An O(NP) Sequence Comparison Algorithm”;<br />
<a
href="http://myerslab.mpi-cbg.de/wp-content/uploads/2014/06/np_diff.pdf"
class="uri">http://myerslab.mpi-cbg.de/wp-content/uploads/2014/06/np_diff.pdf</a></p>
<p>Fowler, Noll, Vo; 1994<br />
<a href="http://www.isthe.com/chongo/tech/comp/fnv/index.html"
class="uri">http://www.isthe.com/chongo/tech/comp/fnv/index.html</a></p>
<p>Fowler, Noll, Vo on Wikipedia<br />
<a
href="https://en.wikipedia.org/wiki/Fowler%E2%80%93Noll%E2%80%93Vo_hash_function"
class="uri">https://en.wikipedia.org/wiki/Fowler%E2%80%93Noll%E2%80%93Vo_hash_function</a></p>
<p>“diff”, The Open Group Base Specifications Issue 7<br />
IEEE Std 1003.1, 2013 Edition<br />
<a
href="http://pubs.opengroup.org/onlinepubs/9699919799/utilities/diff.html"
class="uri">http://pubs.opengroup.org/onlinepubs/9699919799/utilities/diff.html</a></p>
<p>Eugene W. Myers; “An O(ND) Difference Algorithm and Its
Variations”;<br />
Algorithmica, 1986, pages. 251-266<br />
<a href="http://www.xmailserver.org/diff2.pdf"
class="uri">http://www.xmailserver.org/diff2.pdf</a></p>
<p>Webb Miller and Eugene W. Myers; “A File Comparison Program”;<br />
Software-Practice And Experience, Vol. 15(11). 1025-1040 (November
1985)<br />
<a
href="http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.189.70&amp;rep=rep1&amp;type=pdf"
class="uri">http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.189.70&amp;rep=rep1&amp;type=pdf</a></p>
<p>D.S. Hirschberg, “A linear space algorithm for computing maximal
common subsequence problem”;<br />
Comm. of ACM, Vol. 18, June 1975, pages 341-343<br />
<a
href="http://www.mathcs.emory.edu/~cheung/Courses/323/Syllabus/DynProg/Docs/Hirschberg-LCS-1975.pdf"
class="uri">http://www.mathcs.emory.edu/~cheung/Courses/323/Syllabus/DynProg/Docs/Hirschberg-LCS-1975.pdf</a></p>
<p>Which hashing algorithm is best for uniqueness and speed?<br />
<a
href="http://programmers.stackexchange.com/questions/49550/which-hashing-algorithm-is-best-for-uniqueness-and-speed"
class="uri">http://programmers.stackexchange.com/questions/49550/which-hashing-algorithm-is-best-for-uniqueness-and-speed</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-2015howe"><a name="inventory"></a>Inventory for
2015/howe</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/2015/howe/prog.c">prog.c</a>
- winning source</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2015/howe/Makefile">Makefile</a>
- winner Makefile</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2015/howe/prog.alt.c">prog.alt.c</a>
- alternative source</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2015/howe/prog.orig.c">prog.orig.c</a>
- original source</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2015/howe/avgtime.sh">avgtime.sh</a>
- how to run</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2015/howe/makeholes.c">makeholes.c</a>
- add random holes to a file</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2015/howe/prog-test.sh">prog-test.sh</a>
- how to run</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2015/howe/try.sh">try.sh</a>
- how to run</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2015/howe/cc.1">cc.1</a>
- gcc man page</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2015/howe/spoiler/Makefile">spoiler/Makefile</a>
- SPOILER WARNING how to make the spoiler</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2015/howe/spoiler/err.h">spoiler/err.h</a>
- SPOILER WARNING</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2015/howe/spoiler/prog.c">spoiler/prog.c</a>
- SPOILER WARNING</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2015/howe/war-and-peace.txt">war-and-peace.txt</a>
- War and Peace translated to English</li>
<li><a href="2015_howe.tar.bz2">2015_howe.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/2015/howe/.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/2015/howe/.winner.json">.winner.json</a>
- description of winner in JSON</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2015/howe/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%2F2015%2Fhowe%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 -->
+299 -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,311 @@
<!-- !!! DO NOT MODIFY THIS FILE - This file is generated by a tool !!! -->
<!-- !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<!-- -->
<!-- file: 2015/mills1/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>2015 mills1</title>
<meta name="description" content="IOCCC year: 2015 IOCCC winner: mills1 winner index page">
<meta name="keywords" content="IOCCC,2015,mills1,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>2015/mills1</title>
<meta name="description" content="2015 IOCCC winner mills1">
<meta name="keywords" content="IOCCC, 2015, IOCCC 2015, IOCCC winner, mills1">
</head>
<!-- END: this line ends content from: inc/head.default.html -->
<!-- START: this line starts content from: inc/body.default.html -->
<body>
<h1>2015 mills1</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>2015/mills1</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%2F2015%2Fmills1%2Findex.html">Nu Html check https://ioccc-src.github.io/temp-test-ioccc/2015/mills1/index.html</a></p>
<!-- End Nu Html Checker -->
<div class="topnav">
<a class="Left" href="../howe/index.html">&larr; howe</a>
<a class="Left" href="../index.html">&uarr; 2015 &uarr;</a>
<a class="Left" href="../mills2/index.html">mills2 &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>
<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">./prog</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">./prog</span></span></code></pre></div>
<p>Press the up arrow and the down arrow at the right time.</p>
<h2 id="judges-remarks">Judges’ remarks:</h2>
<p>Did you find that mobile application game a bit frustrating? Well you
can adjust the Makefile parameters to make life a bit easier for
you:</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>which runs:</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">make</span> clobber all DW=199999 DW=22 DH=16 DA=50 DI=-150</span>
<span id="cb5-2"><a href="#cb5-2" aria-hidden="true" tabindex="-1"></a><span class="ex">./prog</span></span></code></pre></div>
<p>From the Makefile:</p>
<pre><code># Game parameters
#
DU=99999 # Time between steps in microseconds.
# Make it larger if the game is too fast for you.
DW=28 # Pipe-to-pipe spacing, in columns.
# Farther apart is easier.
DD=20 # Space between pipes.
# The difference between DD and DW is the width of a pipe.
# Narrow pipes are easier to fly though.
DH=8 # Height of gap in pipe.
# Make this larger to make the game easier.
DA=100 # Acceleration due to gravity (scaled by 256).
# Smaller values make you glide slower.
DI=-200 # Impulse velocity of a flap (scaled by 256).
# Make larger if you want a less intense tapping experience!
DB=&#39;&quot;&lt;o^=&quot;&#39; # Sprite for player when gliding.
# HINT: Try using various emojis.
# NOTE: The string MUST be enclosed inside double quotes.
DF=&#39;&quot;&lt;ov=&quot;&#39; # Sprite for player when flapping.
# HINT: Try using various emojis.
# NOTE: The string MUST be enclosed inside double quotes.
DG=&#39;&quot;Tap to Flap!&quot;&#39; # Instruction text.
# Change to your native tongue.
# NOTE: The string MUST be enclosed inside double quotes.</code></pre>
<p>WARNING: if you have good eye-hand coordination and too much time on
your hands you might fall asleep while playing as you probably will
never die in this mode. We only stopped when a reminder came through and
we tried to mark it complete at the same time as playing and we almost
managed to survive that. At that point we already scored over 90.</p>
<p>Enjoy!</p>
<pre><code>TAP!! TAP!! TAP!!
FLAP! FLAP! FLAP!</code></pre>
<h2 id="authors-remarks">Author’s remarks:</h2>
<h3 id="the-program">The Program</h3>
<p>Better late than never to jump on the bandwagon of 2014’s most
successful mobile game. The game is called Tappy Bird, and has all the
sophisticated gameplay of the original, except with an exciting twist!
(you get to fly to the right instead of to the left).</p>
<p>In addition, the game features exciting new customization options!
Too hard? Ran into that damn wall too many times? Now you can change
physics! Change any of a number of parameters (speed, gravity, etc.) of
the game to suit your gameplay!</p>
<p>You can even make the game more challenging – resize the terminal
window to make the world taller or shorter. You’ll never be able to get
through the pipes when they are four times as tall!</p>
<h3 id="instructions">Instructions</h3>
<p>The instructions are printed at the start of the game: Tap to
Flap!</p>
<p>Hit any key to make your bird fly. Navigate her between the gaps in
the pipes. Your score is shown in the upper left, along with your
current high-score.</p>
<h3 id="customization-options">Customization options</h3>
<p>To customize the gameplay, change any of the following options on the
compile command line:</p>
<ul>
<li><code>-DU</code>: Time between steps in microseconds. Make it larger
if the game is too fast for you.</li>
<li><code>-DW</code>: Pipe-to-pipe spacing, in columns. Farther apart is
easier.</li>
<li><code>-DD</code>: Space between pipes. The difference between
<code>D</code> and <code>W</code> is the width of the pipe. Narrow pipes
are easier to fly though.</li>
<li><code>-DH</code>: Height of gap in pipe. Make this larger to reduce
the challenge.</li>
<li><code>-DA</code>: Acceleration due to gravity (scaled by 256).
Smaller values make you glide slower.</li>
<li><code>-DI</code>: Impulse velocity of a flap (scaled by 256). Make
this smaller if you want an intense tapping experience!</li>
<li><code>-DB</code>: Sprite for player when gliding.</li>
<li><code>-DF</code>: Sprite for player when flapping.</li>
<li><code>-DG</code>: Instruction text. Change to your native
tongue.</li>
</ul>
<p>Feel free to try out physics or play field options to make the game
more interesting. Try setting the player sprites to change the game
completely – maybe you can be a fish, or a pig – the options are
limitless! Try using emojis – you can be a flying beer mug!</p>
<p>Note that since the <code>curses</code> library on POSIX doesn’t
natively support wide characters (needed for UTF-8 support, which is
needed for emojis), you may need to make some changes to the
<code>Makefile</code> to get emojis to work on your system. To help you
get started, I’ve included some example substitutions for emojis sprites
and instruction text; for example, type</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">make</span> EMOJI=beer LANGUAGE=spanish</span></code></pre></div>
<p>or</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">make</span> EMOJI=globe</span></code></pre></div>
<p>for some examples (the full list of options is in the
<code>Makefile</code>). Don’t forget to <code>make clobber</code> first
(or use <code>make -B</code>). If the output doesn’t look right, you may
need to link with the “wide” version of <code>ncurses</code>. On MacOSX
10.11, it should work with the current <code>-lcurses</code>; on Linux,
you might need <code>-lncursesw</code>. See the <code>Makefile</code> to
make this change if you need to. Or buy a Mac.</p>
<p>You will also need a UTF-8 compatible terminal and an emoji font
installed, and you will need to have your <code>LANG</code> environment
variable set to use UTF-8. Again, if this is too complicated, maybe just
go and get that Mac.</p>
<h3 id="future-additions">Future additions</h3>
<p>Future versions of the game will include monetization via the
freemium model with micropayments for customization options, play-to-win
and of course live-streamed targeted video advertising.</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-2015mills1"><a name="inventory"></a>Inventory for
2015/mills1</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/2015/mills1/prog.c">prog.c</a>
- winning source</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2015/mills1/Makefile">Makefile</a>
- winner Makefile</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2015/mills1/prog.orig.c">prog.orig.c</a>
- original source</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2015/mills1/try.sh">try.sh</a>
- how to run</li>
<li><a href="2015_mills1.tar.bz2">2015_mills1.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/2015/mills1/.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/2015/mills1/.winner.json">.winner.json</a>
- description of winner in JSON</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2015/mills1/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%2F2015%2Fmills1%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 -->
+285 -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,297 @@
<!-- !!! DO NOT MODIFY THIS FILE - This file is generated by a tool !!! -->
<!-- !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<!-- -->
<!-- file: 2015/mills2/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>2015 mills2</title>
<meta name="description" content="IOCCC year: 2015 IOCCC winner: mills2 winner index page">
<meta name="keywords" content="IOCCC,2015,mills2,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>2015/mills2</title>
<meta name="description" content="2015 IOCCC winner mills2">
<meta name="keywords" content="IOCCC, 2015, IOCCC 2015, IOCCC winner, mills2">
</head>
<!-- END: this line ends content from: inc/head.default.html -->
<!-- START: this line starts content from: inc/body.default.html -->
<body>
<h1>2015 mills2</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>2015/mills2</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%2F2015%2Fmills2%2Findex.html">Nu Html check https://ioccc-src.github.io/temp-test-ioccc/2015/mills2/index.html</a></p>
<!-- End Nu Html Checker -->
<div class="topnav">
<a class="Left" href="../mills1/index.html">&larr; mills1</a>
<a class="Left" href="../index.html">&uarr; 2015 &uarr;</a>
<a class="Left" href="../muth/index.html">muth &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#2015-mills2">2015
mills2 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">./prog</span> compressed_file.Z</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>
<h2 id="judges-remarks">Judges’ remarks:</h2>
<p>Without ASCII art, the source code of this entry would have been
exactly 256 bytes. Compared to <a
href="http://ioccc.org/years.html#1990_jaw">1990/jaw</a>, it is very
impressive, even taking into account the missing <code>atob</code>
functionality. Now we wish for a <code>compress(1)</code>-like
compressor using a similar idea.</p>
<p>Why is the sad smiley on line 12 in that particular place?</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> c<span class="op">=</span><span class="dv">0</span><span class="op">)</span> <span class="op">:(</span> O</span></code></pre></div>
<h2 id="authors-remarks">Author’s remarks:</h2>
<h3 id="the-program">The Program</h3>
<p>This program is an implementation of the unix <code>zcat(1)</code>
command for printing compressed files that have been created by the
<code>compress(1)</code> command.</p>
<p>The adaptive <a
href="https://en.wikipedia.org/wiki/Lempel–Ziv–Welch">LZW</a>
compression employed by <code>compress(1)</code> usually requires a
fairly large amount of memory to build the decompression tables (in
fact, <code>compress(1)</code> has a command-line option to control the
size of the decompression tables, since some of the early systems to
which it was ported (*cough*<a
href="https://computerhistory.org/blog/microsoft-ms-dos-early-source-code/?key=microsoft-ms-dos-early-source-code">MS-DOS</a>*cough*)
did not have enough memory to use the full 16-bit codes). This version
has no large static or dynamic tables. It is able to decompress 16-bit
files using a single function and a few <code>int</code>s.</p>
<p>To run the program, take an existing compressed file and pass it to
the program on the command line. On the odd chance you don’t have
<code>compress(1)</code> hanging about on your system, I’ve provided
compressed copies of this year’s IOCCC rules and guidelines files. To
print them, just do</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">./prog</span> ioccc_guidelines.txt.Z</span>
<span id="cb6-2"><a href="#cb6-2" aria-hidden="true" tabindex="-1"></a><span class="ex">./prog</span> ioccc_rules.txt.Z</span></code></pre></div>
<h3 id="the-details">The Details</h3>
<p>The basic cleverness here comes from realizing that the compressed
data is itself an encoded version of the code dictionary. When the
encoder sees an input string that is not in its dictionary, it emits the
code corresponding to the longest prefix that is in the dictionary and
adds a new entry consisting of that code followed by the next input
character. This means that when the decoder wants to know how to decode
a code, it just needs to find the spot in the code-stream where the
encoder added that entry to the dictionary. The code at that spot is the
prefix, and the first character of the following code is the suffix.
Decoding then just becomes recursion, to follow the chain of prefixes
and suffix characters.</p>
<p>Of course, it’s not nearly that simple. Finding the code in the
stream is complicated by several issues:</p>
<ul>
<li>Codes are at bit offsets within the stream, and must be
extracted.</li>
<li>As codes are added to the dictionary, the code word size grows, so
finding the offset to a particular code word is involved.</li>
<li>The <code>compress(1)</code> encoder reserves a code word that
clears the coding tables. When this is encountered, the computation of
offsets and bit sizes reset.</li>
<li>The <code>compress(1)</code> decoder is designed to always read a
block of eight code words at the same time, so that it need only read
<code>N</code> bytes to get eight <code>N-bit</code> code words. When
the “clear” code is encountered, the entire eight-word block is flushed
(since the decoder didn’t know the word size would change). The program
needs to account for this extra flushing.</li>
<li>The end of the stream is not explicitly marked; the encoder just
pads out the output to the next byte. The decoder must notice this to
know when to stop.</li>
<li>The output stream contains a header that must be skipped.</li>
</ul>
<p>Managing all the details involved added a lovely additional layer of
obfuscation to the otherwise elegant recursive decoder. Still, the code
manages it in a remarkably small amount of code.</p>
<h3 id="limitations">Limitations</h3>
<p>The decoder doesn’t look at the header. If you supply something that
is not compressed data, it’s likely to crash in an interesting
manner.</p>
<p>In particular, it doesn’t look at the third byte of the header, which
encodes the maximum code word size and whether “block mode” was used
when the encoder was run. If you use <code>compress(1)</code> in its
default mode, the maximum word size will be 16 bits and “block mode”
will be enabled. You are unlikely to find any files that don’t use
“block mode”, since all versions of <code>compress(1)</code> after 2.0
(circa 1984) use it by default and have no documented way to disable it.
Reducing the bit depth is still possibly by using the <code>-b</code>
flag. Modern systems have no problem with the 200 KB or so needed for
16-bit decoder tables, so the need for reducing the table size has
passed, hence this program always assumes 16-bits… However, should you
find a file that needs a smaller table, feel free to change the
hard-coded 16 in the source into the appropriate number and
recompile.</p>
<p>In the event that you don’t supply an argument, or that argument
doesn’t name a readable file, the program will just silently exit. This
is a feature.</p>
<p>The program depends on having a little-endian system. On a big-endian
system you will get a weird big-endian version of
<code>compress(1)</code>, which might have come to pass in an alternate
universe where the <a href="https://en.wikipedia.org/wiki/VAX">VAX</a>
on which <code>compress(1)</code> was authored had been big-endian.
Luckily for us, it wasn’t, and neither are most of the systems you might
want to compile this for.</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-2015mills2"><a name="inventory"></a>Inventory for
2015/mills2</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/2015/mills2/prog.c">prog.c</a>
- winning source</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2015/mills2/Makefile">Makefile</a>
- winner Makefile</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2015/mills2/prog.orig.c">prog.orig.c</a>
- original source</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2015/mills2/try.sh">try.sh</a>
- how to run</li>
<li><a href="ioccc_guidelines.txt.Z">ioccc_guidelines.txt.Z</a> -
compressed IOCCC 2015 guidelines</li>
<li><a href="ioccc_rules.txt.Z">ioccc_rules.txt.Z</a> - compressed IOCCC
2015 rules</li>
<li><a href="2015_mills2.tar.bz2">2015_mills2.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/2015/mills2/.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/2015/mills2/.winner.json">.winner.json</a>
- description of winner in JSON</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2015/mills2/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%2F2015%2Fmills2%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 -->
+300 -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,312 @@
<!-- !!! DO NOT MODIFY THIS FILE - This file is generated by a tool !!! -->
<!-- !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<!-- -->
<!-- file: 2015/muth/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>2015 muth</title>
<meta name="description" content="IOCCC year: 2015 IOCCC winner: muth winner index page">
<meta name="keywords" content="IOCCC,2015,muth,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>2015/muth</title>
<meta name="description" content="2015 IOCCC winner muth">
<meta name="keywords" content="IOCCC, 2015, IOCCC 2015, IOCCC winner, muth">
</head>
<!-- END: this line ends content from: inc/head.default.html -->
<!-- START: this line starts content from: inc/body.default.html -->
<body>
<h1>2015 muth</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>2015/muth</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%2F2015%2Fmuth%2Findex.html">Nu Html check https://ioccc-src.github.io/temp-test-ioccc/2015/muth/index.html</a></p>
<!-- End Nu Html Checker -->
<div class="topnav">
<a class="Left" href="../mills2/index.html">&larr; mills2</a>
<a class="Left" href="../index.html">&uarr; 2015 &uarr;</a>
<a class="Left" href="../schweikhardt/index.html">schweikhardt &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#Dominik_Muth">Dominik Muth</a><br>
Location: <a href="/temp-test-ioccc/location.html#DE">DE</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> <span class="at">-B</span> <span class="pp">[</span><span class="ss">MACHINE=your_machine.h</span><span class="pp">]</span> <span class="pp">[</span><span class="ss">TAPE=your_tape.h</span><span class="pp">]</span> [X=[0<span class="kw">|</span><span class="ex">1</span><span class="kw">|</span><span class="ex">2</span><span class="kw">|</span><span class="ex">3</span><span class="kw">|</span><span class="ex">4</span><span class="kw">|</span><span class="ex">5</span><span class="kw">|</span><span class="ex">6</span><span class="kw">|</span><span class="ex">7</span><span class="kw">|</span><span class="ex">8</span><span class="kw">|</span><span class="ex">9]]</span> [V=[0<span class="kw">|</span><span class="ex">1</span><span class="kw">|</span><span class="ex">2]]</span> run</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>This is something we were fearing all along: that the C preprocessor
is Turing-complete even without conditionals and recursive file
inclusion as some kind of a <a
href="https://en.wikipedia.org/wiki/Rewriting">rewriting system</a>. Now
we have the proof!</p>
<h2 id="authors-remarks">Author’s remarks:</h2>
<h3 id="preprocessor-turing-engine">Preprocessor Turing Engine</h3>
<h3 id="features">Features</h3>
<ul>
<li>Turing machine runs in preprocessor</li>
<li>universal (unlimited configurable states, symbols, and tape)</li>
<li>no <code>#if</code>s or other conditional directives, only
<code>#define</code>s</li>
<li>no recursive <code>#include</code></li>
<li>single compiler run (no repeated preprocessing)</li>
<li>no variadic macros</li>
<li>verbosity levels:
<ul>
<li><code>V=0</code> (default) only prints the final tape</li>
<li><code>V=1</code> additionally prints one tilde character per machine
step (slow)</li>
<li><code>V=2</code> additionally prints details on each machine step
(slow; generates large files)</li>
</ul></li>
<li>make target <code>run</code> runs <code>./prog</code> and filters a
little statistics out of the verbose output</li>
<li><code>X</code> (defaults to 3) sets the maximum number of steps:
<em>M</em>(<code>X</code>) ~ 8<sup><code>X</code></sup></li>
</ul>
<h3 id="limitations">Limitations</h3>
<p>If the machine does not halt after <em>M</em>(<code>X</code>) steps,
you will see unexpanded macros in the output.</p>
<h3 id="compiler-warnings">Compiler warnings</h3>
<p>If <code>V=1</code> or <code>V=2</code> is used, you may see
“<code>warning: string length is greater than the length '4095' ISO C99 compilers are required to support</code>”.</p>
<h3 id="programming">Programming</h3>
<p>Implementing your own Turing machine is easy. Take a look at the
supplied header files for examples.</p>
<h4 id="tape-symbols">Tape Symbols</h4>
<p>Every symbol used (except <code>_</code>) must be explicitly declared
using</p>
<div class="sourceCode" id="cb4"><pre class="sourceCode c"><code class="sourceCode c"><span id="cb4-1"><a href="#cb4-1" aria-hidden="true" tabindex="-1"></a><span class="pp">#define sym_SYMBOL</span><span class="op">(</span><span class="pp">sym</span><span class="op">,</span><span class="pp"> _SYMBOL</span><span class="op">)</span><span class="pp"> sym</span></span></code></pre></div>
<p>Example:</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><span class="pp">#define sym_1</span><span class="op">(</span><span class="pp">sym</span><span class="op">,</span><span class="pp"> _1</span><span class="op">)</span><span class="pp"> sym</span></span></code></pre></div>
<h4 id="tape">Tape</h4>
<p>The initial content of the tape must be defined in the tape header
using a triple like:</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">#define tape </span><span class="op">((((,),...</span><span class="pp">l2</span><span class="op">),</span><span class="pp"> l1</span><span class="op">),</span><span class="pp"> c</span><span class="op">,</span><span class="pp"> </span><span class="op">(</span><span class="pp">r1</span><span class="op">,</span><span class="pp"> </span><span class="op">(</span><span class="pp">r2</span><span class="op">...,</span><span class="pp"> </span><span class="op">(,))))</span></span></code></pre></div>
<ul>
<li><code>l1</code>, <code>l2</code>, … are the symbols to the left</li>
<li><code>c</code> is the symbol at the current position</li>
<li><code>r1</code>, <code>r2</code>, … are the symbols to the
right</li>
</ul>
<p>The empty pairs <code>(,)</code> represent the continuations of the
tape, filled with underscore symbols (<code>_</code>). They are expanded
on demand.</p>
<h4 id="state-machine">State Machine</h4>
<p>All transitions are defined in the machine header using the
syntax</p>
<pre><code>#define CURRENT_SCANNED (WRITE, MOVEMENT, NEXT)</code></pre>
<p>where</p>
<ul>
<li><code>CURRENT</code> is the current state.</li>
<li><code>SCANNED</code> is the symbol at the current position.</li>
<li>The whitespace before the parentheses is significant.</li>
<li><code>WRITE</code> is the symbol to be written to the tape.</li>
<li><code>MOVEMENT</code> is <code>L</code> for left, <code>R</code> for
right; don’t specify anything if you want no movement.</li>
<li><code>NEXT</code> is the next state.</li>
</ul>
<p>There must be a state <code>A</code> defined, which becomes the
initial state of the machine.</p>
<p>To halt the machine, use the keyword <code>break</code> as in</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="pp">#define A_1 </span><span class="op">(</span><span class="dv">2</span><span class="op">,</span><span class="pp"> </span><span class="cf">break</span><span class="op">)</span></span></code></pre></div>
<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-2015muth"><a name="inventory"></a>Inventory for
2015/muth</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/2015/muth/prog.c">prog.c</a>
- winning source</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2015/muth/Makefile">Makefile</a>
- winner Makefile</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2015/muth/prog.orig.c">prog.orig.c</a>
- original source</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2015/muth/try.sh">try.sh</a>
- how to run</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2015/muth/machine_beaver_4_2.h">machine_beaver_4_2.h</a>
- cpp macros</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2015/muth/machine_champ_2_4.h">machine_champ_2_4.h</a>
- cpp macros</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2015/muth/machine_chaos_5_2.h">machine_chaos_5_2.h</a>
- cpp macros</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2015/muth/machine_cmplx_5_2.h">machine_cmplx_5_2.h</a>
- cpp macros</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2015/muth/machine_count_5_2.h">machine_count_5_2.h</a>
- cpp macros</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2015/muth/machine_gcd.h">machine_gcd.h</a>
- cpp macros</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2015/muth/machine_great_3_2.h">machine_great_3_2.h</a>
- cpp macros</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2015/muth/machine_ioccc.h">machine_ioccc.h</a>
- cpp macros</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2015/muth/machine_nop.h">machine_nop.h</a>
- cpp macros</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2015/muth/machine_ru_2_4.h">machine_ru_2_4.h</a>
- cpp macros</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2015/muth/machine_times2.h">machine_times2.h</a>
- cpp macros</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2015/muth/tape_15_50.h">tape_15_50.h</a>
- cpp macros</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2015/muth/tape_77_55.h">tape_77_55.h</a>
- cpp macros</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2015/muth/tape_empty.h">tape_empty.h</a>
- cpp macros</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2015/muth/tape_five.h">tape_five.h</a>
- cpp macros</li>
<li><a href="2015_muth.tar.bz2">2015_muth.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/2015/muth/.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/2015/muth/.winner.json">.winner.json</a>
- description of winner in JSON</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2015/muth/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%2F2015%2Fmuth%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 -->
+882 -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,894 @@
<!-- !!! DO NOT MODIFY THIS FILE - This file is generated by a tool !!! -->
<!-- !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<!-- -->
<!-- file: 2015/schweikhardt/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>2015 schweikhardt</title>
<meta name="description" content="IOCCC year: 2015 IOCCC winner: schweikhardt winner index page">
<meta name="keywords" content="IOCCC,2015,schweikhardt,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>2015/schweikhardt</title>
<meta name="description" content="2015 IOCCC winner schweikhardt">
<meta name="keywords" content="IOCCC, 2015, IOCCC 2015, IOCCC winner, schweikhardt">
</head>
<!-- END: this line ends content from: inc/head.default.html -->
<!-- START: this line starts content from: inc/body.default.html -->
<body>
<h1>2015 schweikhardt</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>2015/schweikhardt</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%2F2015%2Fschweikhardt%2Findex.html">Nu Html check https://ioccc-src.github.io/temp-test-ioccc/2015/schweikhardt/index.html</a></p>
<!-- End Nu Html Checker -->
<div class="topnav">
<a class="Left" href="../muth/index.html">&larr; muth</a>
<a class="Left" href="../index.html">&uarr; 2015 &uarr;</a>
<a class="Left" href="../yang/index.html">yang &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#Jens_Schweikhardt">Jens
Schweikhardt</a><br> Location: <a
href="/temp-test-ioccc/location.html#DE">DE</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#2015-schweikhardt">2015 schweikhardt 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">./prog</span> n</span></code></pre></div>
<p>where n is a base 16 number of any size.</p>
<p>NOTE: although it’s supposed to be a base 16 number nothing will stop
you from doing something else. The author explains this in more
details.</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>After running it once to see what commands are run, you might wish to
run it a second time and just hold down space to see a fun scroll of
numbers especially where zeroes move to the right.</p>
<h2 id="judges-remarks">Judges’ remarks:</h2>
<p>This code is clean. When you compile with all warnings enabled, such
as with clang:</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">-Weverything</span> <span class="at">-pedantic</span> <span class="at">-std</span><span class="op">=</span>c11 <span class="at">-Dtyp</span><span class="op">=</span>uint64<span class="dt">\_</span>t <span class="at">-O3</span> prog.c <span class="at">-o</span> prog</span></code></pre></div>
<p>The code compiles without warnings on the systems that we tested!</p>
<p>Even more, the code was 100% clean when we ran it against various
static source checkers.</p>
<p>This tool references a problem that <a
href="http://members.tip.net.au/~dbell/">David I. Bell</a> once
described as having one of the largest “yummo quotients” in number
theory:</p>
<pre><code> complexity of the solution
yummo quotient = -----------------------------------
complexity of the problem statement</code></pre>
<p><a href="https://en.wikipedia.org/wiki/Paul_Erdős">Erdős</a>
privately told one of the IOCCC judges:</p>
<blockquote>
<p>Solving the <a
href="https://en.wikipedia.org/wiki/Generalized_Riemann_hypothesis#Extended_Riemann_hypothesis_.28ERH.29">Generalized
Riemann hypothesis</a> would be a good warm-up exercise for someone to
get ready to begin to work on the <a
href="https://en.wikipedia.org/wiki/Collatz_conjecture">Collatz
conjecture</a>.</p>
</blockquote>
<p>You may explore this famous conjecture using this entry:</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">./prog</span> 2410</span>
<span id="cb7-2"><a href="#cb7-2" aria-hidden="true" tabindex="-1"></a><span class="ex">./prog</span> abfff</span>
<span id="cb7-3"><a href="#cb7-3" aria-hidden="true" tabindex="-1"></a><span class="ex">./prog</span> 27f8cebf</span>
<span id="cb7-4"><a href="#cb7-4" aria-hidden="true" tabindex="-1"></a><span class="ex">./prog</span> 246f8fddf</span>
<span id="cb7-5"><a href="#cb7-5" aria-hidden="true" tabindex="-1"></a><span class="ex">./prog</span> 2e95ab51ffea9de</span>
<span id="cb7-6"><a href="#cb7-6" aria-hidden="true" tabindex="-1"></a><span class="ex">./prog</span> e6a5c22fd7bde9f</span>
<span id="cb7-7"><a href="#cb7-7" aria-hidden="true" tabindex="-1"></a><span class="ex">./prog</span> 1b7dd73a937485bf</span>
<span id="cb7-8"><a href="#cb7-8" aria-hidden="true" tabindex="-1"></a><span class="ex">./prog</span> 7d3237680d190a77e53751b</span>
<span id="cb7-9"><a href="#cb7-9" aria-hidden="true" tabindex="-1"></a><span class="ex">./prog</span> 302ab3d052fb87c06228d249581be0e4</span></code></pre></div>
<p>NOTE: <a href="try.sh">try.sh</a> runs these for you, filtered
through <code>less(1)</code>.</p>
<p>When you first look at the source, the code looks fairly
straightforward. But look again. Like the Collatz conjecture, simplicity
is deceptive! Oh, and the variable names? They are not simple single
letter variables, they are names of various <a
href="https://en.wikipedia.org/wiki/Proteinogenic_amino_acid">Proteinogenic
amino acid</a>: which is yet another simple building block that can be
used to build some very complex structures. :-)</p>
<p>p.s. We appreciated that apart from a few powers of 2, the source
code is magic number free.</p>
<h2 id="authors-remarks">Author’s remarks:</h2>
<h3 id="the-tldr-version">The TL;DR version</h3>
<p>This is the cleanest program ever submitted. If for some input it
enters a non-terminating loop or runs out of memory you will be
insta-famous. It’s a bit like a lottery without the need to buy a ticket
and you can play as often as you like. One notable historic person has
even offered some prize money.</p>
<p>The program illustrates the bloat caused by adherence to too many
rules, each of which may sound sane in isolation, but in their entirety
lead to an obfuscated, hard to read and understand monster.</p>
<h3 id="what-this-program-does.">What this program does.</h3>
<p>The program tests whether a given natural number satisfies the <a
href="https://en.wikipedia.org/wiki/Collatz_conjecture">Collatz
Conjecture</a>:</p>
<p>Take any natural number <code>n</code>. If <code>n</code> is even,
divide it by <code>2</code> to get <code>n/2</code>. If <code>n</code>
is odd, multiply it by <code>3</code> and add <code>1</code> to obtain
<code>3n + 1</code>. Repeat the process indefinitely.</p>
<p>The conjecture is that no matter what number you start with, you
eventually reach <code>1</code>.</p>
<p>Paul Erdős said about the Collatz conjecture:</p>
<blockquote>
<p>“Mathematics may not be ready for such problems.”</p>
</blockquote>
<p>He also offered $500 for its solution.</p>
<p>For example, the sequence of numbers for <code>n</code> = 6 is</p>
<blockquote>
<p>6, 3, 10, 5, 16, 8, 4, 2, 1.</p>
</blockquote>
<p>Continuing past one leads to the <em>cycle</em> 1, 4, 2, 1, 4, 2, 1,
… Interesting factoid: if you allow <em>negative</em> start values,
there are a few more cycles, each of different length:</p>
<pre><code>−1, −2, −1
−5, −14, −7, −20, −10, −5
−17, −50, −25, −74, −37, −110, −55, −164,
−82, −41, −122, −61, −182, −91, −272, −136,
−68, −34, −17</code></pre>
<p>The program computes the sequence for a given positive natural number
and stops at <code>1</code>. The number <code>n</code> is specified in
hexadecimal (without <code>0x</code> prefix) as the first argument. The
program prints the given number in zero-padded hex and each iteration
along with a line count in decimal. The example above looks like this
(compiled with 64 bit word size):</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">$</span> ./prog 6</span>
<span id="cb9-2"><a href="#cb9-2" aria-hidden="true" tabindex="-1"></a><span class="ex">0000000000000006</span></span>
<span id="cb9-3"><a href="#cb9-3" aria-hidden="true" tabindex="-1"></a><span class="ex">0000000000000003</span> 1</span>
<span id="cb9-4"><a href="#cb9-4" aria-hidden="true" tabindex="-1"></a><span class="ex">000000000000000A</span> 2</span>
<span id="cb9-5"><a href="#cb9-5" aria-hidden="true" tabindex="-1"></a><span class="ex">0000000000000005</span> 3</span>
<span id="cb9-6"><a href="#cb9-6" aria-hidden="true" tabindex="-1"></a><span class="ex">0000000000000010</span> 4</span>
<span id="cb9-7"><a href="#cb9-7" aria-hidden="true" tabindex="-1"></a><span class="ex">0000000000000008</span> 5</span>
<span id="cb9-8"><a href="#cb9-8" aria-hidden="true" tabindex="-1"></a><span class="ex">0000000000000004</span> 6</span>
<span id="cb9-9"><a href="#cb9-9" aria-hidden="true" tabindex="-1"></a><span class="ex">0000000000000002</span> 7</span>
<span id="cb9-10"><a href="#cb9-10" aria-hidden="true" tabindex="-1"></a><span class="ex">0000000000000001</span> 8</span></code></pre></div>
<p>The size of <code>n</code> is only limited by the argument size limit
of your shell/OS (the program implements arbitrary size
<code>bignum</code>s). To query this on your POSIX system, run</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> getconf ARG_MAX</span>
<span id="cb10-2"><a href="#cb10-2" aria-hidden="true" tabindex="-1"></a><span class="ex">262144</span></span></code></pre></div>
<p>which reports the limit in bytes, here 256KB. This allows to test
whether a <a href="https://en.wikipedia.org/wiki/Googol">Googol</a>,
which is 10<sup>100</sup>, satisfies the conjecture. But what is a
googol in hex? Fear not, <a
href="http://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html">bc(1)</a>
to the rescue:</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> printf <span class="st">&#39;obase=16;10^100\n&#39;</span> <span class="kw">|</span> <span class="fu">bc</span></span>
<span id="cb11-2"><a href="#cb11-2" aria-hidden="true" tabindex="-1"></a><span class="ex">1249AD2594C37CEB0B2784C4CE0BF38ACE408E211A7CAAB24308A82E8F1000000000</span><span class="dt">\</span></span>
<span id="cb11-3"><a href="#cb11-3" aria-hidden="true" tabindex="-1"></a><span class="ex">0000000000000000</span></span>
<span id="cb11-4"><a href="#cb11-4" aria-hidden="true" tabindex="-1"></a><span class="ex">$</span> ./prog 1249AD2594C37CEB0B2784C4CE0BF38ACE408E211A7CAAB24308A82E8F10000000000000000000000000 <span class="dt">\</span></span>
<span id="cb11-5"><a href="#cb11-5" aria-hidden="true" tabindex="-1"></a><span class="kw">|</span> <span class="fu">less</span></span>
<span id="cb11-6"><a href="#cb11-6" aria-hidden="true" tabindex="-1"></a><span class="ex">[...]</span></span></code></pre></div>
<p>Observe how the first 100 iterations melt the zeros to the right. Can
you explain why?</p>
<p>For a given <code>n</code> the program behavior is one of the
following 3:</p>
<ol type="1">
<li>The sequence stops at 1. No fame. No money. Thanks for playing.
Computational mathematicians have tested all
<code>n &lt; 4FFDD776055A0000</code> (~10<sup>18</sup>) so don’t try
anything less than that.</li>
<li>The chosen <code>n</code> leads to a sequence with ever bigger
numbers, so that eventually the <code>bignum</code> cannot be stored in
memory. If this happens, the program outputs <code>laugh</code> (more
likely) or <code>throw up</code> (less likely) and stops. You
<em>might</em> have found a number for which the sequence
<em>diverges</em>. If confirmed, this disproves the conjecture.</li>
<li>The chosen <code>n</code> leads to a cycle not including 1
(i.e. runs forever, repeating the same sequence over and over). You have
disproved the conjecture and should certainly submit a paper to the
nearest mathematical journal.</li>
</ol>
<h3 id="design-objectives">Design objectives</h3>
<p>I gave myself the following objectives. Like in real world
programming, not all of them can be met 100%. Think of them as a
multidimensional continuum, where trade-offs have to be made.</p>
<ol type="1">
<li>No arbitrary limits on the input number. 64 bits might be enough for
everybody, but is not enough for exploring new Collatz-territory. Thus
<code>bignums</code> are required.</li>
<li>Ultra-portable. Must run on C89 systems and self-adapt to C99 and
C11 features like exact width types.</li>
<li>Super-efficient. Must be able to run with the widest type as the
base of the <code>bignums</code>. Make the user select the widest type
supported by the implementation and then crunch away. If a non-standard
128bit type is available, it should be usable.</li>
<li>Pentagon level lint cleanliness and MISRA compliance.</li>
<li>Easy to understand, self-documenting clear code. A joy for
maintenance programmers. The epitome of best practice demonstration for
all future textbooks on C.</li>
</ol>
<h3 id="program-obfuscation">Program Obfuscation</h3>
<p>In the following I address all the <em>tests</em> as specified by
your honors in the <em>guidelines</em>.</p>
<ul>
<li>look at the original source</li>
<li>convert ANSI trigraphs to ASCII</li>
<li>C pre-process the source ignoring <code>#include</code> lines</li>
<li>C pre-process the source ignoring <code>#define</code> and
<code>#include</code> lines</li>
<li>run it through a C beautifier</li>
<li>examine the algorithm</li>
<li>compile it (with flags to enable all warnings)</li>
<li>execute it</li>
</ul>
<h3 id="look-at-the-original-source">Look at the original source</h3>
<p>Using one letter identifiers is quite old. I decided to use TLI
(three letter identifiers). Not the random kind, rather with a
connection to the meaning of life, the universe and the rest. Enter
amino acids! Among the myriad of possible amino acids there are 23 from
which proteins are built. In biochemistry, each is assigned a TLI (see
<a
href="https://en.wikipedia.org/wiki/Proteinogenic_amino_acid">Proteinogenic
amino acid</a>):</p>
<pre><code> ala Alanine
cys Cysteine
asp Aspartic acid
glu Glutamic acid
phe Phenylalanine
gly Glycine
his Histidine
ile Isoleucine
lys Lysine
leu Leucine
met Methionine
asn Asparagine
pyl Pyrrolysine
pro Proline
gln Glutamine
arg Arginine
ser Serine
thr Threonine
sec Selenocysteine
val Valine
trp Tryptophan
tyr Tyrosine
asx Asparagine or Aspartic acid
glx Glutamic acid or Glutamine
xle Leucine or Isoleucine
unk Unknown</code></pre>
<p>My own research results complete this list (not yet in Wikipedia due
to the rule “<a
href="https://en.wikipedia.org/wiki/Wikipedia:No_original_research">No
original research</a>”):</p>
<pre><code>and Androgynine
xor Xenoricine
not Notanamine
tla Triletramine</code></pre>
<p>Interestingly, the TLI are the perfect mnemonics for C language
source. For example, <code>met</code> is
“<code>main()'s Exit Type</code>” (<code>int</code>), <code>ala</code>
is “<code>A Large Algebraic</code>” (<code>bignum</code>),
<code>ile</code> an “<code>Incremented Local Entity</code>” (index
counter), <code>gly</code> means “<code>Grow Larger memorY</code>”,
<code>gln</code> is “<code>Grown Larger Now</code>” (after
<code>realloc(3)</code>), <code>not</code> is a
“<code>Not Overflowing Type</code>” (recursive!), <code>unk</code> is
the “<code>UNit (Known as 1)</code>”, <code>trp</code> is the
“<code>Tabula Rasa Product</code>” (zero), <code>phe</code> is
“<code>Print HEx</code>” and so on.</p>
<h3 id="convert-ansi-trigraphs-to-ascii">Convert ANSI trigraphs to
ASCII</h3>
<p>Huh??!</p>
<h3 id="c-pre-process-the-source-ignoring-include-lines">C pre-process
the source ignoring <code>#include</code> lines</h3>
<p>Wow, an identity operation (except for the
<code>&lt;stdint.h&gt;</code> and <code>EOF + __STDC__</code>
trivialities). Did you gain any insight through this?</p>
<h3 id="c-pre-process-the-source-ignoring-define-and-include-lines">C
pre-process the source ignoring ‘#define’ and ‘#include’ lines</h3>
<p><code>#define</code>? Which <code>#define</code> directives? How many
4K source files do you see that don’t use a single <code>#define</code>
directive <em>or</em> abuse the build file? Even though the “no
<code>#define</code>” rule I submitted myself to made it hard, I could
use <code>__LINE__</code> and <code>stdio.h</code> macros
<code>EOF</code>, <code>L_tmpnam</code>, <code>BUFSIZ</code>,
<code>FILENAME_MAX</code>, <code>TMP_MAX</code> to obfuscate at least
something.</p>
<h3 id="run-it-through-a-c-beautifier">Run it through a C
beautifier</h3>
<p>Another identity operation. I’ve done it for you already. Use this
<code>.indent.pro</code> with FreeBSD indent:</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">$</span> cat .indent.pro</span>
<span id="cb14-2"><a href="#cb14-2" aria-hidden="true" tabindex="-1"></a> <span class="ex">-bad</span> /<span class="pp">*</span> blank line after decls <span class="pp">*</span>/</span>
<span id="cb14-3"><a href="#cb14-3" aria-hidden="true" tabindex="-1"></a> <span class="ex">-bap</span> /<span class="pp">*</span> blank line after functions <span class="pp">*</span>/</span>
<span id="cb14-4"><a href="#cb14-4" aria-hidden="true" tabindex="-1"></a> <span class="ex">-br</span> /<span class="pp">*</span> braces on if line <span class="pp">*</span>/</span>
<span id="cb14-5"><a href="#cb14-5" aria-hidden="true" tabindex="-1"></a> <span class="ex">-i8</span> /<span class="pp">*</span> indent <span class="pp">*</span>/</span>
<span id="cb14-6"><a href="#cb14-6" aria-hidden="true" tabindex="-1"></a> <span class="ex">-l999</span> /<span class="pp">*</span> line length <span class="pp">*</span>/</span>
<span id="cb14-7"><a href="#cb14-7" aria-hidden="true" tabindex="-1"></a> <span class="ex">-npcs</span> /<span class="pp">*</span> no space after function call names <span class="pp">*</span>/</span>
<span id="cb14-8"><a href="#cb14-8" aria-hidden="true" tabindex="-1"></a> <span class="ex">-npsl</span> /<span class="pp">*</span> don<span class="st">&#39;t break procedure type */</span></span>
<span id="cb14-9"><a href="#cb14-9" aria-hidden="true" tabindex="-1"></a><span class="st"> -ut /* use tabs */</span></span>
<span id="cb14-10"><a href="#cb14-10" aria-hidden="true" tabindex="-1"></a><span class="st"> -ce /* cuddle else */</span></span>
<span id="cb14-11"><a href="#cb14-11" aria-hidden="true" tabindex="-1"></a><span class="st"> -nip /* no parameter indentation */</span></span>
<span id="cb14-12"><a href="#cb14-12" aria-hidden="true" tabindex="-1"></a><span class="st"> -di1 /* declaration indent */</span></span>
<span id="cb14-13"><a href="#cb14-13" aria-hidden="true" tabindex="-1"></a><span class="st"> -Tand</span></span>
<span id="cb14-14"><a href="#cb14-14" aria-hidden="true" tabindex="-1"></a><span class="st"> -Tmet</span></span>
<span id="cb14-15"><a href="#cb14-15" aria-hidden="true" tabindex="-1"></a><span class="st"> -Tthr</span></span>
<span id="cb14-16"><a href="#cb14-16" aria-hidden="true" tabindex="-1"></a><span class="st"> -Tpro</span></span>
<span id="cb14-17"><a href="#cb14-17" aria-hidden="true" tabindex="-1"></a><span class="st"> -Tser</span></span>
<span id="cb14-18"><a href="#cb14-18" aria-hidden="true" tabindex="-1"></a><span class="st"> -Tala</span></span></code></pre></div>
<p>It looks like a perfect program should have:</p>
<ul>
<li>two and a half <code>#include</code>s of non-suspicious standard
headers</li>
<li>followed by self protection against goofy implementations</li>
<li>followed by a handful of <code>typedef</code>s</li>
<li>and a pair of file scope objects by necessity</li>
<li>prototypes! With parameter names! <code>static</code> for internal
linkage even! This <strong>must</strong> be a first in IOCCC
history.</li>
<li>function definitions, <code>main</code> last</li>
<li>everything is fully <code>const</code>-poisoned: automatics,
statics, arguments, even <code>main</code></li>
<li>everything is fully curly braced, even single statements</li>
<li>plenty of meaningful TLC (Three Letter Comments)</li>
</ul>
<p>The program contains not a single <em>magic number</em> (only 0 and
powers of 2, each power from 1 to 512) which are obvious to competent
software engineers). How many programs have <em>that</em> property? The
check for <code>__STDC_VERSION__</code> was a bit tough to arrive at,
since 199901L has too many bits set. But I realized that I only needed a
number larger than 199409 and less than 199901. 199680 has only 4 bits
set and writing it as <code>(256 + 128 + 4 + 2) * 512</code> minimizes
the character count. That’s what judges get when they don’t like
programs that are longer than they need to be.</p>
<h3 id="examine-the-algorithm">Examine the algorithm</h3>
<p>Spoilers ahead. Duh!</p>
<p>Pseudocode, with comments matching those in the C source:</p>
<div class="sourceCode" id="cb15"><pre class="sourceCode c"><code class="sourceCode c"><span id="cb15-1"><a href="#cb15-1" aria-hidden="true" tabindex="-1"></a><span class="co">/* run */</span></span>
<span id="cb15-2"><a href="#cb15-2" aria-hidden="true" tabindex="-1"></a><span class="cf">if</span> <span class="op">(</span>non<span class="op">-</span>NULL and nonempty argv<span class="op">[</span><span class="dv">1</span><span class="op">])</span> <span class="op">{</span></span>
<span id="cb15-3"><a href="#cb15-3" aria-hidden="true" tabindex="-1"></a> n <span class="op">=</span> convert<span class="op">(</span>argv<span class="op">[</span><span class="dv">1</span><span class="op">])</span></span>
<span id="cb15-4"><a href="#cb15-4" aria-hidden="true" tabindex="-1"></a> print n <span class="co">/* 2hx */</span></span>
<span id="cb15-5"><a href="#cb15-5" aria-hidden="true" tabindex="-1"></a> <span class="cf">while</span> <span class="op">(</span>n <span class="op">!=</span> <span class="dv">1</span><span class="op">)</span> <span class="op">{</span> <span class="co">/* one */</span></span>
<span id="cb15-6"><a href="#cb15-6" aria-hidden="true" tabindex="-1"></a> <span class="cf">if</span> <span class="op">(</span>n is odd<span class="op">)</span> <span class="op">{</span> <span class="co">/* odd */</span></span>
<span id="cb15-7"><a href="#cb15-7" aria-hidden="true" tabindex="-1"></a> m <span class="op">=</span> deep copy of n <span class="co">/* cpy */</span></span>
<span id="cb15-8"><a href="#cb15-8" aria-hidden="true" tabindex="-1"></a> n <span class="op">&lt;&lt;=</span> <span class="dv">1</span> <span class="co">/* shl */</span></span>
<span id="cb15-9"><a href="#cb15-9" aria-hidden="true" tabindex="-1"></a> n <span class="op">+=</span> m <span class="co">/* add */</span></span>
<span id="cb15-10"><a href="#cb15-10" aria-hidden="true" tabindex="-1"></a> increment n <span class="co">/* inc */</span></span>
<span id="cb15-11"><a href="#cb15-11" aria-hidden="true" tabindex="-1"></a> <span class="op">}</span> <span class="cf">else</span> <span class="op">{</span> <span class="co">/* eve */</span></span>
<span id="cb15-12"><a href="#cb15-12" aria-hidden="true" tabindex="-1"></a> n <span class="op">&gt;&gt;=</span> <span class="dv">1</span> <span class="co">/* shr */</span></span>
<span id="cb15-13"><a href="#cb15-13" aria-hidden="true" tabindex="-1"></a> <span class="op">}</span></span>
<span id="cb15-14"><a href="#cb15-14" aria-hidden="true" tabindex="-1"></a> print n <span class="co">/* 2hx */</span></span>
<span id="cb15-15"><a href="#cb15-15" aria-hidden="true" tabindex="-1"></a> <span class="op">}</span></span>
<span id="cb15-16"><a href="#cb15-16" aria-hidden="true" tabindex="-1"></a><span class="op">}</span></span></code></pre></div>
<p><code>Bignum</code>s are represented as the two member
<code>struct</code>s:</p>
<div class="sourceCode" id="cb16"><pre class="sourceCode c"><code class="sourceCode c"><span id="cb16-1"><a href="#cb16-1" aria-hidden="true" tabindex="-1"></a><span class="kw">typedef</span> <span class="kw">struct</span> <span class="op">{</span></span>
<span id="cb16-2"><a href="#cb16-2" aria-hidden="true" tabindex="-1"></a> <span class="dt">size_t</span> places<span class="op">;</span> <span class="co">/* number of places in base 2 to the power of (8*sizeof(type)) */</span></span>
<span id="cb16-3"><a href="#cb16-3" aria-hidden="true" tabindex="-1"></a> type <span class="op">*</span>number<span class="op">;</span> <span class="co">/* dynamically allocated memory for number */</span></span>
<span id="cb16-4"><a href="#cb16-4" aria-hidden="true" tabindex="-1"></a><span class="op">}</span> bignum</span></code></pre></div>
<h3 id="compile-it-with-flags-to-enable-all-warnings">Compile it (with
flags to enable all warnings)</h3>
<p>Here’s where the program shines brighter than a <a
href="https://en.wikipedia.org/wiki/Gamma-ray_burst">gamma-ray
burst</a>!</p>
<p>I challenge you to throw all kinds of compilers, lints, checkers and
analyzers at my program and make it find the slightest of issues.</p>
<p>Is
<code>clang -Wall -Wextra -Weverything -Dtyp=uint32_t prog.c</code> all
you can do? Clang has implemented a new warning? Bring it on!</p>
<h3 id="execute-it">Execute it</h3>
<p>May you win the jackpot!</p>
<p>For least surprising results, the execution character set should be
ASCII. The program computes four bits from every character in
<code>argv[1]</code> and interprets them as a hex digit. In ASCII the
characters <code>a-f</code>, <code>A-F</code> and <code>0-9</code> are
converted as expected.</p>
<p>This means however, that the program accepts <strong>any
string</strong>, turns it into a starting number (which is output as the
first line), and starts crunching. Nothing stops you from executing</p>
<div class="sourceCode" id="cb17"><pre
class="sourceCode sh"><code class="sourceCode bash"><span id="cb17-1"><a href="#cb17-1" aria-hidden="true" tabindex="-1"></a><span class="ex">./prog</span> <span class="st">&quot;</span><span class="va">$(</span><span class="fu">cat</span> prog.c<span class="va">)</span><span class="st">&quot;</span> <span class="co"># Kind of quine?</span></span>
<span id="cb17-2"><a href="#cb17-2" aria-hidden="true" tabindex="-1"></a><span class="ex">./prog</span> <span class="st">&quot;</span><span class="va">$(</span><span class="fu">cat</span> rules guidelines<span class="va">)</span><span class="st">&quot;</span> <span class="co"># A jackpot? Maybe next year...</span></span>
<span id="cb17-3"><a href="#cb17-3" aria-hidden="true" tabindex="-1"></a><span class="ex">./prog</span> <span class="st">&quot;</span><span class="va">$(</span><span class="fu">cat</span> /bin/ls<span class="va">)</span><span class="st">&quot;</span> <span class="co"># Number cut short at first NUL byte.</span></span></code></pre></div>
<p>In a certain way, the program is character set and encoding
agnostic.</p>
<h3 id="assumptions-made">Assumptions made</h3>
<ul>
<li>The <code>EOF</code> macro from <code>&lt;stdio.h&gt;</code> must
expand to <code>-1</code> since it is used to decrement a pointer and do
some other math. None of the tools catch this one. The program
self-protects against unusual systems with
<code>#if EOF + __STDC__</code> followed by <code>#error goofy!</code>.
In the rare event your system is goofy, replace all <code>EOF</code>
tokens with <code>(-1)</code> and remove the <code>#error</code>
directive.</li>
</ul>
<p>While the program works best when bytes/characters are octets and the
number of bits in a type is <code>sizeof(typ) &lt;&lt; 3</code>, it will
work correctly on 24-bit or 36-bit systems with 9 bits/byte, or systems
where <code>sizeof(typ)</code> is 1 even for <code>int</code> and so on.
On such systems, it will only use <code>8 * sizeof(typ)</code> bits per
place. It does not work when <code>CHAR_BIT &lt;= 7</code>.</p>
<h3 id="results-of-various-checkers">Results of various checkers</h3>
<h3 id="cppcheck">cppcheck</h3>
<p>The open source static checker <a
href="http://cppcheck.sourceforge.net/">cppcheck</a> checks various
problems with respect to style, performance, portability and general
fishiness. To enable all checks, run</p>
<div class="sourceCode" id="cb18"><pre
class="sourceCode sh"><code class="sourceCode bash"><span id="cb18-1"><a href="#cb18-1" aria-hidden="true" tabindex="-1"></a><span class="ex">cppcheck</span> <span class="at">--enable</span><span class="op">=</span>all <span class="at">--force</span> <span class="at">-I</span>/usr/include <span class="at">-Dtyp</span><span class="op">=</span>uint32_t prog.c</span></code></pre></div>
<p>No issues found.</p>
<h3 id="flawfinder">flawfinder</h3>
<p>The open source static checker <a
href="http://www.dwheeler.com/flawfinder/">flawfinder</a> checks various
problems with respect to security like buffer overflows, function
arguments to known troublemaker functions and more. It doesn’t need to
pre-process code, so can be run without the <code>typ</code> macro being
defined:</p>
<div class="sourceCode" id="cb19"><pre
class="sourceCode sh"><code class="sourceCode bash"><span id="cb19-1"><a href="#cb19-1" aria-hidden="true" tabindex="-1"></a><span class="ex">$</span> flawfinder prog.c</span>
<span id="cb19-2"><a href="#cb19-2" aria-hidden="true" tabindex="-1"></a><span class="ex">Flawfinder</span> version 1.31, <span class="er">(</span><span class="ex">C</span><span class="kw">)</span> <span class="ex">2001-2014</span> David A. Wheeler.</span>
<span id="cb19-3"><a href="#cb19-3" aria-hidden="true" tabindex="-1"></a><span class="ex">Number</span> of rules <span class="er">(</span><span class="ex">primarily</span> dangerous function names<span class="kw">)</span> <span class="er">in</span> <span class="ex">C/C++</span> ruleset: 169</span>
<span id="cb19-4"><a href="#cb19-4" aria-hidden="true" tabindex="-1"></a><span class="ex">Examining</span> prog.c</span>
<span id="cb19-5"><a href="#cb19-5" aria-hidden="true" tabindex="-1"></a><span class="ex">FINAL</span> RESULTS:</span>
<span id="cb19-6"><a href="#cb19-6" aria-hidden="true" tabindex="-1"></a><span class="ex">ANALYSIS</span> SUMMARY:</span>
<span id="cb19-7"><a href="#cb19-7" aria-hidden="true" tabindex="-1"></a><span class="ex">No</span> hits found.</span></code></pre></div>
<h4 id="valgrind">valgrind</h4>
<p>The open source dynamic checker <a
href="http://valgrind.org/">valgrind</a> runs an executable and verifies
all memory accesses and (de)allocations for proper bounds and memory
leaks. Since the program frees all memory in all possible execution
paths, even when it must bail out, valgrind should be happy. An early
version of my program however reported this:</p>
<pre><code>valgrind --leak-check=full --show-leak-kinds=all ./prog 6
[...]
==14615== HEAP SUMMARY:
==14615== in use at exit: 4,096 bytes in 1 blocks
==14615== total heap usage: 4 allocs, 3 frees, 4,108 bytes allocated
==14615==
==14615== 4,096 bytes in 1 blocks are still reachable in loss record 1 of 1
==14615== at 0x4C236C0: malloc (in /usr/local/lib/valgrind/vgpreload_memcheck-amd64-freebsd.so)
==14615== by 0x4F62175: ??? (in /lib/libc.so.7)
==14615== by 0x4F62073: ??? (in /lib/libc.so.7)
==14615== by 0x4F514EE: ??? (in /lib/libc.so.7)
==14615== by 0x4F51265: vfprintf_l (in /lib/libc.so.7)
==14615== by 0x4F3E001: printf (in /lib/libc.so.7)
==14615== by 0x40101E: phe (in ./prog)
==14615== by 0x400A9F: main (in ./prog)
==14615==
==14615== LEAK SUMMARY:
==14615== definitely lost: 0 bytes in 0 blocks
==14615== indirectly lost: 0 bytes in 0 blocks
==14615== possibly lost: 0 bytes in 0 blocks
==14615== still reachable: 4,096 bytes in 1 blocks
==14615== suppressed: 0 bytes in 0 blocks
==14615==
==14615== For counts of detected and suppressed errors, rerun with: -v
==14615== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0)</code></pre>
<p>From which I concluded that <code>printf(3)</code> allocated a single
4K block for which no matching <code>free(3)</code> existed. But how to
free memory allocated deep down in the guts of the Standard I/O library?
After some serious head scratching it hit me. The only chance I have is
telling the system I no longer want to do I/O, maybe then it would free
that buffer. A reading of C99 7.19.5.1, “The fclose function”, was
encouraging:</p>
<blockquote>
<p>Whether or not the call succeeds, the stream is disassociated from
the file and any buffer set by the <code>setbuf</code> or
<code>setvbuf</code> function is disassociated from the stream (and
deallocated if it was automatically allocated).</p>
</blockquote>
<p>So I <code>fclose(stdout)</code> before returning and now:</p>
<pre><code>valgrind --leak-check=full --show-leak-kinds=all ./prog 6
==14571== Memcheck, a memory error detector
==14571== Copyright (C) 2002-2013, and GNU GPL&#39;d, by Julian Seward et al.
==14571== Using Valgrind-3.10.0 and LibVEX; rerun with -h for copyright info
==14571== Command: ./prog 6
==14571==
0000000000000006
0000000000000003 1
000000000000000A 2
0000000000000005 3
0000000000000010 4
0000000000000008 5
0000000000000004 6
0000000000000002 7
0000000000000001 8
==14571==
==14571== HEAP SUMMARY:
==14571== in use at exit: 0 bytes in 0 blocks
==14571== total heap usage: 4 allocs, 4 frees, 4,120 bytes allocated
==14571==
==14571== All heap blocks were freed -- no leaks are possible
==14571==
==14571== For counts of detected and suppressed errors, rerun with: -v
==14571== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0)</code></pre>
<p>A squeaky clean valgrind result!</p>
<h4 id="flexelint">FlexeLint</h4>
<p>FlexeLint is a commercial lint tool by <a
href="http://www.gimpel.com/html/index.htm">Gimpel Software</a>. It
supports nearly a thousand checks, broadly categorized into 4
levels,</p>
<ol type="1">
<li>Syntax errors only (messages 1 to 399)</li>
<li>Warnings (messages 400 to 699)</li>
<li>Informational messages (700 to 899)</li>
<li>Elective notes (900 to 1000 and &gt; 9000)</li>
</ol>
<p>There is an <a
href="http://www.gimpel-online.com/OnlineTesting.html">on-line
demonstrator</a> you can use for checking your C programs and I highly
recommend trying it. For a start, paste the well know first program in
the form and press “Analyze Code”. Note the FlexeLint configuration
options in comments (no space between <code>/*</code> and
<code>lint</code>).</p>
<div class="sourceCode" id="cb22"><pre class="sourceCode c"><code class="sourceCode c"><span id="cb22-1"><a href="#cb22-1" aria-hidden="true" tabindex="-1"></a> <span class="co">/*lint -w4 turn on everything */</span></span>
<span id="cb22-2"><a href="#cb22-2" aria-hidden="true" tabindex="-1"></a> <span class="co">/*lint +esym(534,*) no demonstrator defaults */</span></span>
<span id="cb22-3"><a href="#cb22-3" aria-hidden="true" tabindex="-1"></a> <span class="co">/*lint -e966 indirectly included header file not used */</span></span>
<span id="cb22-4"><a href="#cb22-4" aria-hidden="true" tabindex="-1"></a> <span class="co">/*lint -esym(9058,_*) tag not used outside typedef */</span></span>
<span id="cb22-5"><a href="#cb22-5" aria-hidden="true" tabindex="-1"></a> <span class="co">/*lint -misra(2) */</span></span>
<span id="cb22-6"><a href="#cb22-6" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb22-7"><a href="#cb22-7" aria-hidden="true" tabindex="-1"></a> <span class="pp">#include </span><span class="im">&lt;stdio.h&gt;</span></span>
<span id="cb22-8"><a href="#cb22-8" aria-hidden="true" tabindex="-1"></a> <span class="dt">int</span> main<span class="op">(</span><span class="dt">void</span><span class="op">)</span></span>
<span id="cb22-9"><a href="#cb22-9" aria-hidden="true" tabindex="-1"></a> <span class="op">{</span></span>
<span id="cb22-10"><a href="#cb22-10" aria-hidden="true" tabindex="-1"></a> printf<span class="op">(</span><span class="st">&quot;hello, world</span><span class="sc">\n</span><span class="st">&quot;</span><span class="op">);</span></span>
<span id="cb22-11"><a href="#cb22-11" aria-hidden="true" tabindex="-1"></a> <span class="cf">return</span> <span class="dv">0</span><span class="op">;</span></span>
<span id="cb22-12"><a href="#cb22-12" aria-hidden="true" tabindex="-1"></a> <span class="op">}</span></span></code></pre></div>
<p>Possible checks include those for MISRA 2004 compliance verification.
The <a
href="https://en.wikipedia.org/wiki/Motor_Industry_Software_Reliability_Association">Motor
Industry Software Reliability Association</a> has produced a <a
href="http://doc.hcc-embedded.com/display/CODING/MISRA+Rules">list of
121 required and 20 advisory rules</a> for C programming. I am proud to
report that my program fulfills <em>almost all</em> rules. To assess the
few exceptions, one has to understand that MISRA rules are geared
towards embedded systems used in the automotive industry. That’s why
features like <code>malloc(3)</code> and <code>printf(3)</code> are
right out. But that’s too restrictive for an IOCCC hosted application,
so I ignored these:</p>
<ul>
<li>17.1 Pointer arithmetic shall only be applied to pointers that
address an array or array element.</li>
<li>17.4 Array indexing shall be the only allowed form of pointer
arithmetic.</li>
<li>20.4 Dynamic heap memory allocation shall not be used.</li>
<li>20.9 The input/output library stdio.h shall not be used in
production code.</li>
<li>20.11 The functions abort, exit, getenv, and system from the library
stdlib.h shall not be used.</li>
</ul>
<p>I started out with enabling <em>all</em> messages using
<code>FlexeLint</code>’s <code>-w4</code> option and disabling all noise
from system headers. Then I dealt with the remaining messages by
addressing them or suppressing them in such a way that the set of
suppressions was minimal. At the end of the day, this is what
remained:</p>
<pre><code> // === Tested with FlexeLint 9.00L on FreeBSD 11 ===
// Compiler:
// &quot;4.2.1 Compatible FreeBSD Clang 3.6.1 (tags/RELEASE_361/final 237755)&quot;
-w4 // Enable maximum pickiness
-passes(6) // Recommended in FlexeLint manual for torture testing
+fsc // Make string literals have type const char*
+fnr // ptr-returning functions may return NULL
-strong(AJX,and,pro,ser,ala) // strong types
-strong(AcJcm,thr) // thr is strong, but most arithmetic is okay
-strong(AarJemorX,met) // met is strong, but some use is okay
+libclass(angle) // All &lt;headers&gt; are system headers
-wlib(1) // Only errors for system headers
-i/usr/include // System headers
-i/usr/local/lib/supp/ansi // Comes with FlexeLint
-d__GNUC__=4 // Pretend...
-d__GNUC_MINOR__=2 // I&#39;m...
-d__GNUC_PATCHLEVEL__=1 // someone else.
-d__builtin_va_list=char* // Fake this compiler extension
-d__inline= // Delete this compiler extension
-d__attribute__(x)= // Delete this compiler extension
+e900 // Announce number of messages produced
// MISRA 2004 checking
/usr/local/lib/supp/lnt/au-misra2.lnt // Enable all MISRA checking
-elib(960) // Don&#39;t check FreeBSD system headers for required rules
-elib(961) // Don&#39;t check FreeBSD system headers for advisory rules
-e829 // stdio.h used
-e522 // MISRA 14.2 Highest operation, lacks side-effects
-esym(960,17.4) // pointer arithmetic other than array indexing used
-e971 // char without signed/unsigned
-e974 // stack usage report
// Use verboten functions, Req. Rules 20.4 malloc() et al., 20.11, exit()
-esym(586,malloc,realloc,calloc,free,exit)
-e911 // implicit promotion of smaller than int to int
-e921 // cast from integral to integral
-e925 // cast from pointer to pointer
-e958 // padding required in struct
+e9??? // Enable all 9xxx informational messages, except:
-e9079 // conversion from pointer to void to pointer to other type
-e9087 // cast performed between a pointer to object type and a
// pointer to a different object type
-e9141 // global declaration of symbol
// Messages due to code in FreeBSD headers.
//
-dlint // The &quot;lint&quot; macro is tested in x86/_types.h
-elib(537) // Repeated include file
-e793 // external identifiers &gt; 6 chars
-e935 // (unsigned) int within struct (actually the size_t)
-estring(960,_*) // Could be defined at block scope
-e964 // Header file not directly used
-e966 // Indirectly included header file not used
-elib(970) // int outside typedef
-esym(9003,_*) // could be defined at block scope
-elib(9047) // FILE pointer dereferenced
-esym(9058,__*) // tag not used outside typedef
-e9092 // NULL does not expand to a pointer (but plain 0)</code></pre>
<h3 id="compulsory-obfuscations">Compulsory obfuscations</h3>
<p>Which of the rules cause which obfuscation?</p>
<p>MISRA 6.1: “The plain <code>char</code> type shall be used only for
the storage and use of character values.” This forbids using character
constants in expressions other than assignments to <code>char</code>
objects. A consequence is that printing digits with
<code>'0' + digit</code> is not allowed (even though <code>'0'</code> is
technically an <code>int</code>!) so I am forced to output hex digits
with</p>
<div class="sourceCode" id="cb24"><pre class="sourceCode c"><code class="sourceCode c"><span id="cb24-1"><a href="#cb24-1" aria-hidden="true" tabindex="-1"></a>printf<span class="op">(</span><span class="st">&quot;</span><span class="sc">%c</span><span class="st">&quot;</span><span class="op">,</span> <span class="op">(</span>met<span class="op">)</span>tyr <span class="op">+</span> <span class="dv">32</span> <span class="op">+</span> <span class="dv">16</span> <span class="op">+</span> <span class="op">((</span><span class="dv">8</span> <span class="op">+</span> EOF<span class="op">)</span> <span class="op">*</span> <span class="op">((</span>met<span class="op">)</span>tyr <span class="op">/</span> <span class="op">(</span><span class="dv">8</span> <span class="op">+</span> <span class="dv">2</span><span class="op">))));</span></span></code></pre></div>
<p>because of the “no magic numbers other than powers of two” rule. How
is this an improvement over
<code>printf("%c", '0' + tyr + 7 * (tyr / 10)</code>, MISRA?</p>
<p>MISRA 6.3: “<code>typedef</code>s that indicate size and signedness
should be used in place of the basic types.” Well, if you can’t infer
the size and signedness from <code>typedef int met</code>, you’re not a
real C programmer.</p>
<p>MISRA 10.5: “If the bitwise operators <code>~</code> and
<code>&lt;&lt;</code> are applied to an operand of underlying type
<code>unsigned char</code> or <code>unsigned short</code>, the result
shall be immediately cast to the underlying type of the operand.”
Because the program must work for any unsigned type chosen for the
<code>typ</code> macro, including the narrow types enumerated in the
rule, a lot of redundant casting ensues. It gets worse with the next
rule…</p>
<p>MISRA 12.1: “Limited dependence should be placed on the C operator
precedence rules in expressions.” This requires parentheses for almost
all expressions involving more than one operator, especially those for
which a cast is required, leading to hard to understand expressions such
as</p>
<div class="sourceCode" id="cb25"><pre class="sourceCode c"><code class="sourceCode c"><span id="cb25-1"><a href="#cb25-1" aria-hidden="true" tabindex="-1"></a><span class="dt">const</span> ser glx <span class="op">=</span> <span class="op">(</span>ser<span class="op">)((</span>asx <span class="op">&gt;</span> <span class="op">(</span>ser<span class="op">)</span><span class="dv">64</span><span class="bu">u</span><span class="op">)</span> <span class="op">?</span> <span class="op">(</span>ser<span class="op">)((</span>ser<span class="op">)</span>asx <span class="op">+</span> <span class="op">(</span>ser<span class="op">)</span><span class="dv">8</span><span class="bu">u</span> <span class="op">+</span> <span class="op">(</span>ser<span class="op">)</span><span class="dv">1</span><span class="bu">u</span><span class="op">)</span> <span class="op">:</span> <span class="op">(</span>ser<span class="op">)</span>asx<span class="op">);</span></span>
<span id="cb25-2"><a href="#cb25-2" aria-hidden="true" tabindex="-1"></a>not<span class="op">.</span>not<span class="op">[</span>leu<span class="op">]</span> <span class="op">=</span> <span class="op">(</span>and<span class="op">)((</span>and<span class="op">)</span>not<span class="op">.</span>not<span class="op">[</span>leu<span class="op">]</span> <span class="op">|</span> <span class="op">(</span>and<span class="op">)(((</span>and<span class="op">)</span>glx <span class="op">%</span> <span class="op">(</span>and<span class="op">)</span><span class="dv">16</span><span class="bu">u</span><span class="op">)</span> <span class="op">&lt;&lt;</span> <span class="op">(</span>and<span class="op">)</span>lys<span class="op">));</span></span></code></pre></div>
<p>MISRA 14.7: “A function shall have a single point of exit at the end
of the function.” Sigh. Since I must use eloquent prototypes (8.1, 16.3,
16.4) and static functions (8.10, 8.11), I can only use a few functions.
Everything usually written with an early <code>return</code> now cause
<em>another useless indent level</em>. The first three <code>if</code>
statements in <code>main()</code> cause a silly 24 character indent. The
maximum indent is forced to 8, which is way too high for a sane
function.</p>
<p>MISRA 16.10: “If a function returns error information, then that
error information shall be tested.” A cast to <code>void</code> would
draw a lint warning, so I use the <code>printf(3)</code> result in
expressions,</p>
<div class="sourceCode" id="cb26"><pre class="sourceCode c"><code class="sourceCode c"><span id="cb26-1"><a href="#cb26-1" aria-hidden="true" tabindex="-1"></a>lys <span class="op">-=</span> <span class="dv">4</span> <span class="op">*</span> printf<span class="op">(</span><span class="st">&quot;</span><span class="sc">%c</span><span class="st">&quot;</span><span class="op">,</span> <span class="op">(</span>met<span class="op">)</span>tyr <span class="op">+</span> <span class="dv">32</span> <span class="op">+</span> <span class="dv">16</span> <span class="op">+</span> <span class="op">((</span><span class="dv">8</span> <span class="op">+</span> EOF<span class="op">)</span> <span class="op">*</span> <span class="op">((</span>met<span class="op">)</span>tyr <span class="op">/</span> <span class="op">(</span><span class="dv">8</span> <span class="op">+</span> <span class="dv">2</span><span class="op">))));</span></span>
<span id="cb26-2"><a href="#cb26-2" aria-hidden="true" tabindex="-1"></a>val <span class="op">+=</span> printf<span class="op">(</span><span class="st">&quot;</span><span class="sc">\n</span><span class="st">&quot;</span><span class="op">)</span> <span class="op">/</span> <span class="op">((</span>__LINE__ <span class="op">*</span> L_tmpnam<span class="op">)</span> <span class="op">+</span> TMP_MAX<span class="op">);</span></span>
<span id="cb26-3"><a href="#cb26-3" aria-hidden="true" tabindex="-1"></a>val <span class="op">-=</span> <span class="op">(</span>printf<span class="op">(</span><span class="st">&quot; </span><span class="sc">%d\n</span><span class="st">&quot;</span><span class="op">,</span> val<span class="op">)</span> <span class="op">&gt;</span> BUFSIZ<span class="op">)</span> <span class="op">?</span> FILENAME_MAX <span class="op">:</span> EOF<span class="op">;</span></span></code></pre></div>
<p>which are, in the absence of errors, equivalent to</p>
<div class="sourceCode" id="cb27"><pre class="sourceCode c"><code class="sourceCode c"><span id="cb27-1"><a href="#cb27-1" aria-hidden="true" tabindex="-1"></a>lys <span class="op">-=</span> <span class="dv">4</span><span class="op">;</span></span>
<span id="cb27-2"><a href="#cb27-2" aria-hidden="true" tabindex="-1"></a><span class="co">/*nop*/</span></span>
<span id="cb27-3"><a href="#cb27-3" aria-hidden="true" tabindex="-1"></a><span class="op">++</span>val<span class="op">;</span></span></code></pre></div>
<p>MISRA 13.1: “Assignment operators shall not be used in expressions
that yield a Boolean value.” Forbids the idiomatic
<code>if ((p = malloc(n)) == NULL)</code> and requires separate
statements, in other words, bloat.</p>
<p>MISRA 16.7: “A pointer parameter in a function prototype should be
declared as pointer to <code>const</code> if the pointer is not used to
modify the addressed object.” in conjunction with lint’s “Note 952:
Parameter could be declared <code>const</code>” causes
<code>const</code>-poisoning for all functions,</p>
<div class="sourceCode" id="cb28"><pre class="sourceCode c"><code class="sourceCode c"><span id="cb28-1"><a href="#cb28-1" aria-hidden="true" tabindex="-1"></a><span class="dt">static</span> <span class="dt">void</span> phe<span class="op">(</span><span class="dt">const</span> ala not<span class="op">);</span></span>
<span id="cb28-2"><a href="#cb28-2" aria-hidden="true" tabindex="-1"></a><span class="dt">static</span> <span class="dt">void</span> gly<span class="op">(</span>ala <span class="op">*</span><span class="dt">const</span> not<span class="op">,</span> <span class="dt">const</span> and his<span class="op">);</span></span>
<span id="cb28-3"><a href="#cb28-3" aria-hidden="true" tabindex="-1"></a>met main<span class="op">(</span>met val<span class="op">,</span> <span class="dt">const</span> pro <span class="op">*</span><span class="dt">const</span> his<span class="op">[]);</span></span></code></pre></div>
<p>and quite a number of automatic variables.</p>
<h3 id="why-the-laugh-and-throw-up-messages">Why the “laugh” and “throw
up” messages?</h3>
<p>The guidelines state “We like programs that: make us laugh and/or
throw up :-) (humor really helps!)”</p>
<h3 id="if-you-have-a-128-bit-type">If you have a 128 bit type</h3>
<p>If your compiler supports a 128 bit wide type (e.g. clang, gcc) then
you can use it via the <code>typ</code> macro:</p>
<div class="sourceCode" id="cb29"><pre
class="sourceCode sh"><code class="sourceCode bash"><span id="cb29-1"><a href="#cb29-1" aria-hidden="true" tabindex="-1"></a><span class="fu">clang</span> <span class="at">-Dtyp</span><span class="op">=</span>__uint128_t <span class="at">-o</span> prog prog.c</span></code></pre></div>
<p>Indeed, the program can use (and lints clean for) all of</p>
<div class="sourceCode" id="cb30"><pre
class="sourceCode sh"><code class="sourceCode bash"><span id="cb30-1"><a href="#cb30-1" aria-hidden="true" tabindex="-1"></a><span class="fu">clang</span> <span class="at">-Dtyp</span><span class="op">=</span>uint8_t <span class="at">-o</span> prog8 prog.c</span>
<span id="cb30-2"><a href="#cb30-2" aria-hidden="true" tabindex="-1"></a><span class="fu">clang</span> <span class="at">-Dtyp</span><span class="op">=</span>uint16_t <span class="at">-o</span> prog16 prog.c</span>
<span id="cb30-3"><a href="#cb30-3" aria-hidden="true" tabindex="-1"></a><span class="fu">clang</span> <span class="at">-Dtyp</span><span class="op">=</span>uint32_t <span class="at">-o</span> prog32 prog.c</span>
<span id="cb30-4"><a href="#cb30-4" aria-hidden="true" tabindex="-1"></a><span class="fu">clang</span> <span class="at">-Dtyp</span><span class="op">=</span>uint64_t <span class="at">-o</span> prog64 prog.c</span>
<span id="cb30-5"><a href="#cb30-5" aria-hidden="true" tabindex="-1"></a><span class="fu">clang</span> <span class="at">-std</span><span class="op">=</span>c89 <span class="at">-Dtyp</span><span class="op">=</span><span class="st">&quot;unsigned long&quot;</span> <span class="at">-o</span> prog89 prog.c</span></code></pre></div>
<p>This works because the program has no need for corresponding
<code>SCN</code> or <code>PRI</code> macros to do the scanning and
printing of variables of these types. With a 128 bit type the program
can represent numbers up to 340282366920938463463374607431768211457
(<code>3.4 * 1000000000000000000000000000000000000000</code>) as a
single “place”, enough to explore yet untested numbers for the rest of
your life.</p>
<h3 id="how-big-a-number-can-i-test-with-4-gb-of-ram">How big a number
can I test with 4 GB of RAM?</h3>
<p>The number of hex digits in the start number is limited by
<code>ARG_MAX</code>, probably minus some overhead for the environment
variables (use <a
href="http://pubs.opengroup.org/onlinepubs/9699919799/utilities/env.html">env(1)</a>
to trim your environment). In bits this leaves you with
<code>2 to the power of (4 * ARG_MAX)</code>.</p>
<p>The algorithm requires two <code>bignum</code>s in memory for
addition. If you hit a divergent number, this will cause out-of-memory
(“laugh”) somewhere near 2<sup>16,000,000,000</sup>
(<code>4GB/2 * 8bits/byte</code>). Sadly, I don’t have a test case
:-)</p>
<p>How long would it take to overflow the <em>Not Overflowing Type</em>?
Lets assume we’re processing 2GB numbers. The program copies, shifts by
one, adds and increments 2GB long bit strings, each time completely
thrashing the data cache – at <em>all</em> levels. We have a fast
machine that can do an iteration in one second, on average. To make
things easy, we round up <code>3*n* + 1</code> to <code>4*n</code>, and
assume we never need to divide by two (which is quite optimistic). Then
each iteration shifts left by 2. This would take 8 billion seconds, or
about 250 years. If you want to get famous, you better <em>remove</em>
some of the RAM, use an ancient box, or reduce available memory
resources with the <code>ulimit(1)</code> built-in of your shell.</p>
<p>For all intents and purposes, the <em>Not Overflowing Type</em> keeps
the promise!</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-2015schweikhardt"><a name="inventory"></a>Inventory
for 2015/schweikhardt</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/2015/schweikhardt/prog.c">prog.c</a>
- winning source</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2015/schweikhardt/Makefile">Makefile</a>
- winner Makefile</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2015/schweikhardt/prog.orig.c">prog.orig.c</a>
- original source</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2015/schweikhardt/try.sh">try.sh</a>
- how to run</li>
<li><a href="2015_schweikhardt.tar.bz2">2015_schweikhardt.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/2015/schweikhardt/.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/2015/schweikhardt/.winner.json">.winner.json</a>
- description of winner in JSON</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2015/schweikhardt/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%2F2015%2Fschweikhardt%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 -->
+262 -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,274 @@
<!-- !!! DO NOT MODIFY THIS FILE - This file is generated by a tool !!! -->
<!-- !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<!-- -->
<!-- file: 2015/yang/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>2015 yang</title>
<meta name="description" content="IOCCC year: 2015 IOCCC winner: yang winner index page">
<meta name="keywords" content="IOCCC,2015,yang,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>2015/yang</title>
<meta name="description" content="2015 IOCCC winner yang">
<meta name="keywords" content="IOCCC, 2015, IOCCC 2015, IOCCC winner, yang">
</head>
<!-- END: this line ends content from: inc/head.default.html -->
<!-- START: this line starts content from: inc/body.default.html -->
<body>
<h1>2015 yang</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>2015/yang</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%2F2015%2Fyang%2Findex.html">Nu Html check https://ioccc-src.github.io/temp-test-ioccc/2015/yang/index.html</a></p>
<!-- End Nu Html Checker -->
<div class="topnav">
<a class="Left" href="../schweikhardt/index.html">&larr; schweikhardt</a>
<a class="Left" href="../index.html">&uarr; 2015 &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#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>
<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> Some text <span class="kw">|</span> <span class="ex">./prog</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>Before analysing the code in detail we were able to guess two out of
four tests this entry uses to tell the 5 languages/flavors apart. Can
you find all four?</p>
<p>The way the text is encoded in the output doesn’t cease to amaze. Can
you tell why an array of 512 elements is needed?</p>
<p>NOTE: the author calls the program <code>Fuuko</code> and so the
source file referred to in their remarks uses <code>fuuko.c</code>. The
<a href="Makefile">Makefile</a> will compile everything so you need not
worry about this.</p>
<h2 id="authors-remarks">Author’s remarks:</h2>
<p><code>Fuuko</code> is a <a
href="https://en.wikipedia.org/wiki/Starfish">sea star</a> generator.
Feed her some input through <code>stdin</code> to get lots of sea star
patterns on <code>stdout</code>.</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">cc</span> <span class="at">-O3</span> <span class="at">-std</span><span class="op">=</span>c90 fuuko.c <span class="at">-lm</span> <span class="at">-o</span> fuuko_c90</span>
<span id="cb4-2"><a href="#cb4-2" aria-hidden="true" tabindex="-1"></a><span class="bu">echo</span> IOCCC <span class="kw">|</span> <span class="ex">./fuuko_c90</span> <span class="op">&gt;</span> output_c90.c</span></code></pre></div>
<p>If you compile with a C99 compiler instead of C90, the sea stars will
have eyes.</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">-O3</span> <span class="at">-std</span><span class="op">=</span>c99 fuuko.c <span class="at">-lm</span> <span class="at">-o</span> fuuko_c99</span>
<span id="cb5-2"><a href="#cb5-2" aria-hidden="true" tabindex="-1"></a><span class="bu">echo</span> IOCCC <span class="kw">|</span> <span class="ex">./fuuko_c99</span> <span class="op">&gt;</span> output_c99.c</span></code></pre></div>
<p>Don’t like <a href="https://en.wikipedia.org/wiki/Starfish">sea
stars</a>? Use a C++98 compiler to get a <a
href="https://en.wikipedia.org/wiki/Dango">dango</a> instead.</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">g++</span> <span class="at">-O3</span> <span class="at">-std</span><span class="op">=</span>c++98 fuuko.c <span class="at">-lm</span> <span class="at">-o</span> fuuko_cpp98</span>
<span id="cb6-2"><a href="#cb6-2" aria-hidden="true" tabindex="-1"></a><span class="bu">echo</span> IOCCC <span class="kw">|</span> <span class="ex">./fuuko_cpp98</span> <span class="op">&gt;</span> output_cpp98.c</span></code></pre></div>
<p>Don’t like <a href="https://en.wikipedia.org/wiki/Dango">dango</a>
either? Use a C++11 compiler to get just <a
href="https://en.wikipedia.org/wiki/Circle">circles</a> (or <a
href="https://en.wikipedia.org/wiki/Swiss_cheeses_and_dairy_products">Swiss
cheese</a>, if you prefer that).</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">g++</span> <span class="at">-O3</span> <span class="at">-std</span><span class="op">=</span>c++11 fuuko.c <span class="at">-lm</span> <span class="at">-o</span> fuuko_cpp11</span>
<span id="cb7-2"><a href="#cb7-2" aria-hidden="true" tabindex="-1"></a><span class="bu">echo</span> IOCCC <span class="kw">|</span> <span class="ex">./fuuko_cpp11</span> <span class="op">&gt;</span> output_cpp11.c</span></code></pre></div>
<p>Don’t like any of these patterns? Use a C11 compiler and there will
be no extra pattern.</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">cc</span> <span class="at">-O3</span> <span class="at">-std</span><span class="op">=</span>c11 fuuko.c <span class="at">-lm</span> <span class="at">-o</span> fuuko_c11</span>
<span id="cb8-2"><a href="#cb8-2" aria-hidden="true" tabindex="-1"></a><span class="bu">echo</span> IOCCC <span class="kw">|</span> <span class="ex">./fuuko_c11</span> <span class="op">&gt;</span> output_c11.c</span></code></pre></div>
<p>Regardless of which of these C/C++ dialects you choose, the output
will all be valid C90 code that reproduces original input on
<code>stdout</code>, filled with pointer dereferences (C stars).</p>
<p>Next time people ask you for a few pointers on C, you can run their
question through <code>Fuuko</code> and give them pointers all day
long.</p>
<h3 id="compatibility">Compatibility</h3>
<p><code>Fuuko</code> has been tested under these environments:</p>
<ul>
<li>gcc 4.9.3 on Cygwin</li>
<li>gcc 4.9.2 on Linux</li>
<li>gcc 4.8.4 on Linux</li>
<li>gcc 4.6.3 on Linux (doesn’t support C11 nor C++11)</li>
<li>gcc 4.3.5 on JS/Linux</li>
<li>clang 3.5.2 on Cygwin (doesn’t work with optimization enabled,
probably cygwin bug)</li>
<li>clang 3.5.0 on Linux</li>
<li>clang 3.4.1 on Linux</li>
<li>tcc 0.9.25 on JS/Linux (C99 only)</li>
</ul>
<h3 id="features">Features</h3>
<p>The most obscure parts are in detecting the subtle differences in
different dialects. The standard committees put a lot of effort into
avoiding “quiet changes”, but <code>Fuuko</code> is still able to
exploit a few of those. It should be an interesting exercise for the
reader to figure how she did it.</p>
<p>Output patterns are usually random (except for C11). The built-in
random number generator is seeded using <a
href="https://en.wikipedia.org/wiki/Address_space_layout_randomization">ASLR</a>.
On systems where ASLR is not so random (such as cygwin), you can
introduce randomness by changing number of command line arguments to
<code>Fuuko</code>.</p>
<p>Output is somewhat robust: corruption on most of the lines will
usually result in a compiler warning. This is because the output is
vastly redundant: For ~1K of input, expect output to be on the order of
~1MB, and take ~500MB of RAM to compile.</p>
<p><a
href="https://en.wikipedia.org/wiki/Computation_of_cyclic_redundancy_checks#CRC-32_algorithm">CRC32</a>
of source code is embedded in the source code itself.</p>
<p>The process of writing this program can be seen by opening <a
href="spoiler.html">spoiler.html</a> in a browser that supports
JavaScript.</p>
<p>Code layout is inspired by <a
href="https://clannad.fandom.com/wiki/Fuko_Ibuki">Ibuki Fuuko</a>, for
her love of sea stars.</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-2015yang"><a name="inventory"></a>Inventory for
2015/yang</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/2015/yang/prog.c">prog.c</a>
- winning source</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2015/yang/Makefile">Makefile</a>
- winner Makefile</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2015/yang/prog.orig.c">prog.orig.c</a>
- original source</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2015/yang/try.sh">try.sh</a>
- how to run</li>
<li><a href="spoiler.html">spoiler.html</a> - SPOILER WARNING</li>
<li><a href="2015_yang.tar.bz2">2015_yang.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/2015/yang/.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/2015/yang/.winner.json">.winner.json</a>
- description of winner in JSON</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2015/yang/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%2F2015%2Fyang%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 -->