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

+247 -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,259 @@
<!-- !!! DO NOT MODIFY THIS FILE - This file is generated by a tool !!! -->
<!-- !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<!-- -->
<!-- file: 2020/burton/index.html created by: fake.gen_index.sh version: 1.0.5 2023-10-31 -->
<html lang="en">
<!-- END: this line ends content from: inc/top.default.html -->
<!-- -->
<!-- This file was formed by the tool: bin/readme2index.sh version: 1.1 2024-01-16 -->
<!-- -->
<!-- START: this line starts content from: inc/head.default.html -->
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>2020 burton</title>
<meta name="description" content="IOCCC year: 2020 IOCCC winner: burton winner index page">
<meta name="keywords" content="IOCCC,2020,burton,winner index page">
<link rel="stylesheet" href="/temp-test-ioccc/ioccc.css">
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=yes">
<title>2020/burton</title>
<meta name="description" content="2020 IOCCC winner burton">
<meta name="keywords" content="IOCCC, 2020, IOCCC 2020, IOCCC winner, burton">
</head>
<!-- END: this line ends content from: inc/head.default.html -->
<!-- START: this line starts content from: inc/body.default.html -->
<body>
<h1>2020 burton</h1>
<!-- END: this line ends content from: inc/body.default.html -->
<!-- START: this line starts content from: inc/header.default.html -->
<p>XXX - fake content until readme2index is working - XXX</p>
<div class="header">
<img src="/temp-test-ioccc/png/ioccc.png" alt="IOCCC image by Matt Zucker" width=300 height=110>
<h1>The International Obfuscated C Code Contest</h1>
<h2>2020/burton</h2>
</div>
<hr style="width:50%;text-align:left;margin-left:0">
<!-- END: this line ends content from: inc/header.default.html -->
<!-- START: this line starts content from: inc/topnav.first.html -->
<!-- Start Nu Html Checker -->
<p><a href="https://validator.w3.org/nu/?doc=https%3A%2F%2Fioccc-src.github.io%2Ftemp-test-ioccc%2F2020%2Fburton%2Findex.html">Nu Html check https://ioccc-src.github.io/temp-test-ioccc/2020/burton/index.html</a></p>
<!-- End Nu Html Checker -->
<div class="topnav">
<a class="Left Disabled" href="#">first entry</a>
<a class="Left" href="../index.html">&uarr; 2020 &uarr;</a>
<a class="Left" href="../carlini/index.html">carlini &rarr;</a>
<a class="Right" href="#inventory">Inventory</a>
</div>
<!-- END: this line ends content from: inc/topnav.first.html -->
<!-- START: this line starts content from: inc/begin-row.default.html -->
<div class="row">
<!-- END: this line ends content from: inc/begin-row.default.html -->
<!-- START: this line starts content from: inc/begin-leftcolumn.default.html -->
<div class="leftcolumn">
<!-- END: this line ends content from: inc/begin-leftcolumn.default.html -->
<!-- START: this line starts content from: inc/sidenav.default.html -->
<div class="sidenav">
<a href="#content">Jump to contents</a>
</div>
<hr>
<div class="sidenav">
<a href="/temp-test-ioccc/index.html">IOCCC Home</a>
<a href="/temp-test-ioccc/years.html">Winning Entries</a>
<a href="/temp-test-ioccc/winners.html">People who have won</a>
</div>
<hr>
<div class="sidenav">
<a href="/temp-test-ioccc/news.html">IOCCC News</a>
<a href="/temp-test-ioccc/faq.html#submit">How to enter the IOCCC</a>
<a href="/temp-test-ioccc/faq.html">FAQ</a>
</div>
<hr>
<div class="sidenav">
<a href="/temp-test-ioccc/bugs.html">Bugs &amp; (mis)features</a>
<a href="/temp-test-ioccc/faq.html#fix_a_winner">Fixing IOCCC winners</a>
<a href="/temp-test-ioccc/faq.html#fix_web_site">Fixing the web site</a>
<a href="/temp-test-ioccc/faq.html#fix_author">Fixing winner info</a>
<a href="/temp-test-ioccc/thanks-for-help.html">Thanks for the help</a>
</div>
<hr>
<div class="sidenav">
<a href="/temp-test-ioccc/judges.html">The IOCCC Judges</a>
<a href="/temp-test-ioccc/contact.html">Contacting the IOCCC</a>
</div>
<hr>
<div class="sidenav">
<a href="#top">Jump to top</a>
</div>
<!-- END: this line ends content from: inc/sidenav.default.html -->
<!-- START: this line starts content from: inc/end-leftcolumn.default.html -->
</div>
<!-- END: this line ends content from: inc/end-leftcolumn.default.html -->
<!-- START: this line starts content from: inc/begin-rightcolumn.default.html -->
<div class="rightcolumn">
<!-- END: this line ends content from: inc/begin-rightcolumn.default.html -->
<!-- START: this line starts content from: inc/before-content.default.html -->
<a name="content"></a>
<!-- END: this line ends content from: inc/before-content.default.html -->
<!-- START: this line starts content generated by: bin/gen-author.sh -->
<p><a name="author"><strong>Author:</strong></a> <br><br>Name: <a
href="/temp-test-ioccc/winners.html#Dave_Burton">Dave Burton</a><br>
Location: <a href="/temp-test-ioccc/location.html#US">US</a></p>
<!-- END: next line ends content generated by: bin/gen-author.sh -->
<h2 id="to-build">To build:</h2>
<div class="sourceCode" id="cb1"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb1-1"><a href="#cb1-1" aria-hidden="true" tabindex="-1"></a><span class="fu">make</span></span></code></pre></div>
<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#2020-burton">2020
burton in bugs.md</a>.</p>
<h2 id="to-use">To use:</h2>
<div class="sourceCode" id="cb3"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb3-1"><a href="#cb3-1" aria-hidden="true" tabindex="-1"></a><span class="ex">./prog</span> arg ...</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="alternate-code">Alternate code:</h2>
<p>By default, the program works for Little Endian machines. This
alternate build is for Big Endian machines (that works whether you have
LE or BE).</p>
<h3 id="alternate-build">Alternate build:</h3>
<p>Running <code>make</code> builds the alternate code by default.</p>
<h3 id="alternate-use">Alternate use:</h3>
<p>Use <code>prog_be</code> as you would <code>prog</code> above.</p>
<h2 id="judges-remarks">Judges’ remarks:</h2>
<p>Can you determine why this shows strange output for
<code>./prog 128 128</code> and <code>./prog 128 128 128 128</code> but
not <code>./prog 128 128 128</code>?</p>
<p>Can you find a pattern here?</p>
<p>What happens if you specify different numbers?</p>
<p>This tiny one-liner is a bit-twiddler’s delight! It does all of the
work without looping.</p>
<p>To understand how it works, a good place to start is to look at the
hex value that results when the two magic constants are
<code>XOR</code>ed.</p>
<p>Once you’ve figured out what happens with one set of constants, how
can choosing new constants, but using the same computation generate a
reversed result?</p>
<p>This code may be tested by:</p>
<div class="sourceCode" id="cb5"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb5-1"><a href="#cb5-1" aria-hidden="true" tabindex="-1"></a><span class="fu">make</span> test</span></code></pre></div>
<h2 id="authors-remarks">Author’s remarks:</h2>
<p>Invoke this with a single non-negative integer less than 256, and a
useful transformation occurs.</p>
<h3 id="rule-2-ish">Rule 2-ish:</h3>
<p>Exporting the constants
<code>B</code>,<code>I</code>,<code>T</code>,<code>S</code> to the <a
href="Makefile">Makefile</a> allows the code to be compiled for either
LE (little-endian) or BE (big-endian) machines(!!), so they are truly
configuration parameters, not logic.</p>
<h3 id="notes">Notes:</h3>
<p>One <strike>ping</strike> argument only. It will segfault on zero
arguments, and display strange results with more than one argument.</p>
<p>Small, non-negative integers only. Useful range is
<code>0 .. 511</code>, sorta, for LE; <code>0 .. 255</code> for BE.
Bonus points if you can explain why the limits work this way.</p>
<p>ASCII character set, 64-bit <code>long long</code>s are required.</p>
<p>v,a,r,i,a,b,l,e,s_NAME the operation.</p>
<p>No loops, no branches?!?</p>
<h4 id="compilation">Compilation:</h4>
<p>Compiles cleanly under
<code>clang -Wall -Weverything -pedantic</code>, but you need to add
<code>--include stdio.h --include stdlib.h</code> for the
<code>printf(3)</code> and <code>atoi(3)</code>.</p>
<p>On a little-endian machine:</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">clang</span> <span class="at">-include</span> stdio.h <span class="at">-include</span> stdlib.h <span class="at">-Wall</span> <span class="at">-Weverything</span> <span class="at">-pedantic</span> <span class="at">-DB</span><span class="op">=</span>6945503773712347754LL <span class="at">-DI</span><span class="op">=</span>5859838231191962459LL <span class="at">-DT</span><span class="op">=</span>0 <span class="at">-DS</span><span class="op">=</span>7 <span class="at">-o</span> prog prog.c</span></code></pre></div>
<p>On a big-endian machine:</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">clang</span> <span class="at">-include</span> stdio.h <span class="at">-include</span> stdlib.h <span class="at">-Wall</span> <span class="at">-Weverything</span> <span class="at">-pedantic</span> <span class="at">-DB</span><span class="op">=</span>7091606191627001958LL <span class="at">-DI</span><span class="op">=</span>6006468689561538903LL <span class="at">-DT</span><span class="op">=</span>1 <span class="at">-DS</span><span class="op">=</span>0 <span class="at">-o</span> prog_be prog.c</span></code></pre></div>
<p>You might be interested to compile it both ways on the same host, and
try:</p>
<div class="sourceCode" id="cb8"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb8-1"><a href="#cb8-1" aria-hidden="true" tabindex="-1"></a><span class="ex">./prog</span> 1<span class="kw">;</span> <span class="ex">./prog_be</span> 1</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-2020burton"><a name="inventory"></a>Inventory for
2020/burton</h1>
<h2 id="primary-files">Primary files</h2>
<ul>
<li><a href="index.html">index.html</a> - winner home page</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2020/burton/prog.c">prog.c</a>
- winning source</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2020/burton/Makefile">Makefile</a>
- winner Makefile</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2020/burton/prog.orig.c">prog.orig.c</a>
- original source</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2020/burton/try.sh">try.sh</a>
- how to run</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2020/burton/check_be.sh">check_be.sh</a>
- test suite support file</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2020/burton/check_le.sh">check_le.sh</a>
- test suite support file</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2020/burton/correct">correct</a>
- test suite comparison data</li>
<li><a href="2020_burton.tar.bz2">2020_burton.tar.bz2</a> - download
winning source</li>
</ul>
<h2 id="secondary-files">Secondary files</h2>
<ul>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2020/burton/.gitignore">.gitignore</a>
- list of files that should not be committed under git</li>
<li><a href=".path">.path</a> - directory path from top directory</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2020/burton/.winner.json">.winner.json</a>
- description of winner in JSON</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2020/burton/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%2F2020%2Fburton%2Findex.html">Nu HTML check this web page</a></p>
<p><a href="#top">Jump to top</a> <a href="#content">Jump to Content</a> <a href="#inventory">Jump to Inventory</a></p>
</div>
<!-- END: this line ends content from: inc/footer.default.html -->
<!-- START: this line starts content from: inc/bottom.default.html -->
</body>
</html>
<!-- END: this line ends content from: inc/bottom.default.html -->
+2 -2
View File
@@ -242,9 +242,9 @@ the following expression
where argument 1 is a pointer to a temporary variable followed by a NUL byte.
This works because if the current count is 0 mod 256, then `"%1$hhn"` will write
zero to argument 1 and then "%1$s" will never emit any text. If, on the other
zero to argument 1 and then "%1\$s" will never emit any text. If, on the other
hand, the count is not 0 mod 256, a length-1 string will be written to argument
1, and then `"%1$s"` will increment the count by one. By repeating this 256
1, and then `"%1\$s"` will increment the count by one. By repeating this 256
times we're eventually going to reach 0 mod 256.
Checking if there has been an invalid move is achieved similarly.
+391 -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,403 @@
<!-- !!! DO NOT MODIFY THIS FILE - This file is generated by a tool !!! -->
<!-- !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<!-- -->
<!-- file: 2020/carlini/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>2020 carlini</title>
<meta name="description" content="IOCCC year: 2020 IOCCC winner: carlini winner index page">
<meta name="keywords" content="IOCCC,2020,carlini,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>2020/carlini</title>
<meta name="description" content="2020 IOCCC winner carlini">
<meta name="keywords" content="IOCCC, 2020, IOCCC 2020, IOCCC winner, carlini">
</head>
<!-- END: this line ends content from: inc/head.default.html -->
<!-- START: this line starts content from: inc/body.default.html -->
<body>
<h1>2020 carlini</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>2020/carlini</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%2F2020%2Fcarlini%2Findex.html">Nu Html check https://ioccc-src.github.io/temp-test-ioccc/2020/carlini/index.html</a></p>
<!-- End Nu Html Checker -->
<div class="topnav">
<a class="Left" href="../burton/index.html">&larr; burton</a>
<a class="Left" href="../index.html">&uarr; 2020 &uarr;</a>
<a class="Left" href="../endoh1/index.html">endoh1 &rarr;</a>
<a class="Right" href="#inventory">Inventory</a>
</div>
<!-- END: this line ends content from: inc/topnav.mid.html -->
<!-- START: this line starts content from: inc/begin-row.default.html -->
<div class="row">
<!-- END: this line ends content from: inc/begin-row.default.html -->
<!-- START: this line starts content from: inc/begin-leftcolumn.default.html -->
<div class="leftcolumn">
<!-- END: this line ends content from: inc/begin-leftcolumn.default.html -->
<!-- START: this line starts content from: inc/sidenav.default.html -->
<div class="sidenav">
<a href="#content">Jump to contents</a>
</div>
<hr>
<div class="sidenav">
<a href="/temp-test-ioccc/index.html">IOCCC Home</a>
<a href="/temp-test-ioccc/years.html">Winning Entries</a>
<a href="/temp-test-ioccc/winners.html">People who have won</a>
</div>
<hr>
<div class="sidenav">
<a href="/temp-test-ioccc/news.html">IOCCC News</a>
<a href="/temp-test-ioccc/faq.html#submit">How to enter the IOCCC</a>
<a href="/temp-test-ioccc/faq.html">FAQ</a>
</div>
<hr>
<div class="sidenav">
<a href="/temp-test-ioccc/bugs.html">Bugs &amp; (mis)features</a>
<a href="/temp-test-ioccc/faq.html#fix_a_winner">Fixing IOCCC winners</a>
<a href="/temp-test-ioccc/faq.html#fix_web_site">Fixing the web site</a>
<a href="/temp-test-ioccc/faq.html#fix_author">Fixing winner info</a>
<a href="/temp-test-ioccc/thanks-for-help.html">Thanks for the help</a>
</div>
<hr>
<div class="sidenav">
<a href="/temp-test-ioccc/judges.html">The IOCCC Judges</a>
<a href="/temp-test-ioccc/contact.html">Contacting the IOCCC</a>
</div>
<hr>
<div class="sidenav">
<a href="#top">Jump to top</a>
</div>
<!-- END: this line ends content from: inc/sidenav.default.html -->
<!-- START: this line starts content from: inc/end-leftcolumn.default.html -->
</div>
<!-- END: this line ends content from: inc/end-leftcolumn.default.html -->
<!-- START: this line starts content from: inc/begin-rightcolumn.default.html -->
<div class="rightcolumn">
<!-- END: this line ends content from: inc/begin-rightcolumn.default.html -->
<!-- START: this line starts content from: inc/before-content.default.html -->
<a name="content"></a>
<!-- END: this line ends content from: inc/before-content.default.html -->
<!-- START: this line starts content generated by: bin/gen-author.sh -->
<p><a name="author"><strong>Author:</strong></a> <br><br>Name: <a
href="/temp-test-ioccc/winners.html#Nicholas_Carlini">Nicholas
Carlini</a><br> Location: <a
href="/temp-test-ioccc/location.html#US">US</a></p>
<!-- END: next line ends content generated by: bin/gen-author.sh -->
<h2 id="to-build">To build:</h2>
<div class="sourceCode" id="cb1"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb1-1"><a href="#cb1-1" aria-hidden="true" tabindex="-1"></a><span class="fu">make</span></span></code></pre></div>
<h3 id="bugs-and-misfeatures">Bugs and (Mis)features:</h3>
<p>The current status of this entry is:</p>
<pre><code>STATUS: INABIAF - please **DO NOT** fix</code></pre>
<p>For more detailed information see <a
href="/bugs.md#2020-carlini">2020 carlini in bugs.md</a>.</p>
<h2 id="to-use">To use:</h2>
<div class="sourceCode" id="cb3"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb3-1"><a href="#cb3-1" aria-hidden="true" tabindex="-1"></a><span class="ex">./prog</span></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>Or if you actually want to play:</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="co"># Play with a friend, real or imagined, P1 and P2, squares are numbered 1..9</span></span>
<span id="cb5-2"><a href="#cb5-2" aria-hidden="true" tabindex="-1"></a><span class="ex">./prog</span></span></code></pre></div>
<h2 id="judges-remarks">Judges’ remarks:</h2>
<p>This program consists of a single <code>printf(3)</code> statement
wrapped in a <code>while</code> loop. You would not think that this
would amount to much, but you would be very, very wrong. A clue to what
is happening and how this works is encoded in the ASCII art of the
program source.</p>
<h2 id="authors-remarks">Author’s remarks:</h2>
<p>HOW ABOUT A NICE GAME OF <strike>CHESS</strike>TIC-TAC-TOE?</p>
<h3 id="usage">USAGE</h3>
<div class="sourceCode" id="cb6"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb6-1"><a href="#cb6-1" aria-hidden="true" tabindex="-1"></a><span class="fu">cc</span> <span class="at">-o</span> prog prog.c</span>
<span id="cb6-2"><a href="#cb6-2" aria-hidden="true" tabindex="-1"></a><span class="ex">./prog</span></span></code></pre></div>
<p>Alternates between P1 and P2. Enter a digit [1-9] to move:</p>
<pre><code>1 | 2 | 3
---------
4 | 5 | 6
---------
7 | 8 | 9</code></pre>
<p>The game ends if:</p>
<ul>
<li>A player completes three in a row; that player wins.</li>
<li>All squares are taken; neither player wins.</li>
<li>A player makes an illegal move; their opponent wins.</li>
</ul>
<h3 id="limitations">LIMITATIONS</h3>
<p>Bad things may happen if the entered move is outside of the range
[1..9]</p>
<p>While the game will stop if one player tries to overwrite another
player’s move, it will happily allow a player to move on top of
themself. However, given that this is an effective no-op and guarantees
a loss to a competent opponent, if you do this you probably deserve to
lose.</p>
<p>Your terminal may beep at you every turn. We’ll call this a feature
that … the program … is hard at work processing your move! That is!
Please be patient.</p>
<p>After macro expansion the format string is roughly 100K. This makes
some compilers unhappy, and others slow. (For example, passing GCC the
flags <code>-Wall -Wextra -pedantic</code> will result in a warning
about oversized strings.)</p>
<p>Under some terminals the program may exit early. The following should
always work:</p>
<div class="sourceCode" id="cb8"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb8-1"><a href="#cb8-1" aria-hidden="true" tabindex="-1"></a><span class="bu">echo</span> <span class="st">&quot;1 2 3 4 5 6 7&quot;</span> <span class="kw">|</span> <span class="ex">./prog</span></span></code></pre></div>
<h3 id="obfuscation">OBFUSCATION</h3>
<p>The entirety of the program consists of a single iterated call to
<code>printf(3)</code>.</p>
<div class="sourceCode" id="cb9"><pre class="sourceCode c"><code class="sourceCode c"><span id="cb9-1"><a href="#cb9-1" aria-hidden="true" tabindex="-1"></a><span class="dt">int</span> main<span class="op">()</span> <span class="op">{</span></span>
<span id="cb9-2"><a href="#cb9-2" aria-hidden="true" tabindex="-1"></a> <span class="cf">while</span><span class="op">(*</span>d<span class="op">)</span> printf<span class="op">(</span>fmt<span class="op">,</span> arg<span class="op">);</span></span>
<span id="cb9-3"><a href="#cb9-3" aria-hidden="true" tabindex="-1"></a><span class="op">}</span></span></code></pre></div>
<p>Here, <code>fmt</code> is a single string, and <code>arg</code> is a
series of arguments to <code>printf(3)</code>.</p>
<p>While its primary purpose is to serve as The One True Debugger,
<code>printf(3)</code> also happens to be Turing complete. (See
“Control-Flow Bending: On the Effectiveness of Control-Flow Integrity”
where we introduced this in an actual, published, academic paper. The
things you can get away with sometimes.)</p>
<p>We <strike>ab</strike>use this fact to implement the logic of
tic-tac-toe entirely within this one <code>printf(3)</code> call (and a
call to <code>scanf(3)</code> to read user input).</p>
<p>Here’s (briefly) how it works.</p>
<h4 id="preliminaries">Preliminaries</h4>
<p>This program uses three <code>printf(3)</code> format specifiers.</p>
<ul>
<li><p><code>%d</code> takes an integer argument and prints it.</p></li>
<li><p><code>%s</code> takes a string argument and prints it.</p></li>
<li><p><code>%n</code> takes a pointer and writes (!!) the number of
bytes printed so far.</p></li>
</ul>
<p>Okay, everyone probably knows this. Let’s get a bit more
advanced.</p>
<p>Format specifiers can take extra “arguments”.</p>
<ul>
<li><p><code>"%hhn"</code>: store the number of bytes written mod 256 to
the <code>char</code> pointer.</p></li>
<li><p><code>"%2$d"</code>: print argument 2 to <code>printf(3)</code>
(and not the sequentially next argument).</p></li>
<li><p><code>"%8d"</code>: pad the printed integer to 8
characters.</p></li>
<li><p><code>"%3$.*4$d"</code>: print argument 3 to
<code>printf(3)</code> with as many zeros as in argument 4.</p></li>
</ul>
<p>For example, the following expression</p>
<div class="sourceCode" id="cb10"><pre class="sourceCode c"><code class="sourceCode c"><span id="cb10-1"><a href="#cb10-1" aria-hidden="true" tabindex="-1"></a>printf<span class="op">(</span><span class="st">&quot;%1$.*2$d%3$hhn&quot;</span><span class="op">,</span> <span class="dv">5</span><span class="op">,</span> <span class="dv">10</span><span class="op">,</span> <span class="op">&amp;</span>x<span class="op">)</span></span></code></pre></div>
<p>will have the same effect as if we had written</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>x <span class="op">=</span> <span class="dv">10</span><span class="op">;</span></span></code></pre></div>
<p>because it will print out <code>0000000005</code> (5 padded to size
10) and then write the number of bytes written to <code>x</code>.</p>
<h4 id="printf3-oriented-programming"><code>printf(3)</code> Oriented
Programming</h4>
<p>Alright, now we can get to the real fun.</p>
<p>We perform arbitrary computation with <code>printf(3)</code> treating
memory as a binary array–one bit per pair of bytes:</p>
<ul>
<li><p>The zero bit is represented by the sequence
<code>00 00</code>.</p></li>
<li><p>The one-bit is represented by the sequence <code>xx 00</code>
where <code>xx</code> is any non-zero byte.</p></li>
</ul>
<p>We can use format strings to compute the OR/NOT of arbitrary
“bits”.</p>
<p>We’ll start with the simplest, OR:</p>
<div class="sourceCode" id="cb12"><pre class="sourceCode c"><code class="sourceCode c"><span id="cb12-1"><a href="#cb12-1" aria-hidden="true" tabindex="-1"></a>printf<span class="op">(</span><span class="st">&quot;%1$s%2$s%3$hhn&quot;</span><span class="op">,</span> a<span class="op">,</span> b<span class="op">,</span> c<span class="op">)</span></span></code></pre></div>
<p>will compute</p>
<div class="sourceCode" id="cb13"><pre class="sourceCode c"><code class="sourceCode c"><span id="cb13-1"><a href="#cb13-1" aria-hidden="true" tabindex="-1"></a><span class="op">*</span>c <span class="op">=</span> strlen<span class="op">(</span>a<span class="op">)</span> <span class="op">+</span> strlen<span class="op">(</span>b<span class="op">)</span></span></code></pre></div>
<p>but given that <code>strlen(x)</code> is <code>1</code> for a 1-bit
and <code>0</code> for a 0-bit, we have</p>
<div class="sourceCode" id="cb14"><pre class="sourceCode c"><code class="sourceCode c"><span id="cb14-1"><a href="#cb14-1" aria-hidden="true" tabindex="-1"></a><span class="op">*</span>c <span class="op">=</span> a <span class="op">|</span> b</span></code></pre></div>
<p>Computing the NOT of a single value is also easy:</p>
<div class="sourceCode" id="cb15"><pre class="sourceCode c"><code class="sourceCode c"><span id="cb15-1"><a href="#cb15-1" aria-hidden="true" tabindex="-1"></a>printf<span class="op">(</span><span class="st">&quot;%1$255d%1$s</span><span class="sc">%hhn</span><span class="st">&quot;</span><span class="op">,</span> a<span class="op">,</span> b<span class="op">)</span></span></code></pre></div>
<p>will compute</p>
<div class="sourceCode" id="cb16"><pre class="sourceCode c"><code class="sourceCode c"><span id="cb16-1"><a href="#cb16-1" aria-hidden="true" tabindex="-1"></a><span class="op">*</span>b <span class="op">=</span> <span class="op">(</span>strlen<span class="op">(</span>a<span class="op">)+</span><span class="dv">255</span><span class="op">)%</span><span class="dv">256</span> <span class="op">=</span> strlen<span class="op">(</span>a<span class="op">)-</span><span class="dv">1</span></span></code></pre></div>
<p>and again, because <code>strlen(x)</code> is either <code>1</code> or
<code>0</code> we have</p>
<div class="sourceCode" id="cb17"><pre class="sourceCode c"><code class="sourceCode c"><span id="cb17-1"><a href="#cb17-1" aria-hidden="true" tabindex="-1"></a><span class="op">*</span>c <span class="op">=</span> <span class="op">!</span>b</span></code></pre></div>
<p>From here we can compute any binary circuit. Doing something
efficient, though, still takes work.</p>
<h4 id="tic-tac-toe">Tic-Tac-Toe</h4>
<p>The game itself is represented as a board of 18 bits, 9 bits per
player, along with a turn counter that alternates between player 1 and
player 2.</p>
<p>To detect who has won, we implement the following logic. Let
<code>A</code>, <code>B</code>, and <code>C</code> be pointers to three
squares in a row to test, and <code>D</code> be where to save if there
is a win or not.</p>
<div class="sourceCode" id="cb18"><pre class="sourceCode c"><code class="sourceCode c"><span id="cb18-1"><a href="#cb18-1" aria-hidden="true" tabindex="-1"></a><span class="st">&quot;</span><span class="sc">%A</span><span class="st">$s%B$s%C$s%1$253d%11$hhn&quot;</span> <span class="co">// r11 = !(*A &amp; *B &amp; *C)</span></span>
<span id="cb18-2"><a href="#cb18-2" aria-hidden="true" tabindex="-1"></a>ZERO</span>
<span id="cb18-3"><a href="#cb18-3" aria-hidden="true" tabindex="-1"></a><span class="st">&quot;%11$s%1$255d</span><span class="sc">%11hhn</span><span class="st">&quot;</span> <span class="co">// r11 = !r11</span></span>
<span id="cb18-4"><a href="#cb18-4" aria-hidden="true" tabindex="-1"></a>ZERO</span>
<span id="cb18-5"><a href="#cb18-5" aria-hidden="true" tabindex="-1"></a><span class="st">&quot;%11$s%D$s%D$hhn&quot;</span> <span class="co">// *D = *D | r11</span></span></code></pre></div>
<p>That is, we set <code>*D</code> to <code>1</code> if there is a
three-in-a-row. We repeat this for all possible three-in-a-row
configurations, for both players.</p>
<p>The ZERO macro ensures that the number of bytes written out is 0 mod
256 with the following expression</p>
<div class="sourceCode" id="cb19"><pre class="sourceCode c"><code class="sourceCode c"><span id="cb19-1"><a href="#cb19-1" aria-hidden="true" tabindex="-1"></a><span class="st">&quot;%1$hhn%1$s&quot;</span> <span class="op">(</span>repeated <span class="dv">256</span> times<span class="op">)</span></span></code></pre></div>
<p>where argument 1 is a pointer to a temporary variable followed by a
NUL byte.</p>
<p>This works because if the current count is 0 mod 256, then
<code>"%1$hhn"</code> will write zero to argument 1 and then “%1$s” will
never emit any text. If, on the other hand, the count is not 0 mod 256,
a length-1 string will be written to argument 1, and then
<code>"%1\$s"</code> will increment the count by one. By repeating this
256 times we’re eventually going to reach 0 mod 256.</p>
<p>Checking if there has been an invalid move is achieved similarly.</p>
<p>In order to decide what to print out, we have to cast the “in-memory”
array of bits to Xs and Os to print out. This is actually rather
straightforward. Given in <code>1$</code> the pointer to player 1’s
square, and <code>2$</code> the pointer to player 2’s, and in
<code>3$</code> the pointer to the board string, we can compute</p>
<div class="sourceCode" id="cb20"><pre class="sourceCode c"><code class="sourceCode c"><span id="cb20-1"><a href="#cb20-1" aria-hidden="true" tabindex="-1"></a><span class="st">&quot;%1$s&quot;</span> <span class="op">(</span>repeated <span class="dv">47</span> times<span class="op">)</span> <span class="st">&quot;%2$s&quot;</span> <span class="op">(</span>repeated <span class="dv">56</span> times<span class="op">)</span> <span class="op">%</span><span class="dv">1</span>$<span class="dv">32</span><span class="er">d</span><span class="op">%</span><span class="dv">3</span>$hhn<span class="st">&quot;</span></span></code></pre></div>
<p>which will, in effect, compute</p>
<div class="sourceCode" id="cb21"><pre class="sourceCode c"><code class="sourceCode c"><span id="cb21-1"><a href="#cb21-1" aria-hidden="true" tabindex="-1"></a><span class="op">*</span>r3 <span class="op">=</span> <span class="op">(*</span>r1<span class="op">)</span> <span class="op">*</span> <span class="dv">47</span> <span class="op">+</span> <span class="op">(*</span>r2<span class="op">)</span> <span class="op">*</span> <span class="dv">56</span> <span class="op">+</span> <span class="dv">32</span></span></code></pre></div>
<p>which will output <code>' '</code> if neither are true,
<code>'X'</code> if <code>r1</code> is true, or <code>'O'</code> if
<code>r2</code> is true.</p>
<h4 id="further-obfuscations">Further Obfuscations</h4>
<p>In order to be able to finally display the board, while still only
using one <code>printf(3)</code> statement, we finish the statement
with</p>
<div class="sourceCode" id="cb22"><pre class="sourceCode c"><code class="sourceCode c"><span id="cb22-1"><a href="#cb22-1" aria-hidden="true" tabindex="-1"></a><span class="st">&quot;</span><span class="sc">\n\033</span><span class="st">[2J</span><span class="sc">\n</span><span class="st">%26$s&quot;</span></span></code></pre></div>
<p>which is the escape sequence to clear the screen, and then prints
argument 26. Argument 26 is a pointer to a <code>char*</code> in memory,
that initially is undefined, but within the <code>printf(3)</code>
statement we will construct this string to look like a tic-tac-toe
board.</p>
<p>After the board, we need to print one of the following strings:</p>
<pre><code>P1&gt;_
P2&gt;_
P1 WINS
P2 WINS
P1 TIES
P2 TIES</code></pre>
<p>Depending on if it’s P1 or P2’s turn to move, the game is over and
someone won, or the game is over and it is a draw.</p>
<p>This turns out not to be as hard as it might look. Using the same
trick as before, we set byte four to be</p>
<div class="sourceCode" id="cb24"><pre class="sourceCode c"><code class="sourceCode c"><span id="cb24-1"><a href="#cb24-1" aria-hidden="true" tabindex="-1"></a><span class="op">*</span>byte4 <span class="op">=</span> is_win <span class="op">*</span> <span class="ch">&#39;W&#39;</span> <span class="op">+</span> is_tie <span class="op">*</span> <span class="ch">&#39;T&#39;</span></span></code></pre></div>
<p>The byte <code>'I'</code> and <code>'S'</code> can always be the
same, and we do the same for <code>'E'</code>/<code>'N'</code>.</p>
<p>We do this same on-the-fly creation of the <code>scanf(3)</code>
format string, but for a different reason. We first want to run
<code>printf(3)</code> to show the first board, and then alternate
between runs to <code>scanf(3)</code> and <code>printf(3)</code> reading
and then displaying moves. Importantly, we <em>do not</em> want a final
<code>scanf(3)</code> when the game ends. It should just exit.</p>
<p>One option would be to implement the logic as</p>
<div class="sourceCode" id="cb25"><pre class="sourceCode c"><code class="sourceCode c"><span id="cb25-1"><a href="#cb25-1" aria-hidden="true" tabindex="-1"></a>printf<span class="op">()</span></span>
<span id="cb25-2"><a href="#cb25-2" aria-hidden="true" tabindex="-1"></a><span class="cf">while</span> <span class="op">(*</span>ok<span class="op">)</span> <span class="op">{</span></span>
<span id="cb25-3"><a href="#cb25-3" aria-hidden="true" tabindex="-1"></a> scanf<span class="op">();</span></span>
<span id="cb25-4"><a href="#cb25-4" aria-hidden="true" tabindex="-1"></a> printf<span class="op">();</span></span>
<span id="cb25-5"><a href="#cb25-5" aria-hidden="true" tabindex="-1"></a><span class="op">}</span></span></code></pre></div>
<p>but this would DOUBLE the number of calls to <code>printf(3)</code>
we require. So instead we implement it like this</p>
<div class="sourceCode" id="cb26"><pre class="sourceCode c"><code class="sourceCode c"><span id="cb26-1"><a href="#cb26-1" aria-hidden="true" tabindex="-1"></a><span class="cf">while</span> <span class="op">(*</span>ok<span class="op">)</span> <span class="op">{</span></span>
<span id="cb26-2"><a href="#cb26-2" aria-hidden="true" tabindex="-1"></a> scanf<span class="op">();</span></span>
<span id="cb26-3"><a href="#cb26-3" aria-hidden="true" tabindex="-1"></a> printf<span class="op">();</span></span>
<span id="cb26-4"><a href="#cb26-4" aria-hidden="true" tabindex="-1"></a><span class="op">}</span></span></code></pre></div>
<p>(In reality we actually pass <code>scanf(3)</code> as an argument to
avoid the extra statement, but it has the same effect.)</p>
<p>Notice there is now no initial <code>printf(3)</code>. In order make
sure the program doesn’t block before the first <code>printf(3)</code>,
we initialize the <code>scanf(3)</code> format to the NUL string so that
it returns right away without blocking. The first time the
<code>printf(3)</code> call runs, it writes out <code>"%hhd"</code> to
create the <code>scanf(3)</code> format string.</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-2020carlini"><a name="inventory"></a>Inventory for
2020/carlini</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/2020/carlini/prog.c">prog.c</a>
- winning source</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2020/carlini/Makefile">Makefile</a>
- winner Makefile</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2020/carlini/prog.orig.c">prog.orig.c</a>
- original source</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2020/carlini/try.sh">try.sh</a>
- how to run</li>
<li><a href="2020_carlini.tar.bz2">2020_carlini.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/2020/carlini/.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/2020/carlini/.winner.json">.winner.json</a>
- description of winner in JSON</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2020/carlini/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%2F2020%2Fcarlini%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 -->
+345 -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,357 @@
<!-- !!! DO NOT MODIFY THIS FILE - This file is generated by a tool !!! -->
<!-- !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<!-- -->
<!-- file: 2020/endoh1/index.html created by: fake.gen_index.sh version: 1.0.5 2023-10-31 -->
<html lang="en">
<!-- END: this line ends content from: inc/top.default.html -->
<!-- -->
<!-- This file was formed by the tool: bin/readme2index.sh version: 1.1 2024-01-16 -->
<!-- -->
<!-- START: this line starts content from: inc/head.default.html -->
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>2020 endoh1</title>
<meta name="description" content="IOCCC year: 2020 IOCCC winner: endoh1 winner index page">
<meta name="keywords" content="IOCCC,2020,endoh1,winner index page">
<link rel="stylesheet" href="/temp-test-ioccc/ioccc.css">
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=yes">
<title>2020/endoh1</title>
<meta name="description" content="2020 IOCCC winner endoh1">
<meta name="keywords" content="IOCCC, 2020, IOCCC 2020, IOCCC winner, endoh1">
</head>
<!-- END: this line ends content from: inc/head.default.html -->
<!-- START: this line starts content from: inc/body.default.html -->
<body>
<h1>2020 endoh1</h1>
<!-- END: this line ends content from: inc/body.default.html -->
<!-- START: this line starts content from: inc/header.default.html -->
<p>XXX - fake content until readme2index is working - XXX</p>
<div class="header">
<img src="/temp-test-ioccc/png/ioccc.png" alt="IOCCC image by Matt Zucker" width=300 height=110>
<h1>The International Obfuscated C Code Contest</h1>
<h2>2020/endoh1</h2>
</div>
<hr style="width:50%;text-align:left;margin-left:0">
<!-- END: this line ends content from: inc/header.default.html -->
<!-- START: this line starts content from: inc/topnav.mid.html -->
<!-- Start Nu Html Checker -->
<p><a href="https://validator.w3.org/nu/?doc=https%3A%2F%2Fioccc-src.github.io%2Ftemp-test-ioccc%2F2020%2Fendoh1%2Findex.html">Nu Html check https://ioccc-src.github.io/temp-test-ioccc/2020/endoh1/index.html</a></p>
<!-- End Nu Html Checker -->
<div class="topnav">
<a class="Left" href="../carlini/index.html">&larr; carlini</a>
<a class="Left" href="../index.html">&uarr; 2020 &uarr;</a>
<a class="Left" href="../endoh2/index.html">endoh2 &rarr;</a>
<a class="Right" href="#inventory">Inventory</a>
</div>
<!-- END: this line ends content from: inc/topnav.mid.html -->
<!-- START: this line starts content from: inc/begin-row.default.html -->
<div class="row">
<!-- END: this line ends content from: inc/begin-row.default.html -->
<!-- START: this line starts content from: inc/begin-leftcolumn.default.html -->
<div class="leftcolumn">
<!-- END: this line ends content from: inc/begin-leftcolumn.default.html -->
<!-- START: this line starts content from: inc/sidenav.default.html -->
<div class="sidenav">
<a href="#content">Jump to contents</a>
</div>
<hr>
<div class="sidenav">
<a href="/temp-test-ioccc/index.html">IOCCC Home</a>
<a href="/temp-test-ioccc/years.html">Winning Entries</a>
<a href="/temp-test-ioccc/winners.html">People who have won</a>
</div>
<hr>
<div class="sidenav">
<a href="/temp-test-ioccc/news.html">IOCCC News</a>
<a href="/temp-test-ioccc/faq.html#submit">How to enter the IOCCC</a>
<a href="/temp-test-ioccc/faq.html">FAQ</a>
</div>
<hr>
<div class="sidenav">
<a href="/temp-test-ioccc/bugs.html">Bugs &amp; (mis)features</a>
<a href="/temp-test-ioccc/faq.html#fix_a_winner">Fixing IOCCC winners</a>
<a href="/temp-test-ioccc/faq.html#fix_web_site">Fixing the web site</a>
<a href="/temp-test-ioccc/faq.html#fix_author">Fixing winner info</a>
<a href="/temp-test-ioccc/thanks-for-help.html">Thanks for the help</a>
</div>
<hr>
<div class="sidenav">
<a href="/temp-test-ioccc/judges.html">The IOCCC Judges</a>
<a href="/temp-test-ioccc/contact.html">Contacting the IOCCC</a>
</div>
<hr>
<div class="sidenav">
<a href="#top">Jump to top</a>
</div>
<!-- END: this line ends content from: inc/sidenav.default.html -->
<!-- START: this line starts content from: inc/end-leftcolumn.default.html -->
</div>
<!-- END: this line ends content from: inc/end-leftcolumn.default.html -->
<!-- START: this line starts content from: inc/begin-rightcolumn.default.html -->
<div class="rightcolumn">
<!-- END: this line ends content from: inc/begin-rightcolumn.default.html -->
<!-- START: this line starts content from: inc/before-content.default.html -->
<a name="content"></a>
<!-- END: this line ends content from: inc/before-content.default.html -->
<!-- START: this line starts content generated by: bin/gen-author.sh -->
<p><a name="author"><strong>Author:</strong></a> <br><br>Name: <a
href="/temp-test-ioccc/winners.html#Yusuke_Endoh">Yusuke Endoh</a><br>
Location: <a href="/temp-test-ioccc/location.html#JP">JP</a></p>
<!-- END: next line ends content generated by: bin/gen-author.sh -->
<h2 id="to-build">To build:</h2>
<div class="sourceCode" id="cb1"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb1-1"><a href="#cb1-1" aria-hidden="true" tabindex="-1"></a><span class="fu">make</span></span></code></pre></div>
<p>There is an alternate version provided by the author. 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="co"># IMPORTANT for macOS: run under Terminal.app</span></span>
<span id="cb2-2"><a href="#cb2-2" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb2-3"><a href="#cb2-3" aria-hidden="true" tabindex="-1"></a><span class="ex">./prog</span></span></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="co"># IMPORTANT for macOS: run under Terminal.app</span></span>
<span id="cb3-2"><a href="#cb3-2" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb3-3"><a href="#cb3-3" aria-hidden="true" tabindex="-1"></a><span class="co"># Try resizing the terminal window before the first click.</span></span>
<span id="cb3-4"><a href="#cb3-4" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb3-5"><a href="#cb3-5" aria-hidden="true" tabindex="-1"></a><span class="co"># Try resizing the terminal window after the first click.</span></span>
<span id="cb3-6"><a href="#cb3-6" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb3-7"><a href="#cb3-7" aria-hidden="true" tabindex="-1"></a><span class="ex">./prog</span> ioccc.txt</span>
<span id="cb3-8"><a href="#cb3-8" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb3-9"><a href="#cb3-9" aria-hidden="true" tabindex="-1"></a><span class="ex">./prog</span> unwinnable.txt</span></code></pre></div>
<h2 id="alternate-code">Alternate code:</h2>
<p>An alternate version of this entry, <a
href="prog.alt.c">prog.alt.c</a>, is provided. This alternate code lacks
the additional rule to flag all unprobed cells. See the Author’s remarks
for more details.</p>
<h3 id="alternate-build">Alternate build:</h3>
<div class="sourceCode" id="cb4"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb4-1"><a href="#cb4-1" aria-hidden="true" tabindex="-1"></a><span class="fu">make</span> alt</span></code></pre></div>
<h3 id="alternate-use">Alternate use:</h3>
<p>Use <code>prog.alt</code> as you would <code>prog</code> above.</p>
<h2 id="judges-remarks">Judges’ remarks:</h2>
<p>When playing <a
href="https://en.wikipedia.org/wiki/Minesweeper_(video_game)">Minesweeper</a>,
a misclick might ruin a game, so why not leave the routine to the
computer? This program automatically uncovers mines according to several
rules, and leaves guessing (and applying the most straightforward of the
rules – just for fun, perhaps?) to the user.</p>
<p>Try creating your own input files according to the author’s remarks.
Did you encounter any problems?</p>
<p>The submission was in violation of the “2053” size rule by one
character, likely a late typo. It was easy to fix.</p>
<h3 id="for-macos">For macOS:</h3>
<p>We observe that this entry may not work under macOS using iTerm2.
Users on macOS might want to run this entry under the macOS Terminal,
which is located in
<code>/System/Applications/Utilities/Terminal.app</code>.</p>
<h2 id="authors-remarks">Author’s remarks:</h2>
<h3 id="semi-automatic-minesweeper">Semi-automatic Minesweeper:</h3>
<p>Minesweeper is a game to sweep mines, as you know. The task consists
of two parts:</p>
<ol start="0" type="1">
<li>Choose a random cell based on your sixth sense.</li>
<li>Identify a non-mine cell based on logical inference.</li>
</ol>
<p>However, (1) is error-prone, and a waste of time. You must use a
computer to do such a boring task!</p>
<p>This program is a semi-automatic minesweeper which does part (1)
automatically. All you have to do is (0). You can test if you are lucky
or not.</p>
<h3 id="how-to-use">How to use:</h3>
<p>It uses ncurses:</p>
<div class="sourceCode" id="cb5"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb5-1"><a href="#cb5-1" aria-hidden="true" tabindex="-1"></a><span class="fu">gcc</span> <span class="at">-o</span> prog prog.c <span class="at">-lncurses</span></span>
<span id="cb5-2"><a href="#cb5-2" aria-hidden="true" tabindex="-1"></a><span class="ex">./prog</span></span></code></pre></div>
<p>You will see a terminal-wide field of a minesweeper. Probe a cell by
mouse click.</p>
<p>If a cell turns out to have a mine (or not), the program determines
whether its neighbors have a mine or not, and automatically probes (or
flags) the cell.</p>
<h3 id="keyboard-commands">Keyboard commands:</h3>
<ul>
<li><code>r</code>: new game (You can also click the smiley face at the
top line.).</li>
<li><code>q</code>: quit.</li>
</ul>
<p>Input is case-sensitive.</p>
<h3 id="internals">Internals:</h3>
<p>The program uses four types of local inference:</p>
<h4 id="rule-1">Rule 1:</h4>
<p>If the number of a cell is equal to the count of the flagged
neighbors, all the unprobed neighbors are probed.</p>
<p>Example:</p>
<pre><code>? ? ? . . .
? 3 ? =&gt; . 3 .
! ! ! ! ! !</code></pre>
<p>Note that <code>?</code> is an unprobed cell (it is unknown whether
the cell has a mine or not); <code>!</code> is a flagged cell (it is
already known that the cell has a mine); and <code>.</code> is a probed
cell (it is already known that the cell has no mine).</p>
<h4 id="rule-2">Rule 2:</h4>
<p>If the number of a cell is equal to the count of the unprobed or
flagged neighbors, all the unprobed neighbors are flagged.</p>
<p>Example:</p>
<pre><code>. ? ? . ! !
. 4 ? =&gt; . 4 !
. 2 ! . 2 !</code></pre>
<h4 id="rule-3">Rule 3:</h4>
<p>Consider two number cells <code>A</code> and <code>B</code>. If
<code>A</code> is equal to the difference of <code>B</code> and the
count of <code>B</code>’s unprobed and flagged neighbors that are not
<code>A</code>’s neighbors, all <code>A</code>’s unprobed neighbors that
are not <code>B</code>’s neighbors are probed.</p>
<p>Example:</p>
<pre><code>? ? ? . . .
? 1 ? ? =&gt; . 1 ? ?
? ? 4 . . ? 4 .
? . ! ? . !</code></pre>
<p><code>A</code> and <code>B</code> are probed cells whose numbers are,
respectively, 1 and 4. The count of <code>B</code>’s unprobed and
flagged neighbors that are not <code>A</code>’s neighbors is three (one
<code>!</code> and two <code>?</code>s). Since
<code>A == B - count</code> (<code>1 == 4 - 3</code>), the left and top
unprobed cells are probed.</p>
<h4 id="rule-4">Rule 4</h4>
<p>Consider two number cells <code>A</code> and <code>B</code>. If
<code>B</code> is equal to the difference of <code>A</code> and the
count of <code>A</code>’s unprobed and flagged neighbors that are not
<code>B</code>’s neighbors, all of <code>A</code>’s unprobed neighbors
that are not <code>B</code>’s neighbors are flagged.</p>
<pre><code>? ? ? ? ! ? ? ?
? 3 1 2 =&gt; ! 3 1 2
2 2 . . 2 2 . .</code></pre>
<p><code>A</code> and <code>B</code> are probed cells whose numbers are,
respectively, 3 and 1. The count of <code>A</code>’s unprobed and
flagged neighbors that are not <code>B</code>’s neighbors is two (left
<code>?</code>s). Since <code>B == A - count</code>
(<code>1 == 3 - 2</code>), the left unprobed cells are flagged.</p>
<h3 id="note">Note</h3>
<p>Interestingly, these complex rules can be integrated to one simple
rule. Analyze the code.</p>
<h3 id="one-more-thing">One more thing</h3>
<p>You can also play with a prepared map.</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">./prog</span> ioccc.txt</span></code></pre></div>
<p>The format of the text is:</p>
<pre><code>width height number-of-mines priorities-of-each-cell...</code></pre>
<p>There are mines in a cell whose “priorities-of-each-cell” is less
than “number-of-mines”. (But the mine in the first-clicked cell is
removed.)</p>
<h3 id="bug-fixes-and-credits">Bug fixes and Credits</h3>
<p>The judges pointed out a bug of the original version that I submitted
(<a href="prog.alt.c">prog.alt.c</a>). Because this program does not
provide a feature to flag unprobed cells manually, we can do nothing if
the number of unprobed cells are equal to the number of mines remaining;
<a href="unwinnable.txt">unwinnable.txt</a> is an example for such a
case.</p>
<p>Thus, I implemented an additional rule to flag all unprobed cells in
such a case into the final version (<a href="prog.c">prog.c</a>).</p>
<p><a href="/winners.html#Ilya_Kurdyukov">Ilya Kurdyukov</a> also
pointed out a warning “ignoring return value of ‘fscanf’” only when
<code>-O3</code> is used. So I changed the code a little to pretend to
use the return value of <code>fscanf(3)</code>.</p>
<p><a href="/winners.html#Don_Yang">Don Yang</a> (omoikane) contributed
another example map <a href="megumin.txt">megumin.txt</a> which is the
Explosion Arch-Wizard from KonoSuba.</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-2020endoh1"><a name="inventory"></a>Inventory for
2020/endoh1</h1>
<h2 id="primary-files">Primary files</h2>
<ul>
<li><a href="index.html">index.html</a> - winner home page</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2020/endoh1/prog.c">prog.c</a>
- winning source</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2020/endoh1/Makefile">Makefile</a>
- winner Makefile</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2020/endoh1/prog.alt.c">prog.alt.c</a>
- alternative source</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2020/endoh1/prog.orig.c">prog.orig.c</a>
- original source</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2020/endoh1/hilbert16x8.txt">hilbert16x8.txt</a>
- gameplay map</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2020/endoh1/hilbert2x2.txt">hilbert2x2.txt</a>
- gameplay map</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2020/endoh1/hilbert4x4.txt">hilbert4x4.txt</a>
- gameplay map</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2020/endoh1/hilbert8x8.txt">hilbert8x8.txt</a>
- gameplay map</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2020/endoh1/ioccc.txt">ioccc.txt</a>
- gameplay map</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2020/endoh1/megumin.txt">megumin.txt</a>
- gameplay map</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2020/endoh1/unwinnable.txt">unwinnable.txt</a>
- gameplay map</li>
<li><a href="2020_endoh1.tar.bz2">2020_endoh1.tar.bz2</a> - download
winning source</li>
</ul>
<h2 id="secondary-files">Secondary files</h2>
<ul>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2020/endoh1/.gitignore">.gitignore</a>
- list of files that should not be committed under git</li>
<li><a href=".path">.path</a> - directory path from top directory</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2020/endoh1/.winner.json">.winner.json</a>
- description of winner in JSON</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2020/endoh1/README.md">README.md</a>
- markdown source for index.html</li>
</ul>
<!-- END: next line ends content generated by: bin/gen-inventory.sh -->
<!-- START: this line starts content from: inc/after-content.default.html -->
<!-- END: this line ends content from: inc/after-content.default.html -->
<!-- START: this line starts content from: inc/end-rightcolumn.default.html -->
</div>
<!-- END: this line ends content from: inc/end-rightcolumn.default.html -->
<!-- START: this line starts content from: inc/end-row.default.html -->
</div>
<!-- END: this line ends content from: inc/end-row.default.html -->
<!-- START: this line starts content from: inc/footer.default.html -->
<div class="footer">
<hr>
<h2>Coda</h2>
<p><a href="https://validator.w3.org/nu/?doc=https%3A%2F%2Fioccc-src.github.io%2Ftemp-test-ioccc%2F2020%2Fendoh1%2Findex.html">Nu HTML check this web page</a></p>
<p><a href="#top">Jump to top</a> <a href="#content">Jump to Content</a> <a href="#inventory">Jump to Inventory</a></p>
</div>
<!-- END: this line ends content from: inc/footer.default.html -->
<!-- START: this line starts content from: inc/bottom.default.html -->
</body>
</html>
<!-- END: this line ends content from: inc/bottom.default.html -->
+227 -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,239 @@
<!-- !!! DO NOT MODIFY THIS FILE - This file is generated by a tool !!! -->
<!-- !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<!-- -->
<!-- file: 2020/endoh2/index.html created by: fake.gen_index.sh version: 1.0.5 2023-10-31 -->
<html lang="en">
<!-- END: this line ends content from: inc/top.default.html -->
<!-- -->
<!-- This file was formed by the tool: bin/readme2index.sh version: 1.1 2024-01-16 -->
<!-- -->
<!-- START: this line starts content from: inc/head.default.html -->
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>2020 endoh2</title>
<meta name="description" content="IOCCC year: 2020 IOCCC winner: endoh2 winner index page">
<meta name="keywords" content="IOCCC,2020,endoh2,winner index page">
<link rel="stylesheet" href="/temp-test-ioccc/ioccc.css">
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=yes">
<title>2020/endoh2</title>
<meta name="description" content="2020 IOCCC winner endoh2">
<meta name="keywords" content="IOCCC, 2020, IOCCC 2020, IOCCC winner, endoh2">
</head>
<!-- END: this line ends content from: inc/head.default.html -->
<!-- START: this line starts content from: inc/body.default.html -->
<body>
<h1>2020 endoh2</h1>
<!-- END: this line ends content from: inc/body.default.html -->
<!-- START: this line starts content from: inc/header.default.html -->
<p>XXX - fake content until readme2index is working - XXX</p>
<div class="header">
<img src="/temp-test-ioccc/png/ioccc.png" alt="IOCCC image by Matt Zucker" width=300 height=110>
<h1>The International Obfuscated C Code Contest</h1>
<h2>2020/endoh2</h2>
</div>
<hr style="width:50%;text-align:left;margin-left:0">
<!-- END: this line ends content from: inc/header.default.html -->
<!-- START: this line starts content from: inc/topnav.mid.html -->
<!-- Start Nu Html Checker -->
<p><a href="https://validator.w3.org/nu/?doc=https%3A%2F%2Fioccc-src.github.io%2Ftemp-test-ioccc%2F2020%2Fendoh2%2Findex.html">Nu Html check https://ioccc-src.github.io/temp-test-ioccc/2020/endoh2/index.html</a></p>
<!-- End Nu Html Checker -->
<div class="topnav">
<a class="Left" href="../endoh1/index.html">&larr; endoh1</a>
<a class="Left" href="../index.html">&uarr; 2020 &uarr;</a>
<a class="Left" href="../endoh3/index.html">endoh3 &rarr;</a>
<a class="Right" href="#inventory">Inventory</a>
</div>
<!-- END: this line ends content from: inc/topnav.mid.html -->
<!-- START: this line starts content from: inc/begin-row.default.html -->
<div class="row">
<!-- END: this line ends content from: inc/begin-row.default.html -->
<!-- START: this line starts content from: inc/begin-leftcolumn.default.html -->
<div class="leftcolumn">
<!-- END: this line ends content from: inc/begin-leftcolumn.default.html -->
<!-- START: this line starts content from: inc/sidenav.default.html -->
<div class="sidenav">
<a href="#content">Jump to contents</a>
</div>
<hr>
<div class="sidenav">
<a href="/temp-test-ioccc/index.html">IOCCC Home</a>
<a href="/temp-test-ioccc/years.html">Winning Entries</a>
<a href="/temp-test-ioccc/winners.html">People who have won</a>
</div>
<hr>
<div class="sidenav">
<a href="/temp-test-ioccc/news.html">IOCCC News</a>
<a href="/temp-test-ioccc/faq.html#submit">How to enter the IOCCC</a>
<a href="/temp-test-ioccc/faq.html">FAQ</a>
</div>
<hr>
<div class="sidenav">
<a href="/temp-test-ioccc/bugs.html">Bugs &amp; (mis)features</a>
<a href="/temp-test-ioccc/faq.html#fix_a_winner">Fixing IOCCC winners</a>
<a href="/temp-test-ioccc/faq.html#fix_web_site">Fixing the web site</a>
<a href="/temp-test-ioccc/faq.html#fix_author">Fixing winner info</a>
<a href="/temp-test-ioccc/thanks-for-help.html">Thanks for the help</a>
</div>
<hr>
<div class="sidenav">
<a href="/temp-test-ioccc/judges.html">The IOCCC Judges</a>
<a href="/temp-test-ioccc/contact.html">Contacting the IOCCC</a>
</div>
<hr>
<div class="sidenav">
<a href="#top">Jump to top</a>
</div>
<!-- END: this line ends content from: inc/sidenav.default.html -->
<!-- START: this line starts content from: inc/end-leftcolumn.default.html -->
</div>
<!-- END: this line ends content from: inc/end-leftcolumn.default.html -->
<!-- START: this line starts content from: inc/begin-rightcolumn.default.html -->
<div class="rightcolumn">
<!-- END: this line ends content from: inc/begin-rightcolumn.default.html -->
<!-- START: this line starts content from: inc/before-content.default.html -->
<a name="content"></a>
<!-- END: this line ends content from: inc/before-content.default.html -->
<!-- START: this line starts content generated by: bin/gen-author.sh -->
<p><a name="author"><strong>Author:</strong></a> <br><br>Name: <a
href="/temp-test-ioccc/winners.html#Yusuke_Endoh">Yusuke Endoh</a><br>
Location: <a href="/temp-test-ioccc/location.html#JP">JP</a></p>
<!-- END: next line ends content generated by: bin/gen-author.sh -->
<h2 id="to-build">To build:</h2>
<div class="sourceCode" id="cb1"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb1-1"><a href="#cb1-1" aria-hidden="true" tabindex="-1"></a><span class="fu">make</span></span></code></pre></div>
<h2 id="to-use">To use:</h2>
<div class="sourceCode" id="cb2"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb2-1"><a href="#cb2-1" aria-hidden="true" tabindex="-1"></a><span class="ex">./prog</span></span></code></pre></div>
<h2 id="try">Try:</h2>
<div class="sourceCode" id="cb3"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb3-1"><a href="#cb3-1" aria-hidden="true" tabindex="-1"></a><span class="ex">./try.sh</span></span></code></pre></div>
<p>What happens if you do</p>
<div class="sourceCode" id="cb4"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb4-1"><a href="#cb4-1" aria-hidden="true" tabindex="-1"></a><span class="ex">./prog</span> prog.c</span></code></pre></div>
<p>?</p>
<h2 id="judges-remarks">Judges’ remarks:</h2>
<p>Clever use of the C99 complex data type. The <a
href="spoiler/">spoiler</a> directory contains clues as to how some
winning authors create / edit programs into ASCII shapes.</p>
<p>With the source from the <a href="spoiler/">spoiler</a> directory
could you make the code render for a larger terminal window? How about
adding more glyphs?</p>
<h2 id="authors-remarks">Author’s remarks:</h2>
<p>No! Try not. Do, or do not. There is no try.</p>
<div class="sourceCode" id="cb5"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb5-1"><a href="#cb5-1" aria-hidden="true" tabindex="-1"></a><span class="fu">cc</span> <span class="at">-std</span><span class="op">=</span>c99 prog.c</span>
<span id="cb5-2"><a href="#cb5-2" aria-hidden="true" tabindex="-1"></a><span class="ex">./a.out</span></span>
<span id="cb5-3"><a href="#cb5-3" aria-hidden="true" tabindex="-1"></a><span class="ex">./a.out</span> hello.txt</span>
<span id="cb5-4"><a href="#cb5-4" aria-hidden="true" tabindex="-1"></a><span class="ex">./a.out</span> yoda.txt</span>
<span id="cb5-5"><a href="#cb5-5" aria-hidden="true" tabindex="-1"></a><span class="ex">./a.out</span> bear.txt</span></code></pre></div>
<p>See spoiler.zip for the source code. <a
href="https://en.wikipedia.org/wiki/List_of_the_most_common_passwords">The
16th most common password on the Internet in 2017 (according to Splash
Data)</a> the password is.</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-2020endoh2"><a name="inventory"></a>Inventory for
2020/endoh2</h1>
<h2 id="primary-files">Primary files</h2>
<ul>
<li><a href="index.html">index.html</a> - winner home page</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2020/endoh2/prog.c">prog.c</a>
- winning source</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2020/endoh2/Makefile">Makefile</a>
- winner Makefile</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2020/endoh2/prog.orig.c">prog.orig.c</a>
- original source</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2020/endoh2/bear.txt">bear.txt</a>
- sample input</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2020/endoh2/hello.txt">hello.txt</a>
- sample input</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2020/endoh2/try.sh">try.sh</a>
- how to run</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2020/endoh2/yoda.txt">yoda.txt</a>
- sample input</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2020/endoh2/spoiler/code.c">spoiler/code.c</a>
- SPOILER WARNING - main logic for the program</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2020/endoh2/spoiler/gen.rb">spoiler/gen.rb</a>
- SPOILER WARNING - compose items and prog.c</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2020/endoh2/spoiler/glyphs.txt">spoiler/glyphs.txt</a>
- SPOILER WARNING - font data</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2020/endoh2/spoiler/prog.c">spoiler/prog.c</a>
- SPOILER WARNING - generated source</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2020/endoh2/spoiler/spoiler.md">spoiler/spoiler.md</a>
- SPOILER WARNING - about the spoiler</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2020/endoh2/spoiler/tmpl.txt">spoiler/tmpl.txt</a>
- SPOILER WARNING - template for the program</li>
<li><a href="2020_endoh2.tar.bz2">2020_endoh2.tar.bz2</a> - download
winning source</li>
</ul>
<h2 id="secondary-files">Secondary files</h2>
<ul>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2020/endoh2/.gitignore">.gitignore</a>
- list of files that should not be committed under git</li>
<li><a href=".path">.path</a> - directory path from top directory</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2020/endoh2/.winner.json">.winner.json</a>
- description of winner in JSON</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2020/endoh2/README.md">README.md</a>
- markdown source for index.html</li>
</ul>
<!-- END: next line ends content generated by: bin/gen-inventory.sh -->
<!-- START: this line starts content from: inc/after-content.default.html -->
<!-- END: this line ends content from: inc/after-content.default.html -->
<!-- START: this line starts content from: inc/end-rightcolumn.default.html -->
</div>
<!-- END: this line ends content from: inc/end-rightcolumn.default.html -->
<!-- START: this line starts content from: inc/end-row.default.html -->
</div>
<!-- END: this line ends content from: inc/end-row.default.html -->
<!-- START: this line starts content from: inc/footer.default.html -->
<div class="footer">
<hr>
<h2>Coda</h2>
<p><a href="https://validator.w3.org/nu/?doc=https%3A%2F%2Fioccc-src.github.io%2Ftemp-test-ioccc%2F2020%2Fendoh2%2Findex.html">Nu HTML check this web page</a></p>
<p><a href="#top">Jump to top</a> <a href="#content">Jump to Content</a> <a href="#inventory">Jump to Inventory</a></p>
</div>
<!-- END: this line ends content from: inc/footer.default.html -->
<!-- START: this line starts content from: inc/bottom.default.html -->
</body>
</html>
<!-- END: this line ends content from: inc/bottom.default.html -->
+204 -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,216 @@
<!-- !!! DO NOT MODIFY THIS FILE - This file is generated by a tool !!! -->
<!-- !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<!-- -->
<!-- file: 2020/endoh3/index.html created by: fake.gen_index.sh version: 1.0.5 2023-10-31 -->
<html lang="en">
<!-- END: this line ends content from: inc/top.default.html -->
<!-- -->
<!-- This file was formed by the tool: bin/readme2index.sh version: 1.1 2024-01-16 -->
<!-- -->
<!-- START: this line starts content from: inc/head.default.html -->
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>2020 endoh3</title>
<meta name="description" content="IOCCC year: 2020 IOCCC winner: endoh3 winner index page">
<meta name="keywords" content="IOCCC,2020,endoh3,winner index page">
<link rel="stylesheet" href="/temp-test-ioccc/ioccc.css">
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=yes">
<title>2020/endoh3</title>
<meta name="description" content="2020 IOCCC winner endoh3">
<meta name="keywords" content="IOCCC, 2020, IOCCC 2020, IOCCC winner, endoh3">
</head>
<!-- END: this line ends content from: inc/head.default.html -->
<!-- START: this line starts content from: inc/body.default.html -->
<body>
<h1>2020 endoh3</h1>
<!-- END: this line ends content from: inc/body.default.html -->
<!-- START: this line starts content from: inc/header.default.html -->
<p>XXX - fake content until readme2index is working - XXX</p>
<div class="header">
<img src="/temp-test-ioccc/png/ioccc.png" alt="IOCCC image by Matt Zucker" width=300 height=110>
<h1>The International Obfuscated C Code Contest</h1>
<h2>2020/endoh3</h2>
</div>
<hr style="width:50%;text-align:left;margin-left:0">
<!-- END: this line ends content from: inc/header.default.html -->
<!-- START: this line starts content from: inc/topnav.mid.html -->
<!-- Start Nu Html Checker -->
<p><a href="https://validator.w3.org/nu/?doc=https%3A%2F%2Fioccc-src.github.io%2Ftemp-test-ioccc%2F2020%2Fendoh3%2Findex.html">Nu Html check https://ioccc-src.github.io/temp-test-ioccc/2020/endoh3/index.html</a></p>
<!-- End Nu Html Checker -->
<div class="topnav">
<a class="Left" href="../endoh2/index.html">&larr; endoh2</a>
<a class="Left" href="../index.html">&uarr; 2020 &uarr;</a>
<a class="Left" href="../ferguson1/index.html">ferguson1 &rarr;</a>
<a class="Right" href="#inventory">Inventory</a>
</div>
<!-- END: this line ends content from: inc/topnav.mid.html -->
<!-- START: this line starts content from: inc/begin-row.default.html -->
<div class="row">
<!-- END: this line ends content from: inc/begin-row.default.html -->
<!-- START: this line starts content from: inc/begin-leftcolumn.default.html -->
<div class="leftcolumn">
<!-- END: this line ends content from: inc/begin-leftcolumn.default.html -->
<!-- START: this line starts content from: inc/sidenav.default.html -->
<div class="sidenav">
<a href="#content">Jump to contents</a>
</div>
<hr>
<div class="sidenav">
<a href="/temp-test-ioccc/index.html">IOCCC Home</a>
<a href="/temp-test-ioccc/years.html">Winning Entries</a>
<a href="/temp-test-ioccc/winners.html">People who have won</a>
</div>
<hr>
<div class="sidenav">
<a href="/temp-test-ioccc/news.html">IOCCC News</a>
<a href="/temp-test-ioccc/faq.html#submit">How to enter the IOCCC</a>
<a href="/temp-test-ioccc/faq.html">FAQ</a>
</div>
<hr>
<div class="sidenav">
<a href="/temp-test-ioccc/bugs.html">Bugs &amp; (mis)features</a>
<a href="/temp-test-ioccc/faq.html#fix_a_winner">Fixing IOCCC winners</a>
<a href="/temp-test-ioccc/faq.html#fix_web_site">Fixing the web site</a>
<a href="/temp-test-ioccc/faq.html#fix_author">Fixing winner info</a>
<a href="/temp-test-ioccc/thanks-for-help.html">Thanks for the help</a>
</div>
<hr>
<div class="sidenav">
<a href="/temp-test-ioccc/judges.html">The IOCCC Judges</a>
<a href="/temp-test-ioccc/contact.html">Contacting the IOCCC</a>
</div>
<hr>
<div class="sidenav">
<a href="#top">Jump to top</a>
</div>
<!-- END: this line ends content from: inc/sidenav.default.html -->
<!-- START: this line starts content from: inc/end-leftcolumn.default.html -->
</div>
<!-- END: this line ends content from: inc/end-leftcolumn.default.html -->
<!-- START: this line starts content from: inc/begin-rightcolumn.default.html -->
<div class="rightcolumn">
<!-- END: this line ends content from: inc/begin-rightcolumn.default.html -->
<!-- START: this line starts content from: inc/before-content.default.html -->
<a name="content"></a>
<!-- END: this line ends content from: inc/before-content.default.html -->
<!-- START: this line starts content generated by: bin/gen-author.sh -->
<p><a name="author"><strong>Author:</strong></a> <br><br>Name: <a
href="/temp-test-ioccc/winners.html#Yusuke_Endoh">Yusuke Endoh</a><br>
Location: <a href="/temp-test-ioccc/location.html#JP">JP</a></p>
<!-- END: next line ends content generated by: bin/gen-author.sh -->
<h2 id="to-build">To build:</h2>
<div class="sourceCode" id="cb1"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb1-1"><a href="#cb1-1" aria-hidden="true" tabindex="-1"></a><span class="fu">make</span></span></code></pre></div>
<p>An alternate version of this program exists. See <a
href="#alternate-code">Alternate code</a> below.</p>
<h2 id="to-use">To use:</h2>
<div class="sourceCode" id="cb2"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb2-1"><a href="#cb2-1" aria-hidden="true" tabindex="-1"></a><span class="ex">./prog</span></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">./run_clock</span></span>
<span id="cb3-2"><a href="#cb3-2" aria-hidden="true" tabindex="-1"></a><span class="co"># And watch closely for 15-20 seconds</span></span></code></pre></div>
<h2 id="alternate-code">Alternate code:</h2>
<p>An alternate version of this entry, <a
href="prog.alt.c">prog.alt.c</a>, is provided. This alternate code uses
Unicode letters.</p>
<h3 id="alternate-build">Alternate build:</h3>
<div class="sourceCode" id="cb4"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb4-1"><a href="#cb4-1" aria-hidden="true" tabindex="-1"></a><span class="fu">make</span> alt</span></code></pre></div>
<h3 id="alternate-use">Alternate use:</h3>
<p>Use <code>prog.alt</code> as you would <code>prog</code> above.</p>
<h2 id="judges-remarks">Judges’ remarks:</h2>
<p>You may be tempted to use a mirror. Resist the temptation! Try
figuring out how the clock hands are drawn. Can you change the program
to make it draw a familiar (non-mirrored) clock face? Can you add the
second hand?</p>
<p>When using the <a href="run_clock.sh">run_clock.sh</a> shell script,
your perception of time might depend on what time it is.</p>
<h2 id="authors-remarks">Author’s remarks:</h2>
<p>Prepare a mirror!</p>
<div class="sourceCode" id="cb5"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb5-1"><a href="#cb5-1" aria-hidden="true" tabindex="-1"></a><span class="fu">make</span> clock</span></code></pre></div>
<p>Note: You need to recompile it each run.</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-2020endoh3"><a name="inventory"></a>Inventory for
2020/endoh3</h1>
<h2 id="primary-files">Primary files</h2>
<ul>
<li><a href="index.html">index.html</a> - winner home page</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2020/endoh3/prog.c">prog.c</a>
- winning source</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2020/endoh3/Makefile">Makefile</a>
- winner Makefile</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2020/endoh3/prog.alt.c">prog.alt.c</a>
- alternative source</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2020/endoh3/prog.orig.c">prog.orig.c</a>
- original source</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2020/endoh3/run_clock.sh">run_clock.sh</a>
- how to run</li>
<li><a href="2020_endoh3.tar.bz2">2020_endoh3.tar.bz2</a> - download
winning source</li>
</ul>
<h2 id="secondary-files">Secondary files</h2>
<ul>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2020/endoh3/.gitignore">.gitignore</a>
- list of files that should not be committed under git</li>
<li><a href=".path">.path</a> - directory path from top directory</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2020/endoh3/.winner.json">.winner.json</a>
- description of winner in JSON</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2020/endoh3/README.md">README.md</a>
- markdown source for index.html</li>
</ul>
<!-- END: next line ends content generated by: bin/gen-inventory.sh -->
<!-- START: this line starts content from: inc/after-content.default.html -->
<!-- END: this line ends content from: inc/after-content.default.html -->
<!-- START: this line starts content from: inc/end-rightcolumn.default.html -->
</div>
<!-- END: this line ends content from: inc/end-rightcolumn.default.html -->
<!-- START: this line starts content from: inc/end-row.default.html -->
</div>
<!-- END: this line ends content from: inc/end-row.default.html -->
<!-- START: this line starts content from: inc/footer.default.html -->
<div class="footer">
<hr>
<h2>Coda</h2>
<p><a href="https://validator.w3.org/nu/?doc=https%3A%2F%2Fioccc-src.github.io%2Ftemp-test-ioccc%2F2020%2Fendoh3%2Findex.html">Nu HTML check this web page</a></p>
<p><a href="#top">Jump to top</a> <a href="#content">Jump to Content</a> <a href="#inventory">Jump to Inventory</a></p>
</div>
<!-- END: this line ends content from: inc/footer.default.html -->
<!-- START: this line starts content from: inc/bottom.default.html -->
</body>
</html>
<!-- END: this line ends content from: inc/bottom.default.html -->
+3 -4
View File
@@ -10,7 +10,7 @@
<!-- -->
<!-- END: this line ends content from: inc/top.default.html -->
<!-- -->
<!-- This file was formed by the tool: bin/readme2index.sh version: 1.0 2024-01-14 -->
<!-- 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 -->
@@ -111,8 +111,7 @@
<!-- 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></p>
<p>Name: <a
<p><a name="author"><strong>Author:</strong></a> <br><br>Name: <a
href="/temp-test-ioccc/winners.html#Cody_Boone_Ferguson">Cody Boone
Ferguson</a><br> Location: <a
href="/temp-test-ioccc/location.html#US">US</a></p>
@@ -182,7 +181,7 @@ in this game is a misnomer; see notes below.</p></li>
whether you can go through the Snake or not. Default is 0 (cannot - die
if you try).</p></li>
</ul>
<h3 id="try">Try:</h3>
<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="fu">make</span> test</span>
<span id="cb4-2"><a href="#cb4-2" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb4-3"><a href="#cb4-3" aria-hidden="true" tabindex="-1"></a><span class="va">WAIT</span><span class="op">=</span>75 <span class="va">WALLS</span><span class="op">=</span>1 <span class="va">CANNIBAL</span><span class="op">=</span>1 <span class="ex">./prog</span></span>
+1041 -13
View File
File diff suppressed because it is too large. Load diff
+308 -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,320 @@
<!-- !!! DO NOT MODIFY THIS FILE - This file is generated by a tool !!! -->
<!-- !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<!-- -->
<!-- file: 2020/giles/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>2020 giles</title>
<meta name="description" content="IOCCC year: 2020 IOCCC winner: giles winner index page">
<meta name="keywords" content="IOCCC,2020,giles,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>2020/giles</title>
<meta name="description" content="2020 IOCCC winner giles">
<meta name="keywords" content="IOCCC, 2020, IOCCC 2020, IOCCC winner, giles">
</head>
<!-- END: this line ends content from: inc/head.default.html -->
<!-- START: this line starts content from: inc/body.default.html -->
<body>
<h1>2020 giles</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>2020/giles</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%2F2020%2Fgiles%2Findex.html">Nu Html check https://ioccc-src.github.io/temp-test-ioccc/2020/giles/index.html</a></p>
<!-- End Nu Html Checker -->
<div class="topnav">
<a class="Left" href="../ferguson2/index.html">&larr; ferguson2</a>
<a class="Left" href="../index.html">&uarr; 2020 &uarr;</a>
<a class="Left" href="../kurdyukov1/index.html">kurdyukov1 &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#Edward_Giles">Edward Giles</a><br>
Location: <a href="/temp-test-ioccc/location.html#AU">AU</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#2020-giles">2020
giles in bugs.md</a>.</p>
<h2 id="to-use">To use:</h2>
<div class="sourceCode" id="cb3"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb3-1"><a href="#cb3-1" aria-hidden="true" tabindex="-1"></a><span class="ex">./prog</span> <span class="op">&lt;</span> dtmf.wav</span>
<span id="cb3-2"><a href="#cb3-2" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb3-3"><a href="#cb3-3" aria-hidden="true" tabindex="-1"></a><span class="ex">./prog</span> <span class="pp">[</span><span class="ss">digits</span><span class="pp">]</span> <span class="op">&gt;</span> digits.wav</span></code></pre></div>
<p>where <code>dtmf.wav</code> is a WAV file of the dialling of a number
being dialled with <a
href="https://en.wikipedia.org/wiki/Dual-tone_multi-frequency_signaling">DTMF
(Dual-tone multi frequency)</a> (more commonly known as Touch-Tone) and
<code>[digits]</code> is a sequence of digits that will be converted to
the DTMF sound!</p>
<h2 id="try">Try:</h2>
<div class="sourceCode" id="cb4"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb4-1"><a href="#cb4-1" aria-hidden="true" tabindex="-1"></a><span class="ex">./try.sh</span></span>
<span id="cb4-2"><a href="#cb4-2" aria-hidden="true" tabindex="-1"></a><span class="ex">./prog</span> <span class="op">&lt;</span> pi.wav</span>
<span id="cb4-3"><a href="#cb4-3" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb4-4"><a href="#cb4-4" aria-hidden="true" tabindex="-1"></a><span class="co"># See </span></span>
<span id="cb4-5"><a href="#cb4-5" aria-hidden="true" tabindex="-1"></a><span class="ex">./prog</span> 867-5309 <span class="op">&gt;</span> jenny.wav</span></code></pre></div>
<p>If the script <a href="try.sh">try.sh</a> did not play a WAV file, it
means you do not have SoX installed; see <a href="/faq.md#faq3_10">FAQ
3.10: How do I compile and use an IOCCC winner that requires
sound?</a>). In this case install it and try it again or play the files
<code>jenny.wav</code> and <code>ioccc28.wav</code> in a program that
can play WAV files.</p>
<p>NOTE: the phone number of <code>jenny.wav</code> comes from <a
href="https://en.wikipedia.org/wiki/867-5309/Jenny"
class="uri">https://en.wikipedia.org/wiki/867-5309/Jenny</a>.</p>
<h2 id="judges-remarks">Judges’ remarks:</h2>
<p>A cross platform utility for both encoding and decoding touch
tones.</p>
<h2 id="authors-remarks">Author’s remarks:</h2>
<h3 id="introduction-and-usage">Introduction and Usage</h3>
<p>This program encodes and decodes <a
href="https://en.wikipedia.org/wiki/Dual-tone_multi-frequency_signaling">dual-tone
multiple frequency</a> signals used in telephone systems, more commonly
known as Touch-Tones.</p>
<p>If the program is executed with no arguments, it will read a WAV file
from standard input, decode the touch-tones in the file, and output the
corresponding digits to standard output. This program only supports WAV
files that have exactly 16 bits per sample, but it allows any sample
rate and any number of audio channels.</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">$</span> ./prog <span class="op">&lt;</span> pi.wav</span>
<span id="cb5-2"><a href="#cb5-2" aria-hidden="true" tabindex="-1"></a><span class="ex">31415926</span></span></code></pre></div>
<p>If the program is executed with a command-line argument, it will
generate the tones corresponding to the specified characters, writing
them to standard output as a WAV file.</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">$</span> ./prog 867-5309 <span class="kw">|</span> <span class="fu">aplay</span></span></code></pre></div>
<h3 id="interesting-features">Interesting Features</h3>
<ul>
<li>When compiled with <code>gcc -pedantic -Wall -Wextra</code> there
are no compiler warnings.</li>
<li>This program can be successfully compiled and run on Windows, using
both Microsoft’s C compiler and <a
href="https://bellard.org/tcc/">TCC</a>.</li>
<li>This program resamples the incoming audio, so that it can accept
audio data at any sample rate.</li>
<li>The code that generates the output sine-waves is the same as the
code that looks for sine-waves in the input. (see Algorithm Details for
roughly how this works).</li>
<li>Despite handling lots of sine waves, the program only uses basic
arithmetic operations. It does not depend on <code>libm</code>.</li>
<li>All type punning is done with <code>memcpy(3)</code> so there are no
strict-aliasing violations.</li>
<li>The size of the source code using the IOCCC size tool is 1963, the
year the first push-button telephones were made available to
customers.</li>
<li>The source code (not counting the C pre-processor) is roughly in the
shape of a telephone handset.</li>
</ul>
<h3 id="assumptions">Assumptions</h3>
<ul>
<li>Code is compiled using the C99 or C11 standard.</li>
<li><code>CHAR_BIT == 8</code>.</li>
<li>Machine is little-endian.</li>
<li><code>int16_t</code>, <code>uint16_t</code>, and
<code>uint32_t</code> exist.</li>
<li><code>int16_t</code> is 2’s-complement.</li>
<li><code>double</code> is an IEEE 754 binary64 floating-point
type.</li>
<li><code>sizeof(double) == 8</code>.</li>
</ul>
<h3 id="obfuscations">Obfuscations</h3>
<ul>
<li>DSP code is inherently somewhat difficult to understand.</li>
<li>Lots of identifier reuse. Each identifier is used for about 2.2
different tasks, on average. For example, <code>aa</code> is both a
variable and a macro for error handling, and <code>memcpy(3)</code> is
both a library function and a <code>oto</code> label.</li>
<li>Most of the identifiers are only 1 or 2 characters long, and are
unrelated to their actual function.</li>
<li>The <code>f</code> macro is used to unroll some of the loops.</li>
<li>Some numerical constants are replaced with character literals, so
the actual value is unclear.</li>
<li>All of the strings used by the program have been combined into a
single string literal.</li>
<li>Most of the values used for the actual signal-processing all reside
in one array, named <code>l</code>. This array is usually accessed at
index <code>z</code> plus a constant. Accesses of this type have been
rewritten from, e.g. <code>l[z+17]</code> to <code>17[l+z]</code>.
<code>[l+z]</code> ends up occurring quite often, so I created the macro
<code>a</code> as a shorthand.</li>
</ul>
<h3 id="algorithm-details">Algorithm Details</h3>
<p>Each tone in a DTMF signal is a combination of two frequencies. The
lower frequency determines which row the digit is in, and the higher
frequency determines the column. There are 4 possible row frequencies
and 4 possible column frequencies.</p>
<pre><code>| | **1209 Hz** | **1336 Hz** | **1477 Hz** | **1633 Hz** |
|------------|-------------|-------------|-------------|-------------|
| **697 Hz** | 1 | 2 abc | 3 def | A |
| **770 Hz** | 4 ghi | 5 jkl | 6 mno | B |
| **852 Hz** | 7 pqrs | 8 tuv | 9 wxyz | C |
| **941 Hz** | * | 0 | # | D |</code></pre>
<p>This program determines which frequencies are present in the input by
passing it through a set of 8 virtual resonators, each tuned to one of
the frequencies used for DTMF. These can be implemented using only basic
arithmetic, and they are able to ‘select’ a specific frequency from the
input sound, blocking all other frequencies from reaching the output.
The loudness of the sound output from each resonator can therefore be
used as a measure of how much of a particular frequency was present in
the input. The program then decides, over the course of one tone, which
row frequency and which column frequency were most prominent.</p>
<p>Tones are generated using those same resonators by providing <a
href="https://en.wikipedia.org/wiki/Kronecker_delta#Digital_signal_processing">an
impulse</a> as input. An impulse can be thought of as consisting of
sine-waves at all frequencies, and when it is put through one of the
resonators, the result is a single pure sine wave.</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-2020giles"><a name="inventory"></a>Inventory for
2020/giles</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/2020/giles/prog.c">prog.c</a>
- winning source</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2020/giles/Makefile">Makefile</a>
- winner Makefile</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2020/giles/prog.orig.c">prog.orig.c</a>
- original source</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2020/giles/try.sh">try.sh</a>
- how to run</li>
<li><a href="pi.wav">pi.wav</a> - touch tone for leading decimal digits
of pi</li>
<li><a href="2020_giles.tar.bz2">2020_giles.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/2020/giles/.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/2020/giles/.winner.json">.winner.json</a>
- description of winner in JSON</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2020/giles/README.md">README.md</a>
- markdown source for index.html</li>
<li><a href="dtmf.bin">dtmf.bin</a> - binary support file</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%2F2020%2Fgiles%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 -->
+267 -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,279 @@
<!-- !!! DO NOT MODIFY THIS FILE - This file is generated by a tool !!! -->
<!-- !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<!-- -->
<!-- file: 2020/kurdyukov1/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>2020 kurdyukov1</title>
<meta name="description" content="IOCCC year: 2020 IOCCC winner: kurdyukov1 winner index page">
<meta name="keywords" content="IOCCC,2020,kurdyukov1,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>2020/kurdyukov1</title>
<meta name="description" content="2020 IOCCC winner kurdyukov1">
<meta name="keywords" content="IOCCC, 2020, IOCCC 2020, IOCCC winner, kurdyukov1">
</head>
<!-- END: this line ends content from: inc/head.default.html -->
<!-- START: this line starts content from: inc/body.default.html -->
<body>
<h1>2020 kurdyukov1</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>2020/kurdyukov1</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%2F2020%2Fkurdyukov1%2Findex.html">Nu Html check https://ioccc-src.github.io/temp-test-ioccc/2020/kurdyukov1/index.html</a></p>
<!-- End Nu Html Checker -->
<div class="topnav">
<a class="Left" href="../giles/index.html">&larr; giles</a>
<a class="Left" href="../index.html">&uarr; 2020 &uarr;</a>
<a class="Left" href="../kurdyukov2/index.html">kurdyukov2 &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#Ilya_Kurdyukov">Ilya
Kurdyukov</a><br> Location: <a
href="/temp-test-ioccc/location.html#RU">RU</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 are alternate versions of this entry. See <a
href="#alternate-code">Alternate code</a> below for more details.</p>
<h2 id="to-use">To use:</h2>
<div class="sourceCode" id="cb2"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb2-1"><a href="#cb2-1" aria-hidden="true" tabindex="-1"></a><span class="ex">./prog</span></span>
<span id="cb2-2"><a href="#cb2-2" aria-hidden="true" tabindex="-1"></a><span class="co"># input some text</span></span>
<span id="cb2-3"><a href="#cb2-3" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb2-4"><a href="#cb2-4" aria-hidden="true" tabindex="-1"></a><span class="bu">echo</span> text <span class="kw">|</span> <span class="ex">./prog</span></span>
<span id="cb2-5"><a href="#cb2-5" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb2-6"><a href="#cb2-6" aria-hidden="true" tabindex="-1"></a><span class="ex">./prog</span> <span class="op">&lt;</span> file</span></code></pre></div>
<h2 id="try">Try:</h2>
<div class="sourceCode" id="cb3"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb3-1"><a href="#cb3-1" aria-hidden="true" tabindex="-1"></a><span class="ex">./try.sh</span></span></code></pre></div>
<h2 id="alternate-code">Alternate code:</h2>
<p>There are a number of alternate versions for this program, some in C
and some in assembly.</p>
<p>The file <a href="prog.alt.c">prog.alt.c</a> is smaller and does not
contain any headers or any workaround for WIN32 based platforms.</p>
<p>The file <a href="prog.extra.c">prog.extra.c</a> has a number of
layouts including some for different social media profile covers as well
as different shapes.</p>
<p>The files <a href="prog.x86_64.asm">prog.x86_64.asm</a> and <a
href="prog.x86.asm">prog.x86.asm</a> are the program in assembly for
x86_64 linux and x86 linux respectively.</p>
<h3 id="alternate-build">Alternate build:</h3>
<p>To build <a href="prog.alt.c">prog.alt.c</a>:</p>
<div class="sourceCode" id="cb4"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb4-1"><a href="#cb4-1" aria-hidden="true" tabindex="-1"></a><span class="fu">make</span> alt</span></code></pre></div>
<h3 id="alternate-use">Alternate use:</h3>
<p>Use <code>prog.alt</code> as you would <code>prog</code> above.</p>
<h2 id="judges-remarks">Judges’ remarks:</h2>
<p>This hash of a C code makes a hash out of input. Do you understand
how? You should get a-round-to-it figuring it out!</p>
<h2 id="authors-remarks">Author’s remarks:</h2>
<h3 id="md5-with-integers">MD5 with integers</h3>
<p>Just a tiny MD5 checksum utility. Prints hash string of data from
<code>stdin</code>. Works the same as
<code>openssl md5 | cut -d' ' -f2</code> command.</p>
<h3 id="my-objectives">My objectives</h3>
<ol type="1">
<li>Reduce code size as much as possible.</li>
<li>Avoid warnings from gcc/clang
<code>-Wall -Wextra -pedantic</code>.</li>
<li>Portable (regardless of register size and endianness).</li>
<li>Fit code in a round shape.</li>
<li>Mo macro defines.</li>
<li>No floating-point arithmetics.</li>
</ol>
<h3 id="notes">Notes</h3>
<p>The main difficulty of making MD5 code smaller is a 64x4 bytes long
table with constants which will take more than 512 bytes in hex
encoding. This table is a results of a sine function, so can be
generated dynamically, but merging floating-point arithmetics with
precise integer calculations is not a great idea, because it can cause
portability issues.</p>
<p>Attempts to satisfy <code>clang -Weverything</code> will ruin comma
magic, that is so great for obfuscation, so I don’t want to care about
that.</p>
<p>Probably, should work correctly on any machines, but I have nothing
exotic (like BE or not 32/64) to try it.</p>
<p>Added a macro hack to make <code>stdin</code> work in binary mode
under Windows (tested under mingw64), otherwise the hashes can be
incorrect.</p>
<h3 id="bonus">Bonus</h3>
<ul>
<li><p><a href="prog.extra.c">prog.extra.c</a> is the same with the sine
function (so smaller), and in different shapes.</p></li>
<li><p><a href="prog.x86_64.asm">prog.x86_64.asm</a> contains the same
program, but written in assembly for x86_64 Linux, for the sake of
smaller executable size which is 500 bytes long (where 120 is for the
ELF headers) after compilation. Algorithm details is slightly different
(like constants packing), just to make smaller binary code. It’s
interesting to compare density of binary code and obfuscated</p></li>
</ul>
<ol start="3" type="A">
<li></li>
</ol>
<ul>
<li><a href="prog.x86.asm">prog.x86.asm</a> is for x86, although the
headers are smaller, but the binary code is larger due to fewer
registers and lack of 64-bit multiply.</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-2020kurdyukov1"><a name="inventory"></a>Inventory
for 2020/kurdyukov1</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/2020/kurdyukov1/prog.c">prog.c</a>
- winning source</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2020/kurdyukov1/Makefile">Makefile</a>
- winner Makefile</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2020/kurdyukov1/prog.alt.c">prog.alt.c</a>
- alternative source</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2020/kurdyukov1/prog.orig.c">prog.orig.c</a>
- original source</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2020/kurdyukov1/try.sh">try.sh</a>
- how to run</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2020/kurdyukov1/prog.extra.c">prog.extra.c</a>
- variant of winning source with sine function</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2020/kurdyukov1/prog.x86.asm">prog.x86.asm</a>
- assembly source code</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2020/kurdyukov1/prog.x86_64.asm">prog.x86_64.asm</a>
- assembly source code</li>
<li><a href="2020_kurdyukov1.tar.bz2">2020_kurdyukov1.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/2020/kurdyukov1/.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/2020/kurdyukov1/.winner.json">.winner.json</a>
- description of winner in JSON</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2020/kurdyukov1/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%2F2020%2Fkurdyukov1%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 -->
+266 -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,278 @@
<!-- !!! DO NOT MODIFY THIS FILE - This file is generated by a tool !!! -->
<!-- !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<!-- -->
<!-- file: 2020/kurdyukov2/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>2020 kurdyukov2</title>
<meta name="description" content="IOCCC year: 2020 IOCCC winner: kurdyukov2 winner index page">
<meta name="keywords" content="IOCCC,2020,kurdyukov2,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>2020/kurdyukov2</title>
<meta name="description" content="2020 IOCCC winner kurdyukov2">
<meta name="keywords" content="IOCCC, 2020, IOCCC 2020, IOCCC winner, kurdyukov2">
</head>
<!-- END: this line ends content from: inc/head.default.html -->
<!-- START: this line starts content from: inc/body.default.html -->
<body>
<h1>2020 kurdyukov2</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>2020/kurdyukov2</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%2F2020%2Fkurdyukov2%2Findex.html">Nu Html check https://ioccc-src.github.io/temp-test-ioccc/2020/kurdyukov2/index.html</a></p>
<!-- End Nu Html Checker -->
<div class="topnav">
<a class="Left" href="../kurdyukov1/index.html">&larr; kurdyukov1</a>
<a class="Left" href="../index.html">&uarr; 2020 &uarr;</a>
<a class="Left" href="../kurdyukov3/index.html">kurdyukov3 &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#Ilya_Kurdyukov">Ilya
Kurdyukov</a><br> Location: <a
href="/temp-test-ioccc/location.html#RU">RU</a></p>
<!-- END: next line ends content generated by: bin/gen-author.sh -->
<h2 id="to-build">To build:</h2>
<div class="sourceCode" id="cb1"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb1-1"><a href="#cb1-1" aria-hidden="true" tabindex="-1"></a><span class="fu">make</span></span></code></pre></div>
<h2 id="to-use">To use:</h2>
<div class="sourceCode" id="cb2"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb2-1"><a href="#cb2-1" aria-hidden="true" tabindex="-1"></a><span class="ex">./prog</span></span></code></pre></div>
<h2 id="try">Try:</h2>
<div class="sourceCode" id="cb3"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb3-1"><a href="#cb3-1" aria-hidden="true" tabindex="-1"></a><span class="co"># Take a selfie</span></span>
<span id="cb3-2"><a href="#cb3-2" aria-hidden="true" tabindex="-1"></a><span class="ex">./prog</span> 1000 selfie.jpg output.jpg</span>
<span id="cb3-3"><a href="#cb3-3" aria-hidden="true" tabindex="-1"></a><span class="co"># Admire your portrait in cubist style</span></span>
<span id="cb3-4"><a href="#cb3-4" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb3-5"><a href="#cb3-5" aria-hidden="true" tabindex="-1"></a><span class="ex">./try.sh</span></span></code></pre></div>
<h2 id="judges-remarks">Judges’ remarks:</h2>
<p>This entry has reminded us of a winning entry back in the early 90s.
Can you guess which one?</p>
<p>For a given image, try graphing the execution time relative to the
number of rectangles. What is the complexity? Is it obvious from the
source code?</p>
<h2 id="authors-remarks">Author’s remarks:</h2>
<h3 id="usage">Usage</h3>
<p>This program divides the image into a specified number of rectangles.
This process is content aware, so the algorithm tries to match most of
the information. However, it doesn’t find the best theoretically
possible layout.</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">./prog</span> 1000 input.jpg output.jpg</span></code></pre></div>
<h3 id="building">Building</h3>
<p>You can build three versions, depending on the image format.</p>
<p>Default is JPEG version; if you have the <code>libjpeg</code>
development package installed in your system, then <code>make</code>
without arguments should do the right thing.</p>
<p>If you want to use <code>libjpeg</code> compiled from sources, then
use the <code>LIBJPEG</code> define to specify the path to includes and
the library. For example using <a
href="https://mac-dev-env.patrickbougie.com/libjpeg/">libjpeg source</a>
version 9c:</p>
<div class="sourceCode" id="cb5"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb5-1"><a href="#cb5-1" aria-hidden="true" tabindex="-1"></a><span class="fu">make</span> prog LIBJPEG=<span class="st">&quot;-Ijpeg-9c jpeg-9c/libjpeg.a&quot;</span></span></code></pre></div>
<p>Use this command to build a PNG version (you need
<code>libpng</code>):</p>
<div class="sourceCode" id="cb6"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb6-1"><a href="#cb6-1" aria-hidden="true" tabindex="-1"></a><span class="fu">make</span> prog_png LIBPNG=<span class="st">&quot;-lpng&quot;</span></span></code></pre></div>
<p>And the PPM version (no additional dependencies, can read raw/ASCII
PPM, writes raw PPM):</p>
<pre><code>make prog_ppm</code></pre>
<h3 id="building-on-macos-with-macports">Building on macOS with
MacPorts:</h3>
<p>Thanks to <a href="/winners.html#Cody_Boone_Ferguson">Cody Boone
Ferguson</a> for this information!</p>
<p>First, make sure you have the compiler tools installed e.g. by:</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">sudo</span> xcode-select <span class="at">--install</span></span></code></pre></div>
<p>Make sure you install <a
href="https://www.macports.org/install.php">MacPorts</a>. Then do:</p>
<div class="sourceCode" id="cb9"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb9-1"><a href="#cb9-1" aria-hidden="true" tabindex="-1"></a><span class="fu">sudo</span> port install jpeg libpng ImageMagick</span></code></pre></div>
<p>The program itself doesn’t need ImageMagick, install it only if you
plan to make GIFs from the results using <code>makegif.sh</code>.</p>
<p>After that’s installed you need to run make with these options:</p>
<div class="sourceCode" id="cb10"><pre
class="sourceCode sh"><code class="sourceCode bash"><span id="cb10-1"><a href="#cb10-1" aria-hidden="true" tabindex="-1"></a><span class="fu">make</span> LDFLAGS=<span class="st">&quot;-I/opt/local/include -L/opt/local/lib&quot;</span></span></code></pre></div>
<h3 id="building-on-macos-with-homebrew">Building on macOS with
HomeBrew</h3>
<p>First, make sure you have the compiler tools installed e.g. by:</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">sudo</span> xcode-select <span class="at">--install</span></span></code></pre></div>
<p>Make sure you install <a href="https://brew.sh">HomeBrew</a>.</p>
<p>Then:</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">brew</span> install libjpeg libpng</span>
<span id="cb12-2"><a href="#cb12-2" aria-hidden="true" tabindex="-1"></a><span class="bu">eval</span> <span class="st">&quot;</span><span class="va">$(</span><span class="ex">brew</span> shellenv<span class="va">)</span><span class="st">&quot;</span></span></code></pre></div>
<p>You are now ready to compile this entry:</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">make</span> clobber all</span></code></pre></div>
<h3 id="notes">Notes</h3>
<p>Made this thing while experimenting with the idea of representing an
image with rectangles (lossy compression). It’s not very good in that
sense, but the results look funny, like a kind of cubism pixel art.</p>
<p>Do not use values above 50000, it’ll be slow.</p>
<p>To understand how this works, just try running with 1,2,3,4… number
of rectangles. At each iteration, the rectangle with the biggest
difference from the picture data is split (halves may have different
size) horizontally or vertically to get the minimum difference.</p>
<p>You can use this command to make a GIF from output images (uses
ImageMagick). For instance after running the command suggested by the
judges:</p>
<div class="sourceCode" id="cb14"><pre
class="sourceCode sh"><code class="sourceCode bash"><span id="cb14-1"><a href="#cb14-1" aria-hidden="true" tabindex="-1"></a><span class="ex">convert</span> <span class="at">-delay</span> 10 <span class="at">-dither</span> none <span class="at">-loop</span> 0 <span class="va">$(</span><span class="fu">ls</span> out<span class="pp">*</span>.jpg <span class="kw">|</span> <span class="fu">sort</span> <span class="at">-V</span><span class="va">)</span> <span class="va">$(</span><span class="fu">ls</span> out<span class="pp">*</span>.jpg <span class="kw">|</span> <span class="fu">sort</span> <span class="at">-rV</span><span class="va">)</span> +map out.gif</span></code></pre></div>
<p>Also provided <code>makegif.sh</code> to aid with GIF creation.</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-2020kurdyukov2"><a name="inventory"></a>Inventory
for 2020/kurdyukov2</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/2020/kurdyukov2/prog.c">prog.c</a>
- winning source</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2020/kurdyukov2/Makefile">Makefile</a>
- winner Makefile</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2020/kurdyukov2/prog.orig.c">prog.orig.c</a>
- original source</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2020/kurdyukov2/try.sh">try.sh</a>
- how to run</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2020/kurdyukov2/makegif.sh">makegif.sh</a>
- utility to form GIFs from the results</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2020/kurdyukov2/prog.png.c">prog.png.c</a>
- build a PNG version</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2020/kurdyukov2/prog.ppm.c">prog.ppm.c</a>
- build a PPM version</li>
<li><a href="sample.jpg">sample.jpg</a> - sample image data</li>
<li><a href="2020_kurdyukov2.tar.bz2">2020_kurdyukov2.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/2020/kurdyukov2/.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/2020/kurdyukov2/.winner.json">.winner.json</a>
- description of winner in JSON</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2020/kurdyukov2/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%2F2020%2Fkurdyukov2%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 -->
+219 -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,231 @@
<!-- !!! DO NOT MODIFY THIS FILE - This file is generated by a tool !!! -->
<!-- !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<!-- -->
<!-- file: 2020/kurdyukov3/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>2020 kurdyukov3</title>
<meta name="description" content="IOCCC year: 2020 IOCCC winner: kurdyukov3 winner index page">
<meta name="keywords" content="IOCCC,2020,kurdyukov3,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>2020/kurdyukov3</title>
<meta name="description" content="2020 IOCCC winner kurdyukov3">
<meta name="keywords" content="IOCCC, 2020, IOCCC 2020, IOCCC winner, kurdyukov3">
</head>
<!-- END: this line ends content from: inc/head.default.html -->
<!-- START: this line starts content from: inc/body.default.html -->
<body>
<h1>2020 kurdyukov3</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>2020/kurdyukov3</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%2F2020%2Fkurdyukov3%2Findex.html">Nu Html check https://ioccc-src.github.io/temp-test-ioccc/2020/kurdyukov3/index.html</a></p>
<!-- End Nu Html Checker -->
<div class="topnav">
<a class="Left" href="../kurdyukov2/index.html">&larr; kurdyukov2</a>
<a class="Left" href="../index.html">&uarr; 2020 &uarr;</a>
<a class="Left" href="../kurdyukov4/index.html">kurdyukov4 &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#Ilya_Kurdyukov">Ilya
Kurdyukov</a><br> Location: <a
href="/temp-test-ioccc/location.html#RU">RU</a></p>
<!-- END: next line ends content generated by: bin/gen-author.sh -->
<h2 id="to-build">To build:</h2>
<div class="sourceCode" id="cb1"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb1-1"><a href="#cb1-1" aria-hidden="true" tabindex="-1"></a><span class="fu">make</span></span></code></pre></div>
<p>There is an alternate version of this program. See <a
href="#alternate-code">Alternate code</a> below.</p>
<h2 id="to-use">To use:</h2>
<div class="sourceCode" id="cb2"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb2-1"><a href="#cb2-1" aria-hidden="true" tabindex="-1"></a><span class="ex">./prog</span></span></code></pre></div>
<h2 id="try">Try:</h2>
<div class="sourceCode" id="cb3"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb3-1"><a href="#cb3-1" aria-hidden="true" tabindex="-1"></a><span class="ex">./try.sh</span></span></code></pre></div>
<h2 id="alternate-code">Alternate code:</h2>
<p>The alternate version, <a href="prog.alt.c">prog.alt.c</a>, has the
main code as a macro.</p>
<h3 id="alternate-build">Alternate build:</h3>
<div class="sourceCode" id="cb4"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb4-1"><a href="#cb4-1" aria-hidden="true" tabindex="-1"></a><span class="fu">make</span> alt</span></code></pre></div>
<h3 id="alternate-use">Alternate use:</h3>
<p>Use <code>prog.alt</code> as you would <code>prog</code> above.</p>
<h2 id="judges-remarks">Judges’ remarks:</h2>
<p>It is interesting how well smeonoe can raed txet wtih lots of tyops
in it. How well can you raed porg.c, C prgoarm that is in the shpae of
an SD card (or is it a pnuch crad)?</p>
<p>BTW: this funny reading of English (which also works with several
other languages) is called <a
href="https://www.mrc-cbu.cam.ac.uk/personal/matt.davis/Cmabrigde/">typoglycemia</a>
(the article however is incorrect in stating that if the letters were
more jumbled or if other words were formed one could not read it: we
know of some who can in fact do exactly that). Also, to be clear, there
was no such study stated in <a href="input.txt">input.txt</a> but as
you’ll likely see you should be able to do exactly what it says
nonetheless.</p>
<h2 id="authors-remarks">Author’s remarks:</h2>
<h3 id="letter-mixer">Letter Mixer</h3>
<p>Compile and try this:</p>
<div class="sourceCode" id="cb5"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb5-1"><a href="#cb5-1" aria-hidden="true" tabindex="-1"></a><span class="fu">cat</span> input.txt <span class="kw">|</span> <span class="ex">./prog</span></span></code></pre></div>
<p>The program can work with letters that are not represented in
English, as long as these letters are encoded in the higher part of the
single-byte character set (use <code>iconv</code> to convert from UTF-8
and back).</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-2020kurdyukov3"><a name="inventory"></a>Inventory
for 2020/kurdyukov3</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/2020/kurdyukov3/prog.c">prog.c</a>
- winning source</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2020/kurdyukov3/Makefile">Makefile</a>
- winner Makefile</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2020/kurdyukov3/prog.alt.c">prog.alt.c</a>
- alternative source</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2020/kurdyukov3/prog.orig.c">prog.orig.c</a>
- original source</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2020/kurdyukov3/input.txt">input.txt</a>
- sample input</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2020/kurdyukov3/prog.extra.c">prog.extra.c</a>
- alternative source with extra functionality</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2020/kurdyukov3/try.sh">try.sh</a>
- how to run</li>
<li><a href="2020_kurdyukov3.tar.bz2">2020_kurdyukov3.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/2020/kurdyukov3/.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/2020/kurdyukov3/.winner.json">.winner.json</a>
- description of winner in JSON</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2020/kurdyukov3/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%2F2020%2Fkurdyukov3%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 -->
+280 -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,292 @@
<!-- !!! DO NOT MODIFY THIS FILE - This file is generated by a tool !!! -->
<!-- !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<!-- -->
<!-- file: 2020/kurdyukov4/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>2020 kurdyukov4</title>
<meta name="description" content="IOCCC year: 2020 IOCCC winner: kurdyukov4 winner index page">
<meta name="keywords" content="IOCCC,2020,kurdyukov4,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>2020/kurdyukov4</title>
<meta name="description" content="2020 IOCCC winner kurdyukov4">
<meta name="keywords" content="IOCCC, 2020, IOCCC 2020, IOCCC winner, kurdyukov4">
</head>
<!-- END: this line ends content from: inc/head.default.html -->
<!-- START: this line starts content from: inc/body.default.html -->
<body>
<h1>2020 kurdyukov4</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>2020/kurdyukov4</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%2F2020%2Fkurdyukov4%2Findex.html">Nu Html check https://ioccc-src.github.io/temp-test-ioccc/2020/kurdyukov4/index.html</a></p>
<!-- End Nu Html Checker -->
<div class="topnav">
<a class="Left" href="../kurdyukov3/index.html">&larr; kurdyukov3</a>
<a class="Left" href="../index.html">&uarr; 2020 &uarr;</a>
<a class="Left" href="../otterness/index.html">otterness &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#Ilya_Kurdyukov">Ilya
Kurdyukov</a><br> Location: <a
href="/temp-test-ioccc/location.html#RU">RU</a></p>
<!-- END: next line ends content generated by: bin/gen-author.sh -->
<h2 id="to-build">To build:</h2>
<div class="sourceCode" id="cb1"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb1-1"><a href="#cb1-1" aria-hidden="true" tabindex="-1"></a><span class="fu">make</span></span></code></pre></div>
<h2 id="to-use">To use:</h2>
<div class="sourceCode" id="cb2"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb2-1"><a href="#cb2-1" aria-hidden="true" tabindex="-1"></a><span class="ex">./prog</span> text_file output_length context_length random_seed</span></code></pre></div>
<h2 id="try">Try:</h2>
<p>When running this, ask yourself why it gets progressively slower when
the context length decreases:</p>
<div class="sourceCode" id="cb3"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb3-1"><a href="#cb3-1" aria-hidden="true" tabindex="-1"></a><span class="ex">./try.sh</span></span></code></pre></div>
<blockquote>
<p>Performance depends on the number of same hashes found. Too many
identical strings if the context length is small. – Author</p>
</blockquote>
<h2 id="judges-remarks">Judges’ remarks:</h2>
<p>We were able to <a href="rand.c">write our own program</a> performing
the same trick using the (still non-standard, for some reason) library
function <code>memmem()</code>, but that way it works too fast
regardless of the context length, and it’s much less fun.</p>
<p>The author wrote in reply:</p>
<hr />
<p>Wow, amazing! Very fast, but there is a drawback to randomness. If
some string only appears after half the input, the first instance of
this string will have a 50% chance of occurrence. Example:</p>
<pre><code>echo &quot;00000000000000000000 01 02 02 02 02 02 02&quot; &gt; test.txt
./prog test.txt 1000 2 123
# more twos in output
./rand test.txt 1000 2 123
# more ones in output</code></pre>
<blockquote>
<p>But this will happen very rarely on real data. – Author</p>
</blockquote>
<hr />
<p>Try using the same random seed and varying the context size.</p>
<p>BTW: what on Middle-earth is <code>lámatyávë</code>? It’s Quenya, one
of the languages of the Elves in Tolkien’s Legendarium. It means sound
taste (plural is lámatyáver) and it refers to phonaesthesia - in other
words, it refers to the pleasure of sound and form of words. It’s
discussed in <a
href="https://en.wikipedia.org/wiki/Morgoth%27s_Ring">Morgoth’s
Ring</a>, volume X of <a
href="https://en.wikipedia.org/wiki/The_History_of_Middle-earth">History
of Middle-earth (HoMe)</a>. Now can you appreciate the award title a bit
better?</p>
<h2 id="authors-remarks">Author’s remarks:</h2>
<h3 id="building">Building:</h3>
<div class="sourceCode" id="cb5"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb5-1"><a href="#cb5-1" aria-hidden="true" tabindex="-1"></a><span class="fu">cc</span> prog.c <span class="at">-o</span> prog</span></code></pre></div>
<h3 id="usage">Usage:</h3>
<p>This program generates random text from the provided dictionary using
a Markov chain, outputting to <code>stdout</code>.</p>
<div class="sourceCode" id="cb6"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb6-1"><a href="#cb6-1" aria-hidden="true" tabindex="-1"></a><span class="ex">./prog</span> input.txt 2000 10 12345</span></code></pre></div>
<p>Parameters are:</p>
<ol type="1">
<li><p>dictionary filename Need at least the size of the book, the more
the better (1Mb); you can concatenate several books into one file. This
should be a text file (not <code>.doc</code>/<code>.pdf</code>). You can
feed it with books in <code>.fb2</code> format, metadata is filtered.
Whitespace characters are also filtered. For languages other than
English, it’s better to use ANSI encoding. You can use UTF, but you need
to increase the chain length (if one ANSI character is encoded as two
UTF bytes, then multiply chain length by two).</p></li>
<li><p>bytes to generate (limited to 1Mb)</p></li>
<li><p>chain length Randomness and performance depend inversely on this
parameter and the size of the dictionary. If you feel that the bytes are
generated too slowly, then you need to increase the length of the chain.
This length means that any part of the output of this size in bytes
exists somewhere in the dictionary.</p></li>
<li><p>random seed</p></li>
</ol>
<h3 id="example">Example</h3>
<p>You can try this with the inputs provided with <a
href="/2019/mills/README.md">2019/mills</a> from the IOCCC winners.</p>
<div class="sourceCode" id="cb7"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb7-1"><a href="#cb7-1" aria-hidden="true" tabindex="-1"></a><span class="ex">$</span> ./prog Shakespeare.txt 2001 10 12345</span></code></pre></div>
<p>produces:</p>
<pre><code>r sons, wives for them, as the hope I had it. This is the way they be not too ra
sh a trial of you only. Therefore will not out of door? Nurse: Marry, bachelor,
Have other some, he is in Rome: but where is Warwick frowns at his. PRINCE EDWAR
D: Where is the light: But I will watch thy waking, what work he makes Amongst y
ou? Come, sirs, We shall write to you, fortune and The hazard of much blood. I w
ould to heaven, respective lenity, And fire-eyed fury be my convoy in the senten
ced; &#39;tis too horrible, so bloody on the banks If they were created, Would bring
them to our presence? FLORIZEL: And those his golden crown, What is six winters
? they are but Lewis and Warwick bids you come too late come from the king&#39;s fri
end, and will do&#39;t; for, look you, sir, For still thy true servitor: I will rend
an oak And peg thee in his knotty entrails till Thou hast hazel eyes: what eye
but such an eye would spy out such a day to-morrow, or next day: He is within th
e limit of the like, forsworn to love, Send her a story of more woe Than this is
a merry ballad, but a very pretty one. MOPSA: Thou hast amazed me, My name is E
lbow: I do lean upon, Now thou art: Thy tears are womanish; thy wild acts denote
The unreasonably: come, you must: and there, I then do&#39;t to them? VOLUMNIA: Now
the red pestilence hangs in our aim, which is yours. What is&#39;t your honour, as
in war, since then, You have said before: My child is dead; or &#39;twere not &#39;long
of him; but he, like you, lads; about your ears it is Menenius? Second Officer:
Come, come, young wanton and effeminate boy, Takes on the hungry beach Fillip th
e stars Shall bitterly begin his wooing that we have in hand are angry And frown
ing brow to brow, ourselves, Still your own affections are devised, As blanks, b
enevolences, and I thank thee for it. KING HENRY VI: Master lieutenant comes. Ma
ster lieutenant comes. Master lieutenant, pray you,-- CORIOLANUS: What&#39;s that to
him? CHRISTOPHER: At Pembroke, Sir James Blunt, And Rice ap Thomas with a virtu</code></pre>
<h2 id="copyright-and-cc-by-sa-4.0-license">Copyright and CC BY-SA 4.0
License:</h2>
<p>This file is Copyright (c) 2023 by Landon Curt Noll. All Rights
Reserved. You are free to share and adapt this file under the terms of
this license:</p>
<pre><code>Creative Commons Attribution-ShareAlike 4.0 International (CC BY-SA 4.0)</code></pre>
<p>For more information, see:
https://creativecommons.org/licenses/by-sa/4.0/</p>
<!-- START: this line starts content generated by: bin/gen-inventory.sh -->
<h1 id="inventory-for-2020kurdyukov4"><a name="inventory"></a>Inventory
for 2020/kurdyukov4</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/2020/kurdyukov4/prog.c">prog.c</a>
- winning source</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2020/kurdyukov4/Makefile">Makefile</a>
- winner Makefile</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2020/kurdyukov4/prog.orig.c">prog.orig.c</a>
- original source</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2020/kurdyukov4/Eugene_Onegin.txt">Eugene_Onegin.txt</a>
- Eugene Onegin poetry</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2020/kurdyukov4/Shakespeare.txt">Shakespeare.txt</a>
- Shakespeare text</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2020/kurdyukov4/rand.c">rand.c</a>
- randomize a file</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2020/kurdyukov4/try.sh">try.sh</a>
- how to run</li>
<li><a href="2020_kurdyukov4.tar.bz2">2020_kurdyukov4.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/2020/kurdyukov4/.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/2020/kurdyukov4/.winner.json">.winner.json</a>
- description of winner in JSON</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2020/kurdyukov4/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%2F2020%2Fkurdyukov4%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 -->
+297 -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,309 @@
<!-- !!! DO NOT MODIFY THIS FILE - This file is generated by a tool !!! -->
<!-- !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<!-- -->
<!-- file: 2020/otterness/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>2020 otterness</title>
<meta name="description" content="IOCCC year: 2020 IOCCC winner: otterness winner index page">
<meta name="keywords" content="IOCCC,2020,otterness,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>2020/otterness</title>
<meta name="description" content="2020 IOCCC winner otterness">
<meta name="keywords" content="IOCCC, 2020, IOCCC 2020, IOCCC winner, otterness">
</head>
<!-- END: this line ends content from: inc/head.default.html -->
<!-- START: this line starts content from: inc/body.default.html -->
<body>
<h1>2020 otterness</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>2020/otterness</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%2F2020%2Fotterness%2Findex.html">Nu Html check https://ioccc-src.github.io/temp-test-ioccc/2020/otterness/index.html</a></p>
<!-- End Nu Html Checker -->
<div class="topnav">
<a class="Left" href="../kurdyukov4/index.html">&larr; kurdyukov4</a>
<a class="Left" href="../index.html">&uarr; 2020 &uarr;</a>
<a class="Left" href="../tsoj/index.html">tsoj &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#Nathan_Otterness">Nathan
Otterness</a><br> Location: <a
href="/temp-test-ioccc/location.html#US">US</a></p>
<!-- END: next line ends content generated by: bin/gen-author.sh -->
<h2 id="to-build">To build:</h2>
<div class="sourceCode" id="cb1"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb1-1"><a href="#cb1-1" aria-hidden="true" tabindex="-1"></a><span class="fu">make</span></span></code></pre></div>
<h3 id="bugs-and-misfeatures">Bugs and (Mis)features:</h3>
<p>The current status of this entry is:</p>
<pre><code>STATUS: INABIAF - please **DO NOT** fix</code></pre>
<p>For more detailed information see <a
href="/bugs.md#2020-otterness">2020 otterness in bugs.md</a>.</p>
<h2 id="to-use">To use:</h2>
<div class="sourceCode" id="cb3"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb3-1"><a href="#cb3-1" aria-hidden="true" tabindex="-1"></a><span class="ex">./prog</span></span></code></pre></div>
<h2 id="try">Try:</h2>
<div class="sourceCode" id="cb4"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb4-1"><a href="#cb4-1" aria-hidden="true" tabindex="-1"></a><span class="ex">./prog</span> <span class="op">&lt;</span> cvikl.mid <span class="op">&gt;</span> output.mid</span>
<span id="cb4-2"><a href="#cb4-2" aria-hidden="true" tabindex="-1"></a><span class="co"># Play output.mid with your favorite player</span></span>
<span id="cb4-3"><a href="#cb4-3" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb4-4"><a href="#cb4-4" aria-hidden="true" tabindex="-1"></a><span class="ex">./prog</span> <span class="op">&lt;</span> entertainer.mid <span class="op">&gt;</span> output2.mid</span>
<span id="cb4-5"><a href="#cb4-5" aria-hidden="true" tabindex="-1"></a><span class="co"># Play output2.mid with your favorite player</span></span></code></pre></div>
<h2 id="judges-remarks">Judges’ remarks:</h2>
<p>In an entry that boasts not using literals, one would expect to see
straightforward ways to produce small integers like
<code>!(x^x)&lt;&lt;!(x^x)</code>, etc. but this entry is trickier than
that. Deciphering what it does, apart from reading <code>stdin</code>
and writing to <code>stdout</code>, would take a while.</p>
<p>While doing that, you can be audibly <em>entertained</em> by a sample
of its output.</p>
<h2 id="authors-remarks">Author’s remarks:</h2>
<h3 id="midi-boots-and-cats">MIDI “boots and cats”</h3>
<p>This program seeks to automatically “improve” standard MIDI files
(.mid) by adding an extra track that provides a driving drum beat to
bring some excitement into boring video-game music rips or classical
music sequences that otherwise only see the light of day when modern
musicians import them into FL Studio to copy a few chords.</p>
<h4 id="prerequisites">Prerequisites</h4>
<p>If you’re not using Windows Media Player or already familiar with
MIDI files, you may need to install some additional software to be able
to listen to them. For example, on Ubuntu, I was able to play them in
VLC after installing <code>vlc-plugin-fluidsynth</code> and
<code>fluid-soundfont-gm</code>.</p>
<p>You can obtain MIDIs in many places, but I mostly tested the program
using files I found <a
href="http://www.kunstderfuge.com/beethoven/variae.htm#Symphonies">here</a>.
However, as discussed under the <a href="#limitations">Limitations</a>
section below, not all of them work correctly. I will admit to having
used
<code>http://www.kunstderfuge.com/-/midi.asp?file=beethoven/symphony_6_1_(c)cvikl.mid</code>
for most of my testing (see <a href="cvikl.mid">cvikl.mid</a>).</p>
<h3 id="usage">Usage</h3>
<p>Compile the program using the following command (I tested this using
both <code>clang</code> and <code>gcc</code>):</p>
<div class="sourceCode" id="cb5"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb5-1"><a href="#cb5-1" aria-hidden="true" tabindex="-1"></a><span class="fu">cc</span> <span class="at">-pedantic</span> <span class="at">-Wall</span> <span class="at">-Werror</span> <span class="at">-Wextra</span> <span class="at">-O3</span> <span class="at">-o</span> prog prog.c</span></code></pre></div>
<p>The program expects a MIDI on <code>stdin</code>, and writes a
modified MIDI to <code>stdout</code>:</p>
<pre><code>./prog &lt;input.mid &gt;output.mid</code></pre>
<p>If the program encounters an error, no output will generally be
produced, and it will exit with a specific status code. Meanings of the
various status codes are listed below, under the “Program error codes”
heading. On success, the program exits with a code of 0.</p>
<h3 id="limitations">Limitations</h3>
<ol type="1">
<li><p>The program does not support MIDI files over 4 MB (specifically,
it will not take input files larger than <code>2^22 - 1</code> bytes).
This is unlikely to be a big limitation in practice, since even lengthy
MIDIs are rarely over a couple hundred KB.</p></li>
<li><p>Not all MIDIs set (or <em>correctly</em> set) their timing
information, which will lead to the tempo of the drum beat not matching
the track. This will be especially true for “live performance” .mid
files.</p></li>
<li><p>There may be some types of MIDI messages that the program is
unable to correctly parse, but I have rarely seen this in practice. The
largest cause of program failures, in my experience, has been Limitation
2.</p></li>
</ol>
<h4 id="obfuscation-notes">Obfuscation notes</h4>
<p>I had one primary goal when writing this program: include no C
literals whatsoever. The final C file includes no numerical, string, or
character literals. Instead, all literals have been replaced with a
handful of global variables, which are occasionally modified throughout
the file to prevent simple uses of find-and-replace.</p>
<p>So, in a sense, this obfuscation is simply an intentional use of
global variables’ classic problem: absolute spaghetti code. The absence
of any sort of literals has the added benefit of forcing any would-be
reader to trace the contents of many variables starting from
<code>main()</code>, since, without literals, very little of the code
gives any inherent visual cues as to its purpose.</p>
<p>I already took the liberty of running <code>prog.c</code> through
<code>clang-format</code>, since it still fits in the size limit and the
formatting of the code was never intended to be an obfuscation technique
here.</p>
<h4 id="other-remarks">Other remarks</h4>
<p>MIDI files are generally divided up into one or more “tracks” that
play concurrently. While it is easy to find the positions of each of
these tracks in the file, figuring out the amount of time each track is
supposed to play is more difficult, and requires parsing every track in
its entirety. This means that generating a drum beat that covers the
entire piece of music requires parsing every track (the entire file) in
order to determine the longest track.</p>
<p>Once the program has determined the longest track in the file, it
generates a new track, containing the simple 4-note percussion sequence,
to match the length (in beats) of the longest-running track. It appends
the new track onto the end of the file, taking care to update the file
header, as well.</p>
<h3 id="program-error-codes">Program error codes</h3>
<p>If the program encounters an error, it will exit with a nonzero code.
The error codes can be interpreted as follows:</p>
<ul>
<li><code>1</code>: Encountered an invalid MIDI variable-length integer
in the input.</li>
<li><code>2</code>: Attempted to write an invalid MIDI variable-length
integer to output. (This would be an internal error).</li>
<li><code>3</code>: Encountered an unsupported MIDI event in the
input.</li>
<li><code>4</code>: Encountered a bad MIDI track header in the
input.</li>
<li><code>5</code>: The input MIDI file uses SMPTE time division, which
isn’t supported.</li>
<li><code>6</code>: Failed allocating a temporary buffer to hold a
single copy of our “beat” messages.</li>
<li><code>7</code>: Failed allocating a buffer to hold the new track
data.</li>
<li><code>8</code>: Failed allocating a buffer to hold the input
file.</li>
<li><code>9</code>: The input file was too large.</li>
<li><code>10</code>: The input file’s MIDI header was incorrect (but
this isn’t checked very thoroughly).</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-2020otterness"><a name="inventory"></a>Inventory
for 2020/otterness</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/2020/otterness/prog.c">prog.c</a>
- winning source</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2020/otterness/Makefile">Makefile</a>
- winner Makefile</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2020/otterness/prog.orig.c">prog.orig.c</a>
- original source</li>
<li><a href="cvikl.mid">cvikl.mid</a> - sample input sound</li>
<li><a href="entertainer.mid">entertainer.mid</a> - sample input
sound</li>
<li><a href="2020_otterness.tar.bz2">2020_otterness.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/2020/otterness/.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/2020/otterness/.winner.json">.winner.json</a>
- description of winner in JSON</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2020/otterness/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%2F2020%2Fotterness%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 -->
+269 -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,281 @@
<!-- !!! DO NOT MODIFY THIS FILE - This file is generated by a tool !!! -->
<!-- !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<!-- -->
<!-- file: 2020/tsoj/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>2020 tsoj</title>
<meta name="description" content="IOCCC year: 2020 IOCCC winner: tsoj winner index page">
<meta name="keywords" content="IOCCC,2020,tsoj,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>2020/tsoj</title>
<meta name="description" content="2020 IOCCC winner tsoj">
<meta name="keywords" content="IOCCC, 2020, IOCCC 2020, IOCCC winner, tsoj">
</head>
<!-- END: this line ends content from: inc/head.default.html -->
<!-- START: this line starts content from: inc/body.default.html -->
<body>
<h1>2020 tsoj</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>2020/tsoj</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%2F2020%2Ftsoj%2Findex.html">Nu Html check https://ioccc-src.github.io/temp-test-ioccc/2020/tsoj/index.html</a></p>
<!-- End Nu Html Checker -->
<div class="topnav">
<a class="Left" href="../otterness/index.html">&larr; otterness</a>
<a class="Left" href="../index.html">&uarr; 2020 &uarr;</a>
<a class="Left" href="../yang/index.html">yang &rarr;</a>
<a class="Right" href="#inventory">Inventory</a>
</div>
<!-- END: this line ends content from: inc/topnav.mid.html -->
<!-- START: this line starts content from: inc/begin-row.default.html -->
<div class="row">
<!-- END: this line ends content from: inc/begin-row.default.html -->
<!-- START: this line starts content from: inc/begin-leftcolumn.default.html -->
<div class="leftcolumn">
<!-- END: this line ends content from: inc/begin-leftcolumn.default.html -->
<!-- START: this line starts content from: inc/sidenav.default.html -->
<div class="sidenav">
<a href="#content">Jump to contents</a>
</div>
<hr>
<div class="sidenav">
<a href="/temp-test-ioccc/index.html">IOCCC Home</a>
<a href="/temp-test-ioccc/years.html">Winning Entries</a>
<a href="/temp-test-ioccc/winners.html">People who have won</a>
</div>
<hr>
<div class="sidenav">
<a href="/temp-test-ioccc/news.html">IOCCC News</a>
<a href="/temp-test-ioccc/faq.html#submit">How to enter the IOCCC</a>
<a href="/temp-test-ioccc/faq.html">FAQ</a>
</div>
<hr>
<div class="sidenav">
<a href="/temp-test-ioccc/bugs.html">Bugs &amp; (mis)features</a>
<a href="/temp-test-ioccc/faq.html#fix_a_winner">Fixing IOCCC winners</a>
<a href="/temp-test-ioccc/faq.html#fix_web_site">Fixing the web site</a>
<a href="/temp-test-ioccc/faq.html#fix_author">Fixing winner info</a>
<a href="/temp-test-ioccc/thanks-for-help.html">Thanks for the help</a>
</div>
<hr>
<div class="sidenav">
<a href="/temp-test-ioccc/judges.html">The IOCCC Judges</a>
<a href="/temp-test-ioccc/contact.html">Contacting the IOCCC</a>
</div>
<hr>
<div class="sidenav">
<a href="#top">Jump to top</a>
</div>
<!-- END: this line ends content from: inc/sidenav.default.html -->
<!-- START: this line starts content from: inc/end-leftcolumn.default.html -->
</div>
<!-- END: this line ends content from: inc/end-leftcolumn.default.html -->
<!-- START: this line starts content from: inc/begin-rightcolumn.default.html -->
<div class="rightcolumn">
<!-- END: this line ends content from: inc/begin-rightcolumn.default.html -->
<!-- START: this line starts content from: inc/before-content.default.html -->
<a name="content"></a>
<!-- END: this line ends content from: inc/before-content.default.html -->
<!-- START: this line starts content generated by: bin/gen-author.sh -->
<p><a name="author"><strong>Author:</strong></a> <br><br>Name: <a
href="/temp-test-ioccc/winners.html#Tsoj">tsoj</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>
<p>There is an alternate version which has controls that will make much
more sense to those familiar with vi. See <a
href="#alternate-code">Alternate code</a> below.</p>
<h2 id="to-use">To use:</h2>
<div class="sourceCode" id="cb2"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb2-1"><a href="#cb2-1" aria-hidden="true" tabindex="-1"></a><span class="ex">./prog</span></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="co"># Make your terminal as large as possible, possibly reduce your font size</span></span>
<span id="cb3-2"><a href="#cb3-2" aria-hidden="true" tabindex="-1"></a><span class="co"># then...</span></span>
<span id="cb3-3"><a href="#cb3-3" aria-hidden="true" tabindex="-1"></a><span class="ex">./prog</span></span></code></pre></div>
<h2 id="alternate-code">Alternate code:</h2>
<p>This version has the difference of moving forwards, left, backwards
and right, where instead of <code>w</code>, <code>a</code>,
<code>s</code> and <code>d</code>, you can use <code>k</code>,
<code>h</code>, <code>j</code> and <code>l</code>.</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>
<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="co"># Make your terminal as large as possible, possibly reduce your font size</span></span>
<span id="cb5-2"><a href="#cb5-2" aria-hidden="true" tabindex="-1"></a><span class="co"># then...</span></span>
<span id="cb5-3"><a href="#cb5-3" aria-hidden="true" tabindex="-1"></a><span class="ex">./prog.alt</span></span></code></pre></div>
<p>..and maybe curse less than you might otherwise, but still probably
curse (see below) :-)</p>
<h2 id="judges-remarks">Judges’ remarks:</h2>
<p>This game does not use curses, but you may end up cursing.</p>
<p>The code is made more difficult to read using an innovative, right
justified, reverse indentation style.</p>
<h2 id="authors-remarks">Author’s remarks:</h2>
<h3 id="controls">Controls</h3>
<ul>
<li>Movement: <code>w</code> (forwards), <code>a</code> (left),
<code>s</code> (backwards), <code>d</code> (right)</li>
<li>Fire: space</li>
<li>Quit: <code>q</code></li>
<li>Pause: <code>p</code>, then use any other key to resume</li>
</ul>
<pre><code> /\
//\\
/ \
/______\
/\/\</code></pre>
<h3 id="compile-and-run">Compile and run</h3>
<h4 id="linux">Linux</h4>
<pre><code>cc -std=c99 -O3 prog.c -o prog
./prog</code></pre>
<h4 id="windows">Windows</h4>
<p>The only way I found to make it work is to use <a
href="https://www.msys2.org">MSYS2</a>. When using the MSYS2 shell you
can install gcc via pacman.</p>
<pre><code>cc -std=c99 -O3 prog.c -o prog
./prog.exe</code></pre>
<h4 id="warnings">Warnings</h4>
<ul>
<li><code>-Wno-missing-prototypes</code></li>
<li><code>-Wno-shorten-64-to-32</code></li>
<li><code>-Wno-sign-conversion</code></li>
<li><code>-Wno-implicit-int-float-conversion</code></li>
<li><code>-Wno-missing-field-initializers</code></li>
<li><code>-Wno-implicit-float-conversion</code></li>
<li><code>-Wno-vla</code></li>
<li><code>-Wno-float-conversion</code></li>
<li><code>-Wno-comma</code></li>
<li><code>-Wno-shadow</code></li>
<li><code>-Wno-format</code></li>
<li><code>-Wno-empty-body</code></li>
<li><code>-Wno-misleading-indentation</code></li>
<li><code>-Wno-maybe-uninitialized</code></li>
<li>You may experience a mild <a
href="https://en.wikipedia.org/wiki/Motion_aftereffect">motion
aftereffect</a> when playing for too long.</li>
</ul>
<h3 id="high-score">High score</h3>
<p>Score will be shown in the top left corner. My best was
<strong>156</strong>. If you beat that I’ll send you the image of a very
expensive chocolate.</p>
<h3 id="features">Features</h3>
<ul>
<li>Procedural star generation.</li>
<li>Very space-efficient <code>for</code> loops.</li>
<li>No use of <code>!=</code> or <code>==</code>.</li>
<li>Smooth rendering even on slow terminals.</li>
<li>Advanced ASCII art.</li>
<li>Cutting edge physics engine and collision detection.</li>
<li>Probably not many segfaults.</li>
<li>Every letter in the English alphabet has a variable or function
named after it.</li>
<li>Not a virus.</li>
<li>Runs on my machine.</li>
</ul>
<h3 id="tips">Tips</h3>
<ul>
<li>Adjust your terminal size for different experiences.</li>
<li>Run this program in a virtual console to immerse yourself in the
game.</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-2020tsoj"><a name="inventory"></a>Inventory for
2020/tsoj</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/2020/tsoj/prog.c">prog.c</a>
- winning source</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2020/tsoj/Makefile">Makefile</a>
- winner Makefile</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2020/tsoj/prog.alt.c">prog.alt.c</a>
- alternative source</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2020/tsoj/prog.orig.c">prog.orig.c</a>
- original source</li>
<li><a href="2020_tsoj.tar.bz2">2020_tsoj.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/2020/tsoj/.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/2020/tsoj/.winner.json">.winner.json</a>
- description of winner in JSON</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2020/tsoj/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%2F2020%2Ftsoj%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 -->
+280 -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,292 @@
<!-- !!! DO NOT MODIFY THIS FILE - This file is generated by a tool !!! -->
<!-- !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<!-- -->
<!-- file: 2020/yang/index.html created by: fake.gen_index.sh version: 1.0.5 2023-10-31 -->
<html lang="en">
<!-- END: this line ends content from: inc/top.default.html -->
<!-- -->
<!-- This file was formed by the tool: bin/readme2index.sh version: 1.1 2024-01-16 -->
<!-- -->
<!-- START: this line starts content from: inc/head.default.html -->
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>2020 yang</title>
<meta name="description" content="IOCCC year: 2020 IOCCC winner: yang winner index page">
<meta name="keywords" content="IOCCC,2020,yang,winner index page">
<link rel="stylesheet" href="/temp-test-ioccc/ioccc.css">
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=yes">
<title>2020/yang</title>
<meta name="description" content="2020 IOCCC winner yang">
<meta name="keywords" content="IOCCC, 2020, IOCCC 2020, IOCCC winner, yang">
</head>
<!-- END: this line ends content from: inc/head.default.html -->
<!-- START: this line starts content from: inc/body.default.html -->
<body>
<h1>2020 yang</h1>
<!-- END: this line ends content from: inc/body.default.html -->
<!-- START: this line starts content from: inc/header.default.html -->
<p>XXX - fake content until readme2index is working - XXX</p>
<div class="header">
<img src="/temp-test-ioccc/png/ioccc.png" alt="IOCCC image by Matt Zucker" width=300 height=110>
<h1>The International Obfuscated C Code Contest</h1>
<h2>2020/yang</h2>
</div>
<hr style="width:50%;text-align:left;margin-left:0">
<!-- END: this line ends content from: inc/header.default.html -->
<!-- START: this line starts content from: inc/topnav.last.html -->
<!-- Start Nu Html Checker -->
<p><a href="https://validator.w3.org/nu/?doc=https%3A%2F%2Fioccc-src.github.io%2Ftemp-test-ioccc%2F2020%2Fyang%2Findex.html">Nu Html check https://ioccc-src.github.io/temp-test-ioccc/2020/yang/index.html</a></p>
<!-- End Nu Html Checker -->
<div class="topnav">
<a class="Left" href="../tsoj/index.html">&larr; tsoj</a>
<a class="Left" href="../index.html">&uarr; 2020 &uarr;</a>
<a class="Left Disabled" href="#">last entry</a>
<a class="Right" href="#inventory">Inventory</a>
</div>
<!-- END: this line ends content from: inc/topnav.last.html -->
<!-- START: this line starts content from: inc/begin-row.default.html -->
<div class="row">
<!-- END: this line ends content from: inc/begin-row.default.html -->
<!-- START: this line starts content from: inc/begin-leftcolumn.default.html -->
<div class="leftcolumn">
<!-- END: this line ends content from: inc/begin-leftcolumn.default.html -->
<!-- START: this line starts content from: inc/sidenav.default.html -->
<div class="sidenav">
<a href="#content">Jump to contents</a>
</div>
<hr>
<div class="sidenav">
<a href="/temp-test-ioccc/index.html">IOCCC Home</a>
<a href="/temp-test-ioccc/years.html">Winning Entries</a>
<a href="/temp-test-ioccc/winners.html">People who have won</a>
</div>
<hr>
<div class="sidenav">
<a href="/temp-test-ioccc/news.html">IOCCC News</a>
<a href="/temp-test-ioccc/faq.html#submit">How to enter the IOCCC</a>
<a href="/temp-test-ioccc/faq.html">FAQ</a>
</div>
<hr>
<div class="sidenav">
<a href="/temp-test-ioccc/bugs.html">Bugs &amp; (mis)features</a>
<a href="/temp-test-ioccc/faq.html#fix_a_winner">Fixing IOCCC winners</a>
<a href="/temp-test-ioccc/faq.html#fix_web_site">Fixing the web site</a>
<a href="/temp-test-ioccc/faq.html#fix_author">Fixing winner info</a>
<a href="/temp-test-ioccc/thanks-for-help.html">Thanks for the help</a>
</div>
<hr>
<div class="sidenav">
<a href="/temp-test-ioccc/judges.html">The IOCCC Judges</a>
<a href="/temp-test-ioccc/contact.html">Contacting the IOCCC</a>
</div>
<hr>
<div class="sidenav">
<a href="#top">Jump to top</a>
</div>
<!-- END: this line ends content from: inc/sidenav.default.html -->
<!-- START: this line starts content from: inc/end-leftcolumn.default.html -->
</div>
<!-- END: this line ends content from: inc/end-leftcolumn.default.html -->
<!-- START: this line starts content from: inc/begin-rightcolumn.default.html -->
<div class="rightcolumn">
<!-- END: this line ends content from: inc/begin-rightcolumn.default.html -->
<!-- START: this line starts content from: inc/before-content.default.html -->
<a name="content"></a>
<!-- END: this line ends content from: inc/before-content.default.html -->
<!-- START: this line starts content generated by: bin/gen-author.sh -->
<p><a name="author"><strong>Author:</strong></a> <br><br>Name: <a
href="/temp-test-ioccc/winners.html#Don_Yang">Don Yang</a><br> Location:
<a href="/temp-test-ioccc/location.html#US">US</a></p>
<!-- END: next line ends content generated by: bin/gen-author.sh -->
<h2 id="to-build">To build:</h2>
<div class="sourceCode" id="cb1"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb1-1"><a href="#cb1-1" aria-hidden="true" tabindex="-1"></a><span class="fu">make</span></span></code></pre></div>
<h2 id="to-use">To use:</h2>
<div class="sourceCode" id="cb2"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb2-1"><a href="#cb2-1" aria-hidden="true" tabindex="-1"></a><span class="ex">./prog</span> <span class="pp">[</span><span class="ss">PIN</span><span class="pp">]</span> <span class="op">&lt;</span> input.txt <span class="op">&gt;</span> output.c</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>The author provided the file <a href="cppp.cc">cppp.cc</a> which can
preprocess the generated output to make them more acceptable to typical
compilers. To build:</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> cppp</span></code></pre></div>
<p>See the author’s remarks for more details.</p>
<h2 id="judges-remarks">Judges’ remarks:</h2>
<p>You might think of this entry as code obfuscater with a code. If you
use the wrong code, you’re gonna have a bad time. What is compiling this
entry about? <a
href="https://southpark.fandom.com/wiki/Asspen/Script">Having a good ..
time</a>!</p>
<p>This winning entry also comes with a <a
href="spoiler.html">JavaScript timelapse spoiler</a> that shows how this
entry was written.</p>
<h2 id="authors-remarks">Author’s remarks:</h2>
<h3 id="synopsis">Synopsis</h3>
<div class="sourceCode" id="cb5"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb5-1"><a href="#cb5-1" aria-hidden="true" tabindex="-1"></a><span class="bu">echo</span> <span class="st">&quot;Hello world&quot;</span> <span class="kw">|</span> <span class="ex">./prog</span> 12345 <span class="op">&gt;</span> encoded.c</span>
<span id="cb5-2"><a href="#cb5-2" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb5-3"><a href="#cb5-3" aria-hidden="true" tabindex="-1"></a><span class="fu">gcc</span> <span class="at">-DPIN</span><span class="op">=</span>12345 encoded.c <span class="at">-o</span> ./decoded <span class="kw">&amp;&amp;</span> <span class="ex">./decoded</span></span></code></pre></div>
<h3 id="details">Details</h3>
<p>Mile is a C code generator. Run without arguments for the help
message below:</p>
<pre><code>usage: [PIN] &lt; input.txt &gt; output.c
where [PIN] is an integer in the range of 1..65535</code></pre>
<p>When run with an encoding PIN (first command line argument), Mile
will read bytes from <code>stdin</code> and generate C code on
<code>stdout</code>. Example:</p>
<div class="sourceCode" id="cb7"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb7-1"><a href="#cb7-1" aria-hidden="true" tabindex="-1"></a><span class="bu">echo</span> <span class="st">&quot;Hello, world!&quot;</span> <span class="kw">|</span> <span class="ex">./prog</span> 56789 <span class="op">&gt;</span> encoded.c</span></code></pre></div>
<p>This generated code will reproduce the same input bytes on
<code>stdout</code> when executed, if it was compiled with the same
encoding PIN.</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">-DPIN</span><span class="op">=</span>56789 encoded.c <span class="at">-o</span> decoded</span></code></pre></div>
<p>The generated code reconstructs all data at compile time by seeding a
random number generator with the given PIN to reproduce the input bytes,
and simply does one <code>fwrite(3)</code> call at run time to print
those bytes. Not specifying a PIN is a compile time error. Specify the
wrong PIN and output code will still compile, but will likely produce
garbage instead of the input bytes. If the original input was empty then
any PIN works, but you might get a compile time warning complaining
about empty arrays.</p>
<p>Because all data is reconstructed at compile time, expect the compile
time to be excruciatingly long if you try to encode too much data. Code
generated by encoding a haiku will probably compile in seconds, a
limerick may require tens of seconds, a sonnet will take minutes. Give
Mile an epic poem and you can probably write a faster preprocessor
before GCC is done (Clang probably already failed long before then).</p>
<p>I see that there is a lack of preprocessor abuse in recent years,
probably because programming in preprocessor is too tedious. Mile is
meant to help with that by producing C code filled with at least 98%
preprocessor lines for any input. Now you too can enjoy long compile
times with minimal effort.</p>
<h3 id="features">Features</h3>
<ul>
<li><p>Output is randomized using system clock, so if you wait a second
between runs, you should get a different generated code even for the
same encoding PIN.</p></li>
<li><p>Customized bytecode encoding of preprocessor boilerplates, mostly
for compression but should also make reverse engineering more
fun.</p></li>
<li><p>CRC32 of the source code is embedded in the source code
itself.</p></li>
<li><p>Code layout shaped to resemble “Mile” from “Didn’t I Say to Make
My Abilities Average in the Next Life?!”. Mile is known to be able to
talk to nanomachines directly, which is exactly what programming in
preprocessor feels like.</p></li>
</ul>
<h3 id="compatibility">Compatibility</h3>
<p>Mile has been verified to work in these environments (also, compiles
without warnings on all of these):</p>
<ul>
<li>gcc 9.2.0 on Cygwin</li>
<li>gcc 8.3.0 on Linux</li>
<li>gcc 7.4.0 on Cygwin</li>
<li>gcc 6.1.0 on JSLinux</li>
<li>gcc 5.4.0 on Linux</li>
<li>clang 8.0.1 on Linux</li>
<li>clang 8.0.1 on Cygwin</li>
<li>tcc 0.9.27 on Linux</li>
<li>tcc 0.9.25 on JSLinux</li>
</ul>
<p>Output of Mile is a bit more taxing, and only works with a subset of
the above:</p>
<ul>
<li>gcc: works just fine when using 8.3.0 and below, but may trigger
warning for large files. gcc 9.2.0 and above may crash with large
files.</li>
<li>clang: works fine for small files, fails on large files due to <a
href="https://bugs.llvm.org/show_bug.cgi?id=44480">preprocessor
bug</a>.</li>
<li>tcc: works just fine on Linux. Fails silently on JSLinux.</li>
</ul>
<p>For people eager to encode large files, an extra utility has been
packaged with this entry to preprocess the generated output to make them
more acceptable to typical compilers. View the <a
href="cppp.cc">cppp.cc</a> source and then compile it with a c++
compiler of your choice.</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-2020yang"><a name="inventory"></a>Inventory for
2020/yang</h1>
<h2 id="primary-files">Primary files</h2>
<ul>
<li><a href="index.html">index.html</a> - winner home page</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2020/yang/prog.c">prog.c</a>
- winning source</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2020/yang/Makefile">Makefile</a>
- winner Makefile</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2020/yang/prog.orig.c">prog.orig.c</a>
- original source</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2020/yang/try.sh">try.sh</a>
- how to run</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2020/yang/cppp.cc">cppp.cc</a>
- encode large file C Pre-PreProcessor source</li>
<li><a href="spoiler.html">spoiler.html</a> - SPOILER WARNING</li>
<li><a href="2020_yang.tar.bz2">2020_yang.tar.bz2</a> - download winning
source</li>
</ul>
<h2 id="secondary-files">Secondary files</h2>
<ul>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2020/yang/.gitignore">.gitignore</a>
- list of files that should not be committed under git</li>
<li><a href=".path">.path</a> - directory path from top directory</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2020/yang/.winner.json">.winner.json</a>
- description of winner in JSON</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2020/yang/README.md">README.md</a>
- markdown source for index.html</li>
</ul>
<!-- END: next line ends content generated by: bin/gen-inventory.sh -->
<!-- START: this line starts content from: inc/after-content.default.html -->
<!-- END: this line ends content from: inc/after-content.default.html -->
<!-- START: this line starts content from: inc/end-rightcolumn.default.html -->
</div>
<!-- END: this line ends content from: inc/end-rightcolumn.default.html -->
<!-- START: this line starts content from: inc/end-row.default.html -->
</div>
<!-- END: this line ends content from: inc/end-row.default.html -->
<!-- START: this line starts content from: inc/footer.default.html -->
<div class="footer">
<hr>
<h2>Coda</h2>
<p><a href="https://validator.w3.org/nu/?doc=https%3A%2F%2Fioccc-src.github.io%2Ftemp-test-ioccc%2F2020%2Fyang%2Findex.html">Nu HTML check this web page</a></p>
<p><a href="#top">Jump to top</a> <a href="#content">Jump to Content</a> <a href="#inventory">Jump to Inventory</a></p>
</div>
<!-- END: this line ends content from: inc/footer.default.html -->
<!-- START: this line starts content from: inc/bottom.default.html -->
</body>
</html>
<!-- END: this line ends content from: inc/bottom.default.html -->