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

+263 -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,275 @@
<!-- !!! DO NOT MODIFY THIS FILE - This file is generated by a tool !!! -->
<!-- !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<!-- -->
<!-- file: 2011/akari/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>2011 akari</title>
<meta name="description" content="IOCCC year: 2011 IOCCC winner: akari winner index page">
<meta name="keywords" content="IOCCC,2011,akari,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>2011/akari</title>
<meta name="description" content="2011 IOCCC winner akari">
<meta name="keywords" content="IOCCC, 2011, IOCCC 2011, IOCCC winner, akari">
</head>
<!-- END: this line ends content from: inc/head.default.html -->
<!-- START: this line starts content from: inc/body.default.html -->
<body>
<h1>2011 akari</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>2011/akari</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%2F2011%2Fakari%2Findex.html">Nu Html check https://ioccc-src.github.io/temp-test-ioccc/2011/akari/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; 2011 &uarr;</a>
<a class="Left" href="../blakely/index.html">blakely &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#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="ex">./akari</span> [ input_file <span class="kw">|</span> <span class="ex">-</span> ] [ output_file <span class="kw">|</span> <span class="ex">-</span> ] <span class="pp">[</span><span class="ss">even</span><span class="pp">]</span></span></code></pre></div>
<h2 id="try">Try:</h2>
<div class="sourceCode" id="cb3"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb3-1"><a href="#cb3-1" aria-hidden="true" tabindex="-1"></a><span class="ex">./try.sh</span></span></code></pre></div>
<h2 id="judges-remarks">Judges’ remarks:</h2>
<p><code>Akari</code> is an image downsampling utility that accepts 3
input formats:</p>
<ul>
<li><p><a href="https://netpbm.sourceforge.net/doc/pgm.html">PGM</a> (<a
href="https://netpbm.sourceforge.net/doc/">netpbm</a> <a
href="https://en.wikipedia.org/wiki/Grayscale">greyscale image</a>.
<code>Akari</code> only accepts <code>PGM</code> files with the header:
<code>P5 &lt;width&gt; &lt;height&gt; 255</code>. Images with extra
comments <em>such as the ones produced by <a
href="https://www.gimp.org">GIMP</a> will <strong>not be parsed
properly</strong></em>.</p></li>
<li><p><a href="https://netpbm.sourceforge.net/doc/ppm.html">PPM</a>
(netpbm RGB image). Only <code>PPM</code> files with the header
<code>P6 &lt;width&gt; &lt;height&gt; 255</code> are accepted.</p></li>
<li><p><a href="https://en.wikipedia.org/wiki/ASCII_art">ASCII art</a>
(with <a href="https://en.wikipedia.org/wiki/Newline">end of lines</a>
in LF bytes only, <em><strong>not</strong> CR-LF</em>!)</p></li>
</ul>
<p>Anything that is not parsable as <code>PGM</code> or <code>PPM</code>
will be downsampled as ASCII art.</p>
<h2 id="authors-remarks">Author’s remarks:</h2>
<p><code>Akari</code> is an image downsampling utility. She accepts up
to 3 arguments:</p>
<p>The first argument is the input image. If it’s <code>-</code> or
unspecified, <code>Akari</code> will read from <code>stdin</code>.</p>
<p>The second argument is the output image. If it’s <code>-</code> or
unspecified, <code>Akari</code> will write to <code>stdout</code>.</p>
<p>The third argument, if specified, causes <code>Akari</code> to keep
even pixels on even <a
href="https://en.wikipedia.org/wiki/Scan_line">scanlines</a>. By default
<code>Akari</code> will keep odd pixels on odd <a
href="https://en.wikipedia.org/wiki/Scan_line">scanlines</a>.</p>
<h3 id="examples">Examples:</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">gcc</span> akari.c <span class="at">-o</span> akari</span>
<span id="cb4-2"><a href="#cb4-2" aria-hidden="true" tabindex="-1"></a><span class="ex">./akari</span> <span class="op">&lt;</span> example.ppm <span class="op">&gt;</span> odd_output.ppm</span>
<span id="cb4-3"><a href="#cb4-3" aria-hidden="true" tabindex="-1"></a><span class="ex">./akari</span> <span class="at">-</span> <span class="at">-</span> even <span class="op">&lt;</span> example.ppm <span class="op">&gt;</span> even_output.ppm</span>
<span id="cb4-4"><a href="#cb4-4" aria-hidden="true" tabindex="-1"></a><span class="ex">./akari</span> example.ppm odd_output.ppm</span></code></pre></div>
<p><code>Akari</code> accepts 3 input formats:</p>
<ul>
<li><a href="https://netpbm.sourceforge.net/doc/pgm.html">PGM</a> (<a
href="https://netpbm.sourceforge.net/doc/">netpbm</a> <a
href="https://en.wikipedia.org/wiki/Grayscale">greyscale image</a>.
<code>Akari</code> only accepts <code>PGM</code> files with the header:
<code>P5 &lt;width&gt; &lt;height&gt; 255</code>. Images with extra
comments such as the ones produced by <a
href="https://www.gimp.org">GIMP</a> will not be parsed properly. <a
href="https://netpbm.sourceforge.net/doc/ppm.html">PPM</a> (netpbm RGB
image). Only <code>PPM</code> files with the header
<code>P6 &lt;width&gt; &lt;height&gt; 255</code> are accepted.</li>
<li>ASCII art (with end of lines in LF bytes only, not CR-LF)</li>
</ul>
<p>This is useful for decoding some curiously interlaced images, such as
the included <a href="example.ppm">example.ppm</a>.</p>
<p>Anything that is not parsable as <code>PGM</code> or <code>PPM</code>
will be downsampled as ASCII art. Since the source code is formatted as
ASCII art, it’s only natural to try:</p>
<div class="sourceCode" id="cb5"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb5-1"><a href="#cb5-1" aria-hidden="true" tabindex="-1"></a><span class="ex">./akari</span> akari.c akari2.c</span></code></pre></div>
<p><code>akari2.c</code> is also a valid C program, and accepts up to 1
argument. By default, this second program reads text from
<code>stdin</code> and writes expanded output to <code>stdout</code>. If
the extra argument is specified, the output text will also pass through
a rot13 filter.</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">gcc</span> akari2.c <span class="at">-o</span> akari2</span>
<span id="cb6-2"><a href="#cb6-2" aria-hidden="true" tabindex="-1"></a><span class="ex">./akari2</span> <span class="op">&lt;</span> input.txt <span class="op">&gt;</span> expanded_output.txt</span>
<span id="cb6-3"><a href="#cb6-3" aria-hidden="true" tabindex="-1"></a><span class="ex">./akari2</span> rot13 <span class="op">&lt;</span> input.txt <span class="op">&gt;</span> expanded_and_rot13_output.txt</span></code></pre></div>
<p>You can combine the two programs together to have just a regular
rot13 filter:</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">./akari2</span> rot13 <span class="op">&lt;</span> input.txt <span class="kw">|</span> <span class="ex">./akari</span> <span class="op">&gt;</span> rot13.txt</span></code></pre></div>
<p>Of course, we wouldn’t stop with just 2 programs, you can downsample
the source <em>again</em> and get yet another C program:</p>
<div class="sourceCode" id="cb8"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb8-1"><a href="#cb8-1" aria-hidden="true" tabindex="-1"></a><span class="ex">./akari</span> <span class="op">&lt;</span> akari.c <span class="kw">|</span> <span class="ex">./akari</span> <span class="op">&gt;</span> akari3.c</span></code></pre></div>
<p>We must go deeper:</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">./akari</span> <span class="op">&lt;</span> akari.c <span class="kw">|</span> <span class="ex">./akari</span> <span class="kw">|</span> <span class="ex">./akari</span> <span class="op">&gt;</span> akari4.c</span></code></pre></div>
<p><code>akari3.c</code> and <code>akari4.c</code> are still (mostly
valid) C programs. <code>gcc -Wall</code> will output a few warnings,
but still produce output executables. The output executables each print
a message to <code>stdout</code>.</p>
<p>It takes quite a bit of skill and obfuscation to interleave a C
program 4 levels deep, it’s much easier to interleave something like a
<code>brainf#$%</code> program in a C program, for example. For
comparison, a <code>brainf#$%</code> program is embedded inside <a
href="akari.c">akari.c</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-2011akari"><a name="inventory"></a>Inventory for
2011/akari</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/2011/akari/akari.c">akari.c</a>
- winning source</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2011/akari/Makefile">Makefile</a>
- winner Makefile</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2011/akari/akari.orig.c">akari.orig.c</a>
- original source</li>
<li><a href="example.ppm">example.ppm</a> - input image</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2011/akari/try.sh">try.sh</a>
- how to run</li>
<li><a href="2011_akari.tar.bz2">2011_akari.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/2011/akari/.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/2011/akari/.winner.json">.winner.json</a>
- description of winner in JSON</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2011/akari/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%2F2011%2Fakari%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 -->
+357 -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,369 @@
<!-- !!! DO NOT MODIFY THIS FILE - This file is generated by a tool !!! -->
<!-- !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<!-- -->
<!-- file: 2011/blakely/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>2011 blakely</title>
<meta name="description" content="IOCCC year: 2011 IOCCC winner: blakely winner index page">
<meta name="keywords" content="IOCCC,2011,blakely,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>2011/blakely</title>
<meta name="description" content="2011 IOCCC winner blakely">
<meta name="keywords" content="IOCCC, 2011, IOCCC 2011, IOCCC winner, blakely">
</head>
<!-- END: this line ends content from: inc/head.default.html -->
<!-- START: this line starts content from: inc/body.default.html -->
<body>
<h1>2011 blakely</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>2011/blakely</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%2F2011%2Fblakely%2Findex.html">Nu Html check https://ioccc-src.github.io/temp-test-ioccc/2011/blakely/index.html</a></p>
<!-- End Nu Html Checker -->
<div class="topnav">
<a class="Left" href="../akari/index.html">&larr; akari</a>
<a class="Left" href="../index.html">&uarr; 2011 &uarr;</a>
<a class="Left" href="../borsanyi/index.html">borsanyi &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#Philip_Blakely">Philip
Blakely</a><br> Location: <a
href="/temp-test-ioccc/location.html#GB">GB</a></p>
<!-- END: next line ends content generated by: bin/gen-author.sh -->
<h2 id="to-build">To build:</h2>
<div class="sourceCode" id="cb1"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb1-1"><a href="#cb1-1" aria-hidden="true" tabindex="-1"></a><span class="fu">make</span></span></code></pre></div>
<h2 id="to-use">To use:</h2>
<p>Zoom out and make your terminal window 53 or more lines deep.</p>
<div class="sourceCode" id="cb2"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb2-1"><a href="#cb2-1" aria-hidden="true" tabindex="-1"></a><span class="ex">./blakely</span> <span class="op">&lt;</span> blakely.c <span class="kw">|</span> <span class="fu">head</span> <span class="at">-300</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>
<p>For those who have a lot of time, try:</p>
<div class="sourceCode" id="cb4"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb4-1"><a href="#cb4-1" aria-hidden="true" tabindex="-1"></a><span class="ex">./blakely</span> <span class="op">&lt;</span> t0_3.dat</span></code></pre></div>
<p>though one might or might not need to kill it, depending on your
boredom threshold.</p>
<h2 id="judges-remarks">Judges’ remarks:</h2>
<p>This program plays <a
href="https://en.wikipedia.org/wiki/Conway%27s_Game_of_Life">Life</a>
(see also <a href="https://conwaylife.com">here</a>), computes Pi to 16
digits if given its own source as input, and allows to check if your
garden is a <a
href="http://en.wikipedia.org/wiki/Garden_of_Eden_%28cellular_automaton%29">Garden
of Eden</a>, all in one source.</p>
<p>If you have enough time to spare, put the plan of your garden in a
text file, and run:</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">./blakely</span> <span class="at">-</span> <span class="op">&lt;</span> garden.txt</span></code></pre></div>
<h2 id="authors-remarks">Author’s remarks:</h2>
<p>This program uses a well-known algorithm in order to display pi to
fifteen decimal places. The source-layout itself demonstrates the
importance of using the correct amount of whitespace in code and the
clear superiority of spaces over tabs.</p>
<p>In order to see the main feature of the code, type:</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">./blakely</span> <span class="op">&lt;</span> blakely.c</span></code></pre></div>
<p>and wait for about four seconds before using Ctrl-C (or whatever) to
end the program. The results are best viewed in a terminal window at
least 60 characters high and wide. Alternatively, redirect the output to
a separate file (killing when necessary).</p>
<h3 id="overview">Overview</h3>
<p>The program emulates John Conway’s cellular automaton known as “<a
href="https://conwaylife.com">The Game of Life</a>”, using standard
input as a starting grid. The layout of the source-code is such that it
evolves to a digital representation of the first 15 decimal places of pi
after 4 time steps. This was setup using the other feature of the
program which can be demonstrated as follows:</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">./blakely</span> <span class="at">-</span> <span class="op">&lt;</span> 3.dat</span></code></pre></div>
<p>The program will first display the grid given in <a
href="3.dat">3.dat</a>, and then three more grids (taking a few minutes
to display the last). Waiting for any more grids will take a substantial
amount of time. The final grid has been put into <a
href="evolve_to_3.dat">evolve_to_3.dat</a>, and if you 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="ex">./blakely</span> <span class="op">&lt;</span> evolve_to_3.dat</span></code></pre></div>
<p>then the 3 will reappear after three time steps.</p>
<p>As should now be clear, this use of the program will attempt to
evolve a given setup backwards in time according to the Life rules. The
resulting grid is clearly not necessarily unique. The program will
evolve backwards given <em>any</em> single command line option.</p>
<p>When evolving forwards, the code can only be stopped by killing the
program. In the reverse direction, the code can either be killed, or
will stop if it is unable to find a grid that will evolve to the current
layout correctly. This can be seen with the sample grid <a
href="t0_3.dat">t0_3.dat</a>, which evolves backwards by only two
time-steps.</p>
<h3 id="input-file-format">Input file format</h3>
<p>The input files must encode a square grid, where a space is a dead
cell, and any other character (except a newline) is a living cell. Each
line must be the same length, and end with a single newline character
<code>\n</code> (ASCII 10), including the last line. When designing
grids, it may help to type full-stops (dots) in place of spaces, and do
a global replace afterwards. Any deviation from this format will cause
errors in the output.</p>
<h3 id="limitations">Limitations</h3>
<p>This is only an approximation to the original Life, as it takes place
on a finite grid, with borders that are automatically killed off before
each time step. However, when evolving backwards, the resulting grids
will not cause any cells on the boundaries to come alive. As the display
is performed before killing off the borders, some boundary cells may
sometimes appear to be alive, but not be treated as such for the
following time-step, although any living cells on the right border will
never be displayed.</p>
<p>The maximum grid size is currently 99 by 99 (exceeding this will
cause a segfault), but changing the two <code>9802</code>s to
<code>MAX_SIZE*MAX_SIZE+1</code> will solve this, although some
reformatting of the code might have to be done to allow larger
numbers.</p>
<h3 id="compiler-warningsassumptions">Compiler warnings/assumptions</h3>
<p>When compiled with the <code>-Wall -pedantic -ansi</code> options of
gcc, some warnings suggesting extra parentheses occur (not necessary for
anyone fully conversant with operator precedence). There is one unused
variable, <code>v</code>, but unnamed function parameters are not
permitted in ANSI C, so naming it is necessary, and gcc no longer warns
about its existence, although earlier versions do.</p>
<p>Since the program calculates ASCII character values for display, an
ASCII based system is required to run it. Also, as mentioned above, any
system that uses anything other than a plain <code>\n</code> to end a
line will cause problems when reading in files.</p>
<h3 id="obfuscation">Obfuscation</h3>
<p>Given the finely-tuned layout required to evolve into pi, this is one
of the main obfuscations used in the code. However, running the code
through the preprocessor, expanding the <code>#define</code>s, and
applying GNU’s indent, although making the location of functions and
statements clear, by no means makes the code entirely clear. Note that
expanding out the <code>#define</code>s does not take the program over
the character limit. The main reason for these is to do with the layout,
since there are few places that keywords or tokens of over 2 characters
can be fitted, and requiring the first few lines to be
<code>#include</code>s would cause similar problems.</p>
<p>Other obfuscations used are:</p>
<ul>
<li>Use of the classic <code>2[a]</code> syntax to access the third
element of the array <code>a</code>.</li>
<li>Nested ternary operators, combined with shortcut evaluation being
required for correct operation.</li>
<li>Use of the comma operator to embed operations inside one
another.</li>
<li>Calculation of ASCII codes.</li>
<li>Needlessly recursive functions.</li>
<li>Use of bitwise-operations.</li>
<li>Storing a variable whose value could easily be found from
another.</li>
<li>Use of <code>goto</code>s to emulate a <code>for</code> loop.</li>
</ul>
<h3 id="algorithm">Algorithm</h3>
<p>The forwards evolution of the grid is straightforward.</p>
<p>The reverse evolution is done using a brute-force method. As far as I
know, a brute-force method is the only viable automatic approach for
general grids, although more intelligent algorithms would be possible
given more space.</p>
<p>The program starts with an empty “trial” grid and, starting from the
top-left, tries all possibilities for the neighbours of the current cell
that will cause the cell to evolve to the required state. It then
proceeds to the right and down. Thus, it only ever needs to look at the
cells below and to the right when testing. However, the already defined
cells above and/or to the left of the cell may mean that there are no
possibilities that will give the correct state, in which case the code
backtracks and tries other possibilities on previous cells. The program
knows it has a valid grid if it gets to the last cell. If it cannot find
a valid grid, the program exits.</p>
<p>Since this uses brute-force, it can be very slow. (In fact, the
various obfuscations have, at least for the gcc compiler, caused a
substantial slowdown.)</p>
<h3 id="program-layout">Program layout</h3>
<p>The “calculation” of pi was chosen purely because algorithms to find
pi are numerous, but the <a
href="https://en.wikipedia.org/wiki/Conway%27s_Game_of_Life">Game of
Life</a> is rarely (if ever?) used for this purpose. Also, separate
digits made determining the layout somewhat easier.</p>
<p>Deriving the layout was the most complicated part of the program. As
is clear from the final layout featuring pi, the grid was divided into
sixteen squares, and layouts that would evolve to each of the nine
digits required were found. (This used the three-by-five digit-layout
embedded in, at first, a nine-by-nine grid, then in larger grids, until
fifteen-by-fifteen was reached.) The fifteen-by-fifteen grids give
enough blank cells around them that the digits will not collide when
evolving.</p>
<p>However, this did not allow for sufficient characters to fit the code
into. Therefore it was necessary to add some regions that would quickly
die off without expanding to collide with the digits’ evolution. Groups
of cells such as singletons, pairs, and larger groups like</p>
<pre><code>* * * * * * * * * *
*****************
* * * * * * * * * *</code></pre>
<p>were useful in this regard.</p>
<p>Other problems were keywords which need to be all in one string,
keywords requiring space after them, and multi-character tokens. Some of
these problems were dealt with by using the <code>#define</code>s and
<code>#include</code>s given in the build-script, as there was no way to
have sufficient separate lines in the code to do this without causing
many difficulties. Some rejigging of the grid’s layout as the code was
fitted into its format was also done, resorting to trial-and-improvement
in some cases. Occasional use of constructs such as <code>f -= -3</code>
was made as <code>f += 3</code> could not be fitted into the required
format. The fact that the borders would be killed off immediately was
also helpful.</p>
<p>It should be noted that evolving a full 60-by-60 grid backwards using
this code would probably take us at least up to the heat-death of the
universe.</p>
<p>The command <code>./blakely - &lt; blakely.c</code> is therefore
<em>not</em> recommended.</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-2011blakely"><a name="inventory"></a>Inventory for
2011/blakely</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/2011/blakely/blakely.c">blakely.c</a>
- winning source</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2011/blakely/Makefile">Makefile</a>
- winner Makefile</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2011/blakely/blakely.orig.c">blakely.orig.c</a>
- original source</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2011/blakely/3.dat">3.dat</a>
- input data</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2011/blakely/evolve_to_3.dat">evolve_to_3.dat</a>
- input data</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2011/blakely/t0_3.dat">t0_3.dat</a>
- input data</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2011/blakely/try.sh">try.sh</a>
- how to run</li>
<li><a href="2011_blakely.tar.bz2">2011_blakely.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/2011/blakely/.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/2011/blakely/.winner.json">.winner.json</a>
- description of winner in JSON</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2011/blakely/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%2F2011%2Fblakely%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 -->
+243 -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,255 @@
<!-- !!! DO NOT MODIFY THIS FILE - This file is generated by a tool !!! -->
<!-- !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<!-- -->
<!-- file: 2011/borsanyi/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>2011 borsanyi</title>
<meta name="description" content="IOCCC year: 2011 IOCCC winner: borsanyi winner index page">
<meta name="keywords" content="IOCCC,2011,borsanyi,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>2011/borsanyi</title>
<meta name="description" content="2011 IOCCC winner borsanyi">
<meta name="keywords" content="IOCCC, 2011, IOCCC 2011, IOCCC winner, borsanyi">
</head>
<!-- END: this line ends content from: inc/head.default.html -->
<!-- START: this line starts content from: inc/body.default.html -->
<body>
<h1>2011 borsanyi</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>2011/borsanyi</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%2F2011%2Fborsanyi%2Findex.html">Nu Html check https://ioccc-src.github.io/temp-test-ioccc/2011/borsanyi/index.html</a></p>
<!-- End Nu Html Checker -->
<div class="topnav">
<a class="Left" href="../blakely/index.html">&larr; blakely</a>
<a class="Left" href="../index.html">&uarr; 2011 &uarr;</a>
<a class="Left" href="../dlowe/index.html">dlowe &rarr;</a>
<a class="Right" href="#inventory">Inventory</a>
</div>
<!-- END: this line ends content from: inc/topnav.mid.html -->
<!-- START: this line starts content from: inc/begin-row.default.html -->
<div class="row">
<!-- END: this line ends content from: inc/begin-row.default.html -->
<!-- START: this line starts content from: inc/begin-leftcolumn.default.html -->
<div class="leftcolumn">
<!-- END: this line ends content from: inc/begin-leftcolumn.default.html -->
<!-- START: this line starts content from: inc/sidenav.default.html -->
<div class="sidenav">
<a href="#content">Jump to contents</a>
</div>
<hr>
<div class="sidenav">
<a href="/temp-test-ioccc/index.html">IOCCC Home</a>
<a href="/temp-test-ioccc/years.html">Winning Entries</a>
<a href="/temp-test-ioccc/winners.html">People who have won</a>
</div>
<hr>
<div class="sidenav">
<a href="/temp-test-ioccc/news.html">IOCCC News</a>
<a href="/temp-test-ioccc/faq.html#submit">How to enter the IOCCC</a>
<a href="/temp-test-ioccc/faq.html">FAQ</a>
</div>
<hr>
<div class="sidenav">
<a href="/temp-test-ioccc/bugs.html">Bugs &amp; (mis)features</a>
<a href="/temp-test-ioccc/faq.html#fix_a_winner">Fixing IOCCC winners</a>
<a href="/temp-test-ioccc/faq.html#fix_web_site">Fixing the web site</a>
<a href="/temp-test-ioccc/faq.html#fix_author">Fixing winner info</a>
<a href="/temp-test-ioccc/thanks-for-help.html">Thanks for the help</a>
</div>
<hr>
<div class="sidenav">
<a href="/temp-test-ioccc/judges.html">The IOCCC Judges</a>
<a href="/temp-test-ioccc/contact.html">Contacting the IOCCC</a>
</div>
<hr>
<div class="sidenav">
<a href="#top">Jump to top</a>
</div>
<!-- END: this line ends content from: inc/sidenav.default.html -->
<!-- START: this line starts content from: inc/end-leftcolumn.default.html -->
</div>
<!-- END: this line ends content from: inc/end-leftcolumn.default.html -->
<!-- START: this line starts content from: inc/begin-rightcolumn.default.html -->
<div class="rightcolumn">
<!-- END: this line ends content from: inc/begin-rightcolumn.default.html -->
<!-- START: this line starts content from: inc/before-content.default.html -->
<a name="content"></a>
<!-- END: this line ends content from: inc/before-content.default.html -->
<!-- START: this line starts content generated by: bin/gen-author.sh -->
<p><a name="author"><strong>Author:</strong></a> <br><br>Name: <a
href="/temp-test-ioccc/winners.html#Szabolcs_Borsanyi">Szabolcs
Borsanyi</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#2011-borsanyi">2011 borsanyi 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">./borsanyi</span> <span class="op">&lt;</span> some_data_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="ex">./try.sh</span></span></code></pre></div>
<h2 id="judges-remarks">Judges’ remarks:</h2>
<p>This is a nice quick <a
href="https://en.wikipedia.org/wiki/Histogram">histogram</a> plotter. A
useful utility when you need to look at the distribution of some
data.</p>
<h3 id="challenges">Challenges:</h3>
<p>You can modify the number of histogram <a
href="https://en.wikipedia.org/wiki/Data_binning">bins</a> and the
scaling of the histogram by editing the source. Try to find them!</p>
<p>If you look at the source you will notice that the usual array of
histogram bins is missing. The source contains no arrays and it does not
use <code>malloc(3)</code> or <code>alloca(3)</code>. How does it build
the histogram?</p>
<p>While the input does not need to be sorted, the histogram output is
sorted. How does it put the data into buckets? Why does it
<code>fork(2)</code> 22 times?</p>
<h2 id="authors-remarks">Author’s remarks:</h2>
<p>This small piece of program is meant to be a useful tool, when there
are some data around and you need a quick glance at the histogram. I am
all too often logged in to a remote machine with slow X connection, and
a terminal-based program would be of great help.</p>
<h3 id="limitations">Limitations</h3>
<ul>
<li>I optimized the output for the data I had around, you might want to
adjust for your needs. For a great excess of data points the program
will crash (depending on the available stack).</li>
<li>Giving too few (distinct) points can also cause crash (or division
by zero).</li>
<li>The program expects plain numbers separated by white spaces.</li>
<li>ASCII is assumed.</li>
<li>Some POSIX-like system is assumed (<code>fork()</code> and
<code>wait(NULL)</code> are used).</li>
<li>Do not give any arguments to the program.</li>
<li>Could rounding errors cause the omission of the highest bin? There
might be empty bins at the edges.</li>
</ul>
<h3 id="obfuscation">Obfuscation</h3>
<ul>
<li>The program follows a rather unconventional approach to the task of
histogram building. The usual array of integers (for the histogram bins)
is missing entirely. The data are read once, the range is determined,
but the data points are not put in any array. Yet they are remembered,
and each of them is put into its own bin afterwards. But where are the
bins?</li>
<li>I tried to use as few keywords as possible, hence there are no
loops.</li>
<li>Multi-process approach for optimal use of resources.</li>
<li>Some bin size obfuscation.</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-2011borsanyi"><a name="inventory"></a>Inventory
for 2011/borsanyi</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/2011/borsanyi/borsanyi.c">borsanyi.c</a>
- winning source</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2011/borsanyi/Makefile">Makefile</a>
- winner Makefile</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2011/borsanyi/borsanyi.orig.c">borsanyi.orig.c</a>
- original source</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2011/borsanyi/try.sh">try.sh</a>
- how to run</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2011/borsanyi/data.1">data.1</a>
- sample input</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2011/borsanyi/data.2">data.2</a>
- sample input</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2011/borsanyi/data.3">data.3</a>
- sample input</li>
<li><a href="2011_borsanyi.tar.bz2">2011_borsanyi.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/2011/borsanyi/.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/2011/borsanyi/.winner.json">.winner.json</a>
- description of winner in JSON</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2011/borsanyi/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%2F2011%2Fborsanyi%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 -->
+570 -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,582 @@
<!-- !!! DO NOT MODIFY THIS FILE - This file is generated by a tool !!! -->
<!-- !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<!-- -->
<!-- file: 2011/dlowe/index.html created by: fake.gen_index.sh version: 1.0.5 2023-10-31 -->
<html lang="en">
<!-- END: this line ends content from: inc/top.default.html -->
<!-- -->
<!-- This file was formed by the tool: bin/readme2index.sh version: 1.1 2024-01-16 -->
<!-- -->
<!-- START: this line starts content from: inc/head.default.html -->
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>2011 dlowe</title>
<meta name="description" content="IOCCC year: 2011 IOCCC winner: dlowe winner index page">
<meta name="keywords" content="IOCCC,2011,dlowe,winner index page">
<link rel="stylesheet" href="/temp-test-ioccc/ioccc.css">
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=yes">
<title>2011/dlowe</title>
<meta name="description" content="2011 IOCCC winner dlowe">
<meta name="keywords" content="IOCCC, 2011, IOCCC 2011, IOCCC winner, dlowe">
</head>
<!-- END: this line ends content from: inc/head.default.html -->
<!-- START: this line starts content from: inc/body.default.html -->
<body>
<h1>2011 dlowe</h1>
<!-- END: this line ends content from: inc/body.default.html -->
<!-- START: this line starts content from: inc/header.default.html -->
<p>XXX - fake content until readme2index is working - XXX</p>
<div class="header">
<img src="/temp-test-ioccc/png/ioccc.png" alt="IOCCC image by Matt Zucker" width=300 height=110>
<h1>The International Obfuscated C Code Contest</h1>
<h2>2011/dlowe</h2>
</div>
<hr style="width:50%;text-align:left;margin-left:0">
<!-- END: this line ends content from: inc/header.default.html -->
<!-- START: this line starts content from: inc/topnav.mid.html -->
<!-- Start Nu Html Checker -->
<p><a href="https://validator.w3.org/nu/?doc=https%3A%2F%2Fioccc-src.github.io%2Ftemp-test-ioccc%2F2011%2Fdlowe%2Findex.html">Nu Html check https://ioccc-src.github.io/temp-test-ioccc/2011/dlowe/index.html</a></p>
<!-- End Nu Html Checker -->
<div class="topnav">
<a class="Left" href="../borsanyi/index.html">&larr; borsanyi</a>
<a class="Left" href="../index.html">&uarr; 2011 &uarr;</a>
<a class="Left" href="../eastman/index.html">eastman &rarr;</a>
<a class="Right" href="#inventory">Inventory</a>
</div>
<!-- END: this line ends content from: inc/topnav.mid.html -->
<!-- START: this line starts content from: inc/begin-row.default.html -->
<div class="row">
<!-- END: this line ends content from: inc/begin-row.default.html -->
<!-- START: this line starts content from: inc/begin-leftcolumn.default.html -->
<div class="leftcolumn">
<!-- END: this line ends content from: inc/begin-leftcolumn.default.html -->
<!-- START: this line starts content from: inc/sidenav.default.html -->
<div class="sidenav">
<a href="#content">Jump to contents</a>
</div>
<hr>
<div class="sidenav">
<a href="/temp-test-ioccc/index.html">IOCCC Home</a>
<a href="/temp-test-ioccc/years.html">Winning Entries</a>
<a href="/temp-test-ioccc/winners.html">People who have won</a>
</div>
<hr>
<div class="sidenav">
<a href="/temp-test-ioccc/news.html">IOCCC News</a>
<a href="/temp-test-ioccc/faq.html#submit">How to enter the IOCCC</a>
<a href="/temp-test-ioccc/faq.html">FAQ</a>
</div>
<hr>
<div class="sidenav">
<a href="/temp-test-ioccc/bugs.html">Bugs &amp; (mis)features</a>
<a href="/temp-test-ioccc/faq.html#fix_a_winner">Fixing IOCCC winners</a>
<a href="/temp-test-ioccc/faq.html#fix_web_site">Fixing the web site</a>
<a href="/temp-test-ioccc/faq.html#fix_author">Fixing winner info</a>
<a href="/temp-test-ioccc/thanks-for-help.html">Thanks for the help</a>
</div>
<hr>
<div class="sidenav">
<a href="/temp-test-ioccc/judges.html">The IOCCC Judges</a>
<a href="/temp-test-ioccc/contact.html">Contacting the IOCCC</a>
</div>
<hr>
<div class="sidenav">
<a href="#top">Jump to top</a>
</div>
<!-- END: this line ends content from: inc/sidenav.default.html -->
<!-- START: this line starts content from: inc/end-leftcolumn.default.html -->
</div>
<!-- END: this line ends content from: inc/end-leftcolumn.default.html -->
<!-- START: this line starts content from: inc/begin-rightcolumn.default.html -->
<div class="rightcolumn">
<!-- END: this line ends content from: inc/begin-rightcolumn.default.html -->
<!-- START: this line starts content from: inc/before-content.default.html -->
<a name="content"></a>
<!-- END: this line ends content from: inc/before-content.default.html -->
<!-- START: this line starts content generated by: bin/gen-author.sh -->
<p><a name="author"><strong>Author:</strong></a> <br><br>Name: <a
href="/temp-test-ioccc/winners.html#J_David_Lowe">J. David Lowe</a><br>
Location: <a href="/temp-test-ioccc/location.html#US">US</a></p>
<!-- END: next line ends content generated by: bin/gen-author.sh -->
<h2 id="to-build">To build:</h2>
<div class="sourceCode" id="cb1"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb1-1"><a href="#cb1-1" aria-hidden="true" tabindex="-1"></a><span class="fu">make</span></span></code></pre></div>
<h3 id="bugs-and-misfeatures">Bugs and (Mis)features:</h3>
<p>The current status of this entry is:</p>
<pre><code>STATUS: missing or dead link - please provide them
STATUS: INABIAF - please **DO NOT** fix</code></pre>
<p>For more detailed information see <a href="/bugs.md#2011-dlowe">2011
dlowe in bugs.md</a>.</p>
<h2 id="to-use">To use:</h2>
<div class="sourceCode" id="cb3"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb3-1"><a href="#cb3-1" aria-hidden="true" tabindex="-1"></a><span class="ex">./dlowe</span> <span class="at">-</span><span class="op">&lt;</span>n_iterations<span class="op">&gt;</span> corpus1/ <span class="pp">[</span><span class="ss">...</span><span class="pp">]</span> corpus0/ <span class="op">&lt;</span> start.net <span class="op">&gt;</span> trained.net</span></code></pre></div>
<p>NOTE: In the above command, the directory args MUST end in a
<code>/</code>.</p>
<p>Then to use <code>trained.net</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="ex">./dlowe</span> file [file ...] <span class="op">&lt;</span> trained.net</span></code></pre></div>
<h2 id="try">Try:</h2>
<p>Try these pre-trained networks:</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">./try.sh</span></span></code></pre></div>
<p>NOTE: The <code>dlowe-aux-data/</code> directory, which <a
href="try.sh">try.sh</a> refers to, was created by:</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">tar</span> <span class="at">-jxf</span> dlowe-aux-data.tar.bz2</span></code></pre></div>
<h2 id="judges-remarks">Judges’ remarks:</h2>
<p>This entry is a ghoulish example of a brain (dead?) neural network
classifier. It comes with a set of corpora for you to try.</p>
<h3
id="ioccc-winlose-trained.net"><code>ioccc-winlose-trained.net</code></h3>
<p>You can create your own trained networks. For example, we trained a
network on the C code of entries that were supplied to the 20Th
IOCCC.</p>
<p>The <code>ioccc-winlose-trained.net</code> was trained using the <a
href="earlystop.pl">earlystop.pl</a> tool:</p>
<div class="sourceCode" id="cb7"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb7-1"><a href="#cb7-1" aria-hidden="true" tabindex="-1"></a><span class="fu">rm</span> <span class="at">-f</span> ioccc-winlose-trained.net</span>
<span id="cb7-2"><a href="#cb7-2" aria-hidden="true" tabindex="-1"></a><span class="ex">./earlystop.pl</span> ioccc-winlose-trained.net ioccc_won_training/ ioccc_lost_training/ ioccc_won_test/ ioccc_lost_test/</span></code></pre></div>
<p>where:</p>
<ul>
<li><p><code>ioccc_won_training/</code> 1/2 of C code of the 20th IOCCC
winners (except for <a href="dlowe.c">dlowe.c</a> from 2011) plus 1/2 of
the C code winners from prior IOCCC contests</p></li>
<li><p><code>ioccc_won_test/</code> 1/2 of C code of the 20th IOCCC
winners (except for <a href="dlowe.c">dlowe.c</a> from 2011) plus 1/2 of
the C code winners from prior IOCCC contests</p></li>
<li><p><code>ioccc_lost_training/</code> 1/2 of C code from entries that
that did not win</p></li>
<li><p><code>ioccc_lost_test/</code> 1/2 of C code from entries that
that did not win</p></li>
</ul>
<p>NOTE: The above directories were not shipped and everything from the
entries that did not win were flushed to <code>/dev/null</code>.</p>
<p>The <a href="earlystop.pl">earlystop.pl</a> tool wrote:</p>
<pre><code>training 1 to 1001...
training 1001 to 2001...
prior error = 56.746974766043; current error = 58.095691135305</code></pre>
<p>The resulting <code>ioccc-winlose-trained.net</code> file was
included in the <a
href="dlowe-aux-data.tar.bz2">dlowe-aux-data.tar.bz2</a> tarball.</p>
<p>The <a href="dlowe.c">dlowe.c</a> was explicitly excluded from this
trailing set, so this test is interesting:</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">./dlowe</span> dlowe.c <span class="op">&lt;</span> dlowe-aux-data/ioccc-winlose-trained.net</span></code></pre></div>
<p>NOTE: this is done in <a href="try.sh">try.sh</a>.</p>
<p>The match of <a href="dlowe.c">dlowe.c</a> to the lose/win trailed
network was:</p>
<pre><code>dlowe.c 0.125108</code></pre>
<p>NOTE: The non-artificially intelligent decisions of the IOCCC judges
include random quirks and their non-linear judgment calls not found in
the ioccc trained network. Just because C code is or isn’t scored highly
by this network does not mean it will win or lose a future IOCCC. On the
other hand … it just might!</p>
<h4 id="other-data-sets-to-try">other data sets to try</h4>
<p>While we cannot supply you with the losing IOCCC source code, the
author did supply a number data sets on which to test:</p>
<p>We created the <a
href="dlowe-aux-data/english-trained.net">english-trained.net</a> as
follows:</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">./dlowe</span> <span class="at">-8000</span> dlowe-aux-data/english-1/ dlowe-aux-data/english-0/ <span class="op">&lt;</span> /dev/null <span class="op">&gt;</span> dlowe-aux-data/english-trained.net</span></code></pre></div>
<ul>
<li><p><a href="dlowe-aux-data/english-0/">dlowe-aux-data/english-0/</a>
Non-English (French) text</p></li>
<li><p><a href="dlowe-aux-data/english-1">dlowe-aux-data/english-1/</a>
English (non-French) text</p></li>
</ul>
<p>We created the <a
href="dlowe-aux-data/png-trained.net">png-trained.net</a> as
follows:</p>
<div class="sourceCode" id="cb12"><pre
class="sourceCode sh"><code class="sourceCode bash"><span id="cb12-1"><a href="#cb12-1" aria-hidden="true" tabindex="-1"></a><span class="ex">./dlowe</span> <span class="at">-8000</span> png-1/ png-0/ <span class="op">&lt;</span> /dev/null <span class="op">&gt;</span> dlowe-aux-data/png-trained.net</span></code></pre></div>
<ul>
<li><p><a href="dlowe-aux-data/png-0/">dlowe-aux-data/png-0/</a> Non-png
(gif) images</p></li>
<li><p><a href="dlowe-aux-data/png-1/">dlowe-aux-data/png-1/</a> png
(non-gif) images</p></li>
</ul>
<p>We created the <a
href="dlowe-aux-data/xor-trained.net">xor-trained.net</a> as
follows:</p>
<div class="sourceCode" id="cb13"><pre
class="sourceCode sh"><code class="sourceCode bash"><span id="cb13-1"><a href="#cb13-1" aria-hidden="true" tabindex="-1"></a><span class="ex">./dlowe</span> <span class="at">-8000</span> dlowe-aux-data/xor-1/ dlowe-aux-data/xor-0/ <span class="op">&lt;</span> /dev/null <span class="op">&gt;</span> dlowe-aux-data/xor-trained.net</span></code></pre></div>
<ul>
<li><p><a href="dlowe-aux-data/xor-0/">dlowe-aux-data/xor-0</a> Data
that XORs to 0</p></li>
<li><p><a href="dlowe-aux-data/xor-1/">dlowe-aux-data/xor-1/</a> Data
that XORs to 1</p></li>
</ul>
<p><strong>NOTE</strong>: The directory args <strong>must end in
a</strong> <code>/</code> for them to work.</p>
<h2 id="authors-remarks">Author’s remarks:</h2>
<h3 id="synopsis">Synopsis</h3>
<p>This is an <a
href="https://en.wikipedia.org/wiki/Artificial_intelligence">artificially
intelligent</a> judging tool to help the IOCCC judges. Here’s to
shorter, more frequent contests!</p>
<h3 id="description">Description</h3>
<p>This is a multilayer <a
href="https://en.wikipedia.org/wiki/Perceptron">perceptron</a> (a <a
href="https://en.wikipedia.org/wiki/Feedforward_neural_network">feedforward
artificial neural network</a>) which can be trained, using on-line <a
href="https://en.wikipedia.org/wiki/Backpropagation">backpropagation</a>,
to classify input files.</p>
<p>It has a fixed topology of <code>2^16</code> input neurons, 6 hidden
neurons and 1 output neuron.</p>
<p>The neurons’ activation function is the logistic function
<code>1 / (1 + e ^ -x)</code>.</p>
<h3 id="classifying">Classifying</h3>
<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">./dlowe</span> file [file ...] <span class="op">&lt;</span> trained.net</span></code></pre></div>
<p>To classify files, one specifies a trained network (on
<code>stdin</code>) and one or more files to classify. The program will
output one line per successfully-classified file to <code>stderr</code>,
with the filename and the classification: a number between 0 and 1.</p>
<p>The interpretation of the classification number depends on how the
network was trained, but it’s geared toward interpretation as a
<em>probability</em> or a <em>confidence</em>.</p>
<h3 id="training">Training</h3>
<div class="sourceCode" id="cb15"><pre
class="sourceCode sh"><code class="sourceCode bash"><span id="cb15-1"><a href="#cb15-1" aria-hidden="true" tabindex="-1"></a><span class="ex">./dlowe</span> <span class="at">-</span><span class="op">&lt;</span>n_iterations<span class="op">&gt;</span> corpus1/ <span class="pp">[</span><span class="ss">...</span><span class="pp">]</span> corpus0/ <span class="op">&lt;</span> start.net <span class="op">&gt;</span> end.net</span></code></pre></div>
<p><strong>NOTE</strong>: The directory args <strong>must end in
a</strong> <code>/</code> for them to work.</p>
<p>To train a network, one specifies a starting network (on
<code>stdin</code>), two or more corpora (directories containing
training data), and the number of training iterations to run. The
program will write some progress data to <code>stderr</code> and, when
it’s done, will serialize the updated network to
<code>stdout</code>.</p>
<p>If no input network is given, a random new network will be generated
as a starting point (i.e. provide an empty <code>stdin</code>).</p>
<p>The first corpus will be assigned a target value of <code>1</code>.
The last will be assigned a target value of <code>0</code>. Intervening
directories (if any) will be assigned intermediate target values.</p>
<p>The learning rate is hard-coded as <code>0.3</code>. No momentum
factor is used.</p>
<h4 id="png-corpora">png corpora</h4>
<p>The <a href="dlowe-aux-data/png-1">png-1</a> corpus was obtained by
manually scraping the first results from an <a
href="https://images.google.com"
class="uri">https://images.google.com</a> search for “<a
href="https://www.google.com/search?tbm=isch&amp;sxsrf=APwXEddqIU34dxhpFdjEa8emNJKHOkYXIw:1683049158657&amp;source=hp&amp;biw=1727&amp;bih=952&amp;ei=xkpRZLapJtLKkPIP8bGKkAk&amp;iflsig=AOEireoAAAAAZFFY1nbmEUHC74Cmg3Y5rEY1fV7ocASZ&amp;ved=0ahUKEwi2pPXZltf-AhVSJUQIHfGYApIQ4dUDCAY&amp;uact=5&amp;oq=obfuscate+filetype:png&amp;gs_lcp=CgNpbWcQA1AAWABg9QNoAHAAeACAATuIATuSAQExmAEAoAECoAEBqgELZ3dzLXdpei1pbWc&amp;sclient=img&amp;q=obfuscate&amp;tbs=ift:png">obfuscate
filetype:png</a>”.</p>
<p>The <a href="dlowe-aux-data/png-0">png-0</a> corpus was obtained by
manually scraping the first results from an <a
href="https://images.google.com"
class="uri">https://images.google.com</a> search for “<a
href="https://www.google.com/search?tbm=isch&amp;ved=2ahUKEwiowo7fltf-AhXSOUQIHbJBDp8Q2-cCegQIABAA&amp;oq=obfuscate+filetype:gif&amp;gs_lcp=CgNpbWcQAzoECCMQJzoHCAAQigUQQzoFCAAQgARQ6AxY6AxgpBJoAHAAeACAAUeIAcsBkgEBM5gBAKABAaoBC2d3cy13aXotaW1nwAEB&amp;sclient=img&amp;ei=0UpRZOiVINLzkPIPsoO5-Ak&amp;bih=952&amp;biw=1727&amp;q=obfuscate&amp;tbs=ift:gif">obfuscate
filetype:gif</a>”.</p>
<h5 id="results">Results:</h5>
<ul>
<li>Using these corpora as a training set;</li>
<li>Using several hundred random <code>*.gif</code> and
<code>*.png</code> files from my home computer as a test set;</li>
<li>Using the included <a href="earlystop.pl">earlystop.pl</a> script,
which stopped after 67000 iterations.</li>
<li>Interpreting output of <code>&gt; 0.5</code> as “probably a
<code>.png</code>” and <code>&lt; 0.5</code> as “probably a
<code>.gif</code>”</li>
</ul>
<p>produced a network with about 87% accuracy</p>
<h4 id="english-corpora">English corpora</h4>
<p>The <a href="dlowe-aux-data/english-1">english-1</a> corpus was
obtained by manually scraping the first results from a <a
href="https://www.google.com/webhp?lr=lang_en"
class="uri">https://www.google.com/webhp?lr=lang_en</a> search for “<a
href="https://www.google.com/search?q=paris+filetype%3Atxt&amp;lr=lang_en&amp;tbs=lr%3Alang_1en&amp;sxsrf=APwXEdeHXyUYdUxCYQQDHmJhbHzX9aARSA%3A1683049834430&amp;source=hp&amp;ei=ak1RZJHUGN_DkPIP26OtkA8&amp;iflsig=AOEireoAAAAAZFFbejA0Xfqoq__FXx--Ok0S6GQjnGnA&amp;ved=0ahUKEwiRsZOcmdf-AhXfIUQIHdtRC_IQ4dUDCAo&amp;uact=5&amp;oq=paris+filetype%3Atxt&amp;gs_lcp=Cgdnd3Mtd2l6EANQAFgAYN4DaABwAHgAgAE-iAE-kgEBMZgBAKABAqABAQ&amp;sclient=gws-wiz">paris
filetype:txt</a>”.</p>
<p>The <a href="dlowe-aux-data/english-0">english-0</a> corpus was
obtained by manually scraping the first results from a <a
href="https://www.google.com/webhp?lr=lang_fr"
class="uri">https://www.google.com/webhp?lr=lang_fr</a> search for “<a
href="https://www.google.com/search?q=paris+filetype%3Atxt&amp;lr=lang_fr&amp;tbs=lr%3Alang_1fr&amp;sxsrf=APwXEddcsQ-gMhrqSUJo6omWFUl7jQMASg%3A1683049870736&amp;source=hp&amp;ei=jk1RZLevK_fKkPIPjbWN-AU&amp;iflsig=AOEireoAAAAAZFFbnvExHGkcavB5H8F0xsLAWN2KfYFK&amp;ved=0ahUKEwi3rrutmdf-AhV3JUQIHY1aA18Q4dUDCAo&amp;uact=5&amp;oq=paris+filetype%3Atxt&amp;gs_lcp=Cgdnd3Mtd2l6EANQAFgAYLMDaABwAHgAgAE-iAE-kgEBMZgBAKABAqABAQ&amp;sclient=gws-wiz">paris
filetype:txt</a>”.</p>
<h5 id="results-1">Results:</h5>
<ul>
<li>Using these corpora as a training set;</li>
<li>Using several dozen additional text files (obtained by the same
methods) as a test set;</li>
<li>Using the included <a href="earlystop.pl">earlystop.pl</a> script,
which stopped after 10000 iterations;</li>
<li>Interpreting output of <code>&gt; 0.5</code> as “probably English”
and <code>&lt; 0.5</code> as “probably French”</li>
</ul>
<p>produced a network with 100% accuracy.</p>
<h3 id="xor-corpora">xor corpora</h3>
<p>The <a href="dlowe-aux-data/xor-1">xor-1</a> corpus consists of two
files containing <code>01</code> and <code>10</code> respectively.</p>
<p>The <a href="dlowe-aux-data/xor-0">xor-0</a> corpus consists of two
files containing <code>00</code> and <code>11</code> respectively.</p>
<h5 id="results-2">Results:</h5>
<p>Using these corpora as a training set takes about 8000 iterations to
learn xor to within a tolerance of <code>&lt;0.01</code>.</p>
<h3 id="limitations">Limitations</h3>
<p>The program can’t tell you anything meaningful about files with less
than two bytes in them (I’m looking at you, <a
href="/1994/smr/smr.c">smr.c</a>!)</p>
<p>You must include the trailing directory separator on training
directories (this allows the program to be portable without wasting
precious bytes on figuring out how to concatenate directory and file
names…).</p>
<p>Serialized network files are only portable between systems with the
same <a
href="https://en.wikipedia.org/wiki/Floating-point_arithmetic">floating-point</a>
representation and <a
href="https://en.wikipedia.org/wiki/Endianness">endianness</a>.</p>
<p>Making sure not to <a
href="https://en.wikipedia.org/wiki/Overfitting#Machine_learning">overfit</a>
the network to the training data is a bit of a black art. I have
enclosed <a href="earlystop.pl">earlystop.pl</a>, a wrapper script that
implements a simple ‘early stopping’ algorithm; other techniques are
possible.</p>
<p>Bad input (e.g. nonexistent files, non-numeric number of iterations,
etc.) tends to result in empty output.</p>
<p>Given exactly one corpus, the program will crash or produce
garbage.</p>
<p>Leaks memory and file descriptors while processing files.</p>
<p>Will crash and die horribly if it runs out of memory.</p>
<p>The Microsoft C compiler doesn’t provide a <code>dirent</code> API,
so to get this working on a Windows system you’ll need cygwin+gcc
(tested) or a <code>dirent</code> compatibility library (untested, but
they do exist).</p>
<p>Backpropagation doesn’t always converge: if you play with this long
enough, you’ll eventually have a training session that completely fails
to converge.</p>
<h3 id="obfuscation">Obfuscation</h3>
<ul>
<li><a href="https://en.wikipedia.org/wiki/Zombie">Zombies</a>! (Since
neural networks are modeled after <a
href="https://en.wikipedia.org/wiki/Brain">BRAINS</a>, ya know? And
corpus sounds a lot like corpse. And I have 4- and 7-year-old kids ;)
)</li>
<li>Neural networks are interesting, and while the math isn’t terribly
difficult, their behavior is difficult to fully understand.</li>
<li>Had some extra space in one of the major data structures, and it
seemed a shame to waste it.</li>
<li>Similarly, I think three file pointers ought to be enough for
anyone.</li>
<li>Lots of magic numbers expressed in various ways.</li>
<li>Random abuse of random C trivia.</li>
<li>Some textual changes were made to maximize the classification of
this program by a network trained to recognize <a
href="/winners.html">IOCCC winners</a> ;)</li>
</ul>
<p>… but mostly zombies!</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-2011dlowe"><a name="inventory"></a>Inventory for
2011/dlowe</h1>
<h2 id="primary-files">Primary files</h2>
<ul>
<li><a href="index.html">index.html</a> - winner home page</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2011/dlowe/dlowe.c">dlowe.c</a>
- winning source</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2011/dlowe/Makefile">Makefile</a>
- winner Makefile</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2011/dlowe/dlowe.orig.c">dlowe.orig.c</a>
- original source</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2011/dlowe/earlystop.pl">earlystop.pl</a>
- wrapper script to stop training early</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2011/dlowe/try.sh">try.sh</a>
- how to run</li>
<li><a
href="dlowe-aux-data/png-0/5756029-DMZ-overview-B.gif">dlowe-aux-data/png-0/5756029-DMZ-overview-B.gif</a>
- Non-png gif images</li>
<li><a
href="dlowe-aux-data/png-0/M2.gif">dlowe-aux-data/png-0/M2.gif</a> -
Non-png gif images</li>
<li><a
href="dlowe-aux-data/png-0/Obfuscate.gif">dlowe-aux-data/png-0/Obfuscate.gif</a>
- Non-png gif images</li>
<li><a
href="dlowe-aux-data/png-0/figure_49.gif">dlowe-aux-data/png-0/figure_49.gif</a>
- Non-png gif images</li>
<li><a
href="dlowe-aux-data/png-0/klockhuset.gif">dlowe-aux-data/png-0/klockhuset.gif</a>
- Non-png gif images</li>
<li><a
href="dlowe-aux-data/png-0/obfuscate_1.gif">dlowe-aux-data/png-0/obfuscate_1.gif</a>
- Non-png gif images</li>
<li><a
href="dlowe-aux-data/png-0/podcastimage_150215.gif">dlowe-aux-data/png-0/podcastimage_150215.gif</a>
- Non-png gif images</li>
<li><a
href="dlowe-aux-data/png-0/prjman1.gif">dlowe-aux-data/png-0/prjman1.gif</a>
- Non-png gif images</li>
<li><a
href="dlowe-aux-data/png-0/proguard_obfuscate.gif">dlowe-aux-data/png-0/proguard_obfuscate.gif</a>
- Non-png gif images</li>
<li><a
href="dlowe-aux-data/png-0/scripts_encryptor__screnc_-31918.gif">dlowe-aux-data/png-0/scripts_encryptor_<em>screnc</em>-31918.gif</a>
- Non-png gif images</li>
<li><a
href="dlowe-aux-data/png-0/visual_panel.gif">dlowe-aux-data/png-0/visual_panel.gif</a>
- Non-png gif images</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2011/dlowe/dlowe-aux-data/english-0/040604.txt">dlowe-aux-data/english-0/040604.txt</a>
- training text for neural networks</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2011/dlowe/dlowe-aux-data/english-0/2001-2002.txt">dlowe-aux-data/english-0/2001-2002.txt</a>
- training text for neural networks</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2011/dlowe/dlowe-aux-data/english-0/CFP_TSI_Graphes_appel.txt">dlowe-aux-data/english-0/CFP_TSI_Graphes_appel.txt</a>
- training text for neural networks</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2011/dlowe/dlowe-aux-data/english-0/CIR_APE_08_doc%5B1%5D.txt">dlowe-aux-data/english-0/CIR_APE_08_doc%5B1%5D.txt</a>
- training text for neural networks</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2011/dlowe/dlowe-aux-data/english-0/admin_fr.txt">dlowe-aux-data/english-0/admin_fr.txt</a>
- training text for neural networks</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2011/dlowe/dlowe-aux-data/english-0/agenda.txt">dlowe-aux-data/english-0/agenda.txt</a>
- training text for neural networks</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2011/dlowe/dlowe-aux-data/english-0/paris.txt">dlowe-aux-data/english-0/paris.txt</a>
- training text for neural networks</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2011/dlowe/dlowe-aux-data/english-0/paris2.txt">dlowe-aux-data/english-0/paris2.txt</a>
- training text for neural networks</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2011/dlowe/dlowe-aux-data/english-0/structures3D-Paris.txt">dlowe-aux-data/english-0/structures3D-Paris.txt</a>
- training text for neural networks</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2011/dlowe/dlowe-aux-data/english-1/02-chronology.txt">dlowe-aux-data/english-1/02-chronology.txt</a>
- training text for neural networks</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2011/dlowe/dlowe-aux-data/english-1/36C215.txt">dlowe-aux-data/english-1/36C215.txt</a>
- training text for neural networks</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2011/dlowe/dlowe-aux-data/english-1/Wireless_Days_2011_CFP.txt">dlowe-aux-data/english-1/Wireless_Days_2011_CFP.txt</a>
- training text for neural networks</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2011/dlowe/dlowe-aux-data/english-1/cpb.txt">dlowe-aux-data/english-1/cpb.txt</a>
- training text for neural networks</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2011/dlowe/dlowe-aux-data/english-1/get-there.txt">dlowe-aux-data/english-1/get-there.txt</a>
- training text for neural networks</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2011/dlowe/dlowe-aux-data/english-1/pa_fv010.txt">dlowe-aux-data/english-1/pa_fv010.txt</a>
- training text for neural networks</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2011/dlowe/dlowe-aux-data/english-1/the_poor_people_of_paris.txt">dlowe-aux-data/english-1/the_poor_people_of_paris.txt</a>
- training text for neural networks</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2011/dlowe/dlowe-aux-data/english-1/utmost.txt">dlowe-aux-data/english-1/utmost.txt</a>
- training text for neural networks</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2011/dlowe/dlowe-aux-data/english-1/walljpar.txt">dlowe-aux-data/english-1/walljpar.txt</a>
- training text for neural networks</li>
<li><a href="dlowe-aux-data/xor-0/00">dlowe-aux-data/xor-0/00</a> -
training digits for neural networks</li>
<li><a href="dlowe-aux-data/xor-0/11">dlowe-aux-data/xor-0/11</a> -
training digits for neural networks</li>
<li><a href="dlowe-aux-data/xor-1/01">dlowe-aux-data/xor-1/01</a> -
training digits for neural networks</li>
<li><a href="dlowe-aux-data/xor-1/10">dlowe-aux-data/xor-1/10</a> -
training digits for neural networks</li>
<li><a
href="dlowe-aux-data/png-1/JavaScript-obfuscation-code.png">dlowe-aux-data/png-1/JavaScript-obfuscation-code.png</a>
- training image for neural networks</li>
<li><a
href="dlowe-aux-data/png-1/control_flow_obfuscation_before.png">dlowe-aux-data/png-1/control_flow_obfuscation_before.png</a>
- training image for neural networks</li>
<li><a
href="dlowe-aux-data/png-1/deceive-inveigle-obfuscate-t-shirts.png">dlowe-aux-data/png-1/deceive-inveigle-obfuscate-t-shirts.png</a>
- training image for neural networks</li>
<li><a
href="dlowe-aux-data/png-1/help_obfuscation1.png">dlowe-aux-data/png-1/help_obfuscation1.png</a>
- training image for neural networks</li>
<li><a
href="dlowe-aux-data/png-1/image_thumb%5B40%5D.png">dlowe-aux-data/png-1/image_thumb[40].png</a>
- training image for neural networks</li>
<li><a
href="dlowe-aux-data/png-1/jquery_after_deobfuscation.png">dlowe-aux-data/png-1/jquery_after_deobfuscation.png</a>
- training image for neural networks</li>
<li><a
href="dlowe-aux-data/png-1/obfuscate4e.png">dlowe-aux-data/png-1/obfuscate4e.png</a>
- training image for neural networks</li>
<li><a
href="dlowe-aux-data/png-1/obfuscation-decoder.png">dlowe-aux-data/png-1/obfuscation-decoder.png</a>
- training image for neural networks</li>
<li><a
href="dlowe-aux-data/png-1/obfuscation_methods.png">dlowe-aux-data/png-1/obfuscation_methods.png</a>
- training image for neural networks</li>
<li><a href="2011_dlowe.tar.bz2">2011_dlowe.tar.bz2</a> - download
winning source</li>
</ul>
<h2 id="secondary-files">Secondary files</h2>
<ul>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2011/dlowe/.gitignore">.gitignore</a>
- list of files that should not be committed under git</li>
<li><a href=".path">.path</a> - directory path from top directory</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2011/dlowe/.winner.json">.winner.json</a>
- description of winner in JSON</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2011/dlowe/README.md">README.md</a>
- markdown source for index.html</li>
<li><a href="dlowe-aux-data.tar.bz2">dlowe-aux-data.tar.bz2</a> - IOCCC
win lose trained network</li>
<li><a
href="dlowe-aux-data/english-trained.net">dlowe-aux-data/english-trained.net</a>
- trained neural network for English text</li>
<li><a
href="dlowe-aux-data/ioccc-winlose-trained.net">dlowe-aux-data/ioccc-winlose-trained.net</a>
- trained neural network for C code from 20Th IOCCC</li>
<li><a
href="dlowe-aux-data/png-trained.net">dlowe-aux-data/png-trained.net</a>
- trained neural network for png-0 and png-1 images</li>
<li><a
href="dlowe-aux-data/xor-trained.net">dlowe-aux-data/xor-trained.net</a>
- trained neural network for xor-0 and xor-1 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%2F2011%2Fdlowe%2Findex.html">Nu HTML check this web page</a></p>
<p><a href="#top">Jump to top</a> <a href="#content">Jump to Content</a> <a href="#inventory">Jump to Inventory</a></p>
</div>
<!-- END: this line ends content from: inc/footer.default.html -->
<!-- START: this line starts content from: inc/bottom.default.html -->
</body>
</html>
<!-- END: this line ends content from: inc/bottom.default.html -->
+240 -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,252 @@
<!-- !!! DO NOT MODIFY THIS FILE - This file is generated by a tool !!! -->
<!-- !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<!-- -->
<!-- file: 2011/eastman/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>2011 eastman</title>
<meta name="description" content="IOCCC year: 2011 IOCCC winner: eastman winner index page">
<meta name="keywords" content="IOCCC,2011,eastman,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>2011/eastman</title>
<meta name="description" content="2011 IOCCC winner eastman">
<meta name="keywords" content="IOCCC, 2011, IOCCC 2011, IOCCC winner, eastman">
</head>
<!-- END: this line ends content from: inc/head.default.html -->
<!-- START: this line starts content from: inc/body.default.html -->
<body>
<h1>2011 eastman</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>2011/eastman</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%2F2011%2Feastman%2Findex.html">Nu Html check https://ioccc-src.github.io/temp-test-ioccc/2011/eastman/index.html</a></p>
<!-- End Nu Html Checker -->
<div class="topnav">
<a class="Left" href="../dlowe/index.html">&larr; dlowe</a>
<a class="Left" href="../index.html">&uarr; 2011 &uarr;</a>
<a class="Left" href="../fredriksson/index.html">fredriksson &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#Peter_Eastman">Peter Eastman</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">./eastman</span></span></code></pre></div>
<h2 id="try">Try:</h2>
<p>Quit the program. Resize your terminal window. Run it again.</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">./eastman</span></span></code></pre></div>
<p>NOTE: to restore your cursor in your shell, try
<code>reset</code>.</p>
<h2 id="judges-remarks">Judges’ remarks:</h2>
<p>This round program will generate a classic spherical result!</p>
<p>You will need a terminal capable of displaying coloured ANSI
characters (for example an xterm or a Terminal.app window in macOS).</p>
<p>You might also want to turn off any scrollback history. The program
will size itself to the initial geometry of your terminal.</p>
<p>If you are ambitious, make the font really small and the window
really large for hi-res graphics!</p>
<h2 id="authors-remarks">Author’s remarks:</h2>
<p>This program uses ANSI graphics to recreate the classic Boing Ball
demo from the Commodore Amiga. See <a
href="https://www.youtube.com/watch?v=-ga41edXw3A"
class="uri">https://www.youtube.com/watch?v=-ga41edXw3A</a> if you
aren’t familiar with it. Back in its day, this demo inspired lust and
awe in geeks around the world.</p>
<p>The graphics are
[raytraced](https://en.wikipedia.org/wiki/Ray_tracing_(graphics), with
procedural textures on the ball and the back wall. I did cheat a little
to simplify the calculations: it uses a parallel projection, but
textures the back wall to look as if there were a floor being viewed in
perspective. The shadow is also just part of the texture, not an actual
raytraced shadow.</p>
<p>This program automatically adapts to the size of the terminal it is
running in, so try enlarging the window to get higher resolution. Don’t
resize while the program is running, though. It only checks the size
once, when it starts up.</p>
<p>To compile:</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">-lm</span> eastman.c</span></code></pre></div>
<h3 id="portability">Portability</h3>
<p>It should be completely portable. I’ve tested with gcc on Mac OS X
10.7 (Lion) and Fedora 10. I would expect it to work in any Unix-like
environment.</p>
<h3 id="obfuscation">Obfuscation</h3>
<p>I have merged expressions wherever possible, making extensive use of
ternary operators, commas, return values of assignment operators, etc.
The entire raytracing computation, include ray intersection tests and
procedural texture evaluations, is a single expression involving 41
operators.</p>
<p>Variables are named alphabetically in the order they are
declared.</p>
<p>The third argument to <code>ioctl(2)</code> should really be a
<code>struct winsize</code>, and I should then look up the
<code>ws_row</code> and <code>ws_col</code> fields, but that makes it
way too obvious what I’m doing there. Since a
<code>struct winsize</code> just contains four
<code>unsigned short</code>s, I replaced it with an array. And since all
the values will be much less than <code>32767</code>, I further
simplified the type to just <code>short[]</code>.</p>
<p>A wonderful thing about ANSI graphics is that it produces nearly
unintelligible code. Consider the <code>printf(3)</code> spec to print a
single space in a desired color: <code>"\x1B[%dm</code>. I could have
done something to further obfuscate it, but it’s already
indistinguishable from line noise, so why bother?</p>
<p>There are lots of other minor obfuscations to make the code less
obvious. For example, I could have written the outer loop as
<code>while(1)</code>, but why write a 1 when I can calculate it from
the return value of <code>usleep(3)</code> instead? And I could have
written <code>usleep(80000)</code>, but <code>usleep(79383)</code> just
looks so much better. And so on.</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-2011eastman"><a name="inventory"></a>Inventory for
2011/eastman</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/2011/eastman/eastman.c">eastman.c</a>
- winning source</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2011/eastman/Makefile">Makefile</a>
- winner Makefile</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2011/eastman/eastman.orig.c">eastman.orig.c</a>
- original source</li>
<li><a href="boing-ball.mp4">boing-ball.mp4</a> - original Amiga
bouncing ball demo</li>
<li><a href="2011_eastman.tar.bz2">2011_eastman.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/2011/eastman/.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/2011/eastman/.winner.json">.winner.json</a>
- description of winner in JSON</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2011/eastman/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%2F2011%2Feastman%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 -->
+431 -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,443 @@
<!-- !!! DO NOT MODIFY THIS FILE - This file is generated by a tool !!! -->
<!-- !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<!-- -->
<!-- file: 2011/fredriksson/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>2011 fredriksson</title>
<meta name="description" content="IOCCC year: 2011 IOCCC winner: fredriksson winner index page">
<meta name="keywords" content="IOCCC,2011,fredriksson,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>2011/fredriksson</title>
<meta name="description" content="2011 IOCCC winner fredriksson">
<meta name="keywords" content="IOCCC, 2011, IOCCC 2011, IOCCC winner, fredriksson">
</head>
<!-- END: this line ends content from: inc/head.default.html -->
<!-- START: this line starts content from: inc/body.default.html -->
<body>
<h1>2011 fredriksson</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>2011/fredriksson</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%2F2011%2Ffredriksson%2Findex.html">Nu Html check https://ioccc-src.github.io/temp-test-ioccc/2011/fredriksson/index.html</a></p>
<!-- End Nu Html Checker -->
<div class="topnav">
<a class="Left" href="../eastman/index.html">&larr; eastman</a>
<a class="Left" href="../index.html">&uarr; 2011 &uarr;</a>
<a class="Left" href="../goren/index.html">goren &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#Kimmo_Fredriksson">Kimmo
Fredriksson</a><br> Location: <a
href="/temp-test-ioccc/location.html#FI">FI</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#2011-fredriksson">2011 fredriksson 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">./fredriksson</span> <span class="pp">[-</span><span class="ss">icvtnk#</span><span class="pp">]</span> regexp <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="ex">./try.sh</span></span></code></pre></div>
<p>NOTE: you need to be allowed to change your stack size or else the
last command in the script would likely cause the program to dump core,
which is why the script checks the exit code of <code>ulimit</code>
first.</p>
<h2 id="judges-remarks">Judges’ remarks:</h2>
<p>The author of this entry was making sure that it does not win the
“Best Short Program” award. On the outside, the program behaves as an
approximate <code>grep</code>. On the inside, it is a <a
href="https://en.wikipedia.org/wiki/Burrows-Wheeler_transform">Burrows-Wheeler
transform</a> decompressor that produces the source code of the actual
obfuscated approximate <code>grep</code> program and calls it. As an
exercise, try writing the compressor.</p>
<h2 id="authors-remarks">Author’s remarks:</h2>
<h3 id="approximate-grep">Approximate grep</h3>
<p>Implements a variant of <code>grep</code>.</p>
<h3 id="usage">Usage</h3>
<p>To search regexp from file, do:</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">./fredriksson</span> <span class="pp">[-</span><span class="ss">icvtnk#</span><span class="pp">]</span> regexp <span class="op">&lt;</span> file</span></code></pre></div>
<p>Pipes might not work, see the section Limitations. The options
<code>-i</code>, <code>-c</code>, <code>-v</code> and <code>-n</code>
are the classic ones:</p>
<ul>
<li><p><code>-i</code> Ignore case.</p></li>
<li><p><code>-c</code> Count only, prints the number of matches, but not
the matching lines.</p></li>
<li><p><code>-v</code> Invert match.</p></li>
<li><p><code>-n</code> Prefixes each printed line by its line number
(only if <code>-c</code> was not given).</p></li>
</ul>
<p>This version of <code>grep</code> recognizes two more options, not
present in normal <code>grep</code> implementations:</p>
<ul>
<li><p><code>-kN</code> Permit <code>N</code> insertions, deletions or
mismatches of characters in the matches (aka <a
href="https://en.wikipedia.org/wiki/Edit_distance">edit-distance</a>).
E.g. “<code>obfuscated</code>” matches “<code>obfuscation</code>” with
one deletion and two mismatches. Likewise, “<code>obfuscate</code>” and
“<code>oversimplify</code>” match with 7 <a
href="https://en.wikipedia.org/wiki/Edit_distance#Formal_definition_and_properties">edit
operations</a>. The default is <code>-k0</code> (i.e. exact
match).</p></li>
<li><p><code>-t</code> Add local transpositions to the set of allowed <a
href="https://en.wikipedia.org/wiki/Edit_distance#Formal_definition_and_properties">edit-operations</a>.
That is, “<code>ab</code>” matches “<code>ba</code>” with one
transposition (swap), and “<code>obfuscated</code>” matches
“<code>bofsuact</code>” with three swaps and two insertions, i.e. use
<code>-tk5</code> to find this.</p></li>
</ul>
<p>Of course, one could construct a standard <a
href="https://www.regular-expressions.info">regexp</a> that matches the
same patterns, but the problem is that such a regexp grows exponentially
in size when the number of allowed <a
href="https://en.wikipedia.org/wiki/Edit_distance#Formal_definition_and_properties">edit
operations</a> is increased.</p>
<p>This version does not recognize all regular expressions, but the
following are allowed:</p>
<ul>
<li><p>Wildcard: <code>.</code> (dot) matches any character.</p></li>
<li><p>Bracket expression: list of characters enclosed by <code>[</code>
and <code>]</code>, matches any single character in the list.</p></li>
<li><p>Range expression: two characters separated by hyphen and enclosed
in brackets, matches any character that is lexicographically between the
two characters (inclusive). E.g. <code>[a-d]</code> is the same as
<code>[abcd]</code>.</p></li>
</ul>
<p>The special characters must be escaped, if they are to be taken
literally (e.g. <code>\.</code> to match period). You might want to
protect these with <code>'</code>, i.e. use <code>'foo\[bar'</code>
instead of <code>foo\[bar</code>. If you want to use the literal
<code>-</code> in bracket expression, protect that too
(<code>\-</code>), otherwise this is not needed. Note that the syntax
differs from standard (?) grep a bit, i.e. in plain grep you can use
<code>]</code> and <code>-</code> in bracket expressions by putting
<code>]</code> as the first character, and putting <code>-</code>
last.</p>
<h3 id="other-uses">Other uses</h3>
<ul>
<li>You can use this in place of <a
href="https://en.wikipedia.org/wiki/Cat_(Unix)">cat</a>. Just say</li>
</ul>
<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">./fredriksson</span> <span class="at">-k3</span> cat <span class="op">&lt;</span> file</span></code></pre></div>
<ul>
<li>Like with <code>cat</code>, you can append line numbers too:</li>
</ul>
<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">./fredriksson</span> <span class="at">-nk3</span> cat <span class="op">&lt;</span> file</span></code></pre></div>
<h3 id="other-features">Other features</h3>
<ul>
<li><p>It is assumed that the user knows how to feed correct input to
the program. If undefined options are given, the result is also
undefined. This is a feature.</p></li>
<li><p>It may consume huge amounts of memory, and a stack overflow may
occur. This results in Segmentation fault (or the equivalent of your
favorite system, such as Bus error). This is a feature, that can be used
to detect overly long lines in the input file, such as checking the
length of one liners in IOCCC entries, just adjust your stack size to a
suitable threshold, and search for “<code>ioccc</code>”, with option
<code>-vk5</code>.</p></li>
</ul>
<h3 id="limitations-and-remarks">Limitations and remarks</h3>
<ul>
<li><p>Using warning options (such as <code>-Wall</code>) when building
gives a lot of warning, such as
<code>suggest parentheses around '&amp;&amp;' within '||'</code>,
<code>value computed is not used</code>,
<code>implicit declaration of function 'putchar'</code>,
<code>implicit declaration of function 'getchar'</code>,
<code>control reaches end of non-void function</code> and
<code>format not a string literal and no format arguments</code>. Please
ignore them all, since they just try to tell you that the source is
obfuscated.</p></li>
<li><p>Only standard input is handled. And <em>only</em> if
<code>stdin</code> comes from a file, i.e. pipes may or may not work. If
you want to count only (<code>-c</code> option), then this shouldn’t be
an issue.</p></li>
<li><p>The total length of the (preprocessed) pattern is at most
<code>sizeof(long)*CHAR_BIT</code>. That does not count things like
bracket expressions or escape chars, that is, the pattern
<code>'a[bcd]e\.f'</code> is 5 chars long, not 10 chars. That does not
mean that the matched substring in the standard input has this limit, as
using the edit operations can make the string longer. However, no
assumptions are made for <code>sizeof(long)</code>. In fact, you can
easily use <code>long long</code> instead,</p></li>
<li><p>Depending on the file, it might require a lot of stack space. If
the program segfaults (because of this), say</p>
<p>ulimit -s unlimited</p>
<p>cross your fingers, hope it is enough, and try again.</p></li>
<li><p>Assumes C99 standard, because of the one very long line. Most C
compilers handle this just fine even in C89 mode, though.</p></li>
<li><p>The code should be reasonably portable, it assumes standard ASCII
codes for each char, and that a C compiler is on <code>$PATH</code>; the
latter is hard coded to be ‘gcc’, but any compiler would work, provided
that it supports C99, or long lines as an extension. This code has been
tested on:</p>
<ul>
<li>GNU/Linux FC4, i386, gcc</li>
<li>GNU/Linux FC7, x86_64, gcc 4.1.2, tcc 0.9.24 and icc 10.0</li>
<li>GNU/Linux FC9, x86_64, gcc 4.?.?</li>
<li>GNU/Linux CentOS 5, gcc 4.1.2</li>
<li>GNU/Linux Ubuntu 11.04, gcc 4.5.2</li>
<li>SunOS 5.8, UltraSPARC IIIi, gcc 4.1.2</li>
<li>SunOS 5.9, UltraSPARC IIIi, gcc 4.1.1 and Sun ONE Studio 8 CC</li>
<li>AIX 5.3, IBM eServer p5-550, gcc 3.3.3 and AIX CC Version 6</li>
</ul>
<p>(Btw, tcc has its roots in IOCCC…)</p></li>
</ul>
<h3 id="obfuscations-a.k.a.-spoilers">Obfuscations (a.k.a.
spoilers…)</h3>
<ul>
<li><p>The initialized char array includes the source code of the real
program, as well as its name and commands to build and run it, all <a
href="https://en.wikipedia.org/wiki/Burrows-Wheeler_transform">Burrows-Wheeler</a>
-transformed, then run-length-encoded with unary coding. The main
program extracts and builds that, and then calls it. More precisely, the
command to build is</p>
<pre><code> gcc -O3 ag.c -o ag</code></pre>
<p>To change that you need to edit the char array <code>p[]</code> and
(possibly) two specially encoded constants, <code>-~('('*'(')</code> and
<code>'C'*' '-'-'</code>. The extracted source (<code>ag.c</code>) is
obfuscated as well.</p>
<p>(The original version also deleted the generated source and the
corresponding binary after running it, but this feature was removed from
the submitted entry.)</p></li>
<li><p>The code demonstrates several useful programming paradigms, such
as:</p>
<ul>
<li>recursion to remove all loops</li>
<li>subroutines (<code>main()</code> contains several logical
subroutines, selected by the first argument)</li>
<li>function pointers</li>
</ul></li>
<li><p>Algorithmically, it incorporates the following:</p>
<ul>
<li>(inverse) Burrows-Wheeler transform (used also e.g. in
<code>bzip2(1)</code>)</li>
<li>data compression (really expansion :-), run-length-encoding, unary
coding (this is why it is expansion rather than compression)</li>
<li>approximate string matching</li>
<li>dynamic programming to compute the edit distance</li>
<li>parallel computation in sequential computers (by packing several
objects into a single <code>long</code>, to speed up the dynamic
programming)</li>
<li>self extracting, compiling and running code</li>
</ul></li>
<li><p>As a C program, it demonstrates that</p>
<ul>
<li>a C subset without reserved words is complete enough, excluding data
type specific things (<code>int</code>, <code>char</code>,
<code>void</code> …)</li>
<li>only letters are needed (i.e. the digits <code>0-9</code> are
not)</li>
<li>only one statement is enough to code any program (plus variable
definitions)</li>
<li>white space has other uses than just indenting the code</li>
</ul></li>
<li><p>It also shows the power of boolean logic and bitwise
arithmetic.</p></li>
<li><p>This is the first (?) entry in the history of IOCCC, that cannot
be totally de-obfuscated by the author. This is due to the clever choice
of the actual algorithm, that is obfuscated by nature, and it is an open
research problem whether a simpler algorithm exists, with the same time
complexity.</p></li>
<li><p>The main obfuscation comes from using only arithmetic and boolean
(short-circuit) logic combined with recursion to remove all loops and
if-then-else constructs (also, no ternary <code>?:</code> constructs are
present). Two’s complement representation of integers is also abused.
E.g. instead of writing <code>x++</code> or <code>x-1</code>, it is much
better to write <code>x=-~x</code> and <code>~-x</code>.</p></li>
<li><p>No numerical values, other than in the initialized char array,
try</p>
<pre><code> ./fredriksson -ck0 [0-9] &lt; fredriksson.c</code></pre>
<p>This should print 1, as there is a number <code>3</code> in the char
array (only). You can also try</p>
<pre><code> ./fredriksson -ck0 [0-9] &lt; ag.c</code></pre>
<p>after running <code>fredriksson</code> at least once (since this
generates that <code>ag.c</code> file), and this should print
0.</p></li>
<li><p>The source code is best viewed with cat (or using the program
itself), instead of some editor. (This is a somewhat system dependent
thing.)</p>
<p>One reason for this is that the code builds (some of the) constant
values from string literal <code>"\b"</code>, except that the backspace
<code>\b</code> is not escaped like that; the source uses the raw ASCII
value (<code>010</code> octal) instead. Thus when viewing with cat or
something, that backspace erases the leading quotation mark. Makes it
appear uncompilable, and it is: if you copy-paste the cat output from
terminal to some editor, save it, the result would not compile.</p>
<p>Some other constants are built from ASCII values of
<code>char</code>s.</p>
<p>Besides of making the code hard to read, all this makes it also quite
large.</p></li>
<li><p>Running it through GNU <code>indent(1)</code> or
<code>bcpp(1)</code> (C beautifiers) does not beautify it a bit. In
fact, <code>indent</code> makes it only worse (at least with the default
options). Running it through the preprocessor does basically nothing,
since no <code>#define</code>s are used.</p></li>
<li><p>Some <em>abuse of the rules</em>. The number of non-whitespace
and <code>;</code>, <code>{</code> and <code>}</code> chars is below the
limit, but most of the whitespace chars are in an <em>initialized
character array</em>. That is, the number of chars in the program
exceeds the 2048 limit. However, whitespace is whitespace and the rules
did not specify that these must be in between the statements. A
character is a whitespace if <code>isspace()</code> returns non-zero
value. Even if deleting even one of those chars it breaks the program!
(This does not apply to the generated source
<code>ag.c</code>.)</p></li>
</ul>
<h2 id="copyright-and-cc-by-sa-4.0-license">Copyright and CC BY-SA 4.0
License:</h2>
<p>This file is Copyright (c) 2023 by Landon Curt Noll. All Rights
Reserved. You are free to share and adapt this file under the terms of
this license:</p>
<pre><code>Creative Commons Attribution-ShareAlike 4.0 International (CC BY-SA 4.0)</code></pre>
<p>For more information, see:
https://creativecommons.org/licenses/by-sa/4.0/</p>
<!-- START: this line starts content generated by: bin/gen-inventory.sh -->
<h1 id="inventory-for-2011fredriksson"><a name="inventory"></a>Inventory
for 2011/fredriksson</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/2011/fredriksson/fredriksson.c">fredriksson.c</a>
- winning source</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2011/fredriksson/Makefile">Makefile</a>
- winner Makefile</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2011/fredriksson/fredriksson.orig.c">fredriksson.orig.c</a>
- original source</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2011/fredriksson/try.sh">try.sh</a>
- how to run</li>
<li><a href="2011_fredriksson.tar.bz2">2011_fredriksson.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/2011/fredriksson/.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/2011/fredriksson/.winner.json">.winner.json</a>
- description of winner in JSON</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2011/fredriksson/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%2F2011%2Ffredriksson%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 -->
+236 -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,248 @@
<!-- !!! DO NOT MODIFY THIS FILE - This file is generated by a tool !!! -->
<!-- !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<!-- -->
<!-- file: 2011/goren/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>2011 goren</title>
<meta name="description" content="IOCCC year: 2011 IOCCC winner: goren winner index page">
<meta name="keywords" content="IOCCC,2011,goren,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>2011/goren</title>
<meta name="description" content="2011 IOCCC winner goren">
<meta name="keywords" content="IOCCC, 2011, IOCCC 2011, IOCCC winner, goren">
</head>
<!-- END: this line ends content from: inc/head.default.html -->
<!-- START: this line starts content from: inc/body.default.html -->
<body>
<h1>2011 goren</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>2011/goren</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%2F2011%2Fgoren%2Findex.html">Nu Html check https://ioccc-src.github.io/temp-test-ioccc/2011/goren/index.html</a></p>
<!-- End Nu Html Checker -->
<div class="topnav">
<a class="Left" href="../fredriksson/index.html">&larr; fredriksson</a>
<a class="Left" href="../index.html">&uarr; 2011 &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#Uri_Goren">Uri Goren</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>
<h2 id="to-use">To use:</h2>
<div class="sourceCode" id="cb2"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb2-1"><a href="#cb2-1" aria-hidden="true" tabindex="-1"></a><span class="bu">echo</span> <span class="st">&quot;some text&quot;</span> <span class="kw">|</span> <span class="ex">./goren</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>In the words of <a
href="http://en.wikipedia.org/wiki/Rene_Magritte">René François Ghislain
Magritte Magritte</a>:</p>
<figure>
<img src="MagrittePipe.jpg" title="Ceci n&#39;est pas une pipe"
alt="This is not a pipe" />
<figcaption aria-hidden="true">This is not a pipe</figcaption>
</figure>
<p>One may ask the surrealist question:</p>
<div class="sourceCode" id="cb4"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb4-1"><a href="#cb4-1" aria-hidden="true" tabindex="-1"></a><span class="bu">echo</span> <span class="st">&#39;If | is just a representation of a pipe, then how can data stuff it?&#39;</span> <span class="kw">|</span> <span class="ex">./goren</span></span></code></pre></div>
<p>However if one takes a firm stand and declares:</p>
<div class="sourceCode" id="cb5"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb5-1"><a href="#cb5-1" aria-hidden="true" tabindex="-1"></a><span class="bu">echo</span> <span class="st">&#39;| is just a representation of a pipe because I say so! So stuff it!&#39;</span> <span class="kw">|</span> <span class="ex">./goren</span></span></code></pre></div>
<p>something happens! Why?</p>
<h2 id="authors-remarks">Author’s remarks:</h2>
<p>This program was written in homage to <a
href="http://en.wikipedia.org/wiki/Rene_Magritte">Rene Magritte</a>’s
picture <a
href="https://en.wikipedia.org/wiki/The_Treachery_of_Images">“La
trahison des images” (The Treachery of Images)</a>.</p>
<p>In order to show my unconditional admiration of this work, I avoided
using conditions.</p>
<p>In this work, Magritte points out that a picture of a pipe is not a
pipe. But what IS a pipe? This program tries to provide an answer.</p>
<p>Magritte’s <a
href="http://en.wikipedia.org/wiki/The_Treachery_of_Images">test for
pipes</a> is:</p>
<pre><code>The famous pipe. How people reproached me for it! And yet, could
you stuff my pipe? No, it&#39;s just a representation, is it not?</code></pre>
<p>Accordingly, this program only approves pipes which can be used for
stuffing data.</p>
<p>One thing I tried to achieve is condition free programming. Many have
noted that conditions make the code harder to read and understand. A
good example would be: <a href="/2004/burley/README.md">Brent Burley’s
2004 IOCCC winner</a>.</p>
<p>That entry omits conditional statements such as <code>if</code> and
<code>while</code>. His achievement in improving clarity by omitting
conditions is impressive, but I think it can be taken further, in two
ways.</p>
<p>First, conditional operators, such as <code>?:</code>,
<code>&amp;&amp;</code> and <code>||</code>, can be thrown away. Second,
using <code>setjmp(3)</code> and <code>longjmp(3)</code>, which are
unfortunately not in common use, might make it difficult for a novice
programmer to understand the code without referring to the man page.</p>
<p>By removing these, the code is 100% condition free, and every
function runs its instructions in perfect order. Naturally, this makes
the program flow trivial to understand. This can be verified by
disassembling the compiled code and looking for conditional jumps (when
compiled with gcc on x86, there are none).</p>
<h3 id="compatibility">Compatibility:</h3>
<p>The program should compile with any C compiler, but was tested mostly
with gcc on Linux.</p>
<p>It doesn’t support 64 bits (due to integer-pointer casts, and
<code>a &gt;&gt;31</code>). It does work on 64-bit Linux, because all
functions are below 4GB.</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-2011goren"><a name="inventory"></a>Inventory for
2011/goren</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/2011/goren/goren.c">goren.c</a>
- winning source</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2011/goren/Makefile">Makefile</a>
- winner Makefile</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2011/goren/goren.orig.c">goren.orig.c</a>
- original source</li>
<li><a href="MagrittePipe.jpg">MagrittePipe.jpg</a> - this is not a
pipe</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2011/goren/try.sh">try.sh</a>
- how to run</li>
<li><a href="2011_goren.tar.bz2">2011_goren.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/2011/goren/.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/2011/goren/.winner.json">.winner.json</a>
- description of winner in JSON</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2011/goren/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%2F2011%2Fgoren%2Findex.html">Nu HTML check this web page</a></p>
<p><a href="#top">Jump to top</a> <a href="#content">Jump to Content</a> <a href="#inventory">Jump to Inventory</a></p>
</div>
<!-- END: this line ends content from: inc/footer.default.html -->
<!-- START: this line starts content from: inc/bottom.default.html -->
</body>
</html>
<!-- END: this line ends content from: inc/bottom.default.html -->
+382 -13
View File
@@ -1,4 +1,6 @@
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<!-- START: two lines up starts content from: inc/top.default.html -->
<!-- -->
<!-- !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<!-- !!! DO NOT MODIFY THIS FILE - This file is generated by a tool !!! -->
@@ -6,27 +8,394 @@
<!-- !!! DO NOT MODIFY THIS FILE - This file is generated by a tool !!! -->
<!-- !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<!-- -->
<!-- file: 2011/hamaji/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>2011 hamaji</title>
<meta name="description" content="IOCCC year: 2011 IOCCC winner: hamaji winner index page">
<meta name="keywords" content="IOCCC,2011,hamaji,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>2011/hamaji</title>
<meta name="description" content="2011 IOCCC winner hamaji">
<meta name="keywords" content="IOCCC, 2011, IOCCC 2011, IOCCC winner, hamaji">
</head>
<!-- END: this line ends content from: inc/head.default.html -->
<!-- START: this line starts content from: inc/body.default.html -->
<body>
<h1>2011 hamaji</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>2011/hamaji</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%2F2011%2Fhamaji%2Findex.html">Nu Html check https://ioccc-src.github.io/temp-test-ioccc/2011/hamaji/index.html</a></p>
<!-- End Nu Html Checker -->
<div class="topnav">
<a class="Left" href="../konno/index.html">&larr; konno</a>
<a class="Left" href="../index.html">&uarr; 2011 &uarr;</a>
<a class="Left" href="../richards/index.html">richards &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#Bsoup">bsoup</a><br> Location: <a
href="/temp-test-ioccc/location.html#JP">JP</a> <br><br>Name: <a
href="/temp-test-ioccc/winners.html#Shinichiro_Hamaji">Shinichiro
Hamaji</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">./hamaji</span> <span class="op">&lt;</span> a_nonogram_file</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>
<p>If you have perl installed you should be able to reproduce <a
href="dragon.nono">dragon.nono</a> like:</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">perl</span> c2nono.pl hamaji.c <span class="kw">|</span> <span class="ex">./hamaji</span></span></code></pre></div>
<h2 id="judges-remarks">Judges’ remarks:</h2>
<p>This program solves <a
href="http://en.wikipedia.org/wiki/Nonogram">Nonograms</a> which is also
known as “Paint by Numbers”.</p>
<p>This entry roars as the Year of the Dragon: A year considered some to
be good luck. Well it was certainly true that the IOCCC was lucky to get
such a fine submission!</p>
<p>The source code is a solution to a Paint by Numbers puzzle when you
paint by C. Try your hand at solving a few of the other
<code>.nono</code> files and then compare your solution with this
program!</p>
<p>NOTE: NONOGRAM (r) is a registered Trademark and is used with
permission. See <a href="https://nonogram.com"
class="uri">https://nonogram.com</a> for more information.</p>
<h2 id="authors-remarks">Author’s remarks:</h2>
<p>The format of the input files are as same as this site: <a
href="https://web.archive.org/web/20130218055139/http://codegolf.com/paint-by-numbers"
class="uri">https://web.archive.org/web/20130218055139/http://codegolf.com/paint-by-numbers</a>.</p>
<p>For example, for a simple problem which shows a glider of <a
href="http://en.wikipedia.org/wiki/Conway&#39;s_Game_of_Life">Conway’s
Game of Life</a>:</p>
<pre><code> 1
.
112
1 X
1 X
3 XXX
</code></pre>
<p>the input should be</p>
<pre><code>1
1
3
-
1
1.1
2</code></pre>
<p>The width and the height of an input puzzle should be less than or
equal to 60.</p>
<p>When this solver finds the problem has no solution, it prints
“<code>invalid</code>”. This means the problem is indeed broken. For
example, this happens for an input like</p>
<pre><code>2
-
2</code></pre>
<p>When this solver cannot find a solution, it prints
“<code>failed</code>”. This failure can happen when the problem has more
than one solution or the solver cannot solve the input problem. Here is
an example input of the former:</p>
<pre><code>1
1
-
1
1</code></pre>
<p>There are two solutions:</p>
<pre><code> 11
1 X
1 X</code></pre>
<p>and</p>
<pre><code> 11
1 X
1 X</code></pre>
<h3 id="detail">Detail</h3>
<p>Solving Nonogram is <a
href="https://en.wikipedia.org/wiki/NP-completeness">NP-complete</a>, so
we cannot make a solver which solves all puzzles. However, we can write
a solver which solves most problems solvable by humans. There are a
bunch of ways to write such programs. The two most obvious approaches
are:</p>
<ol type="1">
<li>Check all possible solutions with backtracking.</li>
<li>Implement all techniques which humans use.</li>
</ol>
<p>The former, brute-force approach is easy to implement. However, it
works only for smaller problems (width and height should be at most 30
or so). Similarly, using generic probabilistic <a
href="https://en.wikipedia.org/wiki/Metaheuristic">metaheuristics</a>
such as <a
href="https://en.wikipedia.org/wiki/Simulated_annealing">simulated
annealing</a> doesn’t work for big problems.</p>
<p>See: <a
href="http://ccl.northwestern.edu/netlogo/models/community/Nonogram"
class="uri">http://ccl.northwestern.edu/netlogo/models/community/Nonogram</a>.</p>
<p>By its definition, the latter method works for all human-solvable
problems. The issue of the latter approach is this kind of program tends
to be lengthy. This approach still requires some <a
href="https://en.wikipedia.org/wiki/Recursion">recursions</a>. The most
difficult problems which are considered human-solvable may require some
“guesses”. For these kinds of problems, we need to assume a cell is a
space or a box, go ahead some steps with simple methods and mark the
tried cell as a box (or a space if we assumed the tried cell is a box)
if a contradiction is found.</p>
<p>My program uses an approach like “Set based solver” introduced in <a
href="https://wiki.haskell.org/Nonogram#Set_based_solver"
class="uri">https://wiki.haskell.org/Nonogram#Set_based_solver</a>. This
should be equivalent to the combinations of simple methods (no advanced
reasoning with guess). My solver also runs a non-recursive guess for
each undetermined cells. So, my program should be able to solve most
human-solvable problems (assuming humans cannot execute deeper
recursions).</p>
<h3 id="obfuscation">Obfuscation</h3>
<p>First of all, as you see, my program looks like a nonogram puzzle
which results in a <a href="https://www.draconika.com/what">dragon</a>.
This puzzle is <a href="dragon.nono">dragon.nono</a> in this directory.
Note that whitespaces in character literals, a string literal, and
around the last comment are considered as a boxed cell.</p>
<p>My program is based on bit operations for speed. Many values are
stored using negative logic (0 means on and 1 means off) to utilize the
initial value of global variables. Thus, it might be difficult to figure
out how it works.</p>
<p>My program is decently shortened, because the size of source code is
limited by IOCCC’s rule (2048 non-whitespace characters) and a lot of
characters are just wasted for numbers around the picture.</p>
<p>The three requirements (dragon, speed, and size) naturally ended up
with the well obfuscated code.</p>
<h3 id="portability">Portability</h3>
<p>This program uses two C99 features. One line comments and
<code>long long</code>. GCC’s <code>-ansi -pedantic</code> check should
pass:</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">cc</span> <span class="at">-ansi</span> <span class="at">-pedantic</span> <span class="at">-std</span><span class="op">=</span>c99 hamaji.c</span></code></pre></div>
<p>I checked my program with gcc-4.6.2 on linux, llvm-gcc-4.2 on Mac,
and clang-3.0 on Mac.</p>
<p>Note that the behavior of <code>scanf(3)</code> differs on linux and
mac, but this program supports both semantics.</p>
<p>This program should not depend on <code>sizeof(int)</code>,
<code>sizeof(void*)</code>, ASCII, memory layout, undefined evaluation
order (e.g., <code>a[i++]=i</code>), etc. This program won’t work if the
size of <code>long long</code> literal is less than 8. By grepping the
source code of gcc</p>
<div class="sourceCode" id="cb12"><pre
class="sourceCode sh"><code class="sourceCode bash"><span id="cb12-1"><a href="#cb12-1" aria-hidden="true" tabindex="-1"></a><span class="fu">grep</span> LONG_LONG_TYPE_SIZE gcc/config/<span class="pp">*</span>/<span class="pp">*</span></span></code></pre></div>
<p>I found long long may be 32bit integers only on AVR.</p>
<h3 id="a-few-more-things">A few more things</h3>
<p>This code is considered as a <a
href="http://en.wikipedia.org/wiki/Japanese_New_Year#Postcards">new
year’s postcard in Japan</a>. We chose the dragon because 2012 is the <a
href="https://japanesezodiac.com/japanese-year-of-the-dragon">year of
dragon</a>.</p>
<p>The second author wrote the picture, and the first author did
everything else.</p>
<p>The <a href="dragon.nono">dragon.nono</a>, <a
href="samurai.nono">samurai.nono</a>, and <a
href="penguin.nono">penguin.nono</a> were written by the second author.
The <a href="soccer.nono">soccer.nono</a> was from a wikipedia entry.
This file is important because it requires some guesses. The <a
href="random.nono">random.nono</a> file was randomly generated. The <a
href="codegolf.nono">codegolf.nono</a> and <a
href="face.nono">face.nono</a> were taken from <a
href="https://web.archive.org/web/20130218055139/http://codegolf.com/paint-by-numbers"
class="uri">https://web.archive.org/web/20130218055139/http://codegolf.com/paint-by-numbers</a>.</p>
<p>You can reproduce <a href="dragon.nono">dragon.nono</a> from <a
href="hamaji.c">hamaji.c</a> using <a
href="c2nono.pl">c2nono.pl</a>:</p>
<div class="sourceCode" id="cb13"><pre
class="sourceCode sh"><code class="sourceCode bash"><span id="cb13-1"><a href="#cb13-1" aria-hidden="true" tabindex="-1"></a><span class="fu">perl</span> c2nono.pl hamaji.c <span class="kw">|</span> <span class="ex">./hamaji</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-2011hamaji"><a name="inventory"></a>Inventory for
2011/hamaji</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/2011/hamaji/hamaji.c">hamaji.c</a>
- winning source</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2011/hamaji/Makefile">Makefile</a>
- winner Makefile</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2011/hamaji/hamaji.orig.c">hamaji.orig.c</a>
- original source</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2011/hamaji/c2nono.pl">c2nono.pl</a>
- reproduce dragon.nono</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2011/hamaji/codegolf.nono">codegolf.nono</a>
- nonogram input data</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2011/hamaji/conway-game-of-life.nono">conway-game-of-life.nono</a>
- nonogram input data</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2011/hamaji/dragon.nono">dragon.nono</a>
- nonogram input data</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2011/hamaji/face.nono">face.nono</a>
- nonogram input data</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2011/hamaji/multi-solutions.nono">multi-solutions.nono</a>
- nonogram input data</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2011/hamaji/no-solution.nono">no-solution.nono</a>
- nonogram input data</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2011/hamaji/penguin.nono">penguin.nono</a>
- nonogram input data</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2011/hamaji/plus.nono">plus.nono</a>
- nonogram input data</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2011/hamaji/random.nono">random.nono</a>
- nonogram input data</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2011/hamaji/samurai.nono">samurai.nono</a>
- nonogram input data</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2011/hamaji/smiley.nono">smiley.nono</a>
- nonogram input data</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2011/hamaji/soccer.nono">soccer.nono</a>
- nonogram input data</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2011/hamaji/try.sh">try.sh</a>
- how to run</li>
<li><a href="2011_hamaji.tar.bz2">2011_hamaji.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/2011/hamaji/.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/2011/hamaji/.winner.json">.winner.json</a>
- description of winner in JSON</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2011/hamaji/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%2F2011%2Fhamaji%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 -->
+253 -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,265 @@
<!-- !!! DO NOT MODIFY THIS FILE - This file is generated by a tool !!! -->
<!-- !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<!-- -->
<!-- file: 2011/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>2011 hou</title>
<meta name="description" content="IOCCC year: 2011 IOCCC winner: hou winner index page">
<meta name="keywords" content="IOCCC,2011,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>2011/hou</title>
<meta name="description" content="2011 IOCCC winner hou">
<meta name="keywords" content="IOCCC, 2011, IOCCC 2011, 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>2011 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>2011/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%2F2011%2Fhou%2Findex.html">Nu Html check https://ioccc-src.github.io/temp-test-ioccc/2011/hou/index.html</a></p>
<!-- End Nu Html Checker -->
<div class="topnav">
<a class="Left" href="../goren/index.html">&larr; goren</a>
<a class="Left" href="../index.html">&uarr; 2011 &uarr;</a>
<a class="Left" href="../konno/index.html">konno &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>
<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">./hou</span> <span class="st">&#39;expression&#39;</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>
<p>As the script asks you, what does the last one mean? Can you get it
to report a different value? Hint: it’s in this file, kind of.</p>
<h2 id="judges-remarks">Judges’ remarks:</h2>
<p>This self-documenting scientific calculator compiles clean with no
warnings under the most strict pedantic mode of gcc and clang.</p>
<p>The first example, along with the correct result appears in the
source code. What does it mean?</p>
<p>The calculator obeys the precedence rules and allows parenthesis.</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">./hou</span> <span class="st">&#39;1+2*3&#39;</span></span>
<span id="cb4-2"><a href="#cb4-2" aria-hidden="true" tabindex="-1"></a><span class="ex">./hou</span> <span class="st">&#39;(1+2)*3&#39;</span></span></code></pre></div>
<p>What exactly does the text formatting do?</p>
<p>What does this evaluate to in C?</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="op">+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~+</span></span></code></pre></div>
<h3 id="self-documenting-source">Self documenting source</h3>
<p>Comments would almost be redundant. :-}</p>
<h3 id="the-ascii-art-is-valid-c-code">The ASCII art is valid C
code</h3>
<p>… and not just fancy formatted comment removed by the C
Pre-processor.</p>
<h3 id="the-only-multi-byte-strings-are-format-strings">The only
multi-byte strings are format strings</h3>
<p>The code does not contain some simple string-encoded lookup table for
calculator operations.</p>
<h3 id="example-input-and-output-in-the-source">Example input and output
in the source</h3>
<p>The example input and output in the C code is significant. Can you
find out why?</p>
<h3 id="the-button-layout">The button layout</h3>
<p>The button layout in the C code is significant … not just a nice
looking layout.</p>
<h3 id="input-parsing">Input parsing</h3>
<p>The parser is functionally equivalent to a normal arithmetic parser
for all valid inputs. For another fun challenge: try to determine how it
parses the command line argument.</p>
<h2 id="authors-remarks">Author’s remarks:</h2>
<h3 id="obfuscations">Obfuscations</h3>
<p>This program is designed to be self-documenting. It doesn’t just
provide an example command line. It also provides the expected output
and illustrates all supported functionality using embedded ASCII
art.</p>
<ul>
<li>A few line numbers are significant and careless beautification will
break the program.</li>
<li>The entire ASCII art is valid code. The preprocessor won’t remove
any part of it.</li>
<li>The only strings longer than 1 byte are
<code>printf(3)</code>/<code>sscanf(3)</code> format strings, even after
preprocessing. No string-encoded lookup table is used.</li>
<li>The example input and its expected output are both algorithmically
significant.</li>
<li>The button layout is also significant.</li>
<li>The actual syntax being parsed is not that obvious, despite being
functionally equivalent for all correct inputs.</li>
</ul>
<h3 id="portability">Portability</h3>
<ul>
<li>This program requires <code>argv</code> to point to writable memory.
It doesn’t require the actual <code>argv</code> strings to be writable,
though.</li>
<li>This program requires ASCII.</li>
<li>This program doesn’t work with <code>%e</code> style numbers like
<code>1e-4</code>.</li>
<li>Some seemingly redundant code works to eliminate warnings and evade
a gcc bug.</li>
</ul>
<h3 id="spoilers">Spoilers</h3>
<p>The parser parses function names, subtraction, and division as
single-letter unary operators. A bitmask encoded hash table is used to
check no-ops/digits and another hash function maps the ASCII to a
function ordinal, which is then executed by the button panel.</p>
<p>Both hash functions were found using a separate search program.
Another program was used to find a way to format one hash function as
example input such that it produces something resembling the bitmask
hash table as part of its output.</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-2011hou"><a name="inventory"></a>Inventory for
2011/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/2011/hou/hou.c">hou.c</a>
- winning source</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2011/hou/Makefile">Makefile</a>
- winner Makefile</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2011/hou/hou.orig.c">hou.orig.c</a>
- original source</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2011/hou/try.sh">try.sh</a>
- how to run</li>
<li><a href="2011_hou.tar.bz2">2011_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/2011/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/2011/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/2011/hou/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%2F2011%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 -->
+198 -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,210 @@
<!-- !!! DO NOT MODIFY THIS FILE - This file is generated by a tool !!! -->
<!-- !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<!-- -->
<!-- file: 2011/konno/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>2011 konno</title>
<meta name="description" content="IOCCC year: 2011 IOCCC winner: konno winner index page">
<meta name="keywords" content="IOCCC,2011,konno,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>2011/konno</title>
<meta name="description" content="2011 IOCCC winner konno">
<meta name="keywords" content="IOCCC, 2011, IOCCC 2011, IOCCC winner, konno">
</head>
<!-- END: this line ends content from: inc/head.default.html -->
<!-- START: this line starts content from: inc/body.default.html -->
<body>
<h1>2011 konno</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>2011/konno</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%2F2011%2Fkonno%2Findex.html">Nu Html check https://ioccc-src.github.io/temp-test-ioccc/2011/konno/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; 2011 &uarr;</a>
<a class="Left" href="../hamaji/index.html">hamaji &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#Taketo_Konno">Taketo Konno</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">./konno</span> lower_case_word</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 tiny program outputs what looks like a tiny keyboard. OK, so the
letters are missing. But that is no problem because this program
identifies the lower case letters that were pressed!</p>
<p>It is one of those minimal keyboards without all of those confusing
symbols keys. No shift for SHOUTING CAPS but at least it does not have
that useless CAPS LOCK key!</p>
<p>We recommend that you completely deconstruct / figure out how this
program works and does what it does. Can you extend this program to deal
with a full QWERTY keyboard? Can you then minimize the size of that
code?</p>
<h2 id="authors-remarks">Author’s remarks:</h2>
<h3 id="limitation">Limitation</h3>
<p>This program ignores non-lower case letters.</p>
<h3 id="obfuscation">Obfuscation</h3>
<ul>
<li><code>for</code> is not used.</li>
<li>A part of the program is encrypted.</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-2011konno"><a name="inventory"></a>Inventory for
2011/konno</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/2011/konno/konno.c">konno.c</a>
- winning source</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2011/konno/Makefile">Makefile</a>
- winner Makefile</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2011/konno/konno.orig.c">konno.orig.c</a>
- original source</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2011/konno/try.sh">try.sh</a>
- how to run</li>
<li><a href="2011_konno.tar.bz2">2011_konno.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/2011/konno/.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/2011/konno/.winner.json">.winner.json</a>
- description of winner in JSON</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2011/konno/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%2F2011%2Fkonno%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 -->
+253 -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,265 @@
<!-- !!! DO NOT MODIFY THIS FILE - This file is generated by a tool !!! -->
<!-- !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<!-- -->
<!-- file: 2011/richards/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>2011 richards</title>
<meta name="description" content="IOCCC year: 2011 IOCCC winner: richards winner index page">
<meta name="keywords" content="IOCCC,2011,richards,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>2011/richards</title>
<meta name="description" content="2011 IOCCC winner richards">
<meta name="keywords" content="IOCCC, 2011, IOCCC 2011, IOCCC winner, richards">
</head>
<!-- END: this line ends content from: inc/head.default.html -->
<!-- START: this line starts content from: inc/body.default.html -->
<body>
<h1>2011 richards</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>2011/richards</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%2F2011%2Frichards%2Findex.html">Nu Html check https://ioccc-src.github.io/temp-test-ioccc/2011/richards/index.html</a></p>
<!-- End Nu Html Checker -->
<div class="topnav">
<a class="Left" href="../hamaji/index.html">&larr; hamaji</a>
<a class="Left" href="../index.html">&uarr; 2011 &uarr;</a>
<a class="Left" href="../toledo/index.html">toledo &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#Gregor_Richards">Gregor
Richards</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: doesn&#39;t work with some platforms - please help us fix</code></pre>
<p>For more detailed information see <a
href="/bugs.md#2011-richards">2011 richards 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">./richards</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="bu">echo</span> <span class="st">&#39;10 9 8 7 6 5 4 3 2 1*p*p*p*p*p*p*p*p*p&#39;</span> <span class="kw">|</span> <span class="ex">./richards</span></span>
<span id="cb4-2"><a href="#cb4-2" aria-hidden="true" tabindex="-1"></a><span class="bu">echo</span> <span class="st">&#39;64 256 128 p/p*p&#39;</span> <span class="kw">|</span> <span class="ex">./richards</span></span></code></pre></div>
<h2 id="judges-remarks">Judges’ remarks:</h2>
<p>Oh no, yet another <a
href="https://en.wikipedia.org/wiki/Dc_(computer_program)">dc</a>-style
calculator? (see <a href="/2000/dlowe">2000/dlowe</a> using an embedded
Perl interpreter and deemed <code>Worst Abuse of the Rules</code>).
Well, this one does it (expression calculation, that is, not the rule
abuse) in a different way. The author claims that his calculator does
just-in-time compilation. What would you do to prove or disprove his
claim without attempting to unravel the source?</p>
<h2 id="authors-remarks">Author’s remarks:</h2>
<p>This is an implementation of the classic UNIX <a
href="https://en.wikipedia.org/wiki/Dc_(computer_program)">dc</a>
command, the <a
href="https://en.wikipedia.org/wiki/Reverse_Polish_notation">reverse
Polish</a> calculator. Actually it’s a pretty bad implementation, since
it only implements 32-bit integers (well, <code>sizeof(int)</code>-sized
integers). It only implements the commands <code>+</code>,
<code>-</code>, <code>*</code>, <code>/</code>, <code>p</code> (only for
numbers), register stacks, macros and comparisons. Wow, you’d think I
could’ve done better in 2K of code.</p>
<p>OH! I forgot to mention! It’s a <a
href="https://en.wikipedia.org/wiki/Just-in-time_compilation">JIT</a>.</p>
<p>Wait, don’t stop reading! I know what you’re thinking,
platform-specific code is discouraged in IOCCC. But do you see any
platform-specific code? There’s no assembler here! This <a
href="https://en.wikipedia.org/wiki/Just-in-time_compilation">JIT</a>
works on a dozen platforms, and the only platform-specific assumptions
it makes are that the stack grows down and integers are at least
32-bit.</p>
<p>You will probably get warnings while compiling the code. In
particular:</p>
<ul>
<li><p>If your system requires the inclusion of <code>alloca.h</code> to
use alloca, use the compile flag <code>-DAH</code>.</p></li>
<li><p>If your system cannot use <code>mmap()</code>, use the compile
flag <code>-DNM</code>.</p></li>
<li><p>I don’t include any headers I don’t strictly need to, so you’ll
get warnings about (at least) <code>memcpy()</code>,
<code>isdigit()</code>, <code>atoi()</code>, <code>calloc()</code>,
<code>malloc()</code> and <code>alloca()</code> if you didn’t use
<code>-DAH</code>.</p>
<ul>
<li>NOTE from judges: we added these includes in 2023.</li>
</ul></li>
<li><p>GCC likes to complain about <code>while (a = b)</code>
(assignments as a condition).</p></li>
<li><p>I don’t return from <code>main()</code>, even though it’s
declared to return <code>int</code>.</p></li>
</ul>
<p>Platforms on which all known/tested optimization levels work with no
additional flags:</p>
<ul>
<li>gcc 4.6.2 + x86[_64] + GNU/Linux, Mac OS X or Windows</li>
<li>clang 2.9-16 + x86[_64] + GNU/Linux or Mac OS X</li>
<li>tcc 0.9.25</li>
<li>gcc 4.4.5 + alpha, arm, mips[el], powerpc[64], s390x (IBM
zSeries)</li>
<li>gcc 4.1.3 + vax + NetBSD</li>
</ul>
<p>Platforms which work but not at all optimization levels or needing
special flags:</p>
<ul>
<li>owcc 1.9 + x86 + Windows: Needs
<code>-DNM -DAH -fno-stack-check</code></li>
<li>gcc 4.4.5 + sh4: -O0 works, higher optimization levels don’t work
for unknown reasons.</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-2011richards"><a name="inventory"></a>Inventory
for 2011/richards</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/2011/richards/richards.c">richards.c</a>
- winning source</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2011/richards/Makefile">Makefile</a>
- winner Makefile</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2011/richards/richards.alt.c">richards.alt.c</a>
- alternative source</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2011/richards/richards.orig.c">richards.orig.c</a>
- original source</li>
<li><a href="2011_richards.tar.bz2">2011_richards.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/2011/richards/.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/2011/richards/.winner.json">.winner.json</a>
- description of winner in JSON</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2011/richards/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%2F2011%2Frichards%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 -->
+403 -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,415 @@
<!-- !!! DO NOT MODIFY THIS FILE - This file is generated by a tool !!! -->
<!-- !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<!-- -->
<!-- file: 2011/toledo/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>2011 toledo</title>
<meta name="description" content="IOCCC year: 2011 IOCCC winner: toledo winner index page">
<meta name="keywords" content="IOCCC,2011,toledo,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>2011/toledo</title>
<meta name="description" content="2011 IOCCC winner toledo">
<meta name="keywords" content="IOCCC, 2011, IOCCC 2011, IOCCC winner, toledo">
</head>
<!-- END: this line ends content from: inc/head.default.html -->
<!-- START: this line starts content from: inc/body.default.html -->
<body>
<h1>2011 toledo</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>2011/toledo</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%2F2011%2Ftoledo%2Findex.html">Nu Html check https://ioccc-src.github.io/temp-test-ioccc/2011/toledo/index.html</a></p>
<!-- End Nu Html Checker -->
<div class="topnav">
<a class="Left" href="../richards/index.html">&larr; richards</a>
<a class="Left" href="../index.html">&uarr; 2011 &uarr;</a>
<a class="Left" href="../vik/index.html">vik &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#Oscar_Toledo">Oscar Toledo
G.</a><br> Location: <a
href="/temp-test-ioccc/location.html#MX">MX</a></p>
<!-- END: next line ends content generated by: bin/gen-author.sh -->
<h2 id="to-build">To build:</h2>
<p>If you have X11 installed:</p>
<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 are two alternate versions, <a href="toledo.alt.c">one that
lets you reconfigure the controls and size</a> and <a
href="toledo.alt2.c">another that should work for Windows</a>. 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">./toledo</span></span></code></pre></div>
<h2 id="alternate-code">Alternate code:</h2>
<p>The first alt version, <a href="toledo.alt.c">toledo.alt.c</a>,
allows you to reconfigure the controls and the dimensions more
easily.</p>
<p>The second version, <a href="toledo.alt2.c">toledo.alt2.c</a>, should
work for Windows but does not allow you to reconfigure the keys or
dimensions. This is because it cannot be tested by us.</p>
<h3 id="alternate-build">Alternate build:</h3>
<p>For the one that lets you reconfigure the keys you will want to look
at the included header file, <a href="keysym.h">keysym.h</a>, to find
the correct macros. Once you have the right names you can define the
macros <code>FIRE</code>, <code>FORWARD</code>, <code>BACKWARD</code>,
<code>LEFT</code>, <code>RIGHT</code>, <code>WIDTH</code> and
<code>HEIGHT</code>. Here are the defaults:</p>
<pre><code>FIRE= XK_BackSpace:XK_Tab
FORWARD= XK_Up:XK_w
BACKWARD= XK_Down:XK_s
LEFT= XK_Left:XK_a
RIGHT= XK_Right:XK_d
WIDTH= 512
HEIGHT= 288</code></pre>
<p>but you can change them about however you like, even with other keys.
For instance to swap <code>LEFT</code> and <code>RIGHT</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">make</span> clobber LEFT=XK_Right:XK_d RIGHT=XK_Left:XK_a alt</span></code></pre></div>
<p>but you can specify something completely else and you can pick and
choose which controls you wish to redefine. You might also wish to
change the dimensions of the game, <code>WIDTH</code> and
<code>HEIGHT</code> which have an arbitrarily selected lower limit as
well as the default values.</p>
<p>Observe that each of the controls are a pair in the form of
<code>player2:player1</code> (yes, player 2 comes first!).</p>
<h2 id="judges-remarks">Judges’ remarks:</h2>
<p>This two player game uses X11. The control keys can be configured by
modifying the <code>A</code>, <code>B</code>, <code>C</code>,
<code>D</code> and <code>E</code> macros at compilation.</p>
<p>After a quick splash screen the objective should be clear. There are
Red, Green and Cyan tanks. A larger window can be made by altering the
source early on, right before the code gets hard to follow, or using the
<a href="#alternate-code">alternate version</a>.</p>
<p>Like Oscar’s previous winning X11 program for the 19th IOCCC, if you
remove both the X11 include files and replace them with</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">#include </span><span class="im">&quot;layer.c&quot;</span></span></code></pre></div>
<p>you ought to be able to compile and run this program on Windows.
NOTE: this is what <a href="toledo.alt2.c">toledo.alt2.c</a> is for.</p>
<h2 id="authors-remarks">Author’s remarks:</h2>
<pre><code> /=========\\
\==\ /==/ ||
|| || /====\ |\/=\ || //==\ ==\ |=\
|| || || || || || // || =| | |
|| || //===| || || ||=// \\=\\ ==/ |=/
|| || || || || || || \\ || User&#39;s
\===/ \\==// || || || \\ \==// Manual</code></pre>
<p>This is a color X11 3D tank-game for two players, just compile and
run it without arguments.</p>
<p>You will see briefly a tank spinning before each level.</p>
<p>The Left half of the window shows the red player view and the right
half shows the green player view; the background will change to blue
when the view goes inactive.</p>
<p>The objective is to chase and destroy the other player’s tank. There
is also an aqua tank for testing your aim and getting extra points.</p>
<p>Caveat: You can shoot only 3 bullets at a time.<br />
Trick: You can fire faster if they explode on anything.<br />
Believe it or not, it has strategy!</p>
<p>When only one tank remains on the field, the level will advance.
Don’t forget to destroy the aqua tank.</p>
<p>The <strike>battle</strike>playground is surrounded by mountains and
each level is filled with random obstacles (pyramids and cubes).</p>
<p>The bars show players energy and score; each bar shows energy and
indicates the current player view (wider on the left). The right part
grows with every point.</p>
<p>Keys for player 1 (lowercase):</p>
<ul>
<li>Tab - Fire</li>
<li>w - Go ahead</li>
<li>s - Go backwards</li>
<li>a - Turn left</li>
<li>d - Turn right</li>
</ul>
<p>Keys for player 2:</p>
<ul>
<li>Backspace - Fire</li>
<li>Up arrow - Go ahead</li>
<li>Down arrow - Go backwards</li>
<li>Left arrow - Turn left</li>
<li>Right arrow - Turn right</li>
</ul>
<p>Note: Numeric keys don’t work.</p>
<p>If you don’t like the keys assignment, you can change it in the
Makefile or use the <a href="#alternate-code">alternate version</a>.</p>
<h3 id="parental-advisory-warning">PARENTAL ADVISORY WARNING:</h3>
<p>This game is highly violent: when the tank explodes you can see the
little stick man blowing in parts.</p>
<p>Not really, just kidding :D</p>
<h3 id="platforms-tested">PLATFORMS TESTED:</h3>
<ul>
<li>openSUSE 10.2 x86-32, X11R6 1024x768 32-bits color.</li>
<li>Fedora Core 8 x86-64, X11R6 1280x1024 32-bits color.</li>
<li>Fedora Core 11 x86-64, X11R6 1024x768 32-bits color.</li>
<li>Fedora Core 14 x86-64, X11R6 1024x768 32-bits color.</li>
</ul>
<h3 id="complete-feature-set">COMPLETE FEATURE SET:</h3>
<ul>
<li>Multiplayer out of the box.</li>
<li>Totally self-contained, no external files.</li>
<li>Fast-and-furious action at 29.97 frames per second.</li>
<li>Just as the movies, 16:9 aspect-ratio.</li>
<li>Beautiful mountains landscape plus horizon line :)</li>
<li>Tanks and bullets exploding as wires with weird physics.</li>
<li>Tanks back off when firing.</li>
<li>There is an infinite number of levels.</li>
<li>Always different levels.</li>
<li>Animated intro.</li>
<li>It has color!</li>
</ul>
<h3 id="features-that-programmers-will-find-appealing">FEATURES THAT
PROGRAMMERS WILL FIND APPEALING:</h3>
<ul>
<li>Works both with 32 and 64-bit CPUs.</li>
<li>Double buffered, portable to any X11 with 24/32-bit color.</li>
<li>Memory-hungry as must be any 3D program; uses a 256 MB array.</li>
<li>Total and absolute irreverent coding style, so it generates a lot of
warnings when compiled.</li>
<li>It can take several minutes to compile (known culprits: Fedora Core
11-14 on x86-64 512 MB).</li>
<li>It is written in the only true C: K&amp;R, and no, that doesn’t mean
Katherine &amp; Rose.</li>
<li>Vectorial scalable graphics: do you want a bigger viewport? Change
variables <code>M</code> and <code>N</code> (see the <a
href="#alternate-code">alternate code</a>).</li>
<li>Half of the program is formatted as 3D cube. View with tabs at 8
columns and a square font.</li>
<li>The other half of the program is unprintable source code, so no
typing from paper, you have to write a converter of tabs and form-feeds
to its C escaped forms.</li>
<li>No text, so this program can be used and understood easily in any
country.</li>
<li>This program is highly ecological, it sleeps when it is not doing
anything.</li>
<li>Virtual world with its own physics laws.</li>
<li>When closing the window it will show an X11 error :P</li>
</ul>
<h3 id="obfuscation-tricks">OBFUSCATION TRICKS:</h3>
<ul>
<li>Loop code included inside loop test.</li>
<li>Function arguments used as variables.</li>
<li>Operators used freely.</li>
<li>Pre-calculated values to save bytes.</li>
<li>Uses the <code>+++</code>, <code>+-</code> and <code>*+</code>
undocumented C operators :P</li>
</ul>
<pre><code>
....,,,,---++++++--,,..\
.,,,....... .$@@@@@@@@@@@@$$@@@@@@@@@@@@@@#+\
@@@@@###@@@@$$$@@@@$$$@@@-......-@+......,,,,,,##\
=++==++++++++=@@$==#$$$$$---,,,,@@@,,,,,,-------@@,..........,,.\
,===#$$$$$$###$####=======@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+=##$@@@@@@@@.
+@,,++++++++=+=========++++===++++++++++-+++@@-,,,,,,,,---+++=++++--,,... @.
.@. .......,,,,-----++=@=++==@$=+--,,... @.
$# S P O I L E R .,,-#@--,,,@$..... @.
.@ ..,--+==++-,,,,.,,,,=@+++++====+++++---,,,....@.
@+ ..,,-+++++++-,,.. @. ....,,,,,---+@@\
,@ ..,--+++=+++,,.. $# .==+\
@#--++==++-,,.. ,@ S P O I L E R .==+\
,#@@$+,,. @. ==+\
.,,+++++,,. S P O I L E R $= +=+\
..,-==++-,. ,@ ---\
.,-+=+++,.. @. .++-\
.,,++=++-,. @+ ==+\
.,-++==+-,. +@ ==+\
..,+++=+-,.. .@. +=+\
.,-+++++,@@==
</code></pre>
<h3 id="the-history-of-this-program">THE HISTORY OF THIS PROGRAM:</h3>
<p>When I started working on this program, I figured that it would be
easy to fit on the character limit, but I missed three things: the
enormous X11 names, the non-portable key codes and my 2 KB of
artwork.</p>
<p>Very hard coding did the first thing. In fact I worked out
twenty-nine different versions and at one step I had four parallel
versions with different characteristics removed (mountains, horizon
lines, score/status bars and explosions) but I’ve managed to fit it all
together!</p>
<p>The second thing was solved using the Makefile: it is under 160 bytes
and you get adjustable controls. The greatest mystery on the Earth is
why X11 gives non-portable key codes to the user.</p>
<p>And finally, the third “Thing” was growing and growing, and growing,
eating bytes for lunch… after endless rounds of crunching I obtained
three-hundred seventy-eight bytes of artwork and guess what? It doesn’t
fit.</p>
<p>So I had to integrate a decompressor based on the space, tabulators
and other non-counted characters.</p>
<p>The final program is composed of eight micro-functions: one is the
core and does most of the hard work and the other functions help do the
X11 things, explosion effects, 3D calculations and viewing.</p>
<ul>
<li><code>K()</code> - 3D transformation</li>
<li><code>s()</code> - Rendering</li>
<li><code>b()</code> - Line color selection</li>
<li><code>G()</code> - Explosion animation</li>
<li><code>g()</code> - Moves 3D object backward and forward</li>
<li><code>F()</code> - Collision detection</li>
<li><code>T()</code> - Core (also known as main loop :D)</li>
<li><code>main()</code> - Initialization and ‘uncruncher’, what a common
name!; C programs should start in the cool() function :).</li>
</ul>
<p>The source code was formatted as a cube using a specially written
program. This program is smaller and obfuscated what is needed so the
reformatting doesn’t exceeded the character limits. The crunched vectors
were generated by another special program and the tank that surrounds
this text was generated by yet another program.</p>
<p><em>Have fun!</em></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-2011toledo"><a name="inventory"></a>Inventory for
2011/toledo</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/2011/toledo/toledo.c">toledo.c</a>
- winning source</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2011/toledo/Makefile">Makefile</a>
- winner Makefile</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2011/toledo/toledo.alt.c">toledo.alt.c</a>
- alternative source</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2011/toledo/toledo.alt2.c">toledo.alt2.c</a>
- alternate alternative source</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2011/toledo/toledo.orig.c">toledo.orig.c</a>
- original source</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2011/toledo/keysym.h">keysym.h</a>
- included header file</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2011/toledo/layer.c">layer.c</a>
- translation layer to make 3D Tanks game</li>
<li><a href="2011_toledo.tar.bz2">2011_toledo.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/2011/toledo/.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/2011/toledo/.winner.json">.winner.json</a>
- description of winner in JSON</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2011/toledo/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%2F2011%2Ftoledo%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 -->
+312 -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,324 @@
<!-- !!! DO NOT MODIFY THIS FILE - This file is generated by a tool !!! -->
<!-- !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<!-- -->
<!-- file: 2011/vik/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>2011 vik</title>
<meta name="description" content="IOCCC year: 2011 IOCCC winner: vik winner index page">
<meta name="keywords" content="IOCCC,2011,vik,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>2011/vik</title>
<meta name="description" content="2011 IOCCC winner vik">
<meta name="keywords" content="IOCCC, 2011, IOCCC 2011, IOCCC winner, vik">
</head>
<!-- END: this line ends content from: inc/head.default.html -->
<!-- START: this line starts content from: inc/body.default.html -->
<body>
<h1>2011 vik</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>2011/vik</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%2F2011%2Fvik%2Findex.html">Nu Html check https://ioccc-src.github.io/temp-test-ioccc/2011/vik/index.html</a></p>
<!-- End Nu Html Checker -->
<div class="topnav">
<a class="Left" href="../toledo/index.html">&larr; toledo</a>
<a class="Left" href="../index.html">&uarr; 2011 &uarr;</a>
<a class="Left" href="../zucker/index.html">zucker &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#Daniel_Vik">Daniel Vik</a><br>
Location: <a href="/temp-test-ioccc/location.html#US">US</a></p>
<!-- END: next line ends content generated by: bin/gen-author.sh -->
<h2 id="to-build">To build:</h2>
<div class="sourceCode" id="cb1"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb1-1"><a href="#cb1-1" aria-hidden="true" tabindex="-1"></a><span class="fu">make</span></span></code></pre></div>
<p>There is an alternate version that should work for Windows. See <a
href="#alternate-code">alternate code</a> below.</p>
<h3 id="bugs-and-misfeatures">Bugs and (Mis)features:</h3>
<p>The current status of this entry is:</p>
<pre><code>STATUS: INABIAF - please **DO NOT** fix</code></pre>
<p>For more detailed information see <a href="/bugs.md#2011-vik">2011
vik 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">./vik</span> file.mod <span class="op">&gt;</span> audio_file.raw</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">./vik</span> randowan.mod <span class="kw">|</span> <span class="ex">mplayer</span> <span class="at">-demuxer</span> rawaudio <span class="at">-</span></span>
<span id="cb4-2"><a href="#cb4-2" aria-hidden="true" tabindex="-1"></a><span class="ex">./vik</span> mad_world.mod <span class="kw">|</span> <span class="ex">mplayer</span> <span class="at">-demuxer</span> rawaudio <span class="at">-</span></span></code></pre></div>
<p>Alternatively, you can use:</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">./vik</span> file.mod <span class="op">&gt;</span> file.raw<span class="kw">;</span> <span class="ex">./raw2wav</span> file.raw <span class="op">&gt;</span> file.wav</span></code></pre></div>
<p>It is possible to download a number of music module files from <a
href="http://modarchive.org">The Mod Archive</a>.</p>
<h2 id="alternate-code">Alternate code:</h2>
<p>This version is based on the author’s remarks and it should work for
Windows.</p>
<h3 id="alternate-build">Alternate build:</h3>
<p>Assuming that <code>make</code> is similar enough try:</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> alt</span></code></pre></div>
<h3 id="alternate-use">Alternate use:</h3>
<p>Use <code>vik.alt</code> as you would <code>vik</code> above.</p>
<h2 id="judges-remarks">Judges’ remarks:</h2>
<p>This entry converts .MOD audio files to a playable stream in a most
pleasing manner if you don’t like tremolo or vibrato.</p>
<p>Also it abuses the C compiler and/or assembler with a partially
initialized 32MB array. Can you tell what that partial initialization
for?</p>
<p>Does it take your system a long time to compile? You may want to
do:</p>
<div class="sourceCode" id="cb7"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb7-1"><a href="#cb7-1" aria-hidden="true" tabindex="-1"></a><span class="fu">cc</span> <span class="at">-S</span> vik.c</span></code></pre></div>
<p>and examine the resulting assembly file <code>vik.s</code>. On some
platforms the assembly file is about 128MB in size!</p>
<p>NOTE: The <a href="randowan.mod">randowan.mod</a> and <a
href="mad_world.mod">mad_world.mod</a> files were created by <a
href="http://www.translucentboy.com">Henrik Bertilsson</a> and are
included with his permission.</p>
<h2 id="authors-remarks">Author’s remarks:</h2>
<h3 id="introduction">Introduction</h3>
<p>In 1987, <a
href="http://www.vgmpf.com/Wiki/index.php?title=Karsten_Obarski">Karsten
Obarski</a> <a
href="https://en.wikipedia.org/wiki/Ultimate_Soundtracker">changed the
way</a> music was handled in games and demos with the introduction of
the MOD file format on <a
href="https://en.wikipedia.org/wiki/Amiga">Commodore Amiga</a></p>
<p>A MOD file contains a set of samples, a number of patterns indicating
how and when the samples are to be played, a list of what patterns to
play in what order, and a number of effects.</p>
<h3 id="features">Features</h3>
<p>This program converts MOD files created with the standard trackers
for Amiga, e.g. Pro Tracker, Noise Tracker and Sound Tracker to raw 16
bit 44.1kHz stereo audio. The program supports MOD music with 4, 6, and
8 channels MOD files with up to 31 samples.</p>
<p>The MOD format includes many effects for each audio channel and this
program supports most of them, including:</p>
<ul>
<li>Arpeggio</li>
<li>Slide and fine slide up/down/to note</li>
<li>Set sample offset</li>
<li>Volume slide</li>
<li>Pattern break</li>
<li>Filter on/off</li>
<li>Set volume</li>
<li>Cut sample</li>
<li>Delay sample</li>
<li>Delay pattern</li>
<li>Set speed</li>
</ul>
<p>Due to size constraints tremolo and vibrato is not supported. Also,
to avoid infinite long songs, the position jump feature is ignored.</p>
<h3 id="songs">Songs</h3>
<p>With his permission, the package includes two songs composed by
Henrik Bertilsson, also known as Deelite:</p>
<ol type="1">
<li>Mad World</li>
<li>Randowan</li>
</ol>
<h3 id="build">Build</h3>
<p>Compiling for Unix systems (including cygwin) is straight
forward:</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">gcc</span> <span class="at">-o</span> vik vik.c</span></code></pre></div>
<h3 id="usage">Usage</h3>
<h4 id="convert-mod-file-to-raw-44.1khz-stereo-audio-file">Convert MOD
file to raw 44.1kHz stereo audio file</h4>
<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">./vik</span> mad_world.mod <span class="op">&gt;</span> audio_file.raw</span></code></pre></div>
<h4 id="listen-to-the-mod-file-streaming-to-mplayer">Listen to the MOD
file (streaming to mplayer)</h4>
<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">./vik</span> randowan.mod <span class="kw">|</span> <span class="ex">mplayer</span> <span class="at">-demuxer</span> rawaudio <span class="at">-</span></span></code></pre></div>
<p>(Don’t forget the last <code>-</code> as it makes mplayer read from
<code>stdin</code>.)</p>
<h3 id="obfuscation">Obfuscation</h3>
<p>The IOCCC rules did not put a limit on the entropy of the source
code, and it appears that the general entropy rules don’t apply. An
estimate is that the code density entropy of this entry is
<code>~1.2</code> which means that there are around 2500 characters of
code carrying information, yet there are only 2037 IOCCC characters of
actual code. Most of the additional characters are encoded with
non-counting characters in the frequency table. But there are also
<code>~50</code> or so white space characters spread out through the
source code that carry information.</p>
<p>The use of macros certainly adds to the obfuscation but the reason
for using them is mainly to fit as many features as possible within the
size limits. So please excuse the use of them.</p>
<p>Once the preprocessor is run, the code gets more interesting. The MOD
player is basically a register based <a
href="https://en.wikipedia.org/wiki/Finite-state_machine">state
machine</a> and all the <a
href="https://en.wikipedia.org/wiki/Magic_(programming)#Variants">magic</a>
is hidden in a fog of short statements. Many of the register updates are
conditional and the program uses the <code>?:</code> operator (sigh)
mainly to save space, but also to leverage the comma operator and
precedence more efficiently.</p>
<h3 id="portability">Portability</h3>
<p>The program is portable to most platforms. The only system dependency
is that the program relies on writing binary data to
<code>stdout</code>.</p>
<p>Microsoft compilers adds a carriage return to newlines, and to
compile the program with this platform, the following line can be added
after the main declaration in order for the program to run
correctly:</p>
<div class="sourceCode" id="cb11"><pre class="sourceCode c"><code class="sourceCode c"><span id="cb11-1"><a href="#cb11-1" aria-hidden="true" tabindex="-1"></a>_setmode<span class="op">(</span>_fileno<span class="op">(</span>stdout<span class="op">),</span> <span class="bn">0x8000</span><span class="op">);</span></span></code></pre></div>
<p>NOTE: this is what the <a href="#alternate-code">alternate
version</a> is for.</p>
<h3 id="limitations">Limitations</h3>
<p>The program only runs when a valid MOD file is passed as argument. If
no argument is passed, the program crashes.</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-2011vik"><a name="inventory"></a>Inventory for
2011/vik</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/2011/vik/vik.c">vik.c</a>
- winning source</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2011/vik/Makefile">Makefile</a>
- winner Makefile</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2011/vik/vik.alt.c">vik.alt.c</a>
- alternative source</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2011/vik/vik.orig.c">vik.orig.c</a>
- original source</li>
<li><a href="mad_world.mod">mad_world.mod</a> - 4-channel Protracker
module sound data</li>
<li><a href="randowan.mod">randowan.mod</a> - 4-channel Protracker
module sound data</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2011/vik/raw2wav">raw2wav</a>
- convert raw format to wav format</li>
<li><a href="2011_vik.tar.bz2">2011_vik.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/2011/vik/.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/2011/vik/.winner.json">.winner.json</a>
- description of winner in JSON</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2011/vik/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%2F2011%2Fvik%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 -->
+334 -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,346 @@
<!-- !!! DO NOT MODIFY THIS FILE - This file is generated by a tool !!! -->
<!-- !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<!-- -->
<!-- file: 2011/zucker/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>2011 zucker</title>
<meta name="description" content="IOCCC year: 2011 IOCCC winner: zucker winner index page">
<meta name="keywords" content="IOCCC,2011,zucker,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>2011/zucker</title>
<meta name="description" content="2011 IOCCC winner zucker">
<meta name="keywords" content="IOCCC, 2011, IOCCC 2011, IOCCC winner, zucker">
</head>
<!-- END: this line ends content from: inc/head.default.html -->
<!-- START: this line starts content from: inc/body.default.html -->
<body>
<h1>2011 zucker</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>2011/zucker</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%2F2011%2Fzucker%2Findex.html">Nu Html check https://ioccc-src.github.io/temp-test-ioccc/2011/zucker/index.html</a></p>
<!-- End Nu Html Checker -->
<div class="topnav">
<a class="Left" href="../vik/index.html">&larr; vik</a>
<a class="Left" href="../index.html">&uarr; 2011 &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#Matt_Zucker">Matt Zucker</a><br>
Location: <a href="/temp-test-ioccc/location.html#US">US</a></p>
<!-- END: next line ends content generated by: bin/gen-author.sh -->
<h2 id="to-build">To build:</h2>
<div class="sourceCode" id="cb1"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb1-1"><a href="#cb1-1" aria-hidden="true" tabindex="-1"></a><span class="fu">make</span></span></code></pre></div>
<p>There is an alternate version which should work for Windows which
distinguishes binary mode from text mode. 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">./zucker</span> <span class="op">&gt;</span> image.ppm</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">./zucker</span> <span class="st">&quot;Hello\!\!\!&quot;</span> <span class="op">&gt;</span> hello.ppm</span>
<span id="cb3-2"><a href="#cb3-2" aria-hidden="true" tabindex="-1"></a><span class="ex">./zucker</span> faster<span class="dt">\!</span> <span class="at">-preview</span> <span class="op">&gt;</span> image2.ppm</span></code></pre></div>
<p>Display the PPM image with your favorite image viewer.</p>
<h2 id="alternate-code">Alternate code:</h2>
<p>This version uses the Windows functions <code>_setmode()</code> and
<code>_fileno()</code> to set binary mode on <code>stdout</code> which
the author noted would be necessary for systems that distinguish binary
and text.</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>zucker.alt</code> as you would <code>zucker</code>
above.</p>
<h3 id="alternate-try">Alternate try:</h3>
<p>Try <code>zucker.alt</code> instead of <code>zucker</code> above.</p>
<h2 id="judges-remarks">Judges’ remarks:</h2>
<p>The rendered image is centered and is output as a 600 by 220 pixel
PPM. The vector font is proportional.</p>
<p>This entry uses no local variables. None! At! All!</p>
<h2 id="authors-remarks">Author’s remarks:</h2>
<h3 id="an-image-generator">An image generator</h3>
<h4 id="what-it-does">What it does:</h4>
<p>This program makes pretty pictures. To see the default output, try
running</p>
<div class="sourceCode" id="cb5"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb5-1"><a href="#cb5-1" aria-hidden="true" tabindex="-1"></a><span class="ex">./zucker</span> <span class="op">&gt;</span> ioccc2011.ppm</span></code></pre></div>
<p>On the author’s 2.5 GHz MacBook Pro, this command takes approximately
1 minute and 18 seconds to run – your runtime may vary. You will need an
image viewer capable of displaying <a
href="https://en.wikipedia.org/wiki/Netpbm">Netpbm images</a> in order
to display the output. On the Mac, the system supplied
<code>Preview.app</code> works well; otherwise <a
href="http://www.imagemagick.org/">ImageMagick</a> and/or <a
href="http://www.graphicsmagick.org/">GraphicsMagick</a> are both
capable of displaying Netpbm files, and are available on multiple
platforms.</p>
<p>With macOS you can type at the command line:</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">open</span> ioccc2021.ppm</span></code></pre></div>
<p>and it will open image in the default application Preview.app.</p>
<p>To use ImageMagick you might do something like:</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">convert</span> ioccc2011.ppm ioccc2011.png</span></code></pre></div>
<p>and then open <code>ioccc2011.png</code> in your viewer of
choice.</p>
<p>To use GraphicsMagick you might do something like:</p>
<div class="sourceCode" id="cb8"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb8-1"><a href="#cb8-1" aria-hidden="true" tabindex="-1"></a><span class="ex">gm</span> convert ioccc2011.ppm ioccc2011.png</span></code></pre></div>
<p>and then open <code>ioccc2011.png</code> in your viewer of
choice.</p>
<p>Aside from the default image, you may create your own by running the
program as follows:</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">./zucker</span> <span class="st">&quot;your text&quot;</span> <span class="op">&gt;</span> image.ppm</span></code></pre></div>
<p>To mitigate long runtime, the program can be invoked in a “preview”
mode by appending <code>-preview</code> to the command line arguments,
like so:</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">./zucker</span> faster<span class="dt">\!</span> <span class="at">-preview</span> <span class="op">&gt;</span> image.ppm</span></code></pre></div>
<p>If your platform distinguishes between binary and text streams, you
may need to insert some code to reopen standard output in binary mode at
the start of <code>main()</code> (the provided <a
href="#alternate-code">alternate version</a> will set binary mode on
<code>stdout</code> in Windows). An ASCII platform is assumed.</p>
<h4 id="pedagogical-value">Pedagogical value:</h4>
<p>This program is quite suitable for the inexperienced programmer, due
to a number of considerations:</p>
<ul>
<li><p>It is fairly short: just 4 preprocessor directives followed by 29
lines of source.</p></li>
<li><p>It compiles cleanly as ANSI C under gcc 4.2.1 with very strict
compilation flags.</p></li>
<li><p>It uses a very small subset of the keywords available in C,
namely <code>char</code>, <code>float</code>, <code>int</code>,
<code>typedef</code>, <code>struct</code>, <code>for</code>, and
<code>return</code>. More difficult concepts such as <code>void</code>,
<code>if</code>, <code>switch</code>, and <code>while</code> are
eschewed for simplicity’s sake.</p></li>
<li><p>It also uses a very small number of library functions: just
<code>putchar(3)</code>, <code>cos(3)</code>, <code>sin(3)</code>,
<code>atan2(3)</code>, <code>sqrt(3)</code>, and
<code>pow(3)</code>.</p></li>
<li><p>New programmers often prefer to use global variables when
possible. Hence, <em>all</em> variables in this program (aside from
function parameters) have global scope.</p></li>
<li><p>An important aspect of the computation is graphically illustrated
by the source code itself: the geometric construction of a reflection
ray at an object’s surface, given the incoming direction and surface
normal.</p></li>
</ul>
<h4 id="further-details-contains-spoilers">Further details (contains
spoilers):</h4>
<p>The program is not quite a traditional <a
href="https://en.wikipedia.org/wiki/Ray_tracing_(graphics)">ray
tracer</a>, but a “<a href="sphere-tracing.pdf">sphere tracer</a>” which
uses distance fields to encode proximity to objects in the scene. Using
sphere tracing to compute visibility instead of analytic ray tracing
provides two advantages: first, it greatly eases the computation of <a
href="https://en.wikipedia.org/wiki/Toric_lens#Torus">ray-torus</a>
intersection (which would otherwise require solving a quartic
polynomial), and second, it makes it possible to compute <a
href="https://en.wikipedia.org/wiki/Ambient_occlusion">ambient
occlusion</a> (which is used to generate soft shadows). Unlike many
traditional ray tracers and sphere tracers, this one uses iteration
instead of recursion to compute the effect of reflections. This,
unfortunately, resulted in the programmer going insane; however, program
size was reduced and readability hindered. Neither the plaintext for the
program’s default output nor for the Netpbm header appears in the
program source, which hinders readability as well. Also, unlike some
previous IOCCC entries which render ASCII text, this one uses a vector
(as opposed to raster) font. Although the program does not generate
uppercase letters, it handles them in a reasonable manner when they
appear in the input.</p>
<p>Even when the program is pretty-printed and preprocessor macros are
translated, it should be fairly resistant to analysis due to reckless
reuse of global variables, the inherently opaque nature of the math, and
its overall density. Global variables are used to store the results of
intermediate computation. As a result, seemingly simple functions have
important side effects. Although some of the global variables are simply
constants, their use is overloaded. For instance, the variable
<code>X</code> is used both as the number <code>40</code> and as the
ASCII character <code>'('</code>. Maintainability is hindered due to
hardcoding several aspects of the program in multiple locations. As an
example, it is impossible to modify either the image width or height
without changing the source in at least three different places,
including inside the large string literal <code>J</code>.</p>
<p>Some of the functions are simple vector algebraic operations such as
vector construction, dot product, and normalization. However, it was
found to be much more compact to define a single operation for
multiply-and-add rather than to have separate functions for addition,
subtraction, and scaling. Again, compactness led to obfuscation.</p>
<p>This program heavily abuses <code>for</code> loops. The comma
operator is used to get as much mileage as possible out of statements
inside of loop declarations. Between <code>for</code> loops, the comma
operator, and the ternary operator, it was possible to avoid
<code>if</code> and <code>while</code> altogether.</p>
<p>Bitwise and arithmetic operators are used instead of logical
operators whenever gcc doesn’t warn about it. Conversely, integer
multiplication, division, and modulus are sometimes used in place of
traditional bitwise operators just to keep the reader on his or her
toes. Automatic casting between characters, integers, and floats is
performed just about everywhere. Fascinatingly, this doesn’t seem to
affect performance too badly. Sometimes when an explicit cast (i.e. from
<code>float</code> to <code>int</code>) is needed, the program instead
simply assigns to a free variable of the desired type instead. Both the
<code>array[index]</code> and <code>index[array]</code> notations are
used interchangeably throughout the program.</p>
<p>Two other programs were written to support development of this
program. The first used a randomized search algorithm to deduce the most
compact encoding of the vector font instructions into ASCII; the second
used a modified form of the <a
href="https://en.wikipedia.org/wiki/Line_wrap_and_word_wrap">Knuth-Plass</a>
algorithm to layout the final text on top of a hand-generated ASCII
“stencil”. The programs were not submitted as entries for this year’s
IOCCC, not because they lack obfuscation, but because neither is written
in C (they are in C++ and Python, respectively).</p>
<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-2011zucker"><a name="inventory"></a>Inventory for
2011/zucker</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/2011/zucker/zucker.c">zucker.c</a>
- winning source</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2011/zucker/Makefile">Makefile</a>
- winner Makefile</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2011/zucker/zucker.alt.c">zucker.alt.c</a>
- alternative source</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2011/zucker/zucker.orig.c">zucker.orig.c</a>
- original source</li>
<li><a href="sphere-tracing.pdf">sphere-tracing.pdf</a> - research paper
on antialiased ray tracing</li>
<li><a href="2011_zucker.tar.bz2">2011_zucker.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/2011/zucker/.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/2011/zucker/.winner.json">.winner.json</a>
- description of winner in JSON</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2011/zucker/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%2F2011%2Fzucker%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 -->