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

+364 -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,376 @@
<!-- !!! DO NOT MODIFY THIS FILE - This file is generated by a tool !!! -->
<!-- !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<!-- -->
<!-- file: 2001/anonymous/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>2001 anonymous</title>
<meta name="description" content="IOCCC year: 2001 IOCCC winner: anonymous winner index page">
<meta name="keywords" content="IOCCC,2001,anonymous,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>2001/anonymous</title>
<meta name="description" content="2001 IOCCC winner anonymous">
<meta name="keywords" content="IOCCC, 2001, IOCCC 2001, IOCCC winner, anonymous">
</head>
<!-- END: this line ends content from: inc/head.default.html -->
<!-- START: this line starts content from: inc/body.default.html -->
<body>
<h1>2001 anonymous</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>2001/anonymous</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%2F2001%2Fanonymous%2Findex.html">Nu Html check https://ioccc-src.github.io/temp-test-ioccc/2001/anonymous/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; 2001 &uarr;</a>
<a class="Left" href="../bellard/index.html">bellard &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#Anonymous_2001">Anonymous
2001</a><br> Location: <a
href="/temp-test-ioccc/location.html#GB">GB</a></p>
<!-- END: next line ends content generated by: bin/gen-author.sh -->
<h2 id="to-build">To build:</h2>
<div class="sourceCode" id="cb1"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb1-1"><a href="#cb1-1" aria-hidden="true" tabindex="-1"></a><span class="fu">make</span></span></code></pre></div>
<p>The programs that this program is supposed to act on, <a
href="anonymous.ten.c">anonymous.ten.c</a> and <a
href="anonymous.bed.c">anonymous.bed.c</a>, compiled with
<code>make</code>, MUST be compiled as 32-bit ELF binaries. In the case
that this fails these programs will be compiled as 64-bit binaries as
alternate code, <code>anonymous.ten.alt</code> and
<code>anonymous.bed.alt</code>, ELF or otherwise. However trying to use
the entry on these files will fail. See <a
href="#alternate-code">Alternate code</a> below for information on how
to compile these programs as 64-bit binaries (or whatever your system
will compile them as).</p>
<h3 id="bugs-and-misfeatures">Bugs and (Mis)features:</h3>
<p>The current status of this entry is:</p>
<pre><code>STATUS: INABIAF - please **DO NOT** fix</code></pre>
<p>For more detailed information see <a
href="/bugs.md#2001-anonymous">2001 anonymous 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">./anonymous</span> x86_program</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>
<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="ex">./anonymous</span> anonymous.bed <span class="co"># if able to compile as a 32-bit (-m32) ELF binary</span></span></code></pre></div>
<p>NOTE: if the 32-bit version cannot be compiled the script will at
least compile <a href="anonymous.ten.c">anonymous.ten</a> as a 64-bit
program (or whatever your system is set to) and run it directly.</p>
<p>What happens if the x86 program has already been modified by this
program? The judges’ remarks below might give you a hint!</p>
<p>What happens if you try it on another file like <a
href="anonymous.c">anonymous.c</a>? Can you recompile it okay? What if
you run it on <code>anonymous</code> itself? Can you run the program
successfully after it without recompiling?</p>
<h2 id="alternate-code">Alternate code:</h2>
<p>In the case you you wish to manually compile the extra programs as
64-bit code you may do so. Using the entry on these binaries will very
likely crash the program or do something terribly wrong like
slaughtering all the <a
href="https://www.glyphweb.com/arda/e/elves.html">elves</a> of <a
href="https://www.glyphweb.com/arda/i/imladris.php">Imladris</a>! :-) so
please don’t do that :-(</p>
<h3 id="alternate-build">Alternate build:</h3>
<div class="sourceCode" id="cb5"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb5-1"><a href="#cb5-1" aria-hidden="true" tabindex="-1"></a><span class="fu">make</span> alt</span></code></pre></div>
<h3 id="alternate-use">Alternate use:</h3>
<div class="sourceCode" id="cb6"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb6-1"><a href="#cb6-1" aria-hidden="true" tabindex="-1"></a><span class="ex">./anonymous.ten.alt</span></span>
<span id="cb6-2"><a href="#cb6-2" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb6-3"><a href="#cb6-3" aria-hidden="true" tabindex="-1"></a><span class="ex">./anonymous.bed.alt</span></span></code></pre></div>
<h3 id="a-2023-note-about-the-warning-from-the-author">A 2023 note about
the warning from the author:</h3>
<p>The author suggested that this <em>might</em> somewhat destroy the
binaries this touches but after the fix of 2023 this was not observed
(yet?). It does indeed modify the files (though not all files are
modified: can you figure out why that is?) but using them after did not
result in any problems. It could be that it’s no longer known exactly
what is supposed to happen and possibly that the modification might not
be entirely correct for that reason though it does appear to be
correct.</p>
<p>It appears that the corruption happens only if the modification fails
in the middle of doing so so that might be why it hasn’t been
observed.</p>
<h2 id="judges-remarks">Judges’ remarks:</h2>
<p>Is emulation the sincerest form of flattery? This small program does
quite a lot of bit twiddling.</p>
<h2 id="authors-remarks">Author’s remarks:</h2>
<p>This program is an optimizing dynamic binary translator, allowing you
to run x86 programs on any machine (x86 or otherwise).</p>
<p>I have included a simple <a
href="https://www.bbc.co.uk/teach/school-radio/nursery-rhymes-ten-green-bottles/zncyt39">10
Green Bottles</a> <a href="anonymous.ten.c">program</a> (try
<code>make anonymous.ten</code>), meant to be compiled as a 32-bit ELF
binary.</p>
<p>The program <code>anonymous.ten</code>, and its source (dull) are
included as data files.</p>
<h3 id="warning">Warning</h3>
<p>Note that the translator screws around with the binary you run on it
and <em>might</em> corrupt the binary to some extent and in so doing
might leave any program you run on it unusable.</p>
<p>The build script should give an example command to compile the
program.</p>
<h3 id="features">Features</h3>
<p><a href="https://en.wikipedia.org/wiki/Basic_block">Basic Block</a>
<a href="https://en.wikipedia.org/wiki/Cache_(computing)">Cache</a>:
Rather than translating each instruction individually the dynamic binary
translator generates a translation for an entire basic block of subject
code. Having translated a block once, the target code generated will be
stored for the duration that the program is running, so as a program
runs its performance will improve, as it hits cached blocks. This can be
clearly observed in the example program, <a
href="anonymous.ten.c">anonymous.ten</a> which must be compiled as a
32-bit ELF binary.</p>
<h3 id="target-library-linking">Target Library Linking:</h3>
<p>The program runs <a
href="https://en.wikipedia.org/wiki/Dynamic_linker">dynamically
linked</a> <a
href="https://en.wikipedia.org/wiki/Executable_and_Linkable_Format">ELF
binaries</a>, and when the subject program attempts to make a call to a
standard <a
href="https://en.wikipedia.org/wiki/Library_(computing)">library</a>,
the translator attempts to make an appropriate call to the native system
libraries on the target machine. This involves mangling between
different calling conventions, etc.</p>
<h3 id="automatic-endian-detectionreversal">Automatic Endian
Detection/Reversal:</h3>
<p>There are various problems raised when attempting to run little <a
href="https://en.wikipedia.org/wiki/Endianness">endian</a> <a
href="https://en.wikipedia.org/wiki/X86">x86</a> code on a big endian
chip, such as a <a href="https://en.wikipedia.org/wiki/PowerPC">PPC</a>.
These problems are dealt with in a manner that is entirely transparent
to the user.</p>
<h3 id="configuration">Configuration:</h3>
<h4 id="warnings">Warnings:</h4>
<p>By default the build script should compile the program with a set of
switches such that while compiling the program it generates one error
(which I feel is useful advice). The program should generate no further
compiler errors while it is running (yes, the program can generate
compiler errors while it is running). If you do not wish to see this
error, or if the program generates any further error when compiled using
your C compiler please remove the <code>-Dwarning='-Dprocessor'</code>
line and the <code>$$warning</code> from the compiler invocation.</p>
<h3 id="optimization">Optimization</h3>
<p>The build script contains a <code>-O1</code> switch for the compiler.
Increasing the optimization level will make the program run
<em>slower</em>, while compiling the program without any optimization
will allow it to run <em>faster</em>.</p>
<h3 id="obfuscation">Obfuscation</h3>
<p>The most obvious part of the obfuscation is probably the mess of
<code>#define</code>s at the top. This may seem a somewhat tired old
obfuscation - however since many of these macros are (sometimes only)
used by the program once it has dynamically recompiled itself, they are
only referenced within the source code from within strings - and
therefore the macros cannot be expanded. Furthermore, some of these
strings of code are not given as strings, but instead are wrapped up in
macros that use the <code>#</code> preprocessor operator to turn them
into strings. In the hope of throwing off a few C beautifiers the macro
to generate the strings is not contained within the source code but
instead is passed in on the command line.</p>
<p>Buried under all this, and the fact that the entire program is just a
call to <code>exit(3)</code>, there are some nice subtle little
obfuscations. For example, you may notice that there are a couple of
macros that use the <code>##</code> preprocessor operator to build pairs
of functions. One of these macros is used to build pairs of functions of
which only one has local variables which shadow global variables: so one
modifies the global state, and the other doesn’t.</p>
<p>There is also quite a nice trick where I wave a magic wand, and a
chunk of code which should only be run when the program is run for the
first time (setting the <a
href="https://en.wikipedia.org/wiki/Program_counter">PC / IP</a> to
point at <code>main()</code> etc.) gets turned into a
<strike>frog</strike>string. The C compiler sees a string by itself in
the code, thinks “yup, that’s a valid C expression”, and quietly moves
on to the next line of code.</p>
<h3 id="limitations">Limitations</h3>
<p>Due to space limitations only a handful of instructions are
supported; these instructions which are supported are supported in
somewhat non-conventional ways: chunks of the architecture (e.g. flags)
are just ignored, the ELF <a
href="https://en.wikipedia.org/wiki/Loader_(computing)">loader</a> does
not really load the <a
href="https://en.wikipedia.org/wiki/Executable_and_Linkable_Format">ELF
binary</a>, the target <a
href="https://en.wikipedia.org/wiki/Linker_(computing)">library
linking</a> can only pass up to 3 parameters to the target library
function, etc.</p>
<p>In short, please consider this a full disclaimer for any bug that may
turn up - yes the program is unsafe, but it’s pretty cool anyway.</p>
<p>Despite all this, the translator is not exclusively limited to
running the <a href="anonymous.ten.c">anonymous.ten</a> program. Other
trivial <strong><em>x86</em></strong> programs may run on the translator
- and I have successfully run a wide range of “Hello World” programs,
including one of last year’s IOCCC winners, <a
href="/2000/tomx/tomx.c">tomx</a>.</p>
<h3 id="complete-program">Complete Program</h3>
<p>The fact that the program makes calls to <code>system(3)</code> and
<code>execv(3)</code> may imply that it is not a complete program in its
own right, as it relies on other programs. The call to
<code>system(3)</code> is a call to ask gcc to recompile the translator
with a new set of switches, and the call to <code>execv(3)</code> asks
for the newly compiled program to be executed. I would point out that
almost every other entry to this competition also require a C compiler
(well, the published winners at any rate, and I recognize that a few
don’t). There is little real difference between this program and one
like last year’s entry <a href="/2000/dhyang/dhyang.c">dhyang</a>; both
are just C programs that generate C code as their output.</p>
<p>Enjoy and thanks!</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-2001anonymous"><a name="inventory"></a>Inventory
for 2001/anonymous</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/2001/anonymous/anonymous.c">anonymous.c</a>
- winning source</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2001/anonymous/Makefile">Makefile</a>
- winner Makefile</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2001/anonymous/anonymous.orig.c">anonymous.orig.c</a>
- original source</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2001/anonymous/anonymous.bed.c">anonymous.bed.c</a>
- roll over song C source</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2001/anonymous/anonymous.ten.c">anonymous.ten.c</a>
- green bottles song C source</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2001/anonymous/try.sh">try.sh</a>
- how to run</li>
<li><a href="2001_anonymous.tar.bz2">2001_anonymous.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/2001/anonymous/.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/2001/anonymous/.winner.json">.winner.json</a>
- description of winner in JSON</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2001/anonymous/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%2F2001%2Fanonymous%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: 2001/bellard/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>2001 bellard</title>
<meta name="description" content="IOCCC year: 2001 IOCCC winner: bellard winner index page">
<meta name="keywords" content="IOCCC,2001,bellard,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>2001/bellard</title>
<meta name="description" content="2001 IOCCC winner bellard">
<meta name="keywords" content="IOCCC, 2001, IOCCC 2001, IOCCC winner, bellard">
</head>
<!-- END: this line ends content from: inc/head.default.html -->
<!-- START: this line starts content from: inc/body.default.html -->
<body>
<h1>2001 bellard</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>2001/bellard</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%2F2001%2Fbellard%2Findex.html">Nu Html check https://ioccc-src.github.io/temp-test-ioccc/2001/bellard/index.html</a></p>
<!-- End Nu Html Checker -->
<div class="topnav">
<a class="Left" href="../anonymous/index.html">&larr; anonymous</a>
<a class="Left" href="../index.html">&uarr; 2001 &uarr;</a>
<a class="Left" href="../cheong/index.html">cheong &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#Fabrice_Bellard">Fabrice
Bellard</a><br> Location: <a
href="/temp-test-ioccc/location.html#FR">FR</a></p>
<!-- END: next line ends content generated by: bin/gen-author.sh -->
<h2 id="to-build">To build:</h2>
<div class="sourceCode" id="cb1"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb1-1"><a href="#cb1-1" aria-hidden="true" tabindex="-1"></a><span class="fu">make</span></span></code></pre></div>
<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
STATUS: doesn&#39;t work with some platforms - please help us fix</code></pre>
<p>For more detailed information see <a
href="/bugs.md#2001-bellard">2001 bellard 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">./bellard</span> file</span></code></pre></div>
<h2 id="try">Try:</h2>
<div class="sourceCode" id="cb4"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb4-1"><a href="#cb4-1" aria-hidden="true" tabindex="-1"></a><span class="ex">./bellard</span> bellard.otccex.c</span></code></pre></div>
<h2 id="judges-remarks">Judges’ remarks:</h2>
<p><code>&lt;JUDGES_COMMENTS&gt;</code> :-)</p>
<h2 id="authors-remarks">Author’s remarks:</h2>
<p><code>OTCC</code> is an Obfuscated Tiny C Compiler for i386-linux. It
generates FAST! i386 32 bit code (no bytecode) and it is powerful enough
to compile itself. <code>OTCC</code> supports a strict subset of C. This
subset is compilable by a standard ANSI C compiler. <code>OTCC</code>
compiles, assembles, links and runs C code without the need of any other
program.</p>
<p>You can use it by typing:</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">./bellard</span> bellard.c <span class="pp">[</span><span class="ss">args</span><span class="pp">]</span>...</span></code></pre></div>
<p>or by giving the C source to its standard input.</p>
<p><code>args</code> are given to the <code>main()</code> function of
<code>bellard.c</code> (<code>argv[0]</code> is <a
href="bellard.c">bellard.c</a>).</p>
<h3 id="examples">Examples:</h3>
<ul>
<li>Sample compilation and execution:</li>
</ul>
<div class="sourceCode" id="cb6"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb6-1"><a href="#cb6-1" aria-hidden="true" tabindex="-1"></a><span class="ex">./bellard</span> bellard.otccex.c 10</span></code></pre></div>
<ul>
<li>Self compilation:</li>
</ul>
<div class="sourceCode" id="cb7"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb7-1"><a href="#cb7-1" aria-hidden="true" tabindex="-1"></a><span class="ex">./bellard</span> bellard.c bellard.otccex.c 10</span></code></pre></div>
<ul>
<li>Self compilation iterated…</li>
</ul>
<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">./bellard</span> bellard.c bellard.c bellard.otccex.c 10</span></code></pre></div>
<p>An alternate syntax is to use it as a script interpreter: you can put
<code>#!/usr/local/bin/otcc</code> at the beginning of your C source if
you installed <code>otcc</code> at this place.</p>
<h3
id="supported-c-language-subset-read-joint-example-bellard.otccex.c-to-have-an-introduction-to-otcc-dialect">Supported
C language subset (read joint example <a
href="bellard.otccex.c">bellard.otccex.c</a> to have an introduction to
<code>OTCC</code> dialect)</h3>
<h4 id="expressions">Expressions:</h4>
<ul>
<li><p>binary operators, in decreasing precedence order: <code>*</code>
<code>/</code> <code>%</code>, <code>+</code> <code>-</code>,
<code>&gt;&gt;</code> <code>&lt;&lt;</code>, <code>&lt;</code>
<code>&lt;=</code> <code>&gt;</code> <code>&gt;=</code>, <code>==</code>
<code>!=</code>, <code>&amp;</code>, <code>^</code>, <code>|</code>,
<code>=</code>, <code>&amp;&amp;</code>, <code>||</code>.</p></li>
<li><p><code>&amp;&amp;</code> and <code>||</code> have the same
semantics as in C: left to right evaluation and early exit
(short-circuited).</p></li>
<li><p>Parenthesis are supported.</p></li>
<li><p>Unary operators: <code>&amp;</code>, <code>*</code> (pointer
indirection), <code>-</code> (negation), <code>+</code>, <code>!</code>,
<code>~</code>, postfix <code>++</code> and <code>--</code>.</p></li>
<li><p>Pointer indirection (<code>*</code>) only works with explicit
cast to <code>char *</code>, <code>int *</code> or
<code>int (*)()</code> (function pointer).</p></li>
<li><p><code>++</code>, <code>--</code>, and unary <code>&amp;</code>
can only be used with variable lvalue (left value).</p></li>
<li><p><code>=</code> can only be used with variable or <code>*</code>
(pointer indirection) lvalue.</p></li>
<li><p>Function calls are supported <em>with standard
<strong>i386</strong> calling convention</em>. Function pointers are
supported <em>with explicit cast</em>. Functions can be used before
being declared.</p></li>
<li><p>Types: only signed integer (<code>int</code>) variables and
functions can be declared. Variables cannot be initialized in
declarations. <em>Only old K&amp;R function declarations are parsed
(implicit integer return value and no types on arguments)</em>.</p></li>
<li><p>Any function or variable from the libc can be used because
<code>OTCC</code> uses the libc dynamic linker to resolve undefined
symbols.</p></li>
<li><p>Instructions: blocks (<code>{</code> <code>}</code>) are
supported as in C. <code>if</code> and <code>else</code> can be used for
tests. The <code>while</code> and <code>for</code> C loops are
supported. <code>break</code> can be used to exit loops.
<code>return</code> is used for the return value of a function.</p></li>
<li><p>Identifiers are parsed the same way as C. Local variables are
handled, but there is no local name space (not a problem if different
names are used for local and global variables).</p></li>
<li><p>Numbers can be entered in decimal, hexadecimal (<code>0x</code>
or <code>0X</code> prefix), or octal (<code>0</code> prefix).</p></li>
<li><p><code>#define</code> is supported without function like
arguments. <em>No macro recursion is tolerated</em>; <em>other
preprocessor directives are ignored</em>.</p></li>
<li><p>C Strings and C character constants are supported. Only
<code>\n</code>, <code>\"</code>, <code>\'</code> and <code>\\</code>
escapes are recognized.</p></li>
<li><p>C Comments can be used (but no C++ comments).</p></li>
<li><p>No error is displayed if an incorrect program is given.</p></li>
<li><p>Memory: the code, data, and symbol sizes are limited to 100KB (it
can be changed in the source code).</p></li>
</ul>
<h3 id="obfuscation">Obfuscation:</h3>
<p>No special effort was needed because obfuscation is almost
unavoidable for such a program :-) <code>#define</code>s must be used to
compress the code, and integrated i386 code generator leads to non
obvious code.</p>
<h3 id="portability">Portability:</h3>
<p><code>OTCC</code> only works on i386 linux because it generates i386
code. <code>OTCC</code> also relies on little endianness, unaligned
memory accesses and ASCII representation of characters. It also supposes
that no valid pointers are less than 512. If all those constraints are
met, then <code>OTCC</code> could be theoretically used to “cross
compile”, although no such support is currently integrated.</p>
<p>It was successfully compiled with gcc version 2.95.2. You get some
warnings because old K&amp;R prototypes are used, some casts are
implicit and some functions are used before being defined.
<code>OTCC</code> uses the dynamic linker to resolve symbols with
<code>dlsym(3)</code>, so <code>-ldl</code> must be used when you
compile and link it.</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-2001bellard"><a name="inventory"></a>Inventory for
2001/bellard</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/2001/bellard/bellard.c">bellard.c</a>
- winning source</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2001/bellard/Makefile">Makefile</a>
- winner Makefile</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2001/bellard/bellard.orig.c">bellard.orig.c</a>
- original source</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2001/bellard/bellard.otccex.c">bellard.otccex.c</a>
- example otcc source</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2001/bellard/otccelf.c">otccelf.c</a>
- another example otcc source</li>
<li><a href="2001_bellard.tar.bz2">2001_bellard.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/2001/bellard/.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/2001/bellard/.winner.json">.winner.json</a>
- description of winner in JSON</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2001/bellard/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%2F2001%2Fbellard%2Findex.html">Nu HTML check this web page</a></p>
<p><a href="#top">Jump to top</a> <a href="#content">Jump to Content</a> <a href="#inventory">Jump to Inventory</a></p>
</div>
<!-- END: this line ends content from: inc/footer.default.html -->
<!-- START: this line starts content from: inc/bottom.default.html -->
</body>
</html>
<!-- END: this line ends content from: inc/bottom.default.html -->
+241 -13
View File
@@ -1,4 +1,6 @@
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<!-- START: two lines up starts content from: inc/top.default.html -->
<!-- -->
<!-- !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<!-- !!! DO NOT MODIFY THIS FILE - This file is generated by a tool !!! -->
@@ -6,27 +8,253 @@
<!-- !!! DO NOT MODIFY THIS FILE - This file is generated by a tool !!! -->
<!-- !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<!-- -->
<!-- file: 2001/cheong/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>2001 cheong</title>
<meta name="description" content="IOCCC year: 2001 IOCCC winner: cheong winner index page">
<meta name="keywords" content="IOCCC,2001,cheong,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>2001/cheong</title>
<meta name="description" content="2001 IOCCC winner cheong">
<meta name="keywords" content="IOCCC, 2001, IOCCC 2001, IOCCC winner, cheong">
</head>
<!-- END: this line ends content from: inc/head.default.html -->
<!-- START: this line starts content from: inc/body.default.html -->
<body>
<h1>2001 cheong</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>2001/cheong</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%2F2001%2Fcheong%2Findex.html">Nu Html check https://ioccc-src.github.io/temp-test-ioccc/2001/cheong/index.html</a></p>
<!-- End Nu Html Checker -->
<div class="topnav">
<a class="Left" href="../bellard/index.html">&larr; bellard</a>
<a class="Left" href="../index.html">&uarr; 2001 &uarr;</a>
<a class="Left" href="../coupard/index.html">coupard &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#Raymond_Cheong">Raymond
Cheong</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">./cheong</span> digits</span></code></pre></div>
<h2 id="try">Try:</h2>
<div class="sourceCode" id="cb3"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb3-1"><a href="#cb3-1" aria-hidden="true" tabindex="-1"></a><span class="ex">./try.sh</span></span></code></pre></div>
<h2 id="judges-remarks">Judges’ remarks:</h2>
<p>Be sure to give an even number of digits in the argument. Add a
leading 0 if needed.</p>
<p>The source code is nice, compact, and self documenting as all good
programs should be! :-)</p>
<h2 id="authors-remarks">Author’s remarks:</h2>
<h3 id="operation">Operation</h3>
<p>Compile normally and run with one argument, an integer with 2n
digits. Program will return the integer part of its square root
(n-digits). For example,</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">$</span> cc <span class="at">-o</span> cheong cheong.c</span>
<span id="cb4-2"><a href="#cb4-2" aria-hidden="true" tabindex="-1"></a><span class="ex">$</span> ./cheong 1234567890</span>
<span id="cb4-3"><a href="#cb4-3" aria-hidden="true" tabindex="-1"></a><span class="ex">35136</span></span>
<span id="cb4-4"><a href="#cb4-4" aria-hidden="true" tabindex="-1"></a><span class="ex">$</span> ./cheong 0200000000000000000000000000</span>
<span id="cb4-5"><a href="#cb4-5" aria-hidden="true" tabindex="-1"></a><span class="ex">14142135623730</span></span></code></pre></div>
<p>Deviation from these instructions will cause undefined results.
:-)</p>
<h3 id="portability">Portability</h3>
<p>This program runs normally on any ANSI C compiler and is ASCII
dependent.</p>
<p>Strict compiling gives just one unavoidable warning:</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">-ansi</span> <span class="at">-Wall</span> cheong.c</span>
<span id="cb5-2"><a href="#cb5-2" aria-hidden="true" tabindex="-1"></a><span class="ex">cheong.c:3:</span> warning: third argument of <span class="kw">`</span><span class="ex">main</span><span class="st">&#39; should probably be `char **&#39;</span></span></code></pre></div>
<h3 id="obfuscation">Obfuscation</h3>
<p>The main obfuscation is the algorithm used to calculate square roots,
sometimes known as the longhand method. The basic algorithm is itself
obfuscated in that it only uses subtraction to calculate square roots.
For a detailed explanation, check Google or see Jack Crenshaw’s article
at <a
href="https://web.archive.org/web/20011215124349/http://www.embedded.com/98/9802fe2.htm"
class="uri">https://web.archive.org/web/20011215124349/http://www.embedded.com/98/9802fe2.htm</a>.</p>
<p>This program uses an even more obscured version which includes the
following:</p>
<ul>
<li>A single string is used to store two numbers of different
lengths</li>
<li>Operations are done in a weird hybrid of base 10 and base 20</li>
<li>Subtraction is done addition style, i.e. <code>4 - 8</code> equals
<code>6</code> carry a <code>-1</code></li>
<li>Recursive calls to <code>main()</code></li>
</ul>
<h4 id="minor-obfuscations">Minor obfuscations:</h4>
<ul>
<li>Self documenting whitespace in rectangular code block, for fun and
glory (view with fixed-width font)</li>
<li>Integer constants adjusted to less meaningful values, just for added
confusion</li>
<li>Hard-to-read, meaningless variable names to spite the reader</li>
</ul>
<h4 id="challenges-for-the-masses">Challenges for the masses:</h4>
<ul>
<li>What are the meanings [sic, plural] of the variable
<code>o</code>?</li>
<li>Why is <code>(c+999)%10-(D[I]+92)%10</code> not equivalent to
<code>(c-D[I]+7)%10</code>?</li>
<li>How does the program terminate?</li>
<li>Is the programmer sane? ;-)</li>
</ul>
<h3 id="appreciation">Appreciation</h3>
<p>Thanks goes out to Bobby Rohde for numerous suggestions on how to
shorten the program.</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-2001cheong"><a name="inventory"></a>Inventory for
2001/cheong</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/2001/cheong/cheong.c">cheong.c</a>
- winning source</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2001/cheong/Makefile">Makefile</a>
- winner Makefile</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2001/cheong/cheong.orig.c">cheong.orig.c</a>
- original source</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2001/cheong/try.sh">try.sh</a>
- how to run</li>
<li><a href="2001_cheong.tar.bz2">2001_cheong.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/2001/cheong/.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/2001/cheong/.winner.json">.winner.json</a>
- description of winner in JSON</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2001/cheong/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%2F2001%2Fcheong%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 -->
+284 -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,296 @@
<!-- !!! DO NOT MODIFY THIS FILE - This file is generated by a tool !!! -->
<!-- !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<!-- -->
<!-- file: 2001/coupard/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>2001 coupard</title>
<meta name="description" content="IOCCC year: 2001 IOCCC winner: coupard winner index page">
<meta name="keywords" content="IOCCC,2001,coupard,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>2001/coupard</title>
<meta name="description" content="2001 IOCCC winner coupard">
<meta name="keywords" content="IOCCC, 2001, IOCCC 2001, IOCCC winner, coupard">
</head>
<!-- END: this line ends content from: inc/head.default.html -->
<!-- START: this line starts content from: inc/body.default.html -->
<body>
<h1>2001 coupard</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>2001/coupard</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%2F2001%2Fcoupard%2Findex.html">Nu Html check https://ioccc-src.github.io/temp-test-ioccc/2001/coupard/index.html</a></p>
<!-- End Nu Html Checker -->
<div class="topnav">
<a class="Left" href="../cheong/index.html">&larr; cheong</a>
<a class="Left" href="../index.html">&uarr; 2001 &uarr;</a>
<a class="Left" href="../ctk/index.html">ctk &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#Pierre-Philippe_Coupard">Pierre-Philippe
Coupard</a><br> Location: <a
href="/temp-test-ioccc/location.html#null">unknown</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">./coupard</span></span></code></pre></div>
<h2 id="try">Try:</h2>
<p>If you have access to <code>/dev/audio</code> or
<code>/dev/sound/dsp</code>:</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">./coupard</span> <span class="op">&gt;</span> /dev/audio</span>
<span id="cb3-2"><a href="#cb3-2" aria-hidden="true" tabindex="-1"></a><span class="ex">./coupard</span> <span class="op">&gt;</span> /dev/sound/dsp</span></code></pre></div>
<p>If you do not, first install <a
href="https://en.wikipedia.org/wiki/SoX">sox</a>. If you use macOS you
might install it from <a href="https://www.macports.org">MacPorts</a> or
<a href="https://brew.sh">Homebrew</a>. Then you can try:</p>
<div class="sourceCode" id="cb4"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb4-1"><a href="#cb4-1" aria-hidden="true" tabindex="-1"></a><span class="ex">./coupard</span> <span class="kw">|</span> <span class="fu">sox</span> <span class="at">-q</span> <span class="at">-traw</span> <span class="at">-r8000</span> <span class="at">-b8</span> <span class="at">-e</span> unsigned-integer <span class="at">-</span> <span class="at">-tcoreaudio</span></span></code></pre></div>
<h2 id="judges-remarks">Judges’ remarks:</h2>
<p>You may need to run this a few times to understand exactly what is
being said. You might even need to look somewhere on your desktop, your
arm or the wall for confirmation.</p>
<h2 id="authors-remarks">Author’s remarks:</h2>
<p>Past years’ IOCCC entries do many marvellous things in small
packages, such as console utilities, games, math, languages or even X
applications. But they all have one thing in common (despite being hard
to read obviously): when they interact with the user, they only
<em>display</em> things, i.e. they display either text or drawings.</p>
<p>So, for a change, this program titillates the sense of hearing
instead of sight: this program is a self-contained speech synthesizer
that tells the current time through the computer’s sound card - in just
under 2 Kb of source code !</p>
<p>In the 2001 IOCCC <a href="/2001/rules.txt">rules</a> and <a
href="/2001/guidelines.txt">guidelines</a> documents, there is no
mention of what is or isn’t acceptable regarding audio I/O, but it is
mentioned that hardware-specific and/or non-portable programs are not
welcome. So, in order to do audio and satisfy those requirements, the
format required by <code>/dev/audio</code> has been chosen:
<code>/dev/audio</code> is a rather ancient fixed-format audio interface
that is supported by the majority of Unices that can do sound, as a
lowest-denominator sound I/O interface.</p>
<h3 id="program-usage">Program usage</h3>
<p>To listen to what the program says directly, invoke</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">./coupard</span> <span class="op">&gt;</span> /dev/audio</span></code></pre></div>
<p>The program then speaks out something like</p>
<blockquote>
<p>The time is HH hours MM minutes SS seconds</p>
</blockquote>
<p>in military time (24 hours). Of course, you need to have permissions
to write to <code>/dev/audio</code>, have your sound card enabled, the
volume up, the speakers connected … :-)</p>
<p>If you want to convert the audio output of the program into another
audio format, you can pipe it to <a
href="https://en.wikipedia.org/wiki/SoX">SoX</a> for example
(<code>sox</code> is the Swiss army knife of Unix audio tools). The
command:</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">./coupard</span> <span class="kw">|</span> <span class="fu">sox</span> <span class="at">-c1</span> <span class="at">-r8000</span> <span class="at">-tub</span> <span class="at">-</span> <span class="at">-c2</span> <span class="at">-r44100</span> <span class="at">-twav</span> test.wav</span></code></pre></div>
<p>converts the output of the program into a 44.1KHz stereo .WAV file
and saves it into <code>test.wav</code>.</p>
<p>The output format of the program is 8KHz, unsigned 8-bit samples.</p>
<p>NOTE: the program’s return code is meaningless.</p>
<h3 id="audio-quality">Audio quality</h3>
<p>The quality of the sound produced by the program is cross between a
<a
href="https://en.wikipedia.org/wiki/Tin_can_telephone">yogurt-pot-and-string
telephone</a> and a bad <a
href="https://en.wikipedia.org/wiki/Phonograph">gramophone</a>, i.e. the
S/N ratio is very low and the signal’s top frequency is very low as
well. This is because the audio is stored internally at a sampling rate
of 4KHz (the <a
href="https://en.wikipedia.org/wiki/Nyquist_frequency">Nyquist
frequency</a> is only 2KHz) with only 4-bit samples (adding 24db of
quantization noise to an already poor signal).</p>
<p>In short, you might have to listen twice to understand what the
program is saying. 2048 bytes including the sound generation program
doesn’t leave much room for audio quality ;-)</p>
<h3 id="speech-generation">Speech generation</h3>
<p>Only 9 phonemes are used to generate the speech. Beside the limited
number of words the program has to generate (66 words), the low sound
quality is actually exploited to take liberties with certain consonants
(for example, <code>s</code> and <code>f</code> sound very much the same
at 4KHz, so they can be merged into one phoneme). Because the <a
href="https://en.wikipedia.org/wiki/Psychoacoustics">psychoacoustic</a>
context around those phonemes is just sufficient, the words can be
interpreted correctly most of the time despite the fact that they are
pronounced quite wrongly.</p>
<p>Internally, a table is used to generate most of the words, and
composite words such as “thirty-five” are made up by the C code
externally.</p>
<h3 id="data-compression">Data compression</h3>
<p>Even at 4KHz / 4 bits, the weight of all the phoneme samples and the
word-to-phonemes table put together is over 1600 bytes, which is well
over 2048 bytes when encoded in a C string made of printable characters.
Therefore, a compression method was needed that’s both efficient and
with a decompressor that is implementable in the shortest amount of code
possible. GSM compression is very good, but needs large psychoacoustic
tables to regenerate the original signal. Raw FFT spectral compression
is efficient too, but the decompression code can’t be made small
enough.</p>
<p>The best compression compromise was found using a simple Huffman
compressor, and encoding the compressed data by blocks of 13 bits in
pairs of printable ASCII characters: the raw data is compressed to 8465
bits, and the resulting C string is therefore about 1300 characters,
which leaves just enough room for the decompressor with a hard-coded
Huffman tree, and the code that plays the phonemes in the right
order.</p>
<h3 id="note-on-compiler-warnings-and-lint">Note on compiler warnings
and lint</h3>
<p>The program should build with <code>gcc -Wall -Werror -ansi</code>.
If the <code>-pedantic</code> flag is used, gcc will complain about the
length of the data string and the sign of its type, and also the fact
that <code>main()</code> returns with no value. The confusion with the
sign of the char type doesn’t matter with the data string because it’s
composed only of printable characters under 127.</p>
<p>When linting the program with <code>lclint</code>, it complains about
a huge list of things that, if corrected to make lint happy, would
probably double the size of the source code.</p>
<h2 id="copyright-and-cc-by-sa-4.0-license">Copyright and CC BY-SA 4.0
License:</h2>
<p>This file is Copyright (c) 2023 by Landon Curt Noll. All Rights
Reserved. You are free to share and adapt this file under the terms of
this license:</p>
<pre><code>Creative Commons Attribution-ShareAlike 4.0 International (CC BY-SA 4.0)</code></pre>
<p>For more information, see:
https://creativecommons.org/licenses/by-sa/4.0/</p>
<!-- START: this line starts content generated by: bin/gen-inventory.sh -->
<h1 id="inventory-for-2001coupard"><a name="inventory"></a>Inventory for
2001/coupard</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/2001/coupard/coupard.c">coupard.c</a>
- winning source</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2001/coupard/Makefile">Makefile</a>
- winner Makefile</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2001/coupard/coupard.orig.c">coupard.orig.c</a>
- original source</li>
<li><a href="2001_coupard.tar.bz2">2001_coupard.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/2001/coupard/.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/2001/coupard/.winner.json">.winner.json</a>
- description of winner in JSON</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2001/coupard/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%2F2001%2Fcoupard%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 -->
+208 -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,220 @@
<!-- !!! DO NOT MODIFY THIS FILE - This file is generated by a tool !!! -->
<!-- !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<!-- -->
<!-- file: 2001/ctk/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>2001 ctk</title>
<meta name="description" content="IOCCC year: 2001 IOCCC winner: ctk winner index page">
<meta name="keywords" content="IOCCC,2001,ctk,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>2001/ctk</title>
<meta name="description" content="2001 IOCCC winner ctk">
<meta name="keywords" content="IOCCC, 2001, IOCCC 2001, IOCCC winner, ctk">
</head>
<!-- END: this line ends content from: inc/head.default.html -->
<!-- START: this line starts content from: inc/body.default.html -->
<body>
<h1>2001 ctk</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>2001/ctk</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%2F2001%2Fctk%2Findex.html">Nu Html check https://ioccc-src.github.io/temp-test-ioccc/2001/ctk/index.html</a></p>
<!-- End Nu Html Checker -->
<div class="topnav">
<a class="Left" href="../coupard/index.html">&larr; coupard</a>
<a class="Left" href="../index.html">&uarr; 2001 &uarr;</a>
<a class="Left" href="../dgbeards/index.html">dgbeards &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#Chris_King">Chris King</a><br>
Location: <a href="/temp-test-ioccc/location.html#null">unknown</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 with vi(m) key movements. See <a
href="#alternate%20code">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">./ctk</span></span></code></pre></div>
<h2 id="alternate-code">Alternate code:</h2>
<p>This alternate version adds to the movement keys <code>l</code> for
right, <code>h</code> for left and <code>k</code> for straight.</p>
<h3 id="alternate-build">Alternate build:</h3>
<div class="sourceCode" id="cb3"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb3-1"><a href="#cb3-1" aria-hidden="true" tabindex="-1"></a><span class="fu">make</span> alt</span></code></pre></div>
<h3 id="alternate-use">Alternate use:</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="ex">./ctk.alt</span></span></code></pre></div>
<h2 id="judges-remarks">Judges’ remarks:</h2>
<p>No matter how careful you are, this guy eventually crashes. Most
people can make at least one successful road trip without crashing.</p>
<p>This is, of course, another of the retro games.</p>
<h2 id="authors-remarks">Author’s remarks:</h2>
<p>This is a game based on an <a
href="https://en.wikipedia.org/wiki/Apple_II_series">Apple II</a> <a
href="https://en.wikipedia.org/wiki/The_Print_Shop">Print Shop
Companion</a> <a
href="https://en.wikipedia.org/wiki/Easter_egg_(media)#In_computing">Easter
egg</a> named ‘DRIVER’, in which the goal is to drive as fast as you can
down a long twisty highway without running off the road. Use
<code>,./</code>, <code>[ ]</code>, or <code>bnm</code> to go left,
straight, and right respectively. Use <code>1234</code> to switch gears.
<code>q</code> quits. The faster you go and the thinner the road is, the
more points you get. Most of the obfuscation is in the nonsensical if
statements among other things. It works best on the Linux console: you
get engine sound (!) and the * Lock keyboard lights tell you what gear
you’re in (none lit=4th). The <code>q</code> argument (no leading
<code>-</code>) will silence the sound. It won’t work on a terminal
smaller than 80x24, but it works fine with more (try it in an XTerm with
the “Unreadable” font and the window maximized vertically!).</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-2001ctk"><a name="inventory"></a>Inventory for
2001/ctk</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/2001/ctk/ctk.c">ctk.c</a>
- winning source</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2001/ctk/Makefile">Makefile</a>
- winner Makefile</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2001/ctk/ctk.alt.c">ctk.alt.c</a>
- alternative source</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2001/ctk/ctk.orig.c">ctk.orig.c</a>
- original source</li>
<li><a href="2001_ctk.tar.bz2">2001_ctk.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/2001/ctk/.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/2001/ctk/.winner.json">.winner.json</a>
- description of winner in JSON</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2001/ctk/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%2F2001%2Fctk%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 -->
+379 -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,391 @@
<!-- !!! DO NOT MODIFY THIS FILE - This file is generated by a tool !!! -->
<!-- !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<!-- -->
<!-- file: 2001/dgbeards/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>2001 dgbeards</title>
<meta name="description" content="IOCCC year: 2001 IOCCC winner: dgbeards winner index page">
<meta name="keywords" content="IOCCC,2001,dgbeards,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>2001/dgbeards</title>
<meta name="description" content="2001 IOCCC winner dgbeards">
<meta name="keywords" content="IOCCC, 2001, IOCCC 2001, IOCCC winner, dgbeards">
</head>
<!-- END: this line ends content from: inc/head.default.html -->
<!-- START: this line starts content from: inc/body.default.html -->
<body>
<h1>2001 dgbeards</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>2001/dgbeards</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%2F2001%2Fdgbeards%2Findex.html">Nu Html check https://ioccc-src.github.io/temp-test-ioccc/2001/dgbeards/index.html</a></p>
<!-- End Nu Html Checker -->
<div class="topnav">
<a class="Left" href="../ctk/index.html">&larr; ctk</a>
<a class="Left" href="../index.html">&uarr; 2001 &uarr;</a>
<a class="Left" href="../herrmann1/index.html">herrmann1 &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#Doug_Beardsley">Doug
Beardsley</a><br> Location: <a
href="/temp-test-ioccc/location.html#US">US</a></p>
<!-- END: next line ends content generated by: bin/gen-author.sh -->
<h2 id="to-build">To build:</h2>
<div class="sourceCode" id="cb1"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb1-1"><a href="#cb1-1" aria-hidden="true" tabindex="-1"></a><span class="fu">make</span></span></code></pre></div>
<p>There is an alternate version based on the author’s remarks. See <a
href="#alternate-code">alternate code</a> below for more details.</p>
<h3 id="bugs-and-misfeatures">Bugs and (Mis)features:</h3>
<p>The current status of this entry is:</p>
<pre><code>STATUS: INABIAF - please **DO NOT** fix</code></pre>
<p>For more detailed information see <a
href="/bugs.md#2001-dgbeards">2001 dgbeards 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">./dgbeards</span></span></code></pre></div>
<h2 id="alternate-code">Alternate code:</h2>
<p>The author provided a way to speed it up a bit and also how to make
it so it doesn’t crash on losing. The idea that it crashes on losing was
too good to lose but this alternate version has the former change. If
you wish to remove this you can look at the author’s remarks and make
the change.</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="ex">./dgbeards.alt</span></span></code></pre></div>
<h2 id="try">Try:</h2>
<p>See if you can figure out how to make the computer always lose (‘win’
:-) ). It’s a very simple thing to do. Read the author’s remarks for
clues.</p>
<p>This game crashes if it loses.</p>
<p>This is supposed to happen. As is written in the <a
href="http://catb.org/jargon/html/F/feature.html">The Jargon
File</a>:</p>
<pre><code>That&#39;s not a bug, that&#39;s a feature.</code></pre>
<h2 id="judges-remarks">Judges’ remarks:</h2>
<p>This is probably the worst AI we’ve ever seen. So, then, why did the
entry win? Because it’s <em>trying</em> to lose.</p>
<p>This is also one of the first chess games we’ve seen.</p>
<p>Of particular interest is the author’s decision that the program
should crash if it loses. I’ve played chess with a lot of people like
that, and I appreciate the realism.</p>
<p>BTW: if your goal is to lose and you do does that mean you win? :-)
What does winning mean in a game you’re supposed to lose at?</p>
<h2 id="authors-remarks">Author’s remarks:</h2>
<h3 id="faq">FAQ</h3>
<h4 id="q-what-does-this-program-do">Q: What does this program do?</h4>
<p>A: It lets the user play two player or single player games of <a
href="https://en.wikipedia.org/wiki/Losing_chess">suicide chess</a>.
Suicide Chess (also known as Losing Chess) is a variant of normal chess.
It is played on the same board and uses the same pieces. Here is a list
of the differences:</p>
<ol type="1">
<li><p>The object of the game is to get to a position where you have no
legal moves. This is usually accomplished by losing all of your pieces.
Sometimes, the game can end when you still have some pawns on the board,
but they are blocked and cannot move. The general rule is if a player
has no legal moves, the game is over. The winner is the player with
fewer pieces on the board. This is almost always the same player that
had no moves, but not always.</p></li>
<li><p>In suicide chess, piece captures are compulsory. If a player can
capture an opponent’s piece, he is required to do so. If he can capture
more than one of the opponent’s pieces or can capture one piece with
more than one of his own pieces, he can choose which capture to
play.</p></li>
<li><p>The king is not significant. There is no concept of check and the
king can be captured.</p></li>
<li><p>Because of rule 3, pawns are allowed to promote to a
king.</p></li>
<li><p>Castling is not allowed.</p></li>
</ol>
<h4 id="q-how-do-you-use-this-program">Q: How do you use this
program?</h4>
<p>A: The program is fairly straightforward. When you start the program,
it displays the opening position for a game of suicide chess and waits
for user input. Commands are as follows:</p>
<ul>
<li><code>quit</code> quits the program</li>
<li><code>g</code> causes the computer to make a move</li>
</ul>
<p>Moves are represented by the long algebraic notation for the move.
For those not familiar with long algebraic notation, a move consists of
a square to move from followed by a square to move to. Squares are
denoted by a letter and a number. The letter specifies the column or
file of the square and the number specifies the row rank. Files are
named from left to right by the letters <code>A</code> - <code>H</code>.
Rows are numbered from bottom to top with the numbers <code>1</code> -
<code>8</code>. A sample move from the opening position is
<code>E2E3</code>. This means to move a piece from square
<code>E2</code> to <code>E3</code>. From the opening position, this
corresponds to moving the king pawn forward one square. This is
generally to be considered one of the best opening moves in suicide
chess. All moves, captures and otherwise, are represented with this
notation. A special case is pawn promotion moves. They use the same
notation followed by an <code>=</code> and a letter representing the
piece to promote to. The letters are <code>R</code>, <code>N</code> ,
<code>B</code>, <code>Q</code>, <code>K</code> representing rook,
knight, bishop, queen, and king respectively. The letters must be upper
case.</p>
<p>You can also specify a command line argument of a single digit to
change the search depth of the program. If no argument is specified, it
defaults to a depth of 3.</p>
<h4 id="q-are-there-any-limitations-in-your-program">Q: Are there any
limitations in your program?</h4>
<p>A: Yes. The first of the limitations is that you can only play legal
moves according to the rules of suicide chess. En passant captures are
not recognized. They are rarely encountered in suicide chess and when
they do happen, they usually do not change the outcome of the game. As
mentioned above, castling is not allowed either.</p>
<p>It also does not detect the end of the game. It can see sure wins or
losses several moves ahead, but does not announce the end of a game or
the winner. Given the existing code it is easy to do this, but it was
deemed unnecessary fluff.</p>
<h4 id="q-what-is-the-playing-strength-of-this-program">Q: What is the
playing strength of this program?</h4>
<p>A: Playing strength is a relative term. Relative to other computer
programs that play suicide chess, it is about the bottom. There is one
freeware program in existence called <code>kenny</code> that this
program can beat, but that is about it.</p>
<p>Suicide chess is a very tactical game. Most humans who do not have
any experience in suicide chess will lose to this program. The <a
href="http://www.freechess.org">Free Internet Chess Server</a> is a free
online chess server that supports suicide chess. This server keeps track
of ratings. The human ratings for suicide chess range from 1000 to about
2400. This program would probably be rated somewhere around 1700-1900.
It is better than most players, but will get destroyed by experienced
human opponents.</p>
<p>This program searches to a fixed depth of 3 <a
href="https://en.wikipedia.org/wiki/Ply_(game_theory)">ply</a>. Because
it does not search very deep, it performs very poorly in quiet strategic
positions. In such positions, it will often just shuffle pieces around
aimlessly until a tactical exchange presents itself.</p>
<p>A small amount of randomness has been added to make the program a
more interesting opponent. To avoid a call to <code>srand(3)</code>,
<code>rand(3)</code> and the extra code for the required include files,
the <code>time(3)</code> function is used as the source of random data.
It is a slow function, and since it is executed inside the search loop,
there is a significant performance decrease. To make it faster, replace
the <code>time(3)</code> call with <code>rand(3)</code> and add the line
<code>srand(time(0));</code> to the beginning of <code>main()</code>. I
used the more inefficient <code>time(3)</code> function to illustrate a
different (and somewhat obfuscated?) way of generating random
numbers.</p>
<h4 id="q-why-is-this-program-obfuscated">Q: Why is this program
obfuscated?</h4>
<p>A: Here are several reasons:</p>
<p>First, without preprocessing, the code is not easy to read. The
preprocessor is used to compress the code and obfuscate it. The main
obstacle to entering this program is the source code size limit. This is
the reason that the preprocessor was used so liberally. It is one of the
best ways to compress C source code.</p>
<p>Second, when possible, variables in the program were made global.
Their names are not descriptive and they are used for a variety of
purposes throughout the program. Because of this, it is difficult to
determine exactly what the code does even after preprocessing and
beautifying the code.</p>
<p>Third, all function names are a single character and are obviously
not descriptive of they’re actual purpose. Again this serves the dual
purpose of compression and obfuscation.</p>
<p>Fourth, most string variables have been encoded. This encoding serves
to obfuscate the program as well as reduce the number of countable
characters and get the program under the size limit of this year’s
IOCCC. There are some places where other simple encoding methods are
used to hide the real purpose of strings. These layers of obscurity
cannot be penetrated by just preprocessing and beautifying the
program.</p>
<p>Fifth, various small obfuscations have been used in places all over
the program. Short circuit evaluation is used as a substitute for
<code>if()</code> statements in some places. The ternary operator is
used. In the author’s opinion, use of the ternary operator is almost
always a strong argument for employee turnover.</p>
<p>Last, if you have succeeded in wading through the previous layers of
obfuscation, you are confronted by the fact that the game that it
implements is an obscure game. Casual inspection of the program might
lead one to believe that it is an implementation of classic chess, but
this is not so.</p>
<h4 id="q-what-about-the-compiler-warnings">Q: What about the compiler
warnings?</h4>
<p>A: When compiled with <code>gcc -Wall</code>, the compiler generated
the following warnings:</p>
<pre><code>suggest parentheses around + or - in operand of &amp;
array subscript has type &#39;char&#39;
return type defaults to &#39;int&#39;
control reaches end of non-void function
value computed is not used</code></pre>
<p>The <code>value computed is not used</code> warning happens because I
use the <code>&amp;&amp;</code> operator and take advantage of short
circuit evaluation instead of using an <code>if()</code> statement.</p>
<p>The <code>suggest parentheses...</code> warnings are given because of
expressions that depend on operator precedence details in the C
language. Eliminating these warnings would reduce obfuscation.</p>
<p>The other warnings are there because it would require more code to
eliminate them and that can’t be done given the size limit.</p>
<h4 id="q-why-does-this-program-crash-when-it-loses">Q: Why does this
program crash when it loses?</h4>
<p>A: What better way to admit defeat? The author thought this was
appropriate sportsmanship for a program of this genre and can think of
no worse job than trying to find an elusive bug in an intentionally
obfuscated program.</p>
<p>[Judge’s note: This was followed by a description of the bug, and the
comment:]</p>
<p>Note, if this program wins, the author thinks it would be good to
leave this information out of the remarks and encourage others to try
and figure it out for themselves.</p>
<p>[Should you be too lazy (or time-efficient or affected by ‘real life’
:-) ) to figure it out yourself, here’s the author’s fix.]</p>
<p>This bug can be fixed in a number of ways, but there is a way that
adds only one byte to the source code. In the statement
<code>s=(e=-V(n-1,o))&gt;s?Y=G,e:s;</code> change the <code>&gt;</code>
to a <code>&gt;=</code> and the bug will be gone.</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-2001dgbeards"><a name="inventory"></a>Inventory
for 2001/dgbeards</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/2001/dgbeards/dgbeards.c">dgbeards.c</a>
- winning source</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2001/dgbeards/Makefile">Makefile</a>
- winner Makefile</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2001/dgbeards/dgbeards.alt.c">dgbeards.alt.c</a>
- alternative source</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2001/dgbeards/dgbeards.orig.c">dgbeards.orig.c</a>
- original source</li>
<li><a href="2001_dgbeards.tar.bz2">2001_dgbeards.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/2001/dgbeards/.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/2001/dgbeards/.winner.json">.winner.json</a>
- description of winner in JSON</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2001/dgbeards/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%2F2001%2Fdgbeards%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 -->
+448 -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,460 @@
<!-- !!! DO NOT MODIFY THIS FILE - This file is generated by a tool !!! -->
<!-- !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<!-- -->
<!-- file: 2001/herrmann1/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>2001 herrmann1</title>
<meta name="description" content="IOCCC year: 2001 IOCCC winner: herrmann1 winner index page">
<meta name="keywords" content="IOCCC,2001,herrmann1,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>2001/herrmann1</title>
<meta name="description" content="2001 IOCCC winner herrmann1">
<meta name="keywords" content="IOCCC, 2001, IOCCC 2001, IOCCC winner, herrmann1">
</head>
<!-- END: this line ends content from: inc/head.default.html -->
<!-- START: this line starts content from: inc/body.default.html -->
<body>
<h1>2001 herrmann1</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>2001/herrmann1</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%2F2001%2Fherrmann1%2Findex.html">Nu Html check https://ioccc-src.github.io/temp-test-ioccc/2001/herrmann1/index.html</a></p>
<!-- End Nu Html Checker -->
<div class="topnav">
<a class="Left" href="../dgbeards/index.html">&larr; dgbeards</a>
<a class="Left" href="../index.html">&uarr; 2001 &uarr;</a>
<a class="Left" href="../herrmann2/index.html">herrmann2 &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#Immanuel_Herrmann">Immanuel
Herrmann</a><br> Location: <a
href="/temp-test-ioccc/location.html#DE">DE</a></p>
<!-- END: next line ends content generated by: bin/gen-author.sh -->
<h2 id="to-build">To build:</h2>
<div class="sourceCode" id="cb1"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb1-1"><a href="#cb1-1" aria-hidden="true" tabindex="-1"></a><span class="fu">make</span></span></code></pre></div>
<h3 id="bugs-and-misfeatures">Bugs and (Mis)features:</h3>
<p>The current status of this entry is:</p>
<pre><code>STATUS: missing files - please provide them
STATUS: known bug - please help us fix</code></pre>
<p>For more detailed information see <a
href="/bugs.md#2001-herrmann1">2001 herrmann1 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">./herrmann1.sh</span> <span class="st">&#39;prg=file&#39;</span></span></code></pre></div>
<p>NOTE: this entry seems to rely on older versions of gcc for the
compilation stage and as such if you wish to see that part like it was
designed you will need an older compiler perhaps gcc 2.95.</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">./herrmann1.sh</span> <span class="st">&#39;prg=herrmann1.times2&#39;</span></span></code></pre></div>
<p>-or-</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">./herrmann1.sh</span> <span class="st">&#39;prg=herrmann1.gcd&#39;</span></span></code></pre></div>
<h2 id="judges-remarks">Judges’ remarks:</h2>
<p>There are some clear hints in the source code as to the purpose of
this program. Perhaps the only way to figure out what is going on is to
look at the differences between the runs of the C preprocessor! Computer
Science students should recognize what is going on.</p>
<h2 id="authors-remarks">Author’s remarks:</h2>
<p>Many cool things have been done with the preprocessor,
e.g. calculation of prime numbers or the Tower of Hanoi. However, up to
now, no one proved that the preprocessor is Turing complete, and I
wondered why. Well, the answer is simply that the preprocessor is
<em>not</em> Turing complete, at least not if the program is
preprocessed only once. This is true even if the program is allowed to
include itself. (The reason being that for a given program, the
preprocessor has only a finite number of states, plus a stack consisting
of the places which the file has been included from. This is only a
push-down automaton.)</p>
<p>Well, this entry <em>is</em> a Turing machine implemented in the
preprocessor; so of course, it has to be preprocessed several times.
Here are the main features:</p>
<ul>
<li><p>Easy to program: Write your own Turing programs in a nice
syntax.</p></li>
<li><p>Easy to debug: (some) errors in the Turing machine program will
be reported nicely. (That’s something which is not often seen in IOCCC
programs.)</p></li>
<li><p>Ultra-fast: The resulting C program will print the output in time
<code>O(n)</code>, where <code>n</code> is the length of the output.
This means for example that you can solve NP hard problems in polynomial
time! ;-)</p></li>
<li><p>And best of all: During the preprocessing, watch the animated
Turing machine running over the tape and doing its work in your
terminal!</p></li>
</ul>
<h3 id="how-to-use-it">How to use it</h3>
<h4 id="for-the-impatient">For the impatient</h4>
<p>The info files <code>herrmann1.turing</code> and <a
href="herrmann1.gcd">herrmann1.gcd</a> are sample programs for the
Turing machine. For example, type</p>
<div class="sourceCode" id="cb6"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb6-1"><a href="#cb6-1" aria-hidden="true" tabindex="-1"></a><span class="ex">./herrmann1.sh</span> <span class="st">&#39;prg=herrmann1.times2&#39;</span></span></code></pre></div>
<p>and watch the animated Turing machine multiply 8 by two (in unary
representation). Here’s a screen shot during compilation:</p>
<pre><code>/*
*
* State: st2.
*
* _ _ _ _ _ * _ _ _ _ _ _ _ _ _ _ _ _ _
* ... O O I I I I I O I I I I I O O ...
* ~ ~ ~ ~ ~ * ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
*
*
*/</code></pre>
<p>(As on real videos, you’ll see a bit of “white noise” at the
beginning and at the end.;-) After compilation has terminated, type
<code>./herrmann1</code> to see the final result. The output will be</p>
<p>Final tape:</p>
<pre><code> *
..OOIIIIIIIIIIIIIIIIOOOO..
*</code></pre>
<p>(Note that the last frame of the animation is <em>not</em> the final
result.)</p>
<p>In the previous example, the Turing machine started on the default
tape of the program <code>times2.turing</code>. To provide your own
tape, type (for example)</p>
<div class="sourceCode" id="cb9"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb9-1"><a href="#cb9-1" aria-hidden="true" tabindex="-1"></a><span class="ex">./herrmann1</span> prg=times2.turing tape=<span class="st">&quot;O O O I I I O O O&quot;</span></span></code></pre></div>
<p>(The <code>O</code>s and <code>I</code>s are letters, not digits.)
You might prefer to provide only a finite portion of the tape, like I
did above. In this case, the remainder of the tape is filled with
<code>O</code>s. ;-)</p>
<p>If you just type:</p>
<pre><code>./herrmann1</code></pre>
<p>and run the program, you’ll get a usage message (and the return code
will be 2).</p>
<p>Note: To get a really nice animation, you’ll need a terminal which is
able to scroll fast enough. <code>xterm</code> is not very good. The KDE
terminal <code>konsole</code> or the text console under linux are much
better. Simply try some out.</p>
<h3 id="writing-your-own-programs">Writing your own programs</h3>
<p>Now, let’s assume you want to write a program which adds 1 to a
number in unary representation. (That is, a row of I’s is expected, and
one more I is appended to the row.) Let’s call it
<code>plus1.turing</code>. Here’s what it could look like:</p>
<div class="sourceCode" id="cb11"><pre class="sourceCode c"><code class="sourceCode c"><span id="cb11-1"><a href="#cb11-1" aria-hidden="true" tabindex="-1"></a><span class="co">/* Search beginning of number. */</span></span>
<span id="cb11-2"><a href="#cb11-2" aria-hidden="true" tabindex="-1"></a><span class="pp">#define start_O O</span><span class="op">,</span><span class="pp"> right</span><span class="op">,</span><span class="pp"> start</span></span>
<span id="cb11-3"><a href="#cb11-3" aria-hidden="true" tabindex="-1"></a><span class="co">/* Number found. Move one step to the left. */</span></span>
<span id="cb11-4"><a href="#cb11-4" aria-hidden="true" tabindex="-1"></a><span class="pp">#define start_I I</span><span class="op">,</span><span class="pp"> left</span><span class="op">,</span><span class="pp"> st2</span></span>
<span id="cb11-5"><a href="#cb11-5" aria-hidden="true" tabindex="-1"></a><span class="co">/* Write a I and stop */</span></span>
<span id="cb11-6"><a href="#cb11-6" aria-hidden="true" tabindex="-1"></a><span class="pp">#define st2_O I</span><span class="op">,</span><span class="pp"> left</span><span class="op">,</span><span class="pp"> stop</span></span></code></pre></div>
<p>Some explanations: - The tape alphabet is always O and I. - The
states can be anything starting with “st”. “start” and “stop” are the
start and stop states, respectively. - To define a state, use two lines:
one for each letter on the tape. You may omit one of the lines if the
Turing machine will never enter the state reading that letter. (In the
example, the line defining <code>st2_I</code> has been left out.) - The
order of the lines is irrelevant. - You may use C-style comments. (Would
you have guessed it?)</p>
<p>Now, the program can be used with</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">./herrmann1.sh</span> <span class="st">&#39;prg=plus1.turing&#39;</span> <span class="st">&#39;tape=&quot;I I I&quot;&#39;</span></span></code></pre></div>
<p>But what happens if no tape is provided? Up to now, the Turing
machine would start on an empty tape (that is, a tape filled with
<code>O</code>s). For many programs, this doesn’t make much sense (as is
the case for <code>plus1.turing</code>). So you might want to provide a
default tape by adding a line like</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="pp">#define tape O O O O O I I I I</span></span></code></pre></div>
<p>to your program.</p>
<h3 id="debugging">Debugging</h3>
<p>When writing long programs, the most common errors are to forget to
define a state or to misspell one. Let’s assume you forgot the line</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="pp">#define start_I I</span><span class="op">,</span><span class="pp"> left</span><span class="op">,</span><span class="pp"> st2</span></span></code></pre></div>
<p>Remove it and type</p>
<div class="sourceCode" id="cb15"><pre
class="sourceCode sh"><code class="sourceCode bash"><span id="cb15-1"><a href="#cb15-1" aria-hidden="true" tabindex="-1"></a><span class="ex">./herrmann1</span> <span class="st">&#39;prg=plus1.turing&#39;</span></span></code></pre></div>
<p>The output will be</p>
<p>Undefined state start.</p>
<p>Tape:</p>
<pre><code> *
..OOOOOOOOIIIIOO..
*</code></pre>
<p>and the return code will be 1. As you can see, the Turing machine
moved over the <code>O</code>s, but when it arrived at the
<code>I</code> (still in state start), the error occurred.</p>
<p>Note that other kinds of errors can cause compilation to fail. If
this happens, the build script will write the error message of gcc into
a file called <code>error</code> and then exit.</p>
<h3 id="what-the-build-script-does">What the build script does</h3>
<p>In principle, the build script simply runs the preprocessor over and
over again, until nothing changes anymore; then, the program is
compiled. After each preprocessing step, the script outputs the
beginning of the program; this is where the animation takes place
(except in the first and last few steps).</p>
<p>However, there’s a technical problem to overcome: Some compilers
(including gcc) insert a lot of white space during the preprocessing.
This is bad for two reasons. First, the animated picture won’t look
right. And second, after some time, the file will grow too big for your
hard disk. (The amount of white space grows exponentially.) So after
each preprocessing, the first thing the build script does is remove all
the unnecessary white space using <code>sed</code>.</p>
<p>(gcc would even insert <code>#line</code> directives if I didn’t
suppress them with the <code>-P</code> option.)</p>
<h3 id="some-more-details">Some more details</h3>
<ul>
<li><p>The arguments passed to the build script are passed on to gcc
with a <code>-D</code> before. I had a slight technical problem doing
this (especially with the spaces that can appear within the tape
argument). That made the build script a bit longer.</p></li>
<li><p>It would be enough to pass the <code>#define</code>s in the first
preprocessing. The program then “remembers” them. However, it doesn’t
matter if they are passed in all pre-processes. (This doesn’t sound very
impressive, but it has required some extra lines of code.)</p></li>
<li><p>During the preprocessing, intermediate files
<code>herrmann1-1.c</code> and <code>herrmann1-2.c</code> are
generated.</p></li>
<li><p>Also, a file <code>error</code> is generated. This file is
removed after the compilation, except if gcc produced an error; then it
contains the error message. (I can’t let gcc output all its messages
directly, because the warnings would clobber the animation. I could have
made the compile script output the error file in case of an error, but I
didn’t want to make it yet longer.)</p></li>
</ul>
<h3 id="some-technical-details-obfuscations">Some technical details /
obfuscations</h3>
<ul>
<li><p>The program is compressed. In the first three preprocessing
passes, it uncompresses itself and initializes the “variables”. So if
you want to understand how it works, the best thing is to pre-process it
three times and then look at it again. (However, I wouldn’t have wasted
three passes if they weren’t needed anyway to initialize the tape in
certain cases. Find out why.)</p></li>
<li><p>The first problem I had to solve when writing this program was to
write a preprocessor program which outputs itself. Of course, each
program which doesn’t contain any preprocessor directives is such a
program, but that’s not what I needed. In fact, to do this, the program
has to include itself, but even then, it’s not easy.</p></li>
<li><p>The next problem to solve was how to pass results of a
calculation of one preprocessing to the next one. This is done by
outputting <code>#define</code>s with the result. But there’s a problem
with this: it is impossible to output a <code>#define result xxx</code>,
where <code>xxx</code> depends on the previous value of result. Try it
if you don’t believe it. And find out what I did instead.</p></li>
<li><p>What’s a useful way to store information, especially the content
of the tape? Of course, a <code>#define tape OOIOOIOIIIIO</code>
contains the information, but then, how do you access the information?
(For example, you won’t be able to write preprocessor code which
replaces the first <code>O</code> by <code>I</code>.) My answer looks
very much like the way a stack would have been implemented in lambda
calculus. (The tape is implemented as two stacks, to be exact.) And
still, there were some technical problems to solve. Look at the program
for more details.</p></li>
<li><p>There are many other interesting things to look at, e.g. the way
to access the information in the user-provided program, the way a
non-defined state is detected, the way the picture is produced, etc. If
you want a real challenge, try to understand what the line
<code>w j k(P ## x)</code> does.</p></li>
<li><p>Due to the fact that our alphabet has only 53 ;-) letters, I had
to use many variables more than once.</p></li>
<li><p>I couldn’t refrain from doing a little bit of nasty stuff
like</p>
<pre><code> #define a 0&amp;0
#if !a</code></pre>
<p>Of course, it is a bit more subtle, and even useful.</p></li>
<li><p>The layout of the source code…, well, let’s call it the “modern
art of programming” - a mixture of program-like indenting and modern
art. There are even some comments…</p></li>
</ul>
<h3 id="compatibility">Compatibility</h3>
<ul>
<li><p>It works with many versions of gcc. I tested it with versions
2.7.2.1, 2.8.1, 2.95.2, and ecgs-2.91.66. However, an old version of gcc
produced “internal compiler errors” (obviously not my fault).</p></li>
<li><p>The only warnings I get tell me that I’m undefining
<code>__FILE__</code> and that preprocessing directives are not
recognized within macro args. My answer to this is “yes, I know this and
it’s all right”. With <code>-Wall</code>, I also get some warnings about
<code>/*</code> inside comments (Well, <em>I</em> like some well-placed
<code>/*/*/</code>.) as well as some suggestions where to place some
more parentheses (as if I didn’t know the operator precedence).</p></li>
<li><p>Different versions of <code>cc</code> all produced only rubbish.
Apparently, the preprocessors didn’t really work. (I don’t feel guilty
there, either. Even with very simple programs, they produced mysterious
output.)</p></li>
<li><p>For Mac-Users: It works with the C compiler of CodeWarrior (an
old version). This compiler even leaves out all that unnecessary white
space, so that no clean-up is needed. (It would be useful to write a
kind of script which does the equivalent to the build script, so that
one does not have to choose “preprocess” from the menu over and over
again. I leave this as an exercise to the experienced Mac
programmer.)</p></li>
<li><p>In the build script, I passed the <code>-P</code> option to gcc
to suppress the insertion of <code>#line</code> directives. If your
compiler doesn’t support this option (and does insert <code>#line</code>
directives), you should change the call to <code>sed</code> to remove
them, too: Add</p>
<pre><code> -e &quot;/^#line/ d&quot;</code></pre>
<p>to the sed parameters. Or, if your <code>#line</code> directives look
like</p>
<pre><code> # 15 &quot;filename&quot;</code></pre>
<p>add</p>
<pre><code> -e &quot;/^# [0-9]/ d&quot;</code></pre>
<p>instead.</p></li>
<li><p>First, I had <code>-ansi -pedantic</code> turned on, but on some
systems, the <code>stdio.h</code> is not compatible to that, so I turned
it back off.</p></li>
<li><p>The build script probably needs a bash to run in. So perhaps you
have to add <code>#!/bin/bash</code> or something like this at the
beginning.</p></li>
<li><p>On SunOS, I had to remove the <code>-q</code> option from diff in
the build script.</p></li>
</ul>
<h2 id="copyright-and-cc-by-sa-4.0-license">Copyright and CC BY-SA 4.0
License:</h2>
<p>This file is Copyright (c) 2023 by Landon Curt Noll. All Rights
Reserved. You are free to share and adapt this file under the terms of
this license:</p>
<pre><code>Creative Commons Attribution-ShareAlike 4.0 International (CC BY-SA 4.0)</code></pre>
<p>For more information, see:
https://creativecommons.org/licenses/by-sa/4.0/</p>
<!-- START: this line starts content generated by: bin/gen-inventory.sh -->
<h1 id="inventory-for-2001herrmann1"><a name="inventory"></a>Inventory
for 2001/herrmann1</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/2001/herrmann1/herrmann1.c">herrmann1.c</a>
- winning source</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2001/herrmann1/Makefile">Makefile</a>
- winner Makefile</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2001/herrmann1/herrmann1.orig.c">herrmann1.orig.c</a>
- original source</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2001/herrmann1/herrmann1.gcd">herrmann1.gcd</a>
- GCD program as c defines</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2001/herrmann1/herrmann1.sh">herrmann1.sh</a>
- how to run</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2001/herrmann1/herrmann1.times2">herrmann1.times2</a>
- turning program as c defines</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2001/herrmann1/plus1.turing">plus1.turing</a>
- turning program as c defines</li>
<li><a href="2001_herrmann1.tar.bz2">2001_herrmann1.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/2001/herrmann1/.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/2001/herrmann1/.winner.json">.winner.json</a>
- description of winner in JSON</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2001/herrmann1/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%2F2001%2Fherrmann1%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 -->
+343 -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,355 @@
<!-- !!! DO NOT MODIFY THIS FILE - This file is generated by a tool !!! -->
<!-- !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<!-- -->
<!-- file: 2001/herrmann2/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>2001 herrmann2</title>
<meta name="description" content="IOCCC year: 2001 IOCCC winner: herrmann2 winner index page">
<meta name="keywords" content="IOCCC,2001,herrmann2,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>2001/herrmann2</title>
<meta name="description" content="2001 IOCCC winner herrmann2">
<meta name="keywords" content="IOCCC, 2001, IOCCC 2001, IOCCC winner, herrmann2">
</head>
<!-- END: this line ends content from: inc/head.default.html -->
<!-- START: this line starts content from: inc/body.default.html -->
<body>
<h1>2001 herrmann2</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>2001/herrmann2</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%2F2001%2Fherrmann2%2Findex.html">Nu Html check https://ioccc-src.github.io/temp-test-ioccc/2001/herrmann2/index.html</a></p>
<!-- End Nu Html Checker -->
<div class="topnav">
<a class="Left" href="../herrmann1/index.html">&larr; herrmann1</a>
<a class="Left" href="../index.html">&uarr; 2001 &uarr;</a>
<a class="Left" href="../jason/index.html">jason &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#Immanuel_Herrmann">Immanuel
Herrmann</a><br> Location: <a
href="/temp-test-ioccc/location.html#DE">DE</a></p>
<!-- END: next line ends content generated by: bin/gen-author.sh -->
<h2 id="to-build">To build:</h2>
<div class="sourceCode" id="cb1"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb1-1"><a href="#cb1-1" aria-hidden="true" tabindex="-1"></a><span class="fu">make</span></span></code></pre></div>
<h2 id="to-use">To use:</h2>
<div class="sourceCode" id="cb2"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb2-1"><a href="#cb2-1" aria-hidden="true" tabindex="-1"></a><span class="ex">./herrmann2</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>If you use vi(m) you can see a pattern in <a
href="herrmann2.cup">herrmann2.cup</a> and
[herrmann2.ioccc][(herrmann2.ioccc]) by say:</p>
<pre><code>/[pon]\</code></pre>
<p>and</p>
<pre><code>/l</code></pre>
<p>For additional fun in <a href="herrmann2.cup">herrmann2.cup</a>
try:</p>
<pre><code>/[po]
/q</code></pre>
<p>and in <a href="herrmann2.ioccc">herrmann2.ioccc</a> try:</p>
<pre><code>/n</code></pre>
<h2 id="judges-remarks">Judges’ remarks:</h2>
<p>Be careful when staring at the source code - your eyes might cross,
but if you concentrate on your focus you will find illumination!</p>
<h2 id="authors-remarks">Author’s remarks:</h2>
<p>You probably know those “magic eye” 3D pictures - pictures looking
like random noise, but when you look “through” the paper, you either get
a three dimensional picture or a headache. With this program, you can
create your own 3D pictures in ASCII art. And yes, the program itself is
such a 3D picture.</p>
<h3 id="how-to-use-it">How to use it</h3>
<ol type="1">
<li><p>Create a file which describes the desired 3D picture. The file
must be a block of lowercase letters the size of the desired picture.
The letters specify the depth of the corresponding pixel: <code>a</code>
means close to the paper, <code>z</code> means far away. The info files
are examples. Be aware that the size of the picture is restricted to
about 9k.</p></li>
<li><p>Pipe your picture into the program. The output will be your 3D
picture, constructed of random characters (with ASCII code between 32
and 126). For example, type</p></li>
</ol>
<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">./herrmann2</span> <span class="op">&lt;</span> herrmann2.ioccc</span></code></pre></div>
<ol start="3" type="1">
<li>If you want to control the characters used in the output (for
example if your picture is to consist only of digits), pass them as the
first argument. In this case, each time the program needs a new random
character, it will take the next one from the argument. When it arrives
at the end of the argument, it will start over at the beginning.
Example:</li>
</ol>
<div class="sourceCode" id="cb9"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb9-1"><a href="#cb9-1" aria-hidden="true" tabindex="-1"></a><span class="ex">./herrmann2</span> <span class="st">&quot;234 84 045 5 6765 7487 65190 84 656 254 12 43931 818 0 6542 </span><span class="dt">\</span></span>
<span id="cb9-2"><a href="#cb9-2" aria-hidden="true" tabindex="-1"></a><span class="st">341 45 567 76967 7244 606 976567 895 81898 095 68678 1843 4650547 </span><span class="dt">\</span></span>
<span id="cb9-3"><a href="#cb9-3" aria-hidden="true" tabindex="-1"></a><span class="st">565980691 389 04974&quot;</span> <span class="op">&lt;</span> herrmann2.ioccc</span></code></pre></div>
<h3 id="some-hints-to-get-better-results">Some hints to get better
results</h3>
<ul>
<li><p>Due to the way these 3D pictures work, the left part of the
picture won’t look really 3D, so don’t put things too much on the left.
The reason is that for each letter in the source file, a character for
the right eye is printed. The 3D effect appears when the left eye sees
the same character more to the left. This is of course impossible on the
left border of the picture.</p></li>
<li><p>Don’t use too different depths and don’t use the depths very
close to the paper (beginning of the alphabet). This would make it more
difficult to see the picture.</p></li>
<li><p>When passing an argument, don’t use a too short one; the
repeating pattern which arises from the repetition of the argument could
interfere with the repeating pattern which creates the 3D
effect.</p></li>
</ul>
<h3 id="extra-features">Extra-Features</h3>
<ul>
<li><p>The program is able to handle all common kinds of line breaks:
Unix, DOS and Mac. To get an output with a certain kind of line breaks,
simply use the same kind of line breaks in the input file.</p></li>
<li><p>As the source code is a 3D picture itself, the easiest way to get
it (if you lost it or if you don’t have it already) is to use the
program itself on the right picture and with the right
argument:</p></li>
</ul>
<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">./herrmann2</span> <span class="dt">\</span></span>
<span id="cb10-2"><a href="#cb10-2" aria-hidden="true" tabindex="-1"></a><span class="st">&#39;char*d,A[9876];e;b;*ad,a,c; tw,ndr,T; wri; ;*h; _,ar ;on;&#39;</span><span class="dt">\</span></span>
<span id="cb10-3"><a href="#cb10-3" aria-hidden="true" tabindex="-1"></a><span class="st">&#39; ;l ;i(V)man,n {-!har ; =Aadre(0,&amp;e,o||n -- +,o4,=9,l=b=8,&#39;</span><span class="dt">\</span></span>
<span id="cb10-4"><a href="#cb10-4" aria-hidden="true" tabindex="-1"></a><span class="st">&#39;!( te-*Aim)|(0~l),srand (l),,!A,d=,b))&amp;&amp;+((A + te-A(&amp;(*)=+ +95&gt;&#39;</span><span class="dt">\</span></span>
<span id="cb10-5"><a href="#cb10-5" aria-hidden="true" tabindex="-1"></a><span class="st">&#39;e?(*&amp; c_*r=5,r+e-r +_:2-19&lt;-+?|(d==d),!n ?*d| *( (char**)+V+), (&#39;</span><span class="dt">\</span></span>
<span id="cb10-6"><a href="#cb10-6" aria-hidden="true" tabindex="-1"></a><span class="st">&#39; +0,*d-7 ) -r+8)c:7:+++7+! r: and%9- 85! ()-(r+o):(+w,_+ A*(=er&#39;</span><span class="dt">\</span></span>
<span id="cb10-7"><a href="#cb10-7" aria-hidden="true" tabindex="-1"></a><span class="st">&#39;i+(o)+b)),!write,(=_((-b+*h)(1,A+b,!!((((-+, a &gt;T^l,( o-95=+))w?&#39;</span><span class="dt">\</span></span>
<span id="cb10-8"><a href="#cb10-8" aria-hidden="true" tabindex="-1"></a><span class="st">&#39;++ &amp;&amp;r:b&lt;&lt;2+a +w) ((!main(n*n,V) , +-) ),l)),w= +T--&gt;o +o+;{ &amp;!&#39;</span><span class="dt">\</span></span>
<span id="cb10-9"><a href="#cb10-9" aria-hidden="true" tabindex="-1"></a><span class="st">&#39;a;}return _+= &#39;</span> <span class="op">&lt;</span> herrmann2.ioccc</span></code></pre></div>
<ul>
<li><p>If I had submitted the program last year, I would have said that
it has exactly the maximum allowed length: 1536 characters. Now let’s
say it’s a way of protesting against the inflation in program
length.</p></li>
<li><p>The size of the source 3D picture has been chosen carefully: as
big as possible, but small enough to be viewed without problems on
normal-sized terminals.</p></li>
</ul>
<h3 id="why-this-program-should-win">Why this program should win</h3>
<ul>
<li><p>The layout is of a completely new kind. And it describes what the
program does more precisely than any comment could.</p></li>
<li><p>I don’t think there has ever been an IOCCC program with so severe
layout constraints. Once the 3D picture has been fixed, only a sixth of
the characters can be chosen freely! (457 of 1840, to be exact.) In
contrast, in palindrome programs, for example, half of the characters
can be chosen freely.</p></li>
<li><p>I did not cheat by using comments or <code>-D</code> options -
something I’ve seen even some palindrome programs do. In fact, at my
first attempt at writing the program I became convinced that it isn’t
possible without cheating. But then I found out that with comments or
defines, it would become trivial, so I had to try harder…</p></li>
<li><p>If you don’t believe the constraints are hard, try to write just
one single line which satisfies them. (To be able to make one function
call, for example, you have to fill an entire line with stuff doing
mostly nothing.)</p></li>
<li><p>Just in case this is not enough: Yes, the code itself is
obfuscated: It’s (almost) only one big expression, with deep nesting of
<code>()</code> and <code>?:</code>, and full of unnecessary operations
which do not really help making it readable. And it contains a lot of
“magic numbers”. (My favourite is the <code>7</code> in line 15 (each
one). Which is the other digit I could have put there instead, and what
other changes to the program would have been necessary? Without
violating the constraints of course.)</p></li>
<li><p>The fact that the main loop of the program calls
<code>main()</code> recursively is nothing new. New however is that this
program only needs a logarithmic recursion depth! (Find out how this
works.)</p></li>
<li><p>When still in doubt about how to judge this program,
type</p></li>
</ul>
<div class="sourceCode" id="cb11"><pre
class="sourceCode sh"><code class="sourceCode bash"><span id="cb11-1"><a href="#cb11-1" aria-hidden="true" tabindex="-1"></a><span class="ex">./herrmann2</span> <span class="op">&lt;</span> herrmann2.cup</span></code></pre></div>
<p>and let the result inspire you. ;-)</p>
<h3 id="requirements-to-the-compiler-compatibility">Requirements to the
compiler / Compatibility</h3>
<ul>
<li><p>I fear that gcc is the only compiler for which this program
works. Due to the severe restrictions, I was forced to use declarations
of <code>int</code> variables, functions and parameters without
specifying their type. The biggest problem was to put
<code>int main(int c, char ** v){</code> into the program. After some
time, I became convinced that this is impossible. Finally, at least I
managed to squeeze <code>main(c, v){</code> into the constraints
instead.</p></li>
<li><p>Also, a lot of warnings are produced - most of them “data
definition has no type or storage class”, but also some “parameter names
(without types) in function declaration” and “assignment from
incompatible pointer type”. I wasn’t able to get rid of them.</p></li>
<li><p>At least, it probably works with all sufficiently recent versions
of gcc. I tested it with versions 2.7.2.1, 2.8.1, 2.95.2, and
ecgs-2.91.66.</p></li>
<li><p>Of course I couldn’t put <code>#include</code>s at the beginning
of the program. Usually, this is not really necessary with gcc. However,
for this program it would have been, because some functions appear as
function pointers, and as such they are not generated implicitly. So the
build script has to pass <code>-include ...</code> to gcc. A problem
with this is that the complete path of the include files has to be
provided. In the build script, I assume that the path is
<code>/usr/include</code>, but this can easily be adapted.</p></li>
</ul>
<h2 id="copyright-and-cc-by-sa-4.0-license">Copyright and CC BY-SA 4.0
License:</h2>
<p>This file is Copyright (c) 2023 by Landon Curt Noll. All Rights
Reserved. You are free to share and adapt this file under the terms of
this license:</p>
<pre><code>Creative Commons Attribution-ShareAlike 4.0 International (CC BY-SA 4.0)</code></pre>
<p>For more information, see:
https://creativecommons.org/licenses/by-sa/4.0/</p>
<!-- START: this line starts content generated by: bin/gen-inventory.sh -->
<h1 id="inventory-for-2001herrmann2"><a name="inventory"></a>Inventory
for 2001/herrmann2</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/2001/herrmann2/herrmann2.c">herrmann2.c</a>
- winning source</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2001/herrmann2/Makefile">Makefile</a>
- winner Makefile</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2001/herrmann2/herrmann2.alt.c">herrmann2.alt.c</a>
- alternative source</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2001/herrmann2/herrmann2.orig.c">herrmann2.orig.c</a>
- original source</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2001/herrmann2/herrmann2.cup">herrmann2.cup</a>
- sample input</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2001/herrmann2/herrmann2.ioccc">herrmann2.ioccc</a>
- sample input</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2001/herrmann2/try.sh">try.sh</a>
- how to run</li>
<li><a href="2001_herrmann2.tar.bz2">2001_herrmann2.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/2001/herrmann2/.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/2001/herrmann2/.winner.json">.winner.json</a>
- description of winner in JSON</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2001/herrmann2/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%2F2001%2Fherrmann2%2Findex.html">Nu HTML check this web page</a></p>
<p><a href="#top">Jump to top</a> <a href="#content">Jump to Content</a> <a href="#inventory">Jump to Inventory</a></p>
</div>
<!-- END: this line ends content from: inc/footer.default.html -->
<!-- START: this line starts content from: inc/bottom.default.html -->
</body>
</html>
<!-- END: this line ends content from: inc/bottom.default.html -->
+255 -13
View File
@@ -1,4 +1,6 @@
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<!-- START: two lines up starts content from: inc/top.default.html -->
<!-- -->
<!-- !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<!-- !!! DO NOT MODIFY THIS FILE - This file is generated by a tool !!! -->
@@ -6,27 +8,267 @@
<!-- !!! DO NOT MODIFY THIS FILE - This file is generated by a tool !!! -->
<!-- !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<!-- -->
<!-- file: 2001/jason/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>2001 jason</title>
<meta name="description" content="IOCCC year: 2001 IOCCC winner: jason winner index page">
<meta name="keywords" content="IOCCC,2001,jason,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>2001/jason</title>
<meta name="description" content="2001 IOCCC winner jason">
<meta name="keywords" content="IOCCC, 2001, IOCCC 2001, IOCCC winner, jason">
</head>
<!-- END: this line ends content from: inc/head.default.html -->
<!-- START: this line starts content from: inc/body.default.html -->
<body>
<h1>2001 jason</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>2001/jason</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%2F2001%2Fjason%2Findex.html">Nu Html check https://ioccc-src.github.io/temp-test-ioccc/2001/jason/index.html</a></p>
<!-- End Nu Html Checker -->
<div class="topnav">
<a class="Left" href="../herrmann2/index.html">&larr; herrmann2</a>
<a class="Left" href="../index.html">&uarr; 2001 &uarr;</a>
<a class="Left" href="../kev/index.html">kev &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#Jason_Orendorff">Jason
Orendorff</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">./jason</span></span></code></pre></div>
<h2 id="judges-remarks">Judges’ remarks:</h2>
<p>You are in a maze of twisty little passages, all alike.</p>
<p>The really amazing part of this is that it’s a text adventure, and
there’s not a single word in the source that isn’t a C keyword or
function name, being used as such.</p>
<p>The interface isn’t very tolerant of errors, but you can’t really
expect that from something this small.</p>
<p>Of particular interest: Go ahead, run it through the preprocessor.
You <em>still</em> won’t see the words that are used in the game.</p>
<p>If you run it through a beautifier you might cause a crash as most of
the whitespace is significant. Also, if you attempt to change one
character identifiers to longer names expect problems. Even swapping the
<code>Y</code> and <code>Z</code> can cause problems. Go ahead, try it!
:-)</p>
<h2 id="authors-remarks">Author’s remarks:</h2>
<p>TED Shroyer came up with the idea that made it possible to hide all
the text. Thanks, TED. You won. :)</p>
<div class="sourceCode" id="cb3"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb3-1"><a href="#cb3-1" aria-hidden="true" tabindex="-1"></a><span class="fu">cc</span> <span class="at">-o</span> jason jason.c</span>
<span id="cb3-2"><a href="#cb3-2" aria-hidden="true" tabindex="-1"></a><span class="ex">./jason</span></span>
<span id="cb3-3"><a href="#cb3-3" aria-hidden="true" tabindex="-1"></a><span class="ex">you</span> are in a maze of twisty little passages</span>
<span id="cb3-4"><a href="#cb3-4" aria-hidden="true" tabindex="-1"></a><span class="ex">caves</span> lead: left forward back</span>
<span id="cb3-5"><a href="#cb3-5" aria-hidden="true" tabindex="-1"></a><span class="ex">you</span> see</span>
<span id="cb3-6"><a href="#cb3-6" aria-hidden="true" tabindex="-1"></a> <span class="ex">a</span> lamp</span>
<span id="cb3-7"><a href="#cb3-7" aria-hidden="true" tabindex="-1"></a><span class="op">&gt;</span> _</span></code></pre></div>
<p>This program is a rather nostalgic little labyrinth game. Start out
by typing “<code>get lamp</code>”, then use the direction words
“<code>left</code>”, “<code>right</code>”, “<code>forward</code>”, and
“<code>back</code>” to explore the caves. Note that these words can
refer to different passages depending on which way you’re facing.
“<code>back</code>” always takes you back the way you came. Type
“<code>quit</code>” to quit.</p>
<p>The maze is randomly generated each time you play. The algorithm
ensures that you start at least 6 hops away from the exit. All passages
are two-way.</p>
<p>(There is a trick, well-known among <a
href="https://en.wikipedia.org/wiki/Colossal_Cave_Adventure">Adventure</a>
game fans, to keeping one’s bearings in games like this. Unless you know
the trick, it can be very difficult to find your way around. Try it out
first; I’ll give away the secret at the bottom of this document.)</p>
<p>The goal is to collect 8 treasures (plus the lamp) and escape into
the sunlight - or moonlight, as the case may be. After a few minutes,
the lamp runs out of oil, and things become perilous.</p>
<p>If you manage to escape, you score 50 points for your hide, 50 points
per item, and bonus points for speed.</p>
<p>Why I think this program is obfuscated:</p>
<ul>
<li><p>70% more <code>#</code> symbols than the average entry.</p></li>
<li><p>Where are all the messages? The game is downright chatty for only
having two string literals (<code>"%d \n"</code> and
<code>"Y\n : ! ,.?&gt;"</code>).</p></li>
<li><p>There is exactly one loop in the program, a <code>for</code>
loop, and it is clearly the product of a deranged mind. Running the
preprocessor only makes it worse.</p></li>
<li><p>Microsoft Visual C++ won’t even compile this program, even though
it is plain ANSI C (<em>innocent look</em>) and limits itself to the
most standard and portable of the standard library facilities.</p></li>
<li><p>Most of the whitespace is significant, so attempts to beautify it
can easily lead to segmentation faults.</p></li>
<li><p>Attempts to replace the one-character identifiers with longer,
more meaningful names will likewise cause problems. In fact, simply
changing all the <code>Y</code>s to <code>Z</code>s and vice versa
results in some unexpected side effects.</p></li>
</ul>
<p>When all warnings are enabled, some compilers express the desire to
see a few more parentheses. I respectfully submit that there are plenty
of parentheses in the program (370 in all.) Besides, any more would put
me over the size limit. <code>gcc</code> also generates a warning about
some calculations not being used. Having just spent 19 hours staring at
this program, sweating over every character, I swear gcc is wrong.</p>
<p>The program is formatted as a poem, to make it more readable. I find
the plaintive chorus “B? B?” particularly poignant. Also, smiley faces
are formatted flush left. (If you don’t find the game entertaining, see
if you can find</p>
<pre><code> the fish scales Q)++j&lt;
the shooting star -~- ~ -~i +</code></pre>
<p>in the source code.)</p>
<h3 id="game-strategy-spoiler">GAME STRATEGY SPOILER</h3>
<p>The trick, of course, is to drop items in empty rooms to mark them.
That way you usually know if you’re in a room you’ve seen before. It
greatly aids mapping.</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-2001jason"><a name="inventory"></a>Inventory for
2001/jason</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/2001/jason/jason.c">jason.c</a>
- winning source</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2001/jason/Makefile">Makefile</a>
- winner Makefile</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2001/jason/jason.orig.c">jason.orig.c</a>
- original source</li>
<li><a href="2001_jason.tar.bz2">2001_jason.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/2001/jason/.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/2001/jason/.winner.json">.winner.json</a>
- description of winner in JSON</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2001/jason/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%2F2001%2Fjason%2Findex.html">Nu HTML check this web page</a></p>
<p><a href="#top">Jump to top</a> <a href="#content">Jump to Content</a> <a href="#inventory">Jump to Inventory</a></p>
</div>
<!-- END: this line ends content from: inc/footer.default.html -->
<!-- START: this line starts content from: inc/bottom.default.html -->
</body>
</html>
<!-- END: this line ends content from: inc/bottom.default.html -->
+353 -13
View File
@@ -1,4 +1,6 @@
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<!-- START: two lines up starts content from: inc/top.default.html -->
<!-- -->
<!-- !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<!-- !!! DO NOT MODIFY THIS FILE - This file is generated by a tool !!! -->
@@ -6,27 +8,365 @@
<!-- !!! DO NOT MODIFY THIS FILE - This file is generated by a tool !!! -->
<!-- !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<!-- -->
<!-- file: 2001/kev/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>2001 kev</title>
<meta name="description" content="IOCCC year: 2001 IOCCC winner: kev winner index page">
<meta name="keywords" content="IOCCC,2001,kev,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>2001/kev</title>
<meta name="description" content="2001 IOCCC winner kev">
<meta name="keywords" content="IOCCC, 2001, IOCCC 2001, IOCCC winner, kev">
</head>
<!-- END: this line ends content from: inc/head.default.html -->
<!-- START: this line starts content from: inc/body.default.html -->
<body>
<h1>2001 kev</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>2001/kev</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%2F2001%2Fkev%2Findex.html">Nu Html check https://ioccc-src.github.io/temp-test-ioccc/2001/kev/index.html</a></p>
<!-- End Nu Html Checker -->
<div class="topnav">
<a class="Left" href="../jason/index.html">&larr; jason</a>
<a class="Left" href="../index.html">&uarr; 2001 &uarr;</a>
<a class="Left" href="../ollinger/index.html">ollinger &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#Kevin_Pulo">Kevin Pulo</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>
<p>There is another version which lets you use the arrow keys rather
than the more awkward <code>,</code> and <code>.</code> keys. See <a
href="#alternate-code">alternate code</a> below.</p>
<h3 id="bugs-and-misfeatures">Bugs and (Mis)features:</h3>
<p>The current status of this entry is:</p>
<pre><code>STATUS: INABIAF - please **DO NOT** fix</code></pre>
<p>For more detailed information see <a href="/bugs.md#2001-kev">2001
kev 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">./kev</span> <span class="co"># in one terminal</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="ex">./kev</span> hostname <span class="co"># in another terminal</span></span></code></pre></div>
<p>NOTE: each player’s paddle is at the bottom and the opponent at the
top.</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">./kev</span> <span class="co"># in one terminal</span></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="ex">./kev</span> localhost <span class="co"># in another terminal on the same host</span></span></code></pre></div>
<p>If you need to change the speed you can reconfigure it like (say for
over a network and not the same host):</p>
<div class="sourceCode" id="cb5"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb5-1"><a href="#cb5-1" aria-hidden="true" tabindex="-1"></a><span class="fu">make</span> clobber SPEED=50 all <span class="co"># original default value which is very fast</span></span></code></pre></div>
<p>If you wish to change the port you can do so like:</p>
<div class="sourceCode" id="cb6"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb6-1"><a href="#cb6-1" aria-hidden="true" tabindex="-1"></a><span class="fu">make</span> clobber PORT=3773 all</span></code></pre></div>
<p>Of course if you want a port &lt; 1024 you’ll need to be root so
don’t do that.</p>
<p>And if you know what you’re doing you can redefine the call to the
<code>socket(2)</code> syscall with the <code>l_</code> macro, changing
the <code>L</code> variable like one would <code>PORT</code>. Of course
you can do more than one at the same time. For instance to change the
speed and port:</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">make</span> clobber SPEED=512 PORT=3773 all</span></code></pre></div>
<p>If you have <code>xterm</code> try on one system:</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">xterm</span> <span class="at">-geometry</span> 80x40 <span class="at">-fg</span> green <span class="at">-bg</span> black <span class="at">-fn</span> 9x15bold <span class="at">-e</span> ./kev <span class="kw">&amp;</span></span></code></pre></div>
<p>and then the other, the client system:</p>
<div class="sourceCode" id="cb9"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb9-1"><a href="#cb9-1" aria-hidden="true" tabindex="-1"></a><span class="ex">xterm</span> <span class="at">-geometry</span> 80x40 <span class="at">-fg</span> green <span class="at">-bg</span> black <span class="at">-fn</span> 9x15bold <span class="at">-e</span> ./kev localhost<span class="kw">&amp;</span></span></code></pre></div>
<p>This might look nicer than just the terminal itself.</p>
<h2 id="alternate-code">Alternate code:</h2>
<p>This version allows you to use arrow keys on the keyboard rather than
the more awkward <code>,</code> and <code>.</code> keys to move your
paddle.</p>
<h3 id="alternate-build">Alternate build:</h3>
<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> alt</span></code></pre></div>
<p>You can reconfigure the macros described above in the same way.</p>
<h3 id="alternate-use">Alternate use:</h3>
<p>Use <code>kev.alt</code> as you would <code>kev</code>.</p>
<p>What happens if you use both, one in one terminal and the other in
another terminal?</p>
<h3 id="alternate-try">Alternate try:</h3>
<p>If you have <code>xterm</code> try on one system:</p>
<div class="sourceCode" id="cb11"><pre
class="sourceCode sh"><code class="sourceCode bash"><span id="cb11-1"><a href="#cb11-1" aria-hidden="true" tabindex="-1"></a><span class="ex">xterm</span> <span class="at">-geometry</span> 80x40 <span class="at">-fg</span> green <span class="at">-bg</span> black <span class="at">-fn</span> 9x15bold <span class="at">-e</span> ./kev.alt <span class="kw">&amp;</span></span></code></pre></div>
<p>and then the other, the client system:</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">xterm</span> <span class="at">-geometry</span> 80x40 <span class="at">-fg</span> green <span class="at">-bg</span> black <span class="at">-fn</span> 9x15bold <span class="at">-e</span> ./kev.alt localhost<span class="kw">&amp;</span></span></code></pre></div>
<h2 id="judges-remarks">Judges’ remarks:</h2>
<p>Continuing with this year’s “retro game” theme, this is another old
game; arguably, one of the oldest. Requires a functioning network, and
curses.</p>
<p>The graphics aren’t the impressive part; the graphics and network
are. How many games come out at $50 and still require you to wait for a
patch to come out before you can play multiplayer? This one works out of
the box.</p>
<h2 id="authors-remarks">Author’s remarks:</h2>
<p><strong>NETWORK PONG!</strong></p>
<h3 id="requirements">REQUIREMENTS</h3>
<ul>
<li>TCP sockets</li>
<li>curses</li>
<li><code>usleep(3)</code></li>
</ul>
<h3 id="description">DESCRIPTION</h3>
<p>This program is a two-player networked version of the eighties arcade
classic, <a href="https://en.wikipedia.org/wiki/Pong">Pong</a>. It uses
standard TCP sockets to communicate over the net, and
<code>ncurses</code> for display. It supports variable terminal sizes
(though both players must have the same terminal size) and game speeds.
Each player has a paddle to hit the ball, and you get points for getting
the ball past your opponent’s paddle. It’s pretty fun! :)</p>
<h3 id="running">RUNNING</h3>
<p>Run the server first without any command line arguments, i.e.</p>
<div class="sourceCode" id="cb13"><pre
class="sourceCode sh"><code class="sourceCode bash"><span id="cb13-1"><a href="#cb13-1" aria-hidden="true" tabindex="-1"></a><span class="ex">./kev</span></span></code></pre></div>
<p>Then run the client with a single command line argument which is the
name of the machine running the server, e.g.</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">./kev</span> localhost</span></code></pre></div>
<p>Make sure that the terminals on both ends are the same size. Also,
the TCP port number (by default 5455) specified in the <a
href="Makefile">Makefile</a> mustn’t be blocked by a firewall.</p>
<p>Here’s a good quick example to see it in action on your own machine,
assuming you have <code>Xwindows</code>:</p>
<div class="sourceCode" id="cb15"><pre
class="sourceCode sh"><code class="sourceCode bash"><span id="cb15-1"><a href="#cb15-1" aria-hidden="true" tabindex="-1"></a><span class="ex">xterm</span> <span class="at">-geometry</span> 80x40 <span class="at">-fg</span> green <span class="at">-bg</span> black <span class="at">-fn</span> 9x15bold <span class="at">-e</span> ./kev <span class="kw">&amp;</span></span>
<span id="cb15-2"><a href="#cb15-2" aria-hidden="true" tabindex="-1"></a><span class="ex">xterm</span> <span class="at">-geometry</span> 80x40 <span class="at">-fg</span> green <span class="at">-bg</span> black <span class="at">-fn</span> 9x15bold <span class="at">-e</span> ./kev localhost<span class="kw">&amp;</span></span></code></pre></div>
<h3 id="playing">PLAYING</h3>
<p>Your paddle is the one at the bottom of the screen, your opponent is
at the top. To move your paddle left, hold down <code>,</code>
(i.e. <code>&lt;</code> but don’t press shift). To move your paddle
right, hold down <code>.</code>. To quit, either player may press
<code>q</code>.</p>
<p>The current score is shown on the left side of the halfway line. Your
score is the lower number, your opponents score is the upper number.
Your score is the number of times your opponent has missed the ball.</p>
<p>You can control the speed of the ball by the motion of your paddle
when the ball hits it. If your paddle is still, then the ball just
bounces normally off it. If your paddle is moving in the same direction
as the ball, then the ball’s speed in that direction will increase. If
your paddle is moving in the opposite direction to the ball, then the
ball’s speed in that direction will decrease (or if the ball is going
slowly enough, it’ll turn around).</p>
<p>You might want to increase your keyboard repeat rate before playing.
On the Linux console try <code>kbdrate -r 24.0 -d 250</code>
(<code>kbdrate</code> might be “hidden” from normal users in
<code>/sbin</code>, and you might need to be root anyway), in
<code>Xwindows</code> try <code>xset r rate 250 24</code> (find out your
current rate first with <code>xset q</code>, so that you can reset it
later).</p>
<p>Look below in the Building section for info on how to speed up or
slow down the game (useful if you increase or decrease the terminal
size).</p>
<h3 id="building">BUILDING</h3>
<p>Just run <code>make</code> to use the Makefile as above. The
<code>SPEED</code> variable in the Makefile controls the speed of the
game (defaults to <code>50</code>). This speed is the delay between
frames in milliseconds. Thus a value of 0 will make the game go as fast
as your network can handle, and values less than 50 are useful for
larger terminals or more exciting games. The program needs bandwidth
equal to 1/s bytes per second (where <code>s</code> is the speed value).
Any latency on the network will be added to <code>s</code> - so you
should probably subtract any latency from the value of <code>s</code>
you want to have. Given that <code>loopback</code> and fast Ethernet
LANs are both much less than 1ms of latency, you should only need to
worry about this if you plan on playing over a slower link like a cable
modem, DSL, or (God-forbid) dial-up.</p>
<p>The TCP port to use for network communications is specified by the
<code>PORT</code> variable in the Makefile. If the default of
<code>5455</code> is blocked for whatever reason, you can change it to
something else. Of course if you use a port &lt; 1024, you’ll need to be
root.</p>
<h3 id="obfuscation">OBFUSCATION</h3>
<p>The program’s broad structure is fairly straightforward, but
individual tasks are rarely done in a straightforward manner. ;)</p>
<p>Identifier names have mostly been chosen to resemble paddles and
balls, and to generally decrease readability.</p>
<p>The source has been cleverly formatted to resemble one of the paddles
from the game, rotated 90 degrees. ;) (The “source paddle” has
approximately the same aspect ratio as the game at 80 columns wide,
which is 1:10.)</p>
<p>Finally, the number of “non-whitespace characters” (as defined by the
rules) in the file is exactly 2048, which I think is rather unexpectedly
cool. :)</p>
<h3 id="bugs">BUGS</h3>
<p>There are 3 warnings when I compile with gcc 2.95.3
(<code>-Wall -ansi -pedantic</code>) on my Linux system, but all are
completely harmless.</p>
<p>I don’t like the curses and/or termcaps/terminfos on IRIX and Solaris
(the only two non-Linux systems I have access to). Despite calling
<code>timeout(0);</code>, <code>notimeout(win, TRUE);</code>,
<code>nodelay(win, TRUE);</code> and/or
<code>keypad(win, FALSE);</code>, it still seems to force a delay into
calls to <code>getch()</code> - I’m guessing at a termcap/terminfo
level. At any rate, I can’t seem to force no delay. This is a shame,
because it basically plays havoc with the input code, particularly the
read-ahead canceller. It still works, but not nearly as well (key
presses are dodgy and holding down keys doesn’t always work), and so I
<em>much</em> prefer and recommend Linux <code>libncurses</code>.</p>
<p>Sometimes when <code>q</code> is pressed in one, the other will crash
out with <code>Broken pipe</code>.</p>
<p>If the specified port can’t be bound or connected to, the program
segfaults.</p>
<p>If your terminal is too wide (we’re talking gigantic here - over 500
characters wide) then the program can segfault. It’s also possible to
crash the program a player scores over a billion points (1e9). Maybe you
can consider that the goal… ;)</p>
<p>If you run the client and server on different architectures, both
architectures need to have the same character systems (i.e. don’t try
mixing ASCII and EBCDIC). It is independent of endianness though.</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-2001kev"><a name="inventory"></a>Inventory for
2001/kev</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/2001/kev/kev.c">kev.c</a>
- winning source</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2001/kev/Makefile">Makefile</a>
- winner Makefile</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2001/kev/kev.alt.c">kev.alt.c</a>
- alternative source</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2001/kev/kev.orig.c">kev.orig.c</a>
- original source</li>
<li><a href="2001_kev.tar.bz2">2001_kev.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/2001/kev/.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/2001/kev/.winner.json">.winner.json</a>
- description of winner in JSON</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2001/kev/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%2F2001%2Fkev%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 -->
+248 -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,260 @@
<!-- !!! DO NOT MODIFY THIS FILE - This file is generated by a tool !!! -->
<!-- !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<!-- -->
<!-- file: 2001/ollinger/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>2001 ollinger</title>
<meta name="description" content="IOCCC year: 2001 IOCCC winner: ollinger winner index page">
<meta name="keywords" content="IOCCC,2001,ollinger,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>2001/ollinger</title>
<meta name="description" content="2001 IOCCC winner ollinger">
<meta name="keywords" content="IOCCC, 2001, IOCCC 2001, IOCCC winner, ollinger">
</head>
<!-- END: this line ends content from: inc/head.default.html -->
<!-- START: this line starts content from: inc/body.default.html -->
<body>
<h1>2001 ollinger</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>2001/ollinger</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%2F2001%2Follinger%2Findex.html">Nu Html check https://ioccc-src.github.io/temp-test-ioccc/2001/ollinger/index.html</a></p>
<!-- End Nu Html Checker -->
<div class="topnav">
<a class="Left" href="../kev/index.html">&larr; kev</a>
<a class="Left" href="../index.html">&uarr; 2001 &uarr;</a>
<a class="Left" href="../rosten/index.html">rosten &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#Nicolas_Ollinger">Nicolas
Ollinger</a><br> Location: <a
href="/temp-test-ioccc/location.html#FR">FR</a></p>
<!-- END: next line ends content generated by: bin/gen-author.sh -->
<h2 id="to-build">To build:</h2>
<div class="sourceCode" id="cb1"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb1-1"><a href="#cb1-1" aria-hidden="true" tabindex="-1"></a><span class="fu">make</span></span></code></pre></div>
<h2 id="to-use">To use:</h2>
<div class="sourceCode" id="cb2"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb2-1"><a href="#cb2-1" aria-hidden="true" tabindex="-1"></a><span class="ex">./ollinger</span> integer</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">./ollinger</span> 1000 <span class="kw">|</span> <span class="fu">cut</span> <span class="at">-c</span> <span class="at">-200</span></span></code></pre></div>
<p>Try the above command in a large window, say 200 chars wide and 100
high (200x100) with a tiny font.</p>
<h2 id="judges-remarks">Judges’ remarks:</h2>
<p>Do get lost in the program’s line of thought! :-)</p>
<h2 id="authors-remarks">Author’s remarks:</h2>
<h3 id="whats-this">What’s this?</h3>
<p>What do you see? On the left, you will see an enumeration of all
successive <a
href="https://en.wikipedia.org/wiki/Prime_number">primes</a> from 2 to
the parameter you gave to the program. On the right part, you can see
the sieve used to find these primes. The big diagonals from right to
left are used to erase composed numbers. When no diagonal crosses a
number, then the left cell take value 1 and the number is prime.</p>
<p>The parallel version of this algorithm works in real time
<code>n</code>. This C sequential version is slower as it works in
<code>O(n*log n)</code>. But you have some nice picture instead… the
cost is a constant number of operation for each character printed on the
screen.</p>
<h3 id="why-did-i-write-this">Why did I write this ?</h3>
<p>Let’s just quote the <a href="/faq.md">FAQ</a>:</p>
<p>Q: Are there types of entries that are submitted so frequently that
the judges get tired of them?</p>
<p>A: Yes, there are types of entries that show up over and over again.
The guidelines say:</p>
<pre><code>We tend to dislike programs that:
are similar to previous winners
We like variety. However too often we see (please look at the winning
examples given to be aware of the level of the competition):
(snip)
generating small primes (below is the list of all prime related winners)
1985/august
1988/applin
1994/weisberg
1995/makarios
1996/dalbec
2000/bellard
As you can see, just a list of primes (let alone small primes)
does not cut it anymore.
(snip)
entries that use some complex state machine/table to print something
1988/isaak
1988/phillipps
Unbeaten for 12 years and counting...</code></pre>
<p>I think this is enough motivation for trying to submit a program
which uses some complex state machine/table to generate small primes and
print them.</p>
<h3 id="the-way-it-works">The way it works</h3>
<p>This program simply prints the space-time diagram of some particular
cellular automaton. The automaton is a 9-state automaton by <a
href="https://sk-m-wikipedia-org.translate.goog/wiki/Ivan_Korec?_x_tr_sl=auto&amp;_x_tr_tl=en&amp;_x_tr_hl=en-US&amp;_x_tr_pto=wapp">Ivan
Korec</a> in 1998. It is an optimization of an old automaton for
recognizing primes designed by <a
href="http://richardallenfischer.com">Fischer</a> in 1965.</p>
<p>The table of the automaton is encoded into the string <code>e</code>
and consists of 345 transitions of the kind
<code>ff(left,middle,right)</code>. This encoding into <code>e</code> is
obfuscated to reduce its size, restrict it to characters 32 to 127 and
guarantee a constant time.</p>
<p>The main loop simply iterates this transition function on each
cell.</p>
<p>“The rest is silence” (Hamlet, V.2)</p>
<p>Enjoy!</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-2001ollinger"><a name="inventory"></a>Inventory
for 2001/ollinger</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/2001/ollinger/ollinger.c">ollinger.c</a>
- winning source</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2001/ollinger/Makefile">Makefile</a>
- winner Makefile</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2001/ollinger/ollinger.orig.c">ollinger.orig.c</a>
- original source</li>
<li><a href="2001_ollinger.tar.bz2">2001_ollinger.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/2001/ollinger/.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/2001/ollinger/.winner.json">.winner.json</a>
- description of winner in JSON</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2001/ollinger/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%2F2001%2Follinger%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 -->
+265 -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,277 @@
<!-- !!! DO NOT MODIFY THIS FILE - This file is generated by a tool !!! -->
<!-- !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<!-- -->
<!-- file: 2001/rosten/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>2001 rosten</title>
<meta name="description" content="IOCCC year: 2001 IOCCC winner: rosten winner index page">
<meta name="keywords" content="IOCCC,2001,rosten,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>2001/rosten</title>
<meta name="description" content="2001 IOCCC winner rosten">
<meta name="keywords" content="IOCCC, 2001, IOCCC 2001, IOCCC winner, rosten">
</head>
<!-- END: this line ends content from: inc/head.default.html -->
<!-- START: this line starts content from: inc/body.default.html -->
<body>
<h1>2001 rosten</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>2001/rosten</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%2F2001%2Frosten%2Findex.html">Nu Html check https://ioccc-src.github.io/temp-test-ioccc/2001/rosten/index.html</a></p>
<!-- End Nu Html Checker -->
<div class="topnav">
<a class="Left" href="../ollinger/index.html">&larr; ollinger</a>
<a class="Left" href="../index.html">&uarr; 2001 &uarr;</a>
<a class="Left" href="../schweikh/index.html">schweikh &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_Rosten">Edward Rosten</a><br>
Location: <a href="/temp-test-ioccc/location.html#GB">GB</a></p>
<!-- END: next line ends content generated by: bin/gen-author.sh -->
<h2 id="to-build">To build:</h2>
<div class="sourceCode" id="cb1"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb1-1"><a href="#cb1-1" aria-hidden="true" tabindex="-1"></a><span class="fu">make</span></span></code></pre></div>
<h3 id="bugs-and-misfeatures">Bugs and (Mis)features:</h3>
<p>The current status of this entry is:</p>
<pre><code>STATUS: missing files - please provide them</code></pre>
<p>For more detailed information see <a href="/bugs.md#2001-rosten">2001
rosten 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">./rosten</span> <span class="pp">[</span><span class="ss">number</span><span class="pp">]</span></span></code></pre></div>
<p>WARNING: this will mess with your mouse and can make it hard to quit
the program. Use at your own risk.</p>
<p>NOTE: number is floating point.</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">./rosten</span> 1.03</span>
<span id="cb4-2"><a href="#cb4-2" aria-hidden="true" tabindex="-1"></a><span class="ex">./rosten</span> 1.00</span></code></pre></div>
<p>For some abuse, try:</p>
<div class="sourceCode" id="cb5"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb5-1"><a href="#cb5-1" aria-hidden="true" tabindex="-1"></a><span class="ex">./rosten</span> 0.99</span></code></pre></div>
<h2 id="judges-remarks">Judges’ remarks:</h2>
<p>Friction can be your friend if it does not rub you (or your mouse
cursor) in the wrong way. :-)</p>
<h2 id="authors-remarks">Author’s remarks:</h2>
<h3 id="name">NAME</h3>
<p><code>rosten</code> - make the mouse act as if it has been
greased</p>
<h3 id="synopsis">SYNOPSIS</h3>
<div class="sourceCode" id="cb6"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb6-1"><a href="#cb6-1" aria-hidden="true" tabindex="-1"></a><span class="ex">./rosten</span> <span class="pp">[</span><span class="ss">greasiness</span><span class="pp">]</span></span></code></pre></div>
<h3 id="description">DESCRIPTION</h3>
<p>This program is designed primarily to make your X windows interface
more obfuscated. Try doing something mouse driven (such as using a mouse
driven editor on this program) whilst it is running. If you’re not sure
what it does, looking at the code should give a fair idea.</p>
<p>It also has a [cat] man page if you want to install it as a
‘utility’.</p>
<h3 id="options">OPTIONS</h3>
<p>It only takes one optional option: the greasiness factor. This is the
number that the speed is divided by on each iteration. The default is
1.03. A setting of 1 - no friction - is fun as is 0.99.</p>
<p>Being an X program, it recognises the <code>DISPLAY</code>
variable.</p>
<h3 id="portability">PORTABILITY</h3>
<p>The program is very portable, even to non X architectures. All that
is required is a large desk and some good grease.</p>
<h3 id="comments">COMMENTS</h3>
<p>It is really rather surprising that code like this should not only be
portable, but compile with almost no warnings on most of the compilers
tested. It’s a kind of shame that none of the compilers do anything like
this:</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> make greasymouse</span>
<span id="cb7-2"><a href="#cb7-2" aria-hidden="true" tabindex="-1"></a><span class="fu">cc</span> greasymouse.c <span class="at">-o</span> greasymouse <span class="at">-lX11</span></span>
<span id="cb7-3"><a href="#cb7-3" aria-hidden="true" tabindex="-1"></a><span class="ex">greasymouse.c:30:</span> This macro should have more text and spaces in it</span>
<span id="cb7-4"><a href="#cb7-4" aria-hidden="true" tabindex="-1"></a><span class="ex">greasymouse.c:32:</span> This is a really stupid way to perform this operation</span>
<span id="cb7-5"><a href="#cb7-5" aria-hidden="true" tabindex="-1"></a><span class="ex">greasymouse.c:42:</span> This program would look better with a newline here</span>
<span id="cb7-6"><a href="#cb7-6" aria-hidden="true" tabindex="-1"></a><span class="ex">greasymouse.c:48:</span> That<span class="st">&#39;s a really silly thing to do</span></span>
<span id="cb7-7"><a href="#cb7-7" aria-hidden="true" tabindex="-1"></a><span class="st">greasymouse.c:55: So is that</span></span>
<span id="cb7-8"><a href="#cb7-8" aria-hidden="true" tabindex="-1"></a><span class="st">...</span></span>
<span id="cb7-9"><a href="#cb7-9" aria-hidden="true" tabindex="-1"></a><span class="st">greasymouse.c:58: This program is rubbish. I&#39;</span>m not going to link it.</span></code></pre></div>
<p>The code is best viewed with <a
href="https://en.wikipedia.org/wiki/Tab_stop">tab stops</a> every 8
spaces.</p>
<h3 id="bugs">BUGS</h3>
<p>The mouse gets stuck completely if you give it an option of less than
1 and leave it for too long. This is quite annoying if it didn’t leave
the terminal it was run from in focus.</p>
<p>It gets very jerky if the processor is being used. There are better
time functions than <code>clock()</code> but I haven’t used them.</p>
<p>It deflects slightly when it gets very slow.</p>
<p>It annoys other people if you run it on their display too often.
Maybe I should make future versions print funny jokes to keep the humor
fresh.</p>
<p>It’s pretty ropey over a 56K modem.</p>
<p>It’s even ropier over a 56K modem and tunneled through 3 ssh
links.</p>
<h3 id="warnings">WARNINGS</h3>
<p>Pages and pages and pages of things, with GCC at any rate.</p>
<p>It suggests loads of <code>()</code>s where they’re not needed.</p>
<p>It reckons I have not used some of the values I have computed. I
would never do a thing like that: I just haven’t used them in the way
it’s used to.</p>
<p>The MIPS compiler suggests an <code>==</code> instead of an
<code>=</code> in expressions such as:</p>
<div class="sourceCode" id="cb8"><pre class="sourceCode c"><code class="sourceCode c"><span id="cb8-1"><a href="#cb8-1" aria-hidden="true" tabindex="-1"></a><span class="op">&amp;&amp;(</span>a<span class="op">=</span>b<span class="op">)</span></span></code></pre></div>
<p>but its suggestions would break my program. It also reckons that
<code>r()</code> has no prototype.</p>
<p>Giving the <code>-pedantic</code> option to the MIPS compiler causes
it to generate warnings about its own header files, but not any extra
ones with this program.</p>
<p>With all warnings enabled, the DEC compiler, oddly enough finds some
problems with its own include files, but none with my program.</p>
<h3 id="errors">ERRORS</h3>
<p>The DEC compiler of this version:
<code>DEC C V5.6-079 on Digital UNIX V4.0 (Rev. 878)</code> can’t
compile the code. It thinks that preprocessor lines can not have
whitespace preceding the <code>#</code>. Moving the preprocessor
directives to the beginning of the line wrecks the layout but makes it
compile.</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-2001rosten"><a name="inventory"></a>Inventory for
2001/rosten</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/2001/rosten/rosten.c">rosten.c</a>
- winning source</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2001/rosten/Makefile">Makefile</a>
- winner Makefile</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2001/rosten/rosten.orig.c">rosten.orig.c</a>
- original source</li>
<li><a href="2001_rosten.tar.bz2">2001_rosten.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/2001/rosten/.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/2001/rosten/.winner.json">.winner.json</a>
- description of winner in JSON</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2001/rosten/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%2F2001%2Frosten%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 -->
+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: 2001/schweikh/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>2001 schweikh</title>
<meta name="description" content="IOCCC year: 2001 IOCCC winner: schweikh winner index page">
<meta name="keywords" content="IOCCC,2001,schweikh,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>2001/schweikh</title>
<meta name="description" content="2001 IOCCC winner schweikh">
<meta name="keywords" content="IOCCC, 2001, IOCCC 2001, IOCCC winner, schweikh">
</head>
<!-- END: this line ends content from: inc/head.default.html -->
<!-- START: this line starts content from: inc/body.default.html -->
<body>
<h1>2001 schweikh</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>2001/schweikh</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%2F2001%2Fschweikh%2Findex.html">Nu Html check https://ioccc-src.github.io/temp-test-ioccc/2001/schweikh/index.html</a></p>
<!-- End Nu Html Checker -->
<div class="topnav">
<a class="Left" href="../rosten/index.html">&larr; rosten</a>
<a class="Left" href="../index.html">&uarr; 2001 &uarr;</a>
<a class="Left" href="../westley/index.html">westley &rarr;</a>
<a class="Right" href="#inventory">Inventory</a>
</div>
<!-- END: this line ends content from: inc/topnav.mid.html -->
<!-- START: this line starts content from: inc/begin-row.default.html -->
<div class="row">
<!-- END: this line ends content from: inc/begin-row.default.html -->
<!-- START: this line starts content from: inc/begin-leftcolumn.default.html -->
<div class="leftcolumn">
<!-- END: this line ends content from: inc/begin-leftcolumn.default.html -->
<!-- START: this line starts content from: inc/sidenav.default.html -->
<div class="sidenav">
<a href="#content">Jump to contents</a>
</div>
<hr>
<div class="sidenav">
<a href="/temp-test-ioccc/index.html">IOCCC Home</a>
<a href="/temp-test-ioccc/years.html">Winning Entries</a>
<a href="/temp-test-ioccc/winners.html">People who have won</a>
</div>
<hr>
<div class="sidenav">
<a href="/temp-test-ioccc/news.html">IOCCC News</a>
<a href="/temp-test-ioccc/faq.html#submit">How to enter the IOCCC</a>
<a href="/temp-test-ioccc/faq.html">FAQ</a>
</div>
<hr>
<div class="sidenav">
<a href="/temp-test-ioccc/bugs.html">Bugs &amp; (mis)features</a>
<a href="/temp-test-ioccc/faq.html#fix_a_winner">Fixing IOCCC winners</a>
<a href="/temp-test-ioccc/faq.html#fix_web_site">Fixing the web site</a>
<a href="/temp-test-ioccc/faq.html#fix_author">Fixing winner info</a>
<a href="/temp-test-ioccc/thanks-for-help.html">Thanks for the help</a>
</div>
<hr>
<div class="sidenav">
<a href="/temp-test-ioccc/judges.html">The IOCCC Judges</a>
<a href="/temp-test-ioccc/contact.html">Contacting the IOCCC</a>
</div>
<hr>
<div class="sidenav">
<a href="#top">Jump to top</a>
</div>
<!-- END: this line ends content from: inc/sidenav.default.html -->
<!-- START: this line starts content from: inc/end-leftcolumn.default.html -->
</div>
<!-- END: this line ends content from: inc/end-leftcolumn.default.html -->
<!-- START: this line starts content from: inc/begin-rightcolumn.default.html -->
<div class="rightcolumn">
<!-- END: this line ends content from: inc/begin-rightcolumn.default.html -->
<!-- START: this line starts content from: inc/before-content.default.html -->
<a name="content"></a>
<!-- END: this line ends content from: inc/before-content.default.html -->
<!-- START: this line starts content generated by: bin/gen-author.sh -->
<p><a name="author"><strong>Author:</strong></a> <br><br>Name: <a
href="/temp-test-ioccc/winners.html#Jens_Schweikhardt">Jens
Schweikhardt</a><br> Location: <a
href="/temp-test-ioccc/location.html#DE">DE</a></p>
<!-- END: next line ends content generated by: bin/gen-author.sh -->
<h2 id="to-build">To build:</h2>
<div class="sourceCode" id="cb1"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb1-1"><a href="#cb1-1" aria-hidden="true" tabindex="-1"></a><span class="fu">make</span></span></code></pre></div>
<h3 id="bugs-and-misfeatures">Bugs and (Mis)features:</h3>
<p>The current status of this entry is:</p>
<pre><code>STATUS: INABIAF - please **DO NOT** fix</code></pre>
<p>For more detailed information see <a
href="/bugs.md#2001-schweikh">2001 schweikh 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">./schweikh</span> string string2</span></code></pre></div>
<p>This program will very likely crash or do something else if you do
not give it two args.</p>
<p>Note also that the glob pattern must match the whole string. See the
author’s comments for details and a workaround.</p>
<p>There’s also no way to escape meta characters.</p>
<p>This is supposed to happen. As is written in the <a
href="http://catb.org/jargon/html/F/feature.html">The Jargon
File</a>:</p>
<pre><code>That&#39;s not a bug, that&#39;s a feature.</code></pre>
<h2 id="try">Try:</h2>
<div class="sourceCode" id="cb5"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb5-1"><a href="#cb5-1" aria-hidden="true" tabindex="-1"></a><span class="ex">./try.sh</span></span></code></pre></div>
<h2 id="judges-remarks">Judges’ remarks:</h2>
<p>Do you get the pattern here?</p>
<h2 id="authors-remarks">Author’s remarks:</h2>
<p>This one-liner program is a glob pattern matcher. It understands the
glob characters <code>*</code> meaning ‘zero or more characters’ and
<code>?</code> meaning exactly one character, just like your unix
shell.</p>
<p>Run it with two args, the string and the glob pattern. The exit
status is 0 (shell true) when the pattern matches, 1 otherwise. The glob
pattern must match the whole string, so you may want to use
<code>*</code> at the beginning and end of the pattern if you are
looking for something in the middle.</p>
<p>You can use it for your shell scripting needs similar to a silent
grep (and without <code>stdout</code> redirected to
<code>/dev/null</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="cf">if</span> <span class="ex">prog</span> <span class="st">&quot;</span><span class="va">${VARIABLE}</span><span class="st">&quot;</span> <span class="st">&#39;&lt;glob&gt;&#39;</span><span class="kw">;</span> <span class="cf">then</span></span>
<span id="cb6-2"><a href="#cb6-2" aria-hidden="true" tabindex="-1"></a> <span class="bu">echo</span> VARIABLE matches</span>
<span id="cb6-3"><a href="#cb6-3" aria-hidden="true" tabindex="-1"></a><span class="cf">else</span></span>
<span id="cb6-4"><a href="#cb6-4" aria-hidden="true" tabindex="-1"></a> <span class="bu">echo</span> no match</span>
<span id="cb6-5"><a href="#cb6-5" aria-hidden="true" tabindex="-1"></a><span class="cf">fi</span></span></code></pre></div>
<h3 id="bugs">Bugs</h3>
<p>There is no way to escape the meta characters. Dammit Jim, I’m a
one-liner, not a regexp lib.</p>
<p>All obfuscation is obviously in the recursive <code>m()</code>
function, an 86 character glob pattern evaluator, returning nonzero for
a match:</p>
<ul>
<li>Just a single complex return expression.</li>
<li>Nested ternary operator <code>?:</code> to save on
<code>if</code>/<code>else</code> verbosity.</li>
<li>Short circuiting <code>&amp;&amp;</code> and <code>||</code> to save
even more on <code>if</code>/<code>else</code> verbosity.</li>
<li>Subtraction instead of an equality operator in
<code>*t - 42</code>.</li>
<li>ASCII codes for <code>*</code> and <code>?</code>.</li>
<li>Careful use of blanks even though this year’s rules have extended
that resource limit.</li>
<li>The source is a complete preprocessed C program. Because it
communicates with the world out there by means of <code>argv</code> and
the exit status, there is no need for <code>stdio.h</code> bloat. An asm
guru could surely squeeze this program in less than a screenful.</li>
<li><code>indent(1)</code> is probably not too helpful.</li>
</ul>
<p>The recursion wonderfully and magically takes care of iteration and
backtracking. I could tell you how it works but then I would have to
<strike>kill</strike> request a NDA from you :-) Run it under a debugger
with several inputs, it will be quite helpful and instructive. Handling
of <code>?</code> is straightforward; for <code>*</code> start out with
<code>*foo</code> and <code>foo*</code> against <code>foo</code>. How
does it deal with sequences of adjacent <code>*</code>? How could this
be improved? If all else fails, recode the <code>?:</code> operators
with <code>if</code>/<code>else</code> and try again. For extra credit
implement character classes like <code>[a-z]</code>.</p>
<h2 id="copyright-and-cc-by-sa-4.0-license">Copyright and CC BY-SA 4.0
License:</h2>
<p>This file is Copyright (c) 2023 by Landon Curt Noll. All Rights
Reserved. You are free to share and adapt this file under the terms of
this license:</p>
<pre><code>Creative Commons Attribution-ShareAlike 4.0 International (CC BY-SA 4.0)</code></pre>
<p>For more information, see:
https://creativecommons.org/licenses/by-sa/4.0/</p>
<!-- START: this line starts content generated by: bin/gen-inventory.sh -->
<h1 id="inventory-for-2001schweikh"><a name="inventory"></a>Inventory
for 2001/schweikh</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/2001/schweikh/schweikh.c">schweikh.c</a>
- winning source</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2001/schweikh/Makefile">Makefile</a>
- winner Makefile</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2001/schweikh/schweikh.orig.c">schweikh.orig.c</a>
- original source</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2001/schweikh/try.sh">try.sh</a>
- how to run</li>
<li><a href="2001_schweikh.tar.bz2">2001_schweikh.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/2001/schweikh/.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/2001/schweikh/.winner.json">.winner.json</a>
- description of winner in JSON</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2001/schweikh/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%2F2001%2Fschweikh%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 -->
+340 -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,352 @@
<!-- !!! DO NOT MODIFY THIS FILE - This file is generated by a tool !!! -->
<!-- !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<!-- -->
<!-- file: 2001/westley/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>2001 westley</title>
<meta name="description" content="IOCCC year: 2001 IOCCC winner: westley winner index page">
<meta name="keywords" content="IOCCC,2001,westley,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>2001/westley</title>
<meta name="description" content="2001 IOCCC winner westley">
<meta name="keywords" content="IOCCC, 2001, IOCCC 2001, IOCCC winner, westley">
</head>
<!-- END: this line ends content from: inc/head.default.html -->
<!-- START: this line starts content from: inc/body.default.html -->
<body>
<h1>2001 westley</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>2001/westley</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%2F2001%2Fwestley%2Findex.html">Nu Html check https://ioccc-src.github.io/temp-test-ioccc/2001/westley/index.html</a></p>
<!-- End Nu Html Checker -->
<div class="topnav">
<a class="Left" href="../schweikh/index.html">&larr; schweikh</a>
<a class="Left" href="../index.html">&uarr; 2001 &uarr;</a>
<a class="Left" href="../williams/index.html">williams &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#Brian_Westley">Brian Westley</a><br>
Location: <a href="/temp-test-ioccc/location.html#US">US</a></p>
<!-- END: next line ends content generated by: bin/gen-author.sh -->
<h2 id="to-build">To build:</h2>
<div class="sourceCode" id="cb1"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb1-1"><a href="#cb1-1" aria-hidden="true" tabindex="-1"></a><span class="fu">make</span></span></code></pre></div>
<p>There are two additional programs based on the author’s remarks and
the original version, provided as alternate code as it might be less
portable. See <a href="#sorted-code">sorted code</a>, <a
href="#punch-card-code">punch card code</a> and <a
href="#alternate-code">alternate code</a> below.</p>
<h3 id="bugs-and-misfeatures">Bugs and (Mis)features:</h3>
<p>The current status of this entry is:</p>
<pre><code>STATUS: uses gets() - change to fgets() if possible
STATUS: missing files - please provide them</code></pre>
<p>For more detailed information see <a
href="/bugs.md#2001-westley">2001 westley 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">./westley</span> <span class="dv">2</span><span class="op">&gt;</span>/dev/null</span>
<span id="cb3-2"><a href="#cb3-2" aria-hidden="true" tabindex="-1"></a><span class="co"># enter some input, terminate with EOF</span></span>
<span id="cb3-3"><a href="#cb3-3" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb3-4"><a href="#cb3-4" aria-hidden="true" tabindex="-1"></a><span class="bu">echo</span> foo <span class="kw">|</span> <span class="ex">./westley</span> <span class="dv">2</span><span class="op">&gt;</span>/dev/null</span>
<span id="cb3-5"><a href="#cb3-5" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb3-6"><a href="#cb3-6" aria-hidden="true" tabindex="-1"></a><span class="ex">./westley</span> <span class="op">&lt;</span> westley.c <span class="dv">2</span><span class="op">&gt;</span>/dev/null</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="sorted-code">Sorted code:</h2>
<p>The author stated that one can sort (ignoring leading blanks
i.e. <code>sort -b</code>) the code by line and it will always sort the
order of the input.</p>
<p>This is compiled by default; use <code>westley.sort</code> as you
would <code>westley</code> above.</p>
<h2 id="punch-card-code">Punch card code:</h2>
<p>The author also stated that if you just sort the code you’ll get the
with <code>sort</code>) version that just prints out the punch card. The
<a href="westley.punch.c">westley.punch.c</a> code is specifically so
that Westley can punch everyone in the face! :-) This is also compiled
by default.</p>
<h3 id="punch-card-try">Punch card try:</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">&#39;Brian Westley does it again!&#39;</span> <span class="kw">|</span> <span class="ex">./westley.punch</span> <span class="dv">2</span><span class="op">&gt;</span>/dev/null</span></code></pre></div>
<h2 id="alternate-code">Alternate code:</h2>
<p>An alternate version of this entry, <a
href="westley.alt.c">westley.alt.c</a>, is provided. This alternate code
might be less portable.</p>
<h3 id="alternate-build">Alternate build:</h3>
<div class="sourceCode" id="cb6"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb6-1"><a href="#cb6-1" aria-hidden="true" tabindex="-1"></a><span class="fu">make</span> alt</span></code></pre></div>
<h3 id="alternate-use">Alternate use:</h3>
<p>Use <code>westley.alt</code> as you would <code>westley</code>
above.</p>
<h2 id="judges-remarks">Judges’ remarks:</h2>
<p>Try copying the source to a new file and changing around the order of
the lines. Does it produce the exact same output?</p>
<p>By changing the order of the source, figure out in how many different
ways this program can transform input to output.</p>
<p>This assortment of obfuscated lines takes <a
href="https://en.wikipedia.org/wiki/Position-independent_code">position-independent
code</a> to a new level! :-)</p>
<p>We find it amazing that with just 28 lines of code (not counting
comments and blank lines) there are <code>28!</code> or
<code>304,888,344,611,713,860,501,504,000,000</code> versions of the
program, all valid C!</p>
<h2 id="authors-remarks">Author’s remarks:</h2>
<p><a href="https://en.wikipedia.org/wiki/Punched_card">Punch cards</a>,
or Hollerith cards, were becoming obsolete just as C was becoming more
popular*; this is rather unfortunate, because C has an advantage over
many other languages when it comes to punch cards - C programs can be
written to be “drop proof”.</p>
<p>Consider the following C program:</p>
<div class="sourceCode" id="cb7"><pre class="sourceCode c"><code class="sourceCode c"><span id="cb7-1"><a href="#cb7-1" aria-hidden="true" tabindex="-1"></a>main<span class="op">(){</span>a<span class="op">();</span>b<span class="op">();</span>c<span class="op">();}</span></span>
<span id="cb7-2"><a href="#cb7-2" aria-hidden="true" tabindex="-1"></a>a<span class="op">(){</span>printf<span class="op">(</span><span class="st">&quot;A&quot;</span><span class="op">);}</span></span>
<span id="cb7-3"><a href="#cb7-3" aria-hidden="true" tabindex="-1"></a>b<span class="op">(){</span>printf<span class="op">(</span><span class="st">&quot;B&quot;</span><span class="op">);}</span></span>
<span id="cb7-4"><a href="#cb7-4" aria-hidden="true" tabindex="-1"></a>c<span class="op">(){</span>printf<span class="op">(</span><span class="st">&quot;C&quot;</span><span class="op">);}</span></span></code></pre></div>
<p>This program will compile and run no matter what order the lines are
in. If you punch it on cards (one line of code per card, naturally) and
drop them, you don’t need to put them in any particular order**; it will
always produce <code>ABC</code> as output.</p>
<p>You can also use global variables:</p>
<div class="sourceCode" id="cb8"><pre class="sourceCode c"><code class="sourceCode c"><span id="cb8-1"><a href="#cb8-1" aria-hidden="true" tabindex="-1"></a><span class="dt">char</span> <span class="op">*</span>greet <span class="op">=</span> <span class="st">&quot;Hello, world!&quot;</span><span class="op">;</span></span>
<span id="cb8-2"><a href="#cb8-2" aria-hidden="true" tabindex="-1"></a><span class="dt">char</span> <span class="op">*</span>greet<span class="op">;</span> main<span class="op">(){</span>puts<span class="op">(</span>greet<span class="op">);}</span></span></code></pre></div>
<p>It would be trivial to write an entire C program that is “drop proof”
using the above techniques; surprisingly, it’s possible to write a
program that will always compile but behave differently depending on the
line order:</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>test<span class="op">(</span>a<span class="op">,</span>b<span class="op">){</span><span class="cf">return</span> a<span class="op">;}</span></span>
<span id="cb9-2"><a href="#cb9-2" aria-hidden="true" tabindex="-1"></a><span class="pp">#define test</span><span class="op">(</span><span class="pp">a</span><span class="op">,</span><span class="pp">b</span><span class="op">)</span><span class="pp"> test</span><span class="op">(</span><span class="pp">b</span><span class="op">,</span><span class="pp">a</span><span class="op">)</span></span>
<span id="cb9-3"><a href="#cb9-3" aria-hidden="true" tabindex="-1"></a>main<span class="op">(){</span><span class="cf">if</span> <span class="op">(</span>test<span class="op">(</span><span class="dv">0</span><span class="op">,</span><span class="dv">1</span><span class="op">))</span> printf<span class="op">(</span><span class="st">&quot;T&quot;</span><span class="op">);</span> <span class="cf">else</span> printf<span class="op">(</span><span class="st">&quot;F&quot;</span><span class="op">);}</span></span></code></pre></div>
<p>This program will print out <code>T</code> if the
<code>#define</code> statement falls between the declaration of
<code>test()</code> and its use in <code>main()</code>, otherwise it
will print out <code>F</code>. Furthermore, you can use the same call to
<code>test()</code> repeatedly in different lines to return different
values:</p>
<div class="sourceCode" id="cb10"><pre class="sourceCode c"><code class="sourceCode c"><span id="cb10-1"><a href="#cb10-1" aria-hidden="true" tabindex="-1"></a><span class="pp">#define test</span><span class="op">(</span><span class="pp">x</span><span class="op">,</span><span class="pp">y</span><span class="op">)</span><span class="pp"> test</span><span class="op">(</span><span class="pp">y</span><span class="op">,</span><span class="pp">x</span><span class="op">)</span></span>
<span id="cb10-2"><a href="#cb10-2" aria-hidden="true" tabindex="-1"></a>main<span class="op">(){</span><span class="dt">int</span> i<span class="op">=</span><span class="dv">0</span><span class="op">;</span>a<span class="op">(&amp;</span>i<span class="op">);</span>b<span class="op">(&amp;</span>i<span class="op">);</span>c<span class="op">(&amp;</span>i<span class="op">);</span>d<span class="op">(&amp;</span>i<span class="op">);</span>printf<span class="op">(</span><span class="st">&quot;</span><span class="sc">%d\n</span><span class="st">&quot;</span><span class="op">,</span>i<span class="op">);}</span></span>
<span id="cb10-3"><a href="#cb10-3" aria-hidden="true" tabindex="-1"></a>a<span class="op">(</span>i<span class="op">)</span><span class="dt">int</span><span class="op">*</span>i<span class="op">;{</span><span class="cf">if</span> <span class="op">(</span>test<span class="op">(</span><span class="dv">0</span><span class="op">,</span><span class="dv">1</span><span class="op">))</span> <span class="op">*</span>i <span class="op">+=</span> <span class="dv">1</span><span class="op">;}</span></span>
<span id="cb10-4"><a href="#cb10-4" aria-hidden="true" tabindex="-1"></a>b<span class="op">(</span>i<span class="op">)</span><span class="dt">int</span><span class="op">*</span>i<span class="op">;{</span><span class="cf">if</span> <span class="op">(</span>test<span class="op">(</span><span class="dv">0</span><span class="op">,</span><span class="dv">1</span><span class="op">))</span> <span class="op">*</span>i <span class="op">+=</span> <span class="dv">2</span><span class="op">;}</span></span>
<span id="cb10-5"><a href="#cb10-5" aria-hidden="true" tabindex="-1"></a>c<span class="op">(</span>i<span class="op">)</span><span class="dt">int</span><span class="op">*</span>i<span class="op">;{</span><span class="cf">if</span> <span class="op">(</span>test<span class="op">(</span><span class="dv">0</span><span class="op">,</span><span class="dv">1</span><span class="op">))</span> <span class="op">*</span>i <span class="op">+=</span> <span class="dv">4</span><span class="op">;}</span></span>
<span id="cb10-6"><a href="#cb10-6" aria-hidden="true" tabindex="-1"></a>d<span class="op">(</span>i<span class="op">)</span><span class="dt">int</span><span class="op">*</span>i<span class="op">;{</span><span class="cf">if</span> <span class="op">(</span>test<span class="op">(</span><span class="dv">0</span><span class="op">,</span><span class="dv">1</span><span class="op">))</span> <span class="op">*</span>i <span class="op">+=</span> <span class="dv">8</span><span class="op">;}</span></span>
<span id="cb10-7"><a href="#cb10-7" aria-hidden="true" tabindex="-1"></a>test<span class="op">(</span>x<span class="op">,</span>y<span class="op">){</span><span class="cf">return</span> x<span class="op">;}</span></span></code></pre></div>
<p>If you enter the above program on punch cards, throw them up in the
air, gather them up, and run it, you will get a number from 0 to 15
printed out. Now <em>that’s</em> a random number generator…</p>
<p>Of course, there are drawbacks to C programming on punch cards; an
80-character line limit can be restricting, and (to be maximally
portable) you need to use trigraphs for the characters
<code>^[]{}\</code> (these aren’t found on every keypunch, and have
various encodings).</p>
<p>My C program entry does the following:</p>
<ol type="1">
<li><p>Reads in lines.</p></li>
<li><p>Rearranges the lines, or not.</p>
<ul>
<li>if it rearranges the lines, they are sorted or scrambled.</li>
</ul></li>
<li><p>Reverses the order of the lines, or not.</p></li>
<li><p>Prints out the lines as either text or <a
href="https://en.wikipedia.org/wiki/EBCDIC">EBCDIC</a> punch
cards.</p></li>
</ol>
<p>The code, as written, scrambles the input and prints it out as normal
text, so you can simulate ‘dropping’ the cards. You can repeatedly
scramble the code to get all 12 variants (but the scrambling isn’t very
random; it’s just a bubble sort with a random number, so some variants
are more common than others). You can also just swap the arguments in
the calls to <code>t()</code> in all combinations to get all the
variations.</p>
<p>If you sort the lines, you will get the version that just prints out
the input as punch cards (you will need to display at least 82 columns
of text, or clip the last few chars by piping it through
<code>sed s/...$//</code>). If you use this on the original code, you
will see that it spells out <code>HOLLERITH</code> when punched on cards
(you can see the tall, thin letters spelling out <code>HOLLERITH</code>
if you turn the C code sideways). You will also see why
<code>/KC 0000 K</code> is a <code>Hollerith emoticon</code>.
Unrecognized characters are punched as a lace column. (You can see an
ASCII simulation of the code as punch cards by looking at
<code>card.gif</code>.)</p>
<p>For a nice test pattern, try</p>
<pre><code>&amp;-0123456789ABCDEFGHIJKLMNOPQR/STUVWXYZ:#@&#39;=&quot;.&lt;(+|!$*);,%_&gt;?abcmnoxyz^[]{}\</code></pre>
<p>If you want to analyze the program, sorting the lines while ignoring
leading blanks works best (<code>sort -b</code>). This will produce the
version that just reverses the line order, and the routines in the code
are in a sensible order.</p>
<p>This program should work on EBCDIC computers. It assumes that the
<code>time_t</code> ptr param to <code>time(3)</code> will work with an
<code>int</code> ptr, and that “passing through” a <code>char[][]</code>
array as a simple <code>char *</code> is OK. Your compiler MUST
understand trigraphs, or it will miss the trigraph backslash before the
double quote in the <code>K</code> string and complain about a malformed
string; for GNU C, use <code>-ansi</code> or <code>-trigraphs</code>.
Entering a line of more than 80 characters, or more than 81 lines, will
jam the card reader.</p>
<p>I’ve used the <code>a[b]</code> ==&gt; <code>*(a+b)</code> trick,
because this is actually shorter than the trigraph version of
<code>a??(b??)</code>.</p>
<p>With 28 lines of code (not counting the blank lines or the comment),
there are technically <code>28!</code> different programs, or
<code>304,888,344,611,713,860,501,504,000,000</code> different versions,
all legal C.</p>
<pre><code>* except in Florida voting machines
** all cards must be face down, nine-edge first, of course.</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-2001westley"><a name="inventory"></a>Inventory for
2001/westley</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/2001/westley/westley.c">westley.c</a>
- winning source</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2001/westley/Makefile">Makefile</a>
- winner Makefile</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2001/westley/westley.alt.c">westley.alt.c</a>
- alternative source</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2001/westley/westley.orig.c">westley.orig.c</a>
- original source</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2001/westley/try.sh">try.sh</a>
- how to run</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2001/westley/westley.punch.c">westley.punch.c</a>
- Punch card code</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2001/westley/westley.sort.c">westley.sort.c</a>
- Sorted code</li>
<li><a href="2001_westley.tar.bz2">2001_westley.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/2001/westley/.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/2001/westley/.winner.json">.winner.json</a>
- description of winner in JSON</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2001/westley/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%2F2001%2Fwestley%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 -->
+214 -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,226 @@
<!-- !!! DO NOT MODIFY THIS FILE - This file is generated by a tool !!! -->
<!-- !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<!-- -->
<!-- file: 2001/williams/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>2001 williams</title>
<meta name="description" content="IOCCC year: 2001 IOCCC winner: williams winner index page">
<meta name="keywords" content="IOCCC,2001,williams,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>2001/williams</title>
<meta name="description" content="2001 IOCCC winner williams">
<meta name="keywords" content="IOCCC, 2001, IOCCC 2001, IOCCC winner, williams">
</head>
<!-- END: this line ends content from: inc/head.default.html -->
<!-- START: this line starts content from: inc/body.default.html -->
<body>
<h1>2001 williams</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>2001/williams</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%2F2001%2Fwilliams%2Findex.html">Nu Html check https://ioccc-src.github.io/temp-test-ioccc/2001/williams/index.html</a></p>
<!-- End Nu Html Checker -->
<div class="topnav">
<a class="Left" href="../westley/index.html">&larr; westley</a>
<a class="Left" href="../index.html">&uarr; 2001 &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#John_Williams">John Williams</a><br>
Location: <a href="/temp-test-ioccc/location.html#null">unknown</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: known bug - please help us fix</code></pre>
<p>For more detailed information see <a
href="/bugs.md#2001-williams">2001 williams 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">./williams</span></span></code></pre></div>
<h2 id="judges-remarks">Judges’ remarks:</h2>
<p><a href="https://en.wikipedia.org/wiki/WarGames">A strange game. The
only winning move is not to play</a>. No, really; you can’t actually
win. :)</p>
<p>The formatting really wants a wide screen; if you can’t read it that
way, it’s the standard “three triangles around a circular” logo for
nukes.</p>
<p>This is a pretty straightforward game.</p>
<h2 id="authors-remarks">Author’s remarks:</h2>
<p>What this program does:</p>
<p>It plays <a
href="https://en.wikipedia.org/wiki/Missile_Command">Missile
Command</a>, complete with MIRVs, smart bombs, extra cities, and
scoring.</p>
<p>Command line arguments and input files are ignored.</p>
<p>To play, just point and click where you want your ABMs to
explode.</p>
<p>The score is 10 points for each missile which is destroyed before it
reaches the ground, -1 point for each ABM used, and 100 bonus points for
each city left at the end of a level.</p>
<p>The game ends when you lose all your cities, although you will have
to wait until the level finishes raining down to see your final
score.</p>
<h3 id="obfuscation">Obfuscation</h3>
<p>The main obfuscation technique is the need to compress the code to
fit all the functionality within the size limits. I could not have
included smart bombs without the rule excluding <code>{};</code>
characters in the counts. All of the <code>#define</code>s are there to
reduce code size.</p>
<p>On the other hand, I did waste a few characters in order to include
some rather obfuscated math in the program. It uses fixed-point
arithmetic, resulting in the overuse of bitwise shift operators. Another
example is <code>(x|1)</code>, which is used in a couple different ways.
The purpose of <code>A/(x|1)</code> is probably obvious, but what does
<code>(x|1)%2</code> do?</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-2001williams"><a name="inventory"></a>Inventory
for 2001/williams</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/2001/williams/williams.c">williams.c</a>
- winning source</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2001/williams/Makefile">Makefile</a>
- winner Makefile</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2001/williams/williams.orig.c">williams.orig.c</a>
- original source</li>
<li><a href="2001_williams.tar.bz2">2001_williams.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/2001/williams/.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/2001/williams/.winner.json">.winner.json</a>
- description of winner in JSON</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2001/williams/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%2F2001%2Fwilliams%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 -->