force use of pandoc version >= 3.1.12.2

The `bin/pandoc-wrapper.sh` tool will verify that the ssytem
has a recent enough version of `pandoc(1)`.

We explain why we insist on `pandoc(1)`. version >= 3.1.12.2
in comments where the $PANDOC_MIN_VERSION is set.

Added `--wrap=preserve` as a default argument to `pandoc(1)`.
While this change will impact every HTML file generated,
we believe this will improve the ability of someone to look
at the generated HTML and correlate with the original markdown.

Changed `bin/pandoc-wrapper.sh` VERSION from "1.4.2 2024-03-17"
to "1.4.3 2024-03-18".

Performed `make www` to achieve all of the above and to generate
HTML using the new  `--wrap=preserve` `pandoc(1)` mode.
This commit is contained in:
Landon Curt Noll committed 2024-03-18 01:26:39 -07:00
1 parent 9eb7a54e9f
commit b0b212acb1
402 files changed
+37061 -55132

No files matched your search

+134 -207
View File
@@ -129,10 +129,9 @@
<h2 id="author"><a name="author"></a>Author:</h2>
<ul>
<li>Name: <a href="../../authors.html#Aidan_Thornton">Aidan
Thornton</a><br> Location: <a href="../../location.html#GB">GB</a> -
<em>United Kingdom of Great Britain and Northern Ireland</em>
(<em>United Kingdom</em>) <br><br></li>
<li>Name: <a href="../../authors.html#Aidan_Thornton">Aidan Thornton</a><br>
Location: <a href="../../location.html#GB">GB</a> - <em>United Kingdom of Great Britain and Northern Ireland</em> (<em>United Kingdom</em>)
<br><br></li>
</ul>
<!-- END: next line ends content generated by: bin/output-index-author.sh -->
@@ -142,8 +141,8 @@ Thornton</a><br> Location: <a href="../../location.html#GB">GB</a> -
<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>.</p>
<p>There is an alternate version based on the author’s remarks. See <a href="#alternate-code">alternate
code</a>.</p>
<h2 id="to-use">To use:</h2>
<div class="sourceCode" id="cb2"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb2-1"><a href="#cb2-1" aria-hidden="true" tabindex="-1"></a><span class="ex">./aidan</span> <span class="op">&lt;</span> puzzle</span>
<span id="cb2-2"><a href="#cb2-2" aria-hidden="true" tabindex="-1"></a></span>
@@ -152,9 +151,8 @@ href="#alternate-code">alternate code</a>.</p>
<h2 id="try">Try:</h2>
<div class="sourceCode" id="cb3"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb3-1"><a href="#cb3-1" aria-hidden="true" tabindex="-1"></a><span class="ex">./try.sh</span></span></code></pre></div>
<h2 id="alternate-code">Alternate code:</h2>
<p>This code is formatted differently and is not the approach used by
the author which is slower, inelegant and not as obscure, as the author
put it.</p>
<p>This code is formatted differently and is not the approach used by the author
which is slower, inelegant and not as obscure, as the author put it.</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>
@@ -162,25 +160,21 @@ put it.</p>
<h3 id="alternate-try">Alternate 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="ex">./try.alt.sh</span></span></code></pre></div>
<h2 id="judges-remarks">Judges’ remarks:</h2>
<p>Are you puzzled about puzzles? This entry might puzzle you more while
it puzzles out some puzzles: all in a puzzling way!</p>
<p>Are you puzzled about puzzles? This entry might puzzle you
more while it puzzles out some puzzles: all in a puzzling way!</p>
<p><code>goto</code> the source and notice the lack of functions. Jump
to the <code>switch</code> statement. And if you think you can puzzle it
out better, try solving <a href="insane1.sudoku">insane1.sudoku</a> all
by yourself!</p>
<p>NOTE: the tarball named by the author was removed after the files
were extracted into the directory instead. These files were added to the
list.</p>
to the <code>switch</code> statement. And if you think you can puzzle
it out better, try solving <a href="insane1.sudoku">insane1.sudoku</a> all by yourself!</p>
<p>NOTE: the tarball named by the author was removed after the files were extracted
into the directory instead. These files were added to the list.</p>
<h2 id="authors-remarks">Author’s remarks:</h2>
<p>This program can solve a type of logic puzzle known as a <a
href="https://en.wikipedia.org/wiki/Sudoku">Sudoku</a>, and also
<p>This program can solve a type of logic puzzle known as a
<a href="https://en.wikipedia.org/wiki/Sudoku">Sudoku</a>, and also
generate new ones.</p>
<h3 id="contents">Contents</h3>
<ul>
<li>program file: <a href="aidan.c">aidan.c</a> - sudoku solver and
generator</li>
<li>test suite: <a href="test-su.perl">test-su.perl</a> - optional test
script (written for Perl5)</li>
<li>program file: <a href="aidan.c">aidan.c</a> - sudoku solver and generator</li>
<li>test suite: <a href="test-su.perl">test-su.perl</a> - optional test script (written for Perl5)</li>
<li>sudoku file: <a href="blank.sudoku">blank.sudoku</a></li>
<li>sudoku file: <a href="insane1.sudoku">insane1.sudoku</a></li>
<li>sudoku file: <a href="insane2.sudoku">insane2.sudoku</a></li>
@@ -190,30 +184,27 @@ script (written for Perl5)</li>
<li>sudoku file: <a href="tough1.sudoku">tough1.sudoku</a></li>
<li>sudoku file: <a href="wp.sudoku">wp.sudoku</a></li>
</ul>
<p>Yes, the test suite really is 5 times larger than the actual program.
You <strong>did</strong> say this was a parody of the software
development process…</p>
<p>Yes, the test suite really is 5 times larger than the actual program. You
<strong>did</strong> say this was a parody of the software development process…</p>
<h3 id="important">IMPORTANT</h3>
<p><a href="test-su.perl">test.perl</a> expects the
<code>sudoku-sf</code> executable to be <code>./sudoku-sf</code>. If you
rename it, please change the definition of <code>$sf_exe</code> to the
<p><a href="test-su.perl">test.perl</a> expects the <code>sudoku-sf</code> executable to be
<code>./sudoku-sf</code>. If you rename it, please change the definition of <code>$sf_exe</code> to the
new name.</p>
<blockquote>
<p>Judges’ note: this was done.</p>
</blockquote>
<h3 id="legal-blurb">Legal blurb</h3>
<p>This program comes with NO WARRANTY, not even that it’ll do what I
say it should. Any misfortunes that occur as a result of using this are
not my fault. Go find some unpopular multinational to sue instead.</p>
<p>This program is not copyrighted and is entirely my work. Distribute
or modify it as you wish, though please give me credit.</p>
<p>This program comes with NO WARRANTY, not even that it’ll do what I say it
should. Any misfortunes that occur as a result of using this are not my fault.
Go find some unpopular multinational to sue instead.</p>
<p>This program is not copyrighted and is entirely my work. Distribute or modify
it as you wish, though please give me credit.</p>
<h3 id="what-is-a-sudoku">What is a sudoku?</h3>
<p>(If you know, feel free to skip this section. Get more details from
<a href="http://en.wikipedia.org/wiki/Sudoku">the wikipedia
entry</a>)</p>
<p>A sudoku is a type of logic puzzle. You are given a grid of 9x9
boxes, some of which contain digits. This is divided into a 3x3 set up,
e.g. (from the Wikipedia article - fairly easy):</p>
<p>(If you know, feel free to skip this section. Get more details from <a href="http://en.wikipedia.org/wiki/Sudoku">the
wikipedia entry</a>)</p>
<p>A sudoku is a type of logic puzzle. You are given a grid of 9x9 boxes, some
of which contain digits. This is divided into a 3x3 set up, e.g. (from the
Wikipedia article - fairly easy):</p>
<pre><code> . . . | 1 . . | 7 4 .
. 5 . | . 9 . | . 3 2
. . 6 | 7 . . | 9 . .
@@ -225,15 +216,12 @@ e.g. (from the Wikipedia article - fairly easy):</p>
. . 4 | . . 7 | 3 . .
7 3 . | . 2 . | . 6 .
. 6 5 | . . 4 | . . .</code></pre>
<p>You have to fill in the remaining boxes so that each row, column, and
smaller box contains all of the digits 1-9. That’s all the information I
needed to figure out how to solve them, but there’s a useful tutorial on
<a href="http://www.sudoku.org.uk/"
class="uri">http://www.sudoku.org.uk/</a>, which is roughly affiliated
with the <a href="https://www.telegraph.co.uk/">Daily Telegraph</a>, a
UK newspaper.</p>
<p>Now, with modern computers this <strong>can</strong> be solved using
brute force, e.g.:</p>
<p>You have to fill in the remaining boxes so that each row, column, and smaller
box contains all of the digits 1-9. That’s all the information I needed to
figure out how to solve them, but there’s a useful tutorial on
<a href="http://www.sudoku.org.uk/" class="uri">http://www.sudoku.org.uk/</a>, which is roughly affiliated with the <a href="https://www.telegraph.co.uk/">Daily
Telegraph</a>, a UK newspaper.</p>
<p>Now, with modern computers this <strong>can</strong> be solved using brute force, e.g.:</p>
<div class="sourceCode" id="cb7"><pre class="sourceCode c"><code class="sourceCode c"><span id="cb7-1"><a href="#cb7-1" aria-hidden="true" tabindex="-1"></a><span class="pp">#include </span><span class="im">&lt;stdio.h&gt;</span><span class="pp"> </span><span class="co">/* sudoku-bfi.c */</span></span>
<span id="cb7-2"><a href="#cb7-2" aria-hidden="true" tabindex="-1"></a><span class="pp">#define S</span><span class="op">(</span><span class="pp">t</span><span class="op">)</span><span class="pp"> </span><span class="cf">for</span><span class="op">(</span><span class="pp">n</span><span class="op">=</span><span class="dv">0</span><span class="op">;</span><span class="pp">n</span><span class="op">&lt;</span><span class="dv">9</span><span class="op">;</span><span class="pp">v</span><span class="op">[</span><span class="pp">n</span><span class="op">++]=</span><span class="dv">0</span><span class="op">);</span><span class="cf">for</span><span class="op">(</span><span class="pp">n</span><span class="op">=</span><span class="dv">0</span><span class="op">;</span><span class="pp">n</span><span class="op">&lt;</span><span class="dv">81</span><span class="op">;</span><span class="pp">n</span><span class="op">++)</span><span class="cf">if</span><span class="op">(</span><span class="pp">i</span><span class="op">[</span><span class="pp">n</span><span class="op">]){</span><span class="pp">z</span><span class="op">=</span><span class="dv">1</span><span class="op">&lt;&lt;</span><span class="pp">i</span><span class="op">[</span><span class="pp">n</span><span class="op">];</span><span class="cf">if</span><span class="op">(</span><span class="pp">v</span><span class="op">[</span><span class="pp">t</span><span class="op">]</span><span class="pp">\</span><span class="op">\</span></span>
<span id="cb7-3"><a href="#cb7-3" aria-hidden="true" tabindex="-1"></a><span class="op">&amp;</span><span class="pp">z</span><span class="op">)</span><span class="cf">for</span><span class="op">(;;){</span><span class="cf">if</span><span class="op">(</span><span class="pp">p</span><span class="op">&lt;</span><span class="dv">0</span><span class="op">)</span><span class="cf">goto</span><span class="pp"> d</span><span class="op">;</span><span class="cf">if</span><span class="op">(</span><span class="pp">i</span><span class="op">[</span><span class="pp">p</span><span class="op">]++&lt;</span><span class="dv">9</span><span class="op">)</span><span class="cf">goto</span><span class="pp"> f</span><span class="op">;</span><span class="pp">i</span><span class="op">[</span><span class="pp">p</span><span class="op">]=</span><span class="dv">0</span><span class="op">;</span><span class="pp">p</span><span class="op">=</span><span class="pp">s</span><span class="op">[</span><span class="pp">p</span><span class="op">];}</span><span class="pp">v</span><span class="op">[</span><span class="pp">t</span><span class="op">]|=</span><span class="pp">z</span><span class="op">;}</span></span>
@@ -243,16 +231,15 @@ brute force, e.g.:</p>
<span id="cb7-7"><a href="#cb7-7" aria-hidden="true" tabindex="-1"></a><span class="st">&quot;Success&quot;</span><span class="op">);</span><span class="cf">for</span><span class="op">(</span>n<span class="op">=</span><span class="dv">0</span><span class="op">;</span>n<span class="op">&lt;</span><span class="dv">81</span><span class="op">;){</span>p<span class="op">=</span>i<span class="op">[</span>n<span class="op">];</span>printf<span class="op">(</span><span class="st">&quot;</span><span class="sc">%c</span><span class="st"> </span><span class="sc">%s</span><span class="st">&quot;</span><span class="op">,(</span>p<span class="op">?</span>p<span class="op">|</span><span class="dv">48</span><span class="op">:</span><span class="ch">&#39;.&#39;</span><span class="op">),(++</span>n<span class="op">%</span><span class="dv">3</span><span class="op">?</span><span class="st">&quot;&quot;</span><span class="op">:</span>n<span class="op">%</span><span class="dv">9</span><span class="op">?</span><span class="st">&quot;| &quot;</span></span>
<span id="cb7-8"><a href="#cb7-8" aria-hidden="true" tabindex="-1"></a><span class="op">:</span>n<span class="op">%</span><span class="dv">27</span><span class="op">?</span><span class="st">&quot;</span><span class="sc">\n</span><span class="st">&quot;</span><span class="op">:</span>n<span class="op">%</span><span class="dv">81</span><span class="op">?</span><span class="st">&quot;</span><span class="sc">\n</span><span class="st">------+-------+------</span><span class="sc">\n</span><span class="st">&quot;</span><span class="op">:</span><span class="st">&quot;</span><span class="sc">\n\n</span><span class="st">&quot;</span><span class="op">));}</span><span class="cf">return</span> z<span class="op">;}</span></span></code></pre></div>
<blockquote>
<p>Judges’ note: this was added as <a
href="aidan.alt.c">aidan.alt.c</a>.</p>
<p>Judges’ note: this was added as <a href="aidan.alt.c">aidan.alt.c</a>.</p>
</blockquote>
<p>That isn’t the approach I’ve used; it’s slow (particularly in
worst-case or nearly so scenarios), inelegant, and not a good starting
point for sudoku generation. It’s also much too easy to understand ;-)
Instead, I’ve written a program which solves them in much the same way
as I do, only a lot faster (and hopefully more reliably).</p>
<p>Oh, and if you think that example sudoku is too easy, try this one
(which my program generated):</p>
<p>That isn’t the approach I’ve used; it’s slow (particularly in worst-case or
nearly so scenarios), inelegant, and not a good starting point for sudoku
generation. It’s also much too easy to understand ;-) Instead, I’ve written a
program which solves them in much the same way as I do, only a lot faster (and
hopefully more reliably).</p>
<p>Oh, and if you think that example sudoku is too easy, try this one (which my
program generated):</p>
<pre><code>--- insane1.sudoku --
. . 4 | . . . | . 5 6
5 . . | . 7 2 | . . .
@@ -265,211 +252,151 @@ as I do, only a lot faster (and hopefully more reliably).</p>
. 5 . | 2 . 1 | 4 . 8
3 . . | . . . | . . .
. . . | . . . | . 6 1</code></pre>
<p>Be warned - it’s evil! (I certainly haven’t been able to solve it by
hand. The brute-force program given above, <code>sudoku-bfi.c</code> (<a
href="aidan.alt.c">aidan.alt.c</a>), also has trouble - it took 66
seconds to solve it - but probably for different reasons. That’s the
worst performance I’ve had from brute-force so far!)</p>
<p>Be warned - it’s evil! (I certainly haven’t been able to solve it by hand. The
brute-force program given above, <code>sudoku-bfi.c</code> (<a href="aidan.alt.c">aidan.alt.c</a>),
also has trouble - it took 66 seconds to solve it - but probably for different
reasons. That’s the worst performance I’ve had from brute-force so far!)</p>
<h3 id="usage">Usage</h3>
<h4 id="building">Building</h4>
<div class="sourceCode" id="cb9"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb9-1"><a href="#cb9-1" aria-hidden="true" tabindex="-1"></a><span class="fu">cc</span> <span class="at">-o</span> sudoku-sf sudoku-sf.c</span></code></pre></div>
<p>or, if using gcc, try:</p>
<div class="sourceCode" id="cb10"><pre
class="sourceCode sh"><code class="sourceCode bash"><span id="cb10-1"><a href="#cb10-1" aria-hidden="true" tabindex="-1"></a><span class="fu">gcc</span> <span class="at">-O2</span> <span class="at">-Wall</span> <span class="at">-Wextra</span> <span class="at">-ansi</span> <span class="at">-pedantic-errors</span> <span class="at">-o</span> sudoku-sf sudoku-sf.c</span></code></pre></div>
<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">gcc</span> <span class="at">-O2</span> <span class="at">-Wall</span> <span class="at">-Wextra</span> <span class="at">-ansi</span> <span class="at">-pedantic-errors</span> <span class="at">-o</span> sudoku-sf sudoku-sf.c</span></code></pre></div>
<h4 id="testing-optional">Testing (optional)</h4>
<div class="sourceCode" id="cb11"><pre
class="sourceCode sh"><code class="sourceCode bash"><span id="cb11-1"><a href="#cb11-1" aria-hidden="true" tabindex="-1"></a><span class="fu">perl</span> ./test-su.perl</span></code></pre></div>
<p>Note that this requires Perl 5 (I use 5.8.5, earlier versions
untested) and is somewhat slow (should take under a minute on a fairly
modern PC - try appending <code>-n 0</code> if you’re in a hurry). I
wrote it mostly for my own benefit, really.</p>
<div class="sourceCode" id="cb11"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb11-1"><a href="#cb11-1" aria-hidden="true" tabindex="-1"></a><span class="fu">perl</span> ./test-su.perl</span></code></pre></div>
<p>Note that this requires Perl 5 (I use 5.8.5, earlier versions untested) and is
somewhat slow (should take under a minute on a fairly modern PC - try
appending <code>-n 0</code> if you’re in a hurry). I wrote it mostly for my own benefit,
really.</p>
<h4 id="solving">Solving</h4>
<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">./aidan</span> <span class="op">&lt;</span> somefile.txt</span></code></pre></div>
<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">./aidan</span> <span class="op">&lt;</span> somefile.txt</span></code></pre></div>
<p>Input should be the numbers of each row in turn. Empty spaces can be
represented as a full stop (<code>.</code>) or zero (<code>0</code>).
Other characters are ignored, so you can cut-and-paste either example
sudoku puzzle from above into a file and feed that in. The program has
coped with every input I’ve thrown at it so far, including an <a
href="blank.sudoku">empty grid</a>.</p>
represented as a full stop (<code>.</code>) or zero (<code>0</code>). Other characters are ignored, so you
can cut-and-paste either example sudoku puzzle from above into a file and feed that
in. The program has coped with every input I’ve thrown at it so far, including
an <a href="blank.sudoku">empty grid</a>.</p>
<p>Output consists of the problem, then the solution, then a message of
success/failure.</p>
<p><code>./aidan U</code> may also be useful, or perhaps not. It only
took an extra 15 bytes of (very simple) code to add, so it doesn’t
really matter to me. (It’s the same as the normal mode for most input
you’re likely to feed it, though slightly slower. See if you can figure
out what it does.)</p>
<p><code>./aidan U</code> may also be useful, or perhaps not. It only took
an extra 15 bytes of (very simple) code to add, so it doesn’t really matter to
me. (It’s the same as the normal mode for most input you’re likely to feed it,
though slightly slower. See if you can figure out what it does.)</p>
<h4 id="generating">Generating</h4>
<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">./sudoku</span> <span class="op">&lt;</span>seed<span class="op">&gt;</span></span></code></pre></div>
<p>Output is a blank grid, then the solution, then the problem. There’s
no control over the difficulty. Sorry. However, all generated sudokus
should have exactly one solution - if one doesn’t, that’s a bug.</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">./sudoku</span> <span class="op">&lt;</span>seed<span class="op">&gt;</span></span></code></pre></div>
<p>Output is a blank grid, then the solution, then the problem. There’s no
control over the difficulty. Sorry. However, all generated sudokus should have
exactly one solution - if one doesn’t, that’s a bug.</p>
<h3 id="speed">Speed</h3>
<p>Fast enough. Solving and generating are practically instant on my
1Ghz Duron. Of course, there could be some cases which take longer…</p>
<p>More precisely - 400 random sudokus are generated and solved in about
45 seconds in tests on my PC (1Ghz Duron, gcc 3.4.1, <code>-O2</code>
optimisation - takes about 60 seconds with no optimisation). If that
isn’t fast enough, what on Earth are you doing with it?</p>
<p>Fast enough. Solving and generating are practically instant on my 1Ghz Duron.
Of course, there could be some cases which take longer…</p>
<p>More precisely - 400 random sudokus are generated and solved in about 45 seconds
in tests on my PC (1Ghz Duron, gcc 3.4.1, <code>-O2</code> optimisation - takes about 60
seconds with no optimisation). If that isn’t fast enough, what on Earth are you
doing with it?</p>
<h3 id="bugs">Bugs</h3>
<p>None known - hopefully I’ve worked out all the major ones. Nothing
has come up in testing since the last bug fix, but what does that
mean?</p>
<p>None known - hopefully I’ve worked out all the major ones. Nothing has come up
in testing since the last bug fix, but what does that mean?</p>
<p>Tested on:</p>
<ul>
<li><code>gcc 3.4.1-3mdk</code>, Linux/x86</li>
</ul>
<p><em>RETEST</em> Borland C 4.5, 16-bit DOS .exe (small memory
model)</p>
<p>I don’t count the fact that it first prints a blank grid whenever
asked to generate a sudoku as a bug - just a minor quirk. The fix is
slightly awkward and would make the program slightly longer, so I
haven’t bothered - it’s not important.</p>
<p><em>RETEST</em> Borland C 4.5, 16-bit DOS .exe (small memory model)</p>
<p>I don’t count the fact that it first prints a blank grid whenever asked to
generate a sudoku as a bug - just a minor quirk. The fix is slightly awkward
and would make the program slightly longer, so I haven’t bothered - it’s not
important.</p>
<h3 id="missing-features">Missing Features</h3>
<ul>
<li><p>No control over the difficulty of generated sudokus - they vary
from easy to hair-tugging near-impossibility. Solver beware. Seeing as
apparently one program <a
href="http://news.bbc.co.uk/1/hi/magazine/4469719.stm">took six
years</a>, I’m in no hurry.</p></li>
<li><p>Some sort of curses-based UI to let you solve interactively might
be cool, but I don’t feel like learning curses just for this. Besides, I
spent enough of the time swearing as it is.</p></li>
<li><p>If you mistype a sudoku (e.g. from a paper/magazine) - and you
will - it can’t help you figure out where the mistake is,
sadly.</p></li>
<li><p>No control over the difficulty of generated sudokus - they vary from easy to
hair-tugging near-impossibility. Solver beware. Seeing as apparently one program
<a href="http://news.bbc.co.uk/1/hi/magazine/4469719.stm">took six years</a>, I’m in no
hurry.</p></li>
<li><p>Some sort of curses-based UI to let you solve interactively might be cool,
but I don’t feel like learning curses just for this. Besides, I spent enough
of the time swearing as it is.</p></li>
<li><p>If you mistype a sudoku (e.g. from a paper/magazine) - and you will - it
can’t help you figure out where the mistake is, sadly.</p></li>
</ul>
<h3 id="portability">Portability</h3>
<p>Dependant on ASCII, requires that an <code>int</code> is at least 15
bits and a <code>long</code> at least 32. (No, that isn’t a typo - I did
say 15, not 16).</p>
<p>Also requires that <code>cpp</code> can properly handle something
like:</p>
<p>Dependant on ASCII, requires that an <code>int</code> is at least 15 bits and a <code>long</code> at
least 32. (No, that isn’t a typo - I did say 15, not 16).</p>
<p>Also requires that <code>cpp</code> can properly handle something like:</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 foo</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"> x y</span></span>
<span id="cb14-2"><a href="#cb14-2" aria-hidden="true" tabindex="-1"></a>foo<span class="op">(</span>bar<span class="op">,)</span></span></code></pre></div>
<p>Apparently, a few can’t (ANSI C specifically doesn’t require that
this works, though it usually does). Unfortunately, I didn’t discover
this issue until too late. (It was mentioned in the notes for people
modifying GCC in the “beware of obscure compiler limitations” section,
so I’m figuring it’s quite unusual.)</p>
<p>Apparently, a few can’t (ANSI C specifically doesn’t require that this works,
though it usually does). Unfortunately, I didn’t discover this issue until too
late. (It was mentioned in the notes for people modifying GCC in the “beware
of obscure compiler limitations” section, so I’m figuring it’s quite unusual.)</p>
<h3 id="compiler-warnings">Compiler warnings</h3>
<p>Some when compiled with
<code>gcc -Wall -Wextra -ansi -pedantic</code>:</p>
<p>Some when compiled with <code>gcc -Wall -Wextra -ansi -pedantic</code>:</p>
<ul>
<li>The left-hand operand of a comma has no effect in two places.</li>
<li>Parentheses are suggested around a <code>+</code> in an operand of
<code>&amp;</code> in the <code>i</code> macro definition.</li>
<li>Parentheses are suggested around a <code>+</code> in an operand of <code>&amp;</code> in the <code>i</code> macro
definition.</li>
</ul>
<p>Borland C also spots some code in expressions which has no effect,
and some uses of <code>=</code> where you’d expect a comparison
operator.</p>
<p>Borland C also spots some code in expressions which has no effect, and some
uses of <code>=</code> where you’d expect a comparison operator.</p>
<h3 id="obfuscation">Obfuscation</h3>
<p>Let’s see now:</p>
<ul>
<li>Squint-inducing variable naming.</li>
<li>Slightly odd <code>#defines</code> (which will be cleaned up by
<code>cpp</code> + a code beautifier, but see the next item).</li>
<li>No functions but <code>main()</code> - all code reuse via
<code>#define</code>s, or by various other methods (usually somewhat
icky ones). This wasn’t deliberate - it just ended up that way
somehow…</li>
<li>Slightly odd <code>#defines</code> (which will be cleaned up by <code>cpp</code> + a code
beautifier, but see the next item).</li>
<li>No functions but <code>main()</code> - all code reuse via <code>#define</code>s, or by various other
methods (usually somewhat icky ones). This wasn’t deliberate - it just ended up
that way somehow…</li>
<li><code>goto</code>s from everywhere to everywhere else.</li>
<li>A slightly… interesting <code>switch</code> statement.</li>
<li>Generally odd flow of control (see above items).</li>
<li>Plenty of bit-twiddling.</li>
<li>To save space, no <code>'A'</code>-style char constants - hard-coded
numbers are used. (There’s one, but it isn’t used to make things
<strong>clearer</strong>).</li>
<li>To save space, no <code>'A'</code>-style char constants - hard-coded numbers are used.
(There’s one, but it isn’t used to make things <strong>clearer</strong>).</li>
<li><code>array[index]</code> notation, because:
<ul>
<li>it’s traditional</li>
<li>take a look at how the <code>s</code> and <code>N(I,l)</code> macros
are used</li>
<li>take a look at how the <code>s</code> and <code>N(I,l)</code> macros are used</li>
</ul></li>
<li>various other little things not worth mentioning.</li>
</ul>
<p>So basically, just what you’d normally expect in an IOCCC entry.</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>
<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>
<p>For more information, see: https://creativecommons.org/licenses/by-sa/4.0/</p>
<!-- END: this line ends content for HTML phase 21 by: bin/pandoc-wrapper.sh via bin/md2html.sh -->
<!-- START: this line starts content for HTML phase 22 by: bin/output-index-inventory.sh via bin/md2html.sh -->
<!-- START: this line starts content generated by: bin/output-index-inventory.sh -->
<h1 id="inventory-for-2005aidan"><a name="inventory"></a>Inventory for
2005/aidan</h1>
<h1 id="inventory-for-2005aidan"><a name="inventory"></a>Inventory for 2005/aidan</h1>
<p><a href="#top">Jump to top</a></p>
<h2 id="primary-files">Primary files</h2>
<ul>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2005/aidan/aidan.c">aidan.c</a>
- entry source</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2005/aidan/Makefile">Makefile</a>
- entry Makefile</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2005/aidan/aidan.alt.c">aidan.alt.c</a>
- alternative source</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2005/aidan/aidan.orig.c">aidan.orig.c</a>
- original source</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2005/aidan/blank.sudoku">blank.sudoku</a>
- blank sudoku puzzle</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2005/aidan/insane1.sudoku">insane1.sudoku</a>
- insane sudoku puzzle</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2005/aidan/insane2.sudoku">insane2.sudoku</a>
- insane sudoku puzzle</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2005/aidan/insane3.sudoku">insane3.sudoku</a>
- insane sudoku puzzle</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2005/aidan/insane4.sudoku">insane4.sudoku</a>
- insane sudoku puzzle</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2005/aidan/insane5.sudoku">insane5.sudoku</a>
- insane sudoku puzzle</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2005/aidan/tough1.sudoku">tough1.sudoku</a>
- tough sudoku puzzle</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2005/aidan/try.alt.sh">try.alt.sh</a>
- how to run alternative code</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2005/aidan/try.sh">try.sh</a>
- how to run</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2005/aidan/wp.sudoku">wp.sudoku</a>
- Wikipedia sudoku puzzle</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2005/aidan/test-su.perl">test-su.perl</a>
- test suite</li>
<li><a href="2005_aidan.tar.bz2">2005_aidan.tar.bz2</a> - download entry
source</li>
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2005/aidan/aidan.c">aidan.c</a> - entry source</li>
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2005/aidan/Makefile">Makefile</a> - entry Makefile</li>
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2005/aidan/aidan.alt.c">aidan.alt.c</a> - alternative source</li>
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2005/aidan/aidan.orig.c">aidan.orig.c</a> - original source</li>
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2005/aidan/blank.sudoku">blank.sudoku</a> - blank sudoku puzzle</li>
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2005/aidan/insane1.sudoku">insane1.sudoku</a> - insane sudoku puzzle</li>
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2005/aidan/insane2.sudoku">insane2.sudoku</a> - insane sudoku puzzle</li>
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2005/aidan/insane3.sudoku">insane3.sudoku</a> - insane sudoku puzzle</li>
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2005/aidan/insane4.sudoku">insane4.sudoku</a> - insane sudoku puzzle</li>
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2005/aidan/insane5.sudoku">insane5.sudoku</a> - insane sudoku puzzle</li>
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2005/aidan/tough1.sudoku">tough1.sudoku</a> - tough sudoku puzzle</li>
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2005/aidan/try.alt.sh">try.alt.sh</a> - how to run alternative code</li>
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2005/aidan/try.sh">try.sh</a> - how to run</li>
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2005/aidan/wp.sudoku">wp.sudoku</a> - Wikipedia sudoku puzzle</li>
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2005/aidan/test-su.perl">test-su.perl</a> - test suite</li>
<li><a href="2005_aidan.tar.bz2">2005_aidan.tar.bz2</a> - download entry source</li>
</ul>
<h2 id="secondary-files">Secondary files</h2>
<ul>
<li><a href="index.html">index.html</a> - entry home page</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2005/aidan/.entry.json">.entry.json</a>
- description of entry in JSON</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2005/aidan/.gitignore">.gitignore</a>
- list of files that should not be committed under git</li>
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2005/aidan/.entry.json">.entry.json</a> - description of entry in JSON</li>
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2005/aidan/.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/2005/aidan/README.md">README.md</a>
- markdown source for index.html</li>
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2005/aidan/README.md">README.md</a> - markdown source for index.html</li>
</ul>
<!-- END: next line ends content generated by: bin/output-index-inventory.sh -->
+255 -331
View File
@@ -129,9 +129,9 @@
<h2 id="author"><a name="author"></a>Author:</h2>
<ul>
<li>Name: <a href="../../authors.html#Anonymous_2005">Anonymous
2005</a><br> Location: <a href="../../location.html#ZZ">ZZ</a> -
<em>Unknown location</em> <br><br></li>
<li>Name: <a href="../../authors.html#Anonymous_2005">Anonymous 2005</a><br>
Location: <a href="../../location.html#ZZ">ZZ</a> - <em>Unknown location</em>
<br><br></li>
</ul>
<!-- END: next line ends content generated by: bin/output-index-author.sh -->
@@ -141,36 +141,32 @@
<h2 id="to-build">To build:</h2>
<div class="sourceCode" id="cb1"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb1-1"><a href="#cb1-1" aria-hidden="true" tabindex="-1"></a><span class="fu">make</span></span></code></pre></div>
<p>NOTE: there is an alternate version for vi(m) like movements. See <a
href="#alternate-code">alternate version</a> below. If your terminal has
problems with the <code>stty(1)</code> commands try:</p>
<p>NOTE: there is an alternate version for vi(m) like movements. See <a href="#alternate-code">alternate
version</a> below. If your terminal has problems with the
<code>stty(1)</code> commands try:</p>
<div class="sourceCode" id="cb2"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb2-1"><a href="#cb2-1" aria-hidden="true" tabindex="-1"></a><span class="fu">make</span> anon-no_stty</span></code></pre></div>
<p>This will compile <a href="anon.c">anon.c</a> as <code>anon</code> to
not use <code>stty(1)</code>.</p>
<p>This will compile <a href="anon.c">anon.c</a> as <code>anon</code> to not use <code>stty(1)</code>.</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.html#2005_anon">2005 anon bugs</a>.</p>
<p>For more detailed information see <a href="../../bugs.html#2005_anon">2005 anon bugs</a>.</p>
<h2 id="to-use">To use:</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">./anon</span> x y <span class="pp">[</span><span class="ss">z</span><span class="pp">]</span></span></code></pre></div>
<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">./anon</span> 4 4</span>
<span id="cb5-2"><a href="#cb5-2" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb5-3"><a href="#cb5-3" aria-hidden="true" tabindex="-1"></a><span class="ex">./anon</span> 3 3 3</span></code></pre></div>
<p>After a very large number of moves this program will deliberately
force itself to destroy its runtime stack. This is the author’s way to
prevent you from being frustrated (which might happen as it likes to
create unsolvable puzzles just to hook you) and spending too much time
playing. :-)</p>
<p>After a very large number of moves this program will deliberately force itself
to destroy its runtime stack. This is the author’s way to prevent you from being
frustrated (which might happen as it likes to create unsolvable puzzles just to
hook you) and spending too much time playing. :-)</p>
<p>If you want to see this in action you can easily do this:</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">yes</span> <span class="st">&#39;please crash on me :-)&#39;</span> <span class="kw">|</span> <span class="ex">./anon</span> 4 4</span></code></pre></div>
<p>What happens if you specify a larger board? For instance:</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">yes</span> <span class="st">&#39;please crash on me :-)&#39;</span> <span class="kw">|</span> <span class="ex">./anon</span> 10 10 10</span></code></pre></div>
<p>If you specify more than three args the program might also crash or
do something strange. This might also happen if you specify excessively
large board dimensions. Try <code>100 100 100</code> for instance and
see what happens!</p>
<p>If you specify more than three args the program might also crash or do
something strange. This might also happen if you specify excessively large board
dimensions. Try <code>100 100 100</code> for instance and see what happens!</p>
<h2 id="alternate-version">Alternate version:</h2>
<p>The alternate version uses <code>vi(m)</code> like movement keys.</p>
<h3 id="alternate-build">Alternate build:</h3>
@@ -178,8 +174,7 @@ see what happens!</p>
<p>To compile the version without <code>stty(1)</code>:</p>
<div class="sourceCode" id="cb9"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb9-1"><a href="#cb9-1" aria-hidden="true" tabindex="-1"></a><span class="fu">make</span> alt-no_stty</span></code></pre></div>
<h3 id="alternate-use">Alternate use:</h3>
<p>Use <code>anon.alt</code> as you would <code>anon</code> with the
change in movements:</p>
<p>Use <code>anon.alt</code> as you would <code>anon</code> with the change in movements:</p>
<pre><code>k | Move empty spot up
h | Move empty spot left
j | Move empty spot down
@@ -187,43 +182,36 @@ l | Move empty spot right
J | Move empty spot forwards
K | Move empty spot backwards</code></pre>
<h2 id="judges-remarks">Judges’ remarks:</h2>
<p>Taking the 4x4 board with 15 tiles to a whole new level, this entry
takes this puzzle to a whole new dimension! While you puzzle out this
puzzle, we invite you to take a good LONG look how and WHY
<code>main()</code> is recursively called and how the runtime stack is
used.</p>
<p>Taking the 4x4 board with 15 tiles to a whole new level, this entry takes this
puzzle to a whole new dimension! While you puzzle out this puzzle, we invite
you to take a good LONG look how and WHY <code>main()</code> is recursively called and how
the runtime stack is used.</p>
<h2 id="authors-remarks">Author’s remarks:</h2>
<h3 id="about-the-game-itself">ABOUT THE GAME ITSELF</h3>
<p>Remember Sam Loyd’s <a
href="https://en.wikipedia.org/wiki/15_puzzle">Fifteen Puzzle</a>? It
consists of a 4x4 board with 15 tiles numbered 1 to 15, and an empty
spot. The goal of the game is to slide the tiles around without lifting
them off the board, so that they become sorted.</p>
<p>Well, that was then. This program is the 21st century version of the
Fifteen Puzzle: not only does it allow arbitrary board sizes, it also
supports <em>3D</em> boards! The tiles are numbered from 1 to N, where N
is one less the number of spaces on the board, and the goal is to
rearrange them so that they appear sorted in the order they appear on
the screen.</p>
<p>The program takes 2 or 3 arguments, specifying the dimensions of the
board. For example, to play the original version of the Fifteen
Puzzle:</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">./anon</span> 4 4</span></code></pre></div>
<p>Remember Sam Loyd’s <a href="https://en.wikipedia.org/wiki/15_puzzle">Fifteen Puzzle</a>?
It consists of a 4x4 board with 15 tiles numbered 1 to 15, and an empty spot.
The goal of the game is to slide the tiles around without lifting them off the
board, so that they become sorted.</p>
<p>Well, that was then. This program is the 21st century version of the Fifteen
Puzzle: not only does it allow arbitrary board sizes, it also supports <em>3D</em>
boards! The tiles are numbered from 1 to N, where N is one less the number of
spaces on the board, and the goal is to rearrange them so that they appear
sorted in the order they appear on the screen.</p>
<p>The program takes 2 or 3 arguments, specifying the dimensions of the board.
For example, to play the original version of the Fifteen Puzzle:</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">./anon</span> 4 4</span></code></pre></div>
<p>To play with a 3D board, do something like this:</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">./anon</span> 3 3 3</span></code></pre></div>
<p><strong>WARNING: do NOT run the program with more than 3 command-line
arguments. This will trigger a bug that will cause it to crash or do
something strange. :-)</strong></p>
<p>Also, resist the temptation to create very large puzzles. The program
does not attempt to resize your terminal for you, and will produce
confusing output. It may also crash on you if you insist on running it
with excessively large board dimensions. :-) (10x10x10 is considered a
safe upper limit.)</p>
<p>The empty space on the board is represented by a space filled with
<code>#</code> characters instead of digits. To slide the tiles around,
use the following keys:</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">./anon</span> 3 3 3</span></code></pre></div>
<p><strong>WARNING: do NOT run the program with more than 3 command-line arguments.
This will trigger a bug that will cause it to crash or do something strange.
:-)</strong></p>
<p>Also, resist the temptation to create very large puzzles. The program does not
attempt to resize your terminal for you, and will produce confusing output. It
may also crash on you if you insist on running it with excessively large board
dimensions. :-) (10x10x10 is considered a safe upper limit.)</p>
<p>The empty space on the board is represented by a space filled with <code>#</code>
characters instead of digits. To slide the tiles around, use the following
keys:</p>
<pre><code>i | Slide the tile above the current empty space downwards.
j | Slide the tile to the left of the current empty space to the right.
k | Slide the tile below the current empty space upwards.
@@ -233,101 +221,87 @@ n | Slide the tile in front of the current empty space backwards.</code></pre>
<p>To quit the game:</p>
<pre><code>q | Quit the game.</code></pre>
<p>Note that, for example, sliding the tile above the current empty spot
downwards will fill up the empty spot, and create a new empty spot above
where the current empty spot was. Hence, you could think of the movement
keys in terms of how they effectively “move” the empty spot:</p>
downwards will fill up the empty spot, and create a new empty spot above where
the current empty spot was. Hence, you could think of the movement keys in
terms of how they effectively “move” the empty spot:</p>
<pre><code>i | Move empty spot up
j | Move empty spot left
k | Move empty spot down
l | Move empty spot right
n | Move empty spot forwards
o | Move empty spot backwards</code></pre>
<p><strong>NOTE:</strong> as a measure of alleviating
counter-productivity due to addiction to this game, particularly for
those hardcore gamers who insist on solving a 10x10x10 puzzle during
work hours, and also to give an upper bound to user frustration when the
program generates an unsolvable puzzle (which it does roughly half the
time, just to hook you), the program will, after a very large number of
moves (which is system-specific) terminate itself by forcefully
destroying its own runtime stack. This will result in a core dump and/or
an abnormal termination message; but this is a feature, not a bug!
:-)</p>
<p><strong>NOTE:</strong> as a measure of alleviating counter-productivity due to addiction to
this game, particularly for those hardcore gamers who insist on solving a
10x10x10 puzzle during work hours, and also to give an upper bound to user
frustration when the program generates an unsolvable puzzle (which it does
roughly half the time, just to hook you), the program will, after a very large
number of moves (which is system-specific) terminate itself by forcefully
destroying its own runtime stack. This will result in a core dump and/or an
abnormal termination message; but this is a feature, not a bug! :-)</p>
<h3 id="compile-notes">COMPILE NOTES</h3>
<p>This program complies with ANSI/C99. It uses ANSI terminal control
sequences, and so requires a terminal that understands ANSI sequences,
such as VT100 or xterm.</p>
<p>This program complies with ANSI/C99. It uses ANSI terminal control sequences,
and so requires a terminal that understands ANSI sequences, such as VT100 or
xterm.</p>
<p>Some compilers may emit lots of warnings about how things ought to be
parenthesized (e.g. <code>gcc -Wall</code>). This is deliberate, since
if everything were parenthesized “properly” the program would fail to
work. It (ab)uses C operator precedence to accomplish some cool hacks.
:-) However, there are no compiler errors. I have tested this with
<code>gcc -pedantic -std=c99</code>.</p>
<p>The program also uses <code>stty cbreak</code>. If this breaks on
your system, compile it with <code>-DNO_STTY</code>. The game interface
will be a bit annoying (you will need to hit enter after every key), but
it works.</p>
<p>The game requires lots of space on the runtime stack space due to
deep recursion, among other things. :-)</p>
parenthesized (e.g. <code>gcc -Wall</code>). This is deliberate, since if everything were
parenthesized “properly” the program would fail to work. It (ab)uses C
operator precedence to accomplish some cool hacks. :-) However, there are no
compiler errors. I have tested this with <code>gcc -pedantic -std=c99</code>.</p>
<p>The program also uses <code>stty cbreak</code>. If this breaks on your system, compile it
with <code>-DNO_STTY</code>. The game interface will be a bit annoying (you will need to
hit enter after every key), but it works.</p>
<p>The game requires lots of space on the runtime stack space due to deep
recursion, among other things. :-)</p>
<p>See spoilers below for more notes about portability.</p>
<h3 id="about-the-code">ABOUT THE CODE</h3>
<p>Clearly, the author is very, very confused. Although he has broken up
the file into sections labelled with helpful headings, and although he
has left ample whitespace between all those <code>#define</code>s to
make them easier to read, :-) and although he has helpfully formatted
the code with beautiful indentation, something is clearly very, very
wrong.</p>
<p>In fact, the closer you look at this code, the more you realize
something is horribly wrong with it. For example, why is it that the
first statement in <code>main()</code> is a <code>return</code>? What do
all those nested <code>do</code> loops do (pun intended)? Why is the
first statement inside the first <code>do</code> loop a mere integer
literal? Why are there such strange statements, like that empty string
on line 65, or that isolated <code>||</code> on line 68?</p>
<p>But wait… why aren’t any statements terminated by semicolons? Why is
there only ONE semicolon in the entire program?! Why is the author
opening nested blocks by such strange things as <code>||</code> and
<code>(</code>, and closing them by <code>||</code> and <code>))</code>?
The <code>for</code> loop isn’t a <code>for</code> loop! The
<code>do</code> loop isn’t a <code>do</code> loop! Or… are they? Well,
the <code>for</code> loop is defined in terms of a <code>while</code>
loop. But wait, the <code>while</code> loop is defined in terms of the
<code>do</code> loop. And the <code>do</code> loop is defined in terms
of … Huh???</p>
<p>And that <code>switch</code> statement toward the end of the program…
wait a minute, that’s not a <code>switch</code> statement! Why is a
<code>case</code> defined in terms of a <code>switch</code> statement?!
And that initial return isn’t a return! Well, it is… but not what you
might think!</p>
<p>Clearly, the author is very, very confused. Although he has broken up the file
into sections labelled with helpful headings, and although he has left ample
whitespace between all those <code>#define</code>s to make them easier to read, :-) and
although he has helpfully formatted the code with beautiful indentation,
something is clearly very, very wrong.</p>
<p>In fact, the closer you look at this code, the more you realize something is
horribly wrong with it. For example, why is it that the first statement in
<code>main()</code> is a <code>return</code>? What do all those nested <code>do</code> loops do (pun intended)? Why
is the first statement inside the first <code>do</code> loop a mere integer literal? Why
are there such strange statements, like that empty string on line 65, or that
isolated <code>||</code> on line 68?</p>
<p>But wait… why aren’t any statements terminated by semicolons? Why is there
only ONE semicolon in the entire program?! Why is the author opening nested
blocks by such strange things as <code>||</code> and <code>(</code>, and closing them by <code>||</code> and <code>))</code>? The
<code>for</code> loop isn’t a <code>for</code> loop! The <code>do</code> loop isn’t a <code>do</code> loop! Or… are they? Well,
the <code>for</code> loop is defined in terms of a <code>while</code> loop. But wait, the <code>while</code> loop is
defined in terms of the <code>do</code> loop. And the <code>do</code> loop is defined in terms of …
Huh???</p>
<p>And that <code>switch</code> statement toward the end of the program… wait a minute,
that’s not a <code>switch</code> statement! Why is a <code>case</code> defined in terms of a <code>switch</code>
statement?! And that initial return isn’t a return! Well, it is… but not what
you might think!</p>
<p>Let’s see if it all makes sense after we run it through CPP…</p>
<p>Uh oh. The result looks like the diseased imagination of a mind more
confused than the one who wrote the original code. Unfortunately, unless
you’re a Lisp expert, it is probably easier to understand the program in
its original form. (And even then.) But that’s just so, so wrong…</p>
<p>The entire program consists of a single expression, returned from
<code>main()</code>. There are no <code>if</code> statements, no
<code>for</code> loops or any looping or control constructs besides the
<code>return</code>, in spite of the misleading appearance of the
original source. :) Yes I know, this has been attempted before, using
<code>?:</code> and the bad old comma operator. BUT this program does
NOT use the <code>?:</code> operator, and there are only TWO comma
operators in the entire program–and they are only there because
<code>srand()</code> and <code>exit()</code> return void.</p>
<p>The entire program consists of a single boolean expression returned
from <code>main()</code>. Looping is achieved by recursion, of course,
and branching is achieved by exploiting short-circuit evaluation of
boolean expressions. :-)</p>
<p>Uh oh. The result looks like the diseased imagination of a mind more confused
than the one who wrote the original code. Unfortunately, unless you’re a Lisp
expert, it is probably easier to understand the program in its original form.
(And even then.) But that’s just so, so wrong…</p>
<p>The entire program consists of a single expression, returned from <code>main()</code>.
There are no <code>if</code> statements, no <code>for</code> loops or any looping or control constructs
besides the <code>return</code>, in spite of the misleading appearance of the original
source. :) Yes I know, this has been attempted before, using <code>?:</code> and the bad
old comma operator. BUT this program does NOT use the <code>?:</code> operator, and there
are only TWO comma operators in the entire program–and they are only there
because <code>srand()</code> and <code>exit()</code> return void.</p>
<p>The entire program consists of a single boolean expression returned from
<code>main()</code>. Looping is achieved by recursion, of course, and branching is achieved
by exploiting short-circuit evaluation of boolean expressions. :-)</p>
<p>But this is not all.</p>
<p>It is comprehensible that the program can achieve branching and
looping using only boolean expressions and recursion. But HOW does the
program STORE DATA??? There are no variables of any kind in the program
except for the two arguments to <code>main()</code>. There are certainly
no arrays declared anywhere. The program does not call any memory
allocation routines, nor any function that indirectly returns allocated
memory. Yet it happily looks up array references without crashing.
How??</p>
<p>One might be tempted to think that this program would be highly
non-portable because of such insane hacks. However, it has been tested
and proven to work on the following architectures:</p>
<p>It is comprehensible that the program can achieve branching and looping using
only boolean expressions and recursion. But HOW does the program STORE DATA???
There are no variables of any kind in the program except for the two arguments
to <code>main()</code>. There are certainly no arrays declared anywhere. The program does
not call any memory allocation routines, nor any function that indirectly
returns allocated memory. Yet it happily looks up array references without
crashing. How??</p>
<p>One might be tempted to think that this program would be highly non-portable
because of such insane hacks. However, it has been tested and proven to work
on the following architectures:</p>
<ul>
<li>i386/linux</li>
<li>sparc/solaris</li>
@@ -339,132 +313,107 @@ and proven to work on the following architectures:</p>
<li>ia64/linux</li>
<li>sparc64/linux</li>
</ul>
<p>It probably will also compile and work on many (all?) other *nix
platforms as well. How does it achieve this incredible feat?</p>
<p>It probably will also compile and work on many (all?) other *nix platforms as
well. How does it achieve this incredible feat?</p>
<h3 id="spoiler">SPOILER</h3>
<p>Read the following only if you give up figuring it out :-)</p>
<h4 id="the-evil-hack">The Evil Hack</h4>
<p>The program (ab)uses an implicit assumption underlying practically
all architectures, and that is that parameters to C functions are
implicit local variables allocated on the runtime stack. This runtime
stack is a contiguous section of memory, and therefore, after
<code>N</code> recursive calls of <code>main()</code> to itself, there
is enough room on the stack to store whatever the program desires, so
long as it does not exceed the maximum stack size.</p>
<p>(Theoretically, the runtime stack doesn’t <strong>have</strong> to be
contiguous… but all current architectures that are worth consideration
make this assumption. I submit that this implies this program is 100%
portable, even though theoretically it shouldn’t even work in the first
place.) :-)</p>
<p>There are two types of architectures the program must handle: those
that allocate the stack top-down, and those that allocate the stack
bottom-up. The program correctly detects this at runtime, and adjusts
itself accordingly. :-) (It is a simple matter of testing if the address
of <code>argc</code> in a recursive call is greater or less than in the
parent call.)</p>
<p>To avoid having to handle issues of <code>int</code> sizes, memory
alignment, what exactly is on the stack between successive locations of
<code>argc</code>, etc., the program (ab)uses the fact that
<code>argc</code> must necessarily be allocated on an aligned address,
and therefore, the range of memory between two <code>argc</code>s is
aligned, and therefore safe to use as an array of <code>long</code>s.[*]
The program also compares the pointers as <code>long*</code> pointers,
so that it will not have to deal with mapping bytes to larger types. The
initial memory allocation is done by recursively calling
<code>main()</code> until there is enough space on the stack (the exact
number of recursive calls is, of course, architecture-dependent).</p>
<p>[*] <code>long</code> was chosen instead of <code>int</code>, in
order to skirt around pointer-size issues on architectures like ia64. It
really can be made anything large enough to hold both <code>int</code>s
and pointers. <code>:-)</code></p>
<p>After the stack is deemed to have grown deep enough to be a
sufficiently <code>long</code> array (pun intended), the program begins
its real code. It uses <code>argc</code> to keep track of what it’s
supposed to be doing (since <code>main()</code> is the only function),
and <code>argv</code> to point to the base of this array (which is
computed differently based on how the architecture allocates the stack).
Since this fills up the only two variables in the program, everything
else is stored in the <code>MASS</code> [**] array.</p>
<p>The program (ab)uses an implicit assumption underlying practically all
architectures, and that is that parameters to C functions are implicit local
variables allocated on the runtime stack. This runtime stack is a contiguous
section of memory, and therefore, after <code>N</code> recursive calls of <code>main()</code> to
itself, there is enough room on the stack to store whatever the program desires,
so long as it does not exceed the maximum stack size.</p>
<p>(Theoretically, the runtime stack doesn’t <strong>have</strong> to be contiguous… but all
current architectures that are worth consideration make this assumption. I
submit that this implies this program is 100% portable, even though
theoretically it shouldn’t even work in the first place.) :-)</p>
<p>There are two types of architectures the program must handle: those that
allocate the stack top-down, and those that allocate the stack bottom-up. The
program correctly detects this at runtime, and adjusts itself accordingly.
:-) (It is a simple matter of testing if the address of <code>argc</code> in a recursive
call is greater or less than in the parent call.)</p>
<p>To avoid having to handle issues of <code>int</code> sizes, memory alignment, what exactly
is on the stack between successive locations of <code>argc</code>, etc., the program
(ab)uses the fact that <code>argc</code> must necessarily be allocated on an aligned
address, and therefore, the range of memory between two <code>argc</code>s is aligned, and
therefore safe to use as an array of <code>long</code>s.[*] The program also compares the
pointers as <code>long*</code> pointers, so that it will not have to deal with mapping
bytes to larger types. The initial memory allocation is done by recursively
calling <code>main()</code> until there is enough space on the stack (the exact number of
recursive calls is, of course, architecture-dependent).</p>
<p>[*] <code>long</code> was chosen instead of <code>int</code>, in order to skirt around pointer-size
issues on architectures like ia64. It really can be made anything large enough
to hold both <code>int</code>s and pointers. <code>:-)</code></p>
<p>After the stack is deemed to have grown deep enough to be a sufficiently <code>long</code>
array (pun intended), the program begins its real code. It uses <code>argc</code> to keep
track of what it’s supposed to be doing (since <code>main()</code> is the only function),
and <code>argv</code> to point to the base of this array (which is computed differently
based on how the architecture allocates the stack). Since this fills up the
only two variables in the program, everything else is stored in the <code>MASS</code> [**]
array.</p>
<p>[**] for “Memory Allocated by Stack Smashing” :-)</p>
<p>Note that from this point on, all bets are off as to what the
contents of the runtime stack are below the current recursive call to
<code>main()</code>. We are overwriting frame pointers, return
addresses, etc., with data. Hence, the program must never return from
this call, otherwise it will crash horribly. That’s why I had to call
<code>exit()</code> even though it meant I can no longer claim the
program doesn’t need the comma operator. :-) (I was going to skirt
around the issue by indirectly calling <code>exit()</code>, such as via
<code>bsearch()</code> or <code>raise()</code>, but I was getting too
close to the size limit.)</p>
<p>Note that from this point on, all bets are off as to what the contents of the
runtime stack are below the current recursive call to <code>main()</code>. We are
overwriting frame pointers, return addresses, etc., with data. Hence, the
program must never return from this call, otherwise it will crash horribly.
That’s why I had to call <code>exit()</code> even though it meant I can no longer claim the
program doesn’t need the comma operator. :-) (I was going to skirt around the
issue by indirectly calling <code>exit()</code>, such as via <code>bsearch()</code> or <code>raise()</code>, but I
was getting too close to the size limit.)</p>
<h4 id="some-notes-about-the-macros">Some notes about the macros</h4>
<p>In spite of the frightening appearance, it is probably easiest to
understand the code in its original form. (Don’t even try running
<code>indent</code> on it: on my system it chokes and complains about
nesting errors.)</p>
<p>Most of the <code>#define</code>s are just to keep the code size
down, due to the abusive amounts of type casting employed. The others
define a bizarre “programming language” (in the crudest, most twisted
sense of the word) that the author used to write this mess.</p>
<p><code>R(i)</code> and <code>W(i,j)</code> are macros to read/write
the <code>i</code>th position of the <code>MASS</code>.</p>
<p><code>A(i)</code> retrieves the <code>i</code>th command-line
argument. This is slightly tricky, because by the time the
<code>MASS</code> is setup, we no longer have access to the original
values of <code>argc</code> and <code>argv</code>. So what is done is
that the initial memory allocation code will save <code>argc</code> and
<code>argv</code> into positions 8 and 9 in the <code>MASS</code> after
the allocation. It does this by using <code>argv</code>, which at that
time contains a pointer to the top-level <code>argc</code>, to compute
the location of the top-level <code>argv</code>. This is done before the
rest of the <code>MASS</code> is used, since otherwise they may be
overwritten.</p>
<p><code>do(x,y)</code> has nothing to do with <code>do</code> loops.
:-) It defines a “state” in <code>main()</code>, essentially, what to do
when <code>main()</code> is called with <code>argc</code> containing a
particular value. (This is why the user must never run the program with
more than 3 arguments. :-) The state number is <code>x</code>, and
<code>y</code> is the code. The program’s boolean expression consists of
a number of states <code>&amp;&amp;</code>d together. Within each state,
it is assumed that statements are separated by <code>||</code>. All
statements are assumed to evaluate to false. This makes it easy to write
conditional statements: <code>if (a) { b } ...</code> can simply be
written <code>a &amp;&amp; b || ...</code>. All states created by
<code>do(x,y)</code> are assumed to evaluate to false. There is only 1
state which can return true or false: state 5, a “manually-implemented”
state which determines whether the system uses top-down or bottom-up
stack allocation. It’s the only state that needs to return a value from
the boolean expression, since once the <code>MASS</code> is initialized
any return value can simply be stored in a well-known location in the
<code>MASS</code>.</p>
<p><code>if(p,q,r,s)</code> is, in fact, an <code>if</code> statement.
:-) It is equivalent to:</p>
<p>In spite of the frightening appearance, it is probably easiest to understand
the code in its original form. (Don’t even try running <code>indent</code> on it: on my
system it chokes and complains about nesting errors.)</p>
<p>Most of the <code>#define</code>s are just to keep the code size down, due to the abusive
amounts of type casting employed. The others define a bizarre “programming
language” (in the crudest, most twisted sense of the word) that the author
used to write this mess.</p>
<p><code>R(i)</code> and <code>W(i,j)</code> are macros to read/write the <code>i</code>th position of the <code>MASS</code>.</p>
<p><code>A(i)</code> retrieves the <code>i</code>th command-line argument. This is slightly tricky,
because by the time the <code>MASS</code> is setup, we no longer have access to the
original values of <code>argc</code> and <code>argv</code>. So what is done is that the initial memory
allocation code will save <code>argc</code> and <code>argv</code> into positions 8 and 9 in the <code>MASS</code>
after the allocation. It does this by using <code>argv</code>, which at that time contains
a pointer to the top-level <code>argc</code>, to compute the location of the top-level
<code>argv</code>. This is done before the rest of the <code>MASS</code> is used, since otherwise they
may be overwritten.</p>
<p><code>do(x,y)</code> has nothing to do with <code>do</code> loops. :-) It defines a “state” in <code>main()</code>,
essentially, what to do when <code>main()</code> is called with <code>argc</code> containing a
particular value. (This is why the user must never run the program with more
than 3 arguments. :-) The state number is <code>x</code>, and <code>y</code> is the code. The program’s
boolean expression consists of a number of states <code>&amp;&amp;</code>d together. Within each
state, it is assumed that statements are separated by <code>||</code>. All statements are
assumed to evaluate to false. This makes it easy to write conditional
statements: <code>if (a) { b } ...</code> can simply be written <code>a &amp;&amp; b || ...</code>. All
states created by <code>do(x,y)</code> are assumed to evaluate to false. There is only 1
state which can return true or false: state 5, a “manually-implemented” state
which determines whether the system uses top-down or bottom-up stack
allocation. It’s the only state that needs to return a value from the boolean
expression, since once the <code>MASS</code> is initialized any return value can simply be
stored in a well-known location in the <code>MASS</code>.</p>
<p><code>if(p,q,r,s)</code> is, in fact, an <code>if</code> statement. :-) It is equivalent to:</p>
<div class="sourceCode" id="cb16"><pre class="sourceCode c"><code class="sourceCode c"><span id="cb16-1"><a href="#cb16-1" aria-hidden="true" tabindex="-1"></a><span class="cf">if</span> <span class="op">(</span>p<span class="op">)</span> <span class="op">{</span> q<span class="op">;</span> r <span class="op">}</span> <span class="cf">else</span> <span class="op">{</span>s<span class="op">}</span></span></code></pre></div>
<p>Why are <code>q</code> and <code>r</code> split up? Because it’s
cleaner (in whatever twisted sense of the word that can be applied to an
IOCCC entry) to implement using boolean expressions. Keep in mind that
all statements are assumed to evaluate to false. The proof that this
macro in fact implements an <code>if-then-else</code> construct is left
as an exercise for the reader.</p>
<p><code>while(x,y,z)</code> is actually a <code>while</code> loop after
all. :-) It implements the loop using, of course, recursive calls to
<code>main()</code>. However, this macro doesn’t actually run a
<code>while</code> loop; it implements the loop in the state numbered
<code>x</code>. It is used for defining a <code>while</code> loop, which
can then be called from another state using <code>f(x)</code>. (The
reason we can’t directly implement a <code>while</code> loop inside
another state ought to be clear: we can’t recursively call
<code>main()</code> to enter into the middle of a state.)</p>
<p>However, it <em>is</em> possible to implement a <code>for</code> loop
directly inside a state! The <code>for(s,i,x,y,z,Z)</code> macro does
exactly this. Well, actually, technically speaking this macro can only
be used as the last thing in a state, because it secretly closes the
current state and opens a new one behind the programmer’s back. :-) Its
intended usage is this: <code>s</code> is the state number for the loop
body, and <code>i</code> is the index variable (well, the index into the
<code>MASS</code> of the index variable); <code>x</code> and
<code>y-1</code> define the starting and ending values of
<code>i</code>, and <code>z</code> is the loop body. <code>Z</code> is
the post-loop code in the current state. For example:</p>
<p>Why are <code>q</code> and <code>r</code> split up? Because it’s cleaner (in whatever twisted sense of
the word that can be applied to an IOCCC entry) to implement using boolean
expressions. Keep in mind that all statements are assumed to evaluate to
false. The proof that this macro in fact implements an <code>if-then-else</code> construct
is left as an exercise for the reader.</p>
<p><code>while(x,y,z)</code> is actually a <code>while</code> loop after all. :-) It implements the loop
using, of course, recursive calls to <code>main()</code>. However, this macro doesn’t
actually run a <code>while</code> loop; it implements the loop in the state numbered <code>x</code>. It
is used for defining a <code>while</code> loop, which can then be called from another state
using <code>f(x)</code>. (The reason we can’t directly implement a <code>while</code> loop inside
another state ought to be clear: we can’t recursively call <code>main()</code> to enter
into the middle of a state.)</p>
<p>However, it <em>is</em> possible to implement a <code>for</code> loop directly inside a state! The
<code>for(s,i,x,y,z,Z)</code> macro does exactly this. Well, actually, technically speaking
this macro can only be used as the last thing in a state, because it secretly
closes the current state and opens a new one behind the programmer’s back.
:-) Its intended usage is this: <code>s</code> is the state number for the loop body, and
<code>i</code> is the index variable (well, the index into the <code>MASS</code> of the index
variable); <code>x</code> and <code>y-1</code> define the starting and ending values of <code>i</code>, and <code>z</code>
is the loop body. <code>Z</code> is the post-loop code in the current state. For example:</p>
<div class="sourceCode" id="cb17"><pre class="sourceCode c"><code class="sourceCode c"><span id="cb17-1"><a href="#cb17-1" aria-hidden="true" tabindex="-1"></a><span class="cf">for</span><span class="op">(</span>s<span class="op">,</span>i<span class="op">,</span> <span class="dv">0</span><span class="op">,</span> <span class="dv">10</span><span class="op">,</span></span>
<span id="cb17-2"><a href="#cb17-2" aria-hidden="true" tabindex="-1"></a>some_code <span class="op">,</span></span>
<span id="cb17-3"><a href="#cb17-3" aria-hidden="true" tabindex="-1"></a>other_code<span class="op">)</span></span></code></pre></div>
@@ -473,29 +422,25 @@ the post-loop code in the current state. For example:</p>
<span id="cb18-2"><a href="#cb18-2" aria-hidden="true" tabindex="-1"></a> some_code<span class="op">;</span></span>
<span id="cb18-3"><a href="#cb18-3" aria-hidden="true" tabindex="-1"></a><span class="op">}</span></span>
<span id="cb18-4"><a href="#cb18-4" aria-hidden="true" tabindex="-1"></a>other_code<span class="op">;</span></span></code></pre></div>
<p>Note the “wrong” indentation in the former: the author prefers to
write it that way, since the analogy to the usual <code>for</code> loop
is clearer. This is why it’s easier to understand the pre-CPP code,
since after CPP, the macro reshuffles <code>some_code</code> after
<code>other_code</code> so that it can close the current state and
define the one containing the loop body. (Have I told you that the
author of this program is horribly, horribly, confused? :-) This
confusion also shows up in the superficial appearance of the program,
which heavily suffers from wrong indentation.)</p>
<p>In spite of all appearances, <code>switch()</code> really is just a
shorthand macro for reducing code size. The evil choice of macro name is
just to instill more confusion into the would-be decipherer of this
entry. :-) After all, <code>case()</code> really <em>is</em> the
equivalent of a <code>case</code> statement, implemented using
<code>&amp;&amp;</code>, and conveniently encapsulating code common to
the cases in the only <code>switch</code> statement in the program,
which is the code that decides what to do with a key press. What could
be more fun than to define such a case in terms of a
<p>Note the “wrong” indentation in the former: the author prefers to write it
that way, since the analogy to the usual <code>for</code> loop is clearer. This is why it’s
easier to understand the pre-CPP code, since after CPP, the macro reshuffles
<code>some_code</code> after <code>other_code</code> so that it can close the current state and define
the one containing the loop body. (Have I told you that the author of this
program is horribly, horribly, confused? :-) This confusion also shows up in
the superficial appearance of the program, which heavily suffers from wrong
indentation.)</p>
<p>In spite of all appearances, <code>switch()</code> really is just a shorthand macro for
reducing code size. The evil choice of macro name is just to instill more
confusion into the would-be decipherer of this entry. :-) After all, <code>case()</code>
really <em>is</em> the equivalent of a <code>case</code> statement, implemented using <code>&amp;&amp;</code>, and
conveniently encapsulating code common to the cases in the only <code>switch</code>
statement in the program, which is the code that decides what to do with a
key press. What could be more fun than to define such a case in terms of a
<code>switch</code>? :-)</p>
<p>Finally, for those who give up deciphering this horribly confused
code, here are the mappings of various locations of the
<code>MASS</code> to their usage in the program, and what the various
state numbers are meant to do:</p>
<p>Finally, for those who give up deciphering this horribly confused code, here
are the mappings of various locations of the <code>MASS</code> to their usage in the
program, and what the various state numbers are meant to do:</p>
<h4 id="mass-usage-map">MASS usage map</h4>
<pre><code>0 | Function return value
1 | Function argument 1
@@ -516,16 +461,14 @@ state numbers are meant to do:</p>
18 | Scratch register used by state 18 :-)
31 | field width for printing tiles
32 | Start of board data</code></pre>
<p>(<strong>CAVEAT:</strong> not all of these mappings ended up in the
final version of the program, mainly due to size limitations which
entailed the trimming off of a lot of neat features in the game. It is
left as an exercise for the reader to figure out which of these are
actually used.)</p>
<p>Note that <code>argv</code> and <code>argc</code> necessarily need to
stay away from lower indices of the <code>MASS</code>, because otherwise
they may overwrite their original values when the memory allocation code
saves them. Index 8 is deemed “safe enough”. (It seems to be on all
tested architectures.)</p>
<p>(<strong>CAVEAT:</strong> not all of these mappings ended up in the final version of the
program, mainly due to size limitations which entailed the trimming off of a
lot of neat features in the game. It is left as an exercise for the reader to
figure out which of these are actually used.)</p>
<p>Note that <code>argv</code> and <code>argc</code> necessarily need to stay away from lower indices of
the <code>MASS</code>, because otherwise they may overwrite their original values when the
memory allocation code saves them. Index 8 is deemed “safe enough”. (It seems
to be on all tested architectures.)</p>
<h4 id="state-number-assignments">State number assignments</h4>
<pre><code>1 | showhelp
2 | showhelp
@@ -543,62 +486,43 @@ tested architectures.)</p>
17 | inner loop of 16.
18 | main loop
19 | checkwin() loop</code></pre>
<p>Note that some of the manually-implemented states (those not
implemented by <code>do()</code>) respond to multiple state numbers.
Also note that states 1-4 conveniently correspond to what the program
should do when 1-4 arguments are given at the command-line. :-)</p>
<p>The original intention was to include a parity-checking routine in
the game so that it will always generate a solvable game. However, size
limits necessitated the removal of this code. And besides, the game is
more addictive when it’s sometimes unsolvable. Especially when it taunts
the user with a smiley. :-)</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>
<p>Note that some of the manually-implemented states (those not implemented by
<code>do()</code>) respond to multiple state numbers. Also note that states 1-4
conveniently correspond to what the program should do when 1-4 arguments are
given at the command-line. :-)</p>
<p>The original intention was to include a parity-checking routine in the game so
that it will always generate a solvable game. However, size limits
necessitated the removal of this code. And besides, the game is more addictive
when it’s sometimes unsolvable. Especially when it taunts the user with a
smiley. :-)</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>
<p>For more information, see: https://creativecommons.org/licenses/by-sa/4.0/</p>
<!-- END: this line ends content for HTML phase 21 by: bin/pandoc-wrapper.sh via bin/md2html.sh -->
<!-- START: this line starts content for HTML phase 22 by: bin/output-index-inventory.sh via bin/md2html.sh -->
<!-- START: this line starts content generated by: bin/output-index-inventory.sh -->
<h1 id="inventory-for-2005anon"><a name="inventory"></a>Inventory for
2005/anon</h1>
<h1 id="inventory-for-2005anon"><a name="inventory"></a>Inventory for 2005/anon</h1>
<p><a href="#top">Jump to top</a></p>
<h2 id="primary-files">Primary files</h2>
<ul>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2005/anon/anon.c">anon.c</a>
- entry source</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2005/anon/Makefile">Makefile</a>
- entry Makefile</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2005/anon/anon.alt.c">anon.alt.c</a>
- alternative source</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2005/anon/anon.orig.c">anon.orig.c</a>
- original source</li>
<li><a href="2005_anon.tar.bz2">2005_anon.tar.bz2</a> - download entry
source</li>
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2005/anon/anon.c">anon.c</a> - entry source</li>
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2005/anon/Makefile">Makefile</a> - entry Makefile</li>
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2005/anon/anon.alt.c">anon.alt.c</a> - alternative source</li>
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2005/anon/anon.orig.c">anon.orig.c</a> - original source</li>
<li><a href="2005_anon.tar.bz2">2005_anon.tar.bz2</a> - download entry source</li>
</ul>
<h2 id="secondary-files">Secondary files</h2>
<ul>
<li><a href="index.html">index.html</a> - entry home page</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2005/anon/.entry.json">.entry.json</a>
- description of entry in JSON</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2005/anon/.gitignore">.gitignore</a>
- list of files that should not be committed under git</li>
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2005/anon/.entry.json">.entry.json</a> - description of entry in JSON</li>
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2005/anon/.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/2005/anon/README.md">README.md</a>
- markdown source for index.html</li>
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2005/anon/README.md">README.md</a> - markdown source for index.html</li>
</ul>
<!-- END: next line ends content generated by: bin/output-index-inventory.sh -->
+85 -127
View File
@@ -129,9 +129,9 @@
<h2 id="author"><a name="author"></a>Author:</h2>
<ul>
<li>Name: <a href="../../authors.html#Francois_Boutines">Francois
Boutines</a><br> Location: <a href="../../location.html#FR">FR</a> -
<em>French Republic</em> (<em>France</em>) <br><br></li>
<li>Name: <a href="../../authors.html#Francois_Boutines">Francois Boutines</a><br>
Location: <a href="../../location.html#FR">FR</a> - <em>French Republic</em> (<em>France</em>)
<br><br></li>
</ul>
<!-- END: next line ends content generated by: bin/output-index-author.sh -->
@@ -142,71 +142,61 @@ Boutines</a><br> Location: <a href="../../location.html#FR">FR</a> -
<h2 id="to-build">To build:</h2>
<div class="sourceCode" id="cb1"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb1-1"><a href="#cb1-1" aria-hidden="true" tabindex="-1"></a><span class="fu">make</span></span></code></pre></div>
<h2 id="to-use">To use:</h2>
<p>You will need an <a
href="https://www.w3.org/TR/SVG11/expanded-toc.html">SVG</a> viewer or a
converter like <a
href="https://imagemagick.org/index.php">ImageMagick</a>’s
<code>convert</code>. See <a href="../../faq.html#imagemagick">FAQ 3.17
- How do I compile and install ImageMagick for entries that require
it?</a>.</p>
<p>Look here to find some <a
href="https://www.w3.org/Graphics/SVG/WG/wiki/Implementations">SVG
Viewer Implementations</a>.</p>
<p>You will need an <a href="https://www.w3.org/TR/SVG11/expanded-toc.html">SVG</a> viewer or
a converter like <a href="https://imagemagick.org/index.php">ImageMagick</a>’s <code>convert</code>.
See <a href="../../faq.html#imagemagick">FAQ 3.17 - How do I compile and install ImageMagick for entries that
require it?</a>.</p>
<p>Look here to find some <a href="https://www.w3.org/Graphics/SVG/WG/wiki/Implementations">SVG Viewer
Implementations</a>.</p>
<div class="sourceCode" id="cb2"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb2-1"><a href="#cb2-1" aria-hidden="true" tabindex="-1"></a><span class="ex">./boutines</span> <span class="op">&lt;</span> input <span class="op">&gt;</span> output.svg</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 <code>ruby</code> is installed <a href="try.sh">try.sh</a> will
generate an SVG file by:</p>
<p>If <code>ruby</code> is installed <a href="try.sh">try.sh</a> will generate an SVG file by:</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">ruby</span> <span class="at">-e</span> <span class="st">&#39;20.times{puts &quot;#{rand} #{rand}&quot;}&#39;</span> <span class="kw">|</span> <span class="ex">./boutines</span> <span class="op">&gt;</span> test.svg</span></code></pre></div>
<p>It will also create an SVG file with the file <a
href="input.txt">input.txt</a>.</p>
<p>The script will check if <code>convert</code> is available and if so
it will try converting the SVG file(s) to PNG file(s) which you should
be able to view in most any graphics viewer, editor or web browser.</p>
<p>If you have a program that opens <a
href="https://www.w3.org/TR/SVG11/expanded-toc.html">SVG</a> files then
you could open the <code>test.svg</code> and <code>result.svg</code>
files directly. An example program is <a
href="https://inkscape.org">Inkscape</a>. See the <a
href="https://www.w3.org/Graphics/SVG/WG/wiki/Implementations">list</a>
cited above for others.</p>
<p>It will also create an SVG file with the file <a href="input.txt">input.txt</a>.</p>
<p>The script will check if <code>convert</code> is available and if so it will try converting
the SVG file(s) to PNG file(s) which you should be able to view in most any
graphics viewer, editor or web browser.</p>
<p>If you have a program that opens
<a href="https://www.w3.org/TR/SVG11/expanded-toc.html">SVG</a> files then you could open
the <code>test.svg</code> and <code>result.svg</code> files directly. An example program is
<a href="https://inkscape.org">Inkscape</a>. See the
<a href="https://www.w3.org/Graphics/SVG/WG/wiki/Implementations">list</a> cited above for
others.</p>
<h2 id="judges-remarks">Judges’ remarks:</h2>
<p>Can you explain the author’s remark “[generated files] are not as
scalable as their name suggests”?</p>
<p>Can you explain the author’s remark “[generated files] are not as scalable as
their name suggests”?</p>
<h2 id="authors-remarks">Author’s remarks:</h2>
<p><em>In memory of my father Pierre Boutines-Vignard.</em></p>
<h3 id="walk-through">Walk-through</h3>
<p>My program works as follows:</p>
<h4 id="input">Input</h4>
<p>A list of 2D points in the <a
href="https://en.wikipedia.org/wiki/Unit_square">unit square</a>.</p>
<p>A list of 2D points in the <a href="https://en.wikipedia.org/wiki/Unit_square">unit
square</a>.</p>
<h4 id="output">Output</h4>
<p>A <a href="https://en.wikipedia.org/wiki/Voronoi_diagram">Voronoi
diagram</a> of the set as an <a
href="https://www.w3.org/TR/SVG11/expanded-toc.html">SVG</a> stream.</p>
<p>A <a href="https://en.wikipedia.org/wiki/Voronoi_diagram">Voronoi diagram</a> of the set as
an <a href="https://www.w3.org/TR/SVG11/expanded-toc.html">SVG</a> stream.</p>
<p>This will possibly save a compressed SVG file and may be useful:</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">./boutines</span> <span class="kw">|</span> <span class="fu">gzip</span> <span class="op">&gt;</span> result.svg.gz</span></code></pre></div>
<p>Input consists of a list of floating points values separated by
whitespaces (ranging preferably in <code>[0,1]</code>). Alternating a
horizontal coordinate, a whitespace then the other coordinate (pointing
downwards in the resulting graph) and a newline will just go fine:</p>
<p>Input consists of a list of floating points values separated by whitespaces
(ranging preferably in <code>[0,1]</code>). Alternating a horizontal coordinate, a
whitespace then the other coordinate (pointing downwards in the resulting
graph) and a newline will just go fine:</p>
<pre><code>0 0
0 1
1 0
1 1
.5 .5</code></pre>
<p>Strictly speaking, you have to provide a <strong>set</strong> of
points. If there are duplicates in the list, there is no guarantee on
the one to be shown (in addition their labels will overlap) in the
resulting colored <a
href="https://en.wikipedia.org/wiki/Voronoi_diagram">Voronoi
<p>Strictly speaking, you have to provide a <strong>set</strong> of points. If there are
duplicates in the list, there is no guarantee on the one to be shown (in
addition their labels will overlap) in the resulting colored <a href="https://en.wikipedia.org/wiki/Voronoi_diagram">Voronoi
diagram</a>.</p>
<h3 id="caution">Caution</h3>
<p>This program might have been a lot shorter, but nearly impractical
even for medium sized datasets. On the other hand it could have been a
lot faster, but hard to qualify under the IOCCC size limit. So guess
what I did? A compromise favoring innermost obfuscation, sacrificing
sometimes speed and other tedious factors.</p>
<p>This program might have been a lot shorter, but nearly impractical even for
medium sized datasets. On the other hand it could have been a lot faster, but
hard to qualify under the IOCCC size limit. So guess what I did? A compromise
favoring innermost obfuscation, sacrificing sometimes speed and other tedious
factors.</p>
<p>Therefore this entry is limited to</p>
<blockquote>
<figure>
@@ -214,33 +204,29 @@ sometimes speed and other tedious factors.</p>
<figcaption aria-hidden="true">floor(-1)</figcaption>
</figure>
</blockquote>
<p>points and won’t even be suitable for more than a few thousand;
although generated files did pass the <a
href="https://validator.w3.org/#validate_by_upload+with_options">W3C SVG
Validator</a>, and are highly compressible, they are not as scalable as
their name suggests… For serious applications about <a
href="https://en.wikipedia.org/wiki/Voronoi_diagram">Voronoi
diagrams</a>, see <a href="http://www.qhull.org/">Qhull</a>, <a
href="https://www.cgal.org">CGAL</a> and the like but you may still
encounter large output volumes (and have to handle some sort of clipping
in order to represent properly infinite regions of the diagram in <a
href="https://www.w3.org/TR/SVG11/expanded-toc.html">SVG</a>).</p>
<p>Beware, compilation may report warnings about precision loss, linting
may be a disaster, but the code should remain portable, and the output
accurate enough for most devices (including many inkjet printers). If
you ever miss precision on a particular dataset or peripheral, you may
want to dive in and let <code>U</code> be the next power of
<code>__LINE__</code>.</p>
<p>NOTE: bad inputs will be sanctioned by the production of the 42nd <a
href="https://en.wikipedia.org/wiki/Mersenne_prime">Mersenne prime</a>
(i.e. 2^25964951 -1); memory will be kept.</p>
<h3 id="why-i-think-this-code-is-obfuscated">Why I think this code is
Obfuscated ?</h3>
<p>points and won’t even be suitable for more than a few thousand; although
generated files did pass the <a href="https://validator.w3.org/#validate_by_upload+with_options">W3C SVG
Validator</a>, and are
highly compressible, they are not as scalable as their name suggests… For
serious applications about <a href="https://en.wikipedia.org/wiki/Voronoi_diagram">Voronoi
diagrams</a>, see
<a href="http://www.qhull.org/">Qhull</a>, <a href="https://www.cgal.org">CGAL</a> and the like but
you may still encounter large output volumes (and have to handle some sort of
clipping in order to represent properly infinite regions of the diagram in
<a href="https://www.w3.org/TR/SVG11/expanded-toc.html">SVG</a>).</p>
<p>Beware, compilation may report warnings about precision loss, linting may be a
disaster, but the code should remain portable, and the output accurate enough
for most devices (including many inkjet printers). If you ever miss precision
on a particular dataset or peripheral, you may want to dive in and let <code>U</code> be
the next power of <code>__LINE__</code>.</p>
<p>NOTE: bad inputs will be sanctioned by the production of the 42nd <a href="https://en.wikipedia.org/wiki/Mersenne_prime">Mersenne
prime</a> (i.e. 2^25964951 -1);
memory will be kept.</p>
<h3 id="why-i-think-this-code-is-obfuscated">Why I think this code is Obfuscated ?</h3>
<p>I’m quite divided on the subject because I wrote:</p>
<ul>
<li>Clear <a
href="https://www.w3.org/TR/SVG11/expanded-toc.html">SVG</a> keywords
but complicated output statements.</li>
<li>Clear <a href="https://www.w3.org/TR/SVG11/expanded-toc.html">SVG</a> keywords but
complicated output statements.</li>
<li>No nested loops but loads of function calls.</li>
<li>Easy recursion but no clear data structure.</li>
<li>Easy maths but no use of <code>math.h</code>.</li>
@@ -249,91 +235,63 @@ but complicated output statements.</li>
<p>Be sure to check the antepenultimate line of code.</p>
<h3 id="missing-features">Missing Features</h3>
<h4 id="color-control">Color control</h4>
<p>Cell colors are chosen randomly (with a questionable rejection
scheme). It might have been useful to input them along with sites
coordinates, turning the application into a puzzling graphics
engine.</p>
<p>Cell colors are chosen randomly (with a questionable rejection scheme). It
might have been useful to input them along with sites coordinates, turning the
application into a puzzling graphics engine.</p>
<h4 id="site-labelling">Site labelling</h4>
<p>The points are implicitly numbered in the order they were entered
(starting at one). This can be overridden however, via a simple XSL
transformation.</p>
<h4 id="site-radius">Site radius</h4>
<p>The site radius is hardcoded in the code, I still wonder why I did
not design it as a function of the underlying cell’s area (which can be
averaged for free) or at least a command line parameter. Same with the
char set, the viewport and potentially every <a
href="https://www.w3.org/TR/SVG11/expanded-toc.html">SVG</a>
property.</p>
<p>The site radius is hardcoded in the code, I still wonder why I did not
design it as a function of the underlying cell’s area (which can be averaged
for free) or at least a command line parameter. Same with the char set, the
viewport and potentially every
<a href="https://www.w3.org/TR/SVG11/expanded-toc.html">SVG</a> property.</p>
<h3 id="see-also">See Also</h3>
<ul>
<li><a href="http://en.wikipedia.org/wiki/Voronoi_diagram">Voronoi at
Wikipedia</a>,</li>
<li><a
href="http://www2.toki.or.id/book/AlgDesignManual/BOOK/BOOK4/NODE187.HTM">An
Excerpt from The Algorithm Design Manual</a>,</li>
<li><a href="http://en.wikipedia.org/wiki/Voronoi_diagram">Voronoi at Wikipedia</a>,</li>
<li><a href="http://www2.toki.or.id/book/AlgDesignManual/BOOK/BOOK4/NODE187.HTM">An Excerpt from The Algorithm Design Manual</a>,</li>
<li><a href="http://www.snibbe.com/scott/bf">Voronoi and Art</a></li>
</ul>
<h3 id="example-output">Example Output</h3>
<blockquote>
<figure>
<img src="Voronoi.png"
alt="Voronoi diagram of two regular pentagon vertices" />
<figcaption aria-hidden="true">Voronoi diagram of two regular pentagon
vertices</figcaption>
<img src="Voronoi.png" alt="Voronoi diagram of two regular pentagon vertices" />
<figcaption aria-hidden="true">Voronoi diagram of two regular pentagon vertices</figcaption>
</figure>
</blockquote>
<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>
<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>
<p>For more information, see: https://creativecommons.org/licenses/by-sa/4.0/</p>
<!-- END: this line ends content for HTML phase 21 by: bin/pandoc-wrapper.sh via bin/md2html.sh -->
<!-- START: this line starts content for HTML phase 22 by: bin/output-index-inventory.sh via bin/md2html.sh -->
<!-- START: this line starts content generated by: bin/output-index-inventory.sh -->
<h1 id="inventory-for-2005boutines"><a name="inventory"></a>Inventory
for 2005/boutines</h1>
<h1 id="inventory-for-2005boutines"><a name="inventory"></a>Inventory for 2005/boutines</h1>
<p><a href="#top">Jump to top</a></p>
<h2 id="primary-files">Primary files</h2>
<ul>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2005/boutines/boutines.c">boutines.c</a>
- entry source</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2005/boutines/Makefile">Makefile</a>
- entry Makefile</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2005/boutines/boutines.orig.c">boutines.orig.c</a>
- original source</li>
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2005/boutines/boutines.c">boutines.c</a> - entry source</li>
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2005/boutines/Makefile">Makefile</a> - entry Makefile</li>
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2005/boutines/boutines.orig.c">boutines.orig.c</a> - original source</li>
<li><a href="Voronoi.png">Voronoi.png</a> - output example</li>
<li><a href="eqn.png">eqn.png</a> - equation limit for entry</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2005/boutines/input.txt">input.txt</a>
- sample input</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2005/boutines/try.sh">try.sh</a>
- how to run</li>
<li><a href="2005_boutines.tar.bz2">2005_boutines.tar.bz2</a> - download
entry source</li>
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2005/boutines/input.txt">input.txt</a> - sample input</li>
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2005/boutines/try.sh">try.sh</a> - how to run</li>
<li><a href="2005_boutines.tar.bz2">2005_boutines.tar.bz2</a> - download entry source</li>
</ul>
<h2 id="secondary-files">Secondary files</h2>
<ul>
<li><a href="index.html">index.html</a> - entry home page</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2005/boutines/.entry.json">.entry.json</a>
- description of entry in JSON</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2005/boutines/.gitignore">.gitignore</a>
- list of files that should not be committed under git</li>
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2005/boutines/.entry.json">.entry.json</a> - description of entry in JSON</li>
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2005/boutines/.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/2005/boutines/README.md">README.md</a>
- markdown source for index.html</li>
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2005/boutines/README.md">README.md</a> - markdown source for index.html</li>
</ul>
<!-- END: next line ends content generated by: bin/output-index-inventory.sh -->
+44 -69
View File
@@ -129,9 +129,9 @@
<h2 id="author"><a name="author"></a>Author:</h2>
<ul>
<li>Name: <a href="../../authors.html#V_Chia">V. Chia</a><br> Location:
<a href="../../location.html#SG">SG</a> - <em>Republic of Singapore</em>
(<em>Singapore</em>) <br><br></li>
<li>Name: <a href="../../authors.html#V_Chia">V. Chia</a><br>
Location: <a href="../../location.html#SG">SG</a> - <em>Republic of Singapore</em> (<em>Singapore</em>)
<br><br></li>
</ul>
<!-- END: next line ends content generated by: bin/output-index-author.sh -->
@@ -144,88 +144,63 @@
<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">./chia</span></span></code></pre></div>
<h2 id="judges-remarks">Judges’ remarks:</h2>
<p>Have you had your morning cup of Java? You might want a second cup
before parsing this entry. And give your C pre-processor a triple shot
as it tries to handle parameters for “stringification”.</p>
<p>Have you had your morning cup of Java? You might want a
second cup before parsing this entry. And give your C
pre-processor a triple shot as it tries to handle parameters
for “stringification”.</p>
<h2 id="authors-remarks">Author’s remarks:</h2>
<p>Two things inspired this entry. First, there were the C programs
which were <code>#define</code>’d to look like <a
href="https://en.wikipedia.org/wiki/Pascal_(programming_language)">Pascal</a>
or <a href="https://en.wikipedia.org/wiki/Visual_Basic_(classic)">Visual
Basic</a>: the <a
href="https://en.wikipedia.org/wiki/Bourne_shell">/bin/sh</a> code from
<a href="https://en.wikipedia.org/wiki/Version_7_Unix">V7 Unix</a>
(which reportedly was the motivation behind this contest!), the <a
href="http://dunfield.classiccmp.org/dos/val_src.zip">VAL Linker</a> by
David Troendle, the <a
href="../../2000/primenum/index.html">2000/primenum</a> IOCCC entry, …
Looking at these programs, I thought, “hmm… if it’s possible to make C
code look like some weird cross between Pascal, VB, and COBOL, then how
about making C code look like some other language?”</p>
<p>As chance would have it, I was writing some <a
href="https://en.wikipedia.org/wiki/Java_(programming_language)">Java</a>
code at that time, and one of my net friends was also working on someone
else’s Java code. We both hated Java; indeed, I hated Java so much that
I was tired of hating it. Then I remembered my earlier idea: “Of course!
Why not write C code that looks like Java? And poke fun at Java while
I’m at it? All ye behold, as I turn anger into action! PH34R MII!!!!!!!”
And so, this entry was born. :-)</p>
<p>Besides carrying a revolutionary message in the comments, this entry
also draws a spiffy little <a
href="https://en.wikipedia.org/wiki/Koch_snowflake">Koch snowflake
fractal</a> on the screen, with the help of <a
href="https://en.wikipedia.org/wiki/ANSI_escape_code">ANSI escape
sequences</a>.</p>
<p>The code requires a preprocessor that can stomach all kinds of
nonsense that are passed as parameters to macros for stringification.
GNU <a href="https://en.wikipedia.org/wiki/C_preprocessor">cpp</a>
handles such things just fine, but certain broken preprocessors may
decide to freak out when they see macro parameters that don’t look like
C tokens.</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>
<p>Two things inspired this entry. First, there were the C programs which were
<code>#define</code>’d to look like <a href="https://en.wikipedia.org/wiki/Pascal_(programming_language)">Pascal</a> or <a href="https://en.wikipedia.org/wiki/Visual_Basic_(classic)">Visual Basic</a>: the
<a href="https://en.wikipedia.org/wiki/Bourne_shell">/bin/sh</a> code from <a href="https://en.wikipedia.org/wiki/Version_7_Unix">V7
Unix</a> (which reportedly was the
motivation behind this contest!), the <a href="http://dunfield.classiccmp.org/dos/val_src.zip">VAL
Linker</a> by David Troendle, the
<a href="../../2000/primenum/index.html">2000/primenum</a> IOCCC entry, … Looking at these
programs, I thought, “hmm… if it’s possible to make C code look like some
weird cross between Pascal, VB, and COBOL, then how about making C code look
like some other language?”</p>
<p>As chance would have it, I was writing some <a href="https://en.wikipedia.org/wiki/Java_(programming_language)">Java</a> code at that time, and one of
my net friends was also working on someone else’s Java code. We both hated
Java; indeed, I hated Java so much that I was tired of hating it. Then I
remembered my earlier idea: “Of course! Why not write C code that looks like
Java? And poke fun at Java while I’m at it? All ye behold, as I turn anger
into action! PH34R MII!!!!!!!” And so, this entry was born. :-)</p>
<p>Besides carrying a revolutionary message in the comments, this entry also
draws a spiffy little <a href="https://en.wikipedia.org/wiki/Koch_snowflake">Koch snowflake
fractal</a> on the screen, with the help of
<a href="https://en.wikipedia.org/wiki/ANSI_escape_code">ANSI escape sequences</a>.</p>
<p>The code requires a preprocessor that can stomach all kinds of nonsense that
are passed as parameters to macros for stringification. GNU
<a href="https://en.wikipedia.org/wiki/C_preprocessor">cpp</a> handles such
things just fine, but certain broken preprocessors may decide to freak out
when they see macro parameters that don’t look like C tokens.</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>
<p>For more information, see: https://creativecommons.org/licenses/by-sa/4.0/</p>
<!-- END: this line ends content for HTML phase 21 by: bin/pandoc-wrapper.sh via bin/md2html.sh -->
<!-- START: this line starts content for HTML phase 22 by: bin/output-index-inventory.sh via bin/md2html.sh -->
<!-- START: this line starts content generated by: bin/output-index-inventory.sh -->
<h1 id="inventory-for-2005chia"><a name="inventory"></a>Inventory for
2005/chia</h1>
<h1 id="inventory-for-2005chia"><a name="inventory"></a>Inventory for 2005/chia</h1>
<p><a href="#top">Jump to top</a></p>
<h2 id="primary-files">Primary files</h2>
<ul>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2005/chia/chia.c">chia.c</a>
- entry source</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2005/chia/Makefile">Makefile</a>
- entry Makefile</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2005/chia/chia.orig.c">chia.orig.c</a>
- original source</li>
<li><a href="2005_chia.tar.bz2">2005_chia.tar.bz2</a> - download entry
source</li>
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2005/chia/chia.c">chia.c</a> - entry source</li>
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2005/chia/Makefile">Makefile</a> - entry Makefile</li>
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2005/chia/chia.orig.c">chia.orig.c</a> - original source</li>
<li><a href="2005_chia.tar.bz2">2005_chia.tar.bz2</a> - download entry source</li>
</ul>
<h2 id="secondary-files">Secondary files</h2>
<ul>
<li><a href="index.html">index.html</a> - entry home page</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2005/chia/.entry.json">.entry.json</a>
- description of entry in JSON</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2005/chia/.gitignore">.gitignore</a>
- list of files that should not be committed under git</li>
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2005/chia/.entry.json">.entry.json</a> - description of entry in JSON</li>
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2005/chia/.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/2005/chia/README.md">README.md</a>
- markdown source for index.html</li>
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2005/chia/README.md">README.md</a> - markdown source for index.html</li>
</ul>
<!-- END: next line ends content generated by: bin/output-index-inventory.sh -->
+105 -147
View File
@@ -130,8 +130,8 @@
<h2 id="author"><a name="author"></a>Author:</h2>
<ul>
<li>Name: <a href="../../authors.html#Gil_Dogon">Gil Dogon</a><br>
Location: <a href="../../location.html#IL">IL</a> - <em>State of
Israel</em> (<em>Israel</em>) <br><br></li>
Location: <a href="../../location.html#IL">IL</a> - <em>State of Israel</em> (<em>Israel</em>)
<br><br></li>
</ul>
<!-- END: next line ends content generated by: bin/output-index-author.sh -->
@@ -141,13 +141,12 @@ Israel</em> (<em>Israel</em>) <br><br></li>
<h2 id="to-build">To build:</h2>
<div class="sourceCode" id="cb1"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb1-1"><a href="#cb1-1" aria-hidden="true" tabindex="-1"></a><span class="fu">make</span></span></code></pre></div>
<p>NOTE: We FORCE the use of -O0 even if someone overrides it because
this entry will not work with it enabled.</p>
<p>NOTE: We FORCE the use of -O0 even if someone overrides it because this entry
will not work with it enabled.</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.html#2005_giljade">2005 giljade bugs</a>.</p>
<p>For more detailed information see <a href="../../bugs.html#2005_giljade">2005 giljade bugs</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">./giljade</span></span></code></pre></div>
<h2 id="try">Try:</h2>
@@ -155,180 +154,139 @@ href="../../bugs.html#2005_giljade">2005 giljade bugs</a>.</p>
<h3 id="self-test-feature-to-try">Self-test feature to 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="ex">./giljade</span> <span class="op">&gt;</span> out</span>
<span id="cb5-2"><a href="#cb5-2" aria-hidden="true" tabindex="-1"></a><span class="ex">./giljade</span> out</span></code></pre></div>
<p>NOTE: <a href="try.sh">try.sh</a> will ask you if you wish to do
this.</p>
<p>NOTE: <a href="try.sh">try.sh</a> will ask you if you wish to do this.</p>
<h2 id="judges-remarks">Judges’ remarks:</h2>
<p>This entry takes editorial in how it deals with its output. After
using <code>vi(1)</code> (or <code>vim(1)</code>) to look at the source,
use <code>vi(1)</code> (or <code>vim(1)</code>) to look at its output.
We especially recommend it on a 78 column xterm while leaning on
<p>This entry takes editorial in how it deals with its output. After using <code>vi(1)</code>
(or <code>vim(1)</code>) to look at the source, use <code>vi(1)</code> (or <code>vim(1)</code>) to look at its
output. We especially recommend it on a 78 column xterm while leaning on
Control-F.</p>
<p>If you really understand expressions, then understand this:</p>
<div class="sourceCode" id="cb6"><pre class="sourceCode c"><code class="sourceCode c"><span id="cb6-1"><a href="#cb6-1" aria-hidden="true" tabindex="-1"></a>s<span class="op">=</span>s<span class="op">^(</span>b<span class="op">=</span>s<span class="op">&amp;</span>s<span class="op">-</span><span class="dv">1</span><span class="op">^</span>s<span class="op">)</span></span></code></pre></div>
<p>… and understand why it is found in the source code.</p>
<h2 id="authors-remarks">Author’s remarks:</h2>
<h3 id="so-what-do-we-have-here">So what do we have here ?</h3>
<p>Just run the executable with no command line args and look at the
output. In order to properly enjoy it you will need two good old
programs: <code>xterm(1)</code> and <code>vi(1)</code> (or
<code>vim(1)</code>). Do the following: open an <code>xterm(1)</code>
with precisely 78 lines, and use the tiny font size for best results.
Then <code>vi(1)</code> (<code>vim(1)</code> will also do) the output.
Type <code>^F</code> repeatedly or hold it down and enjoy the show …</p>
<p>The program solves (very very fast) a sliding block puzzle. There are
many variants of such puzzles which are usually made from wood or
plastic pieces. The start position can be recognized by looking at the
program itself. The goal is to move the big piece (2 by 2) to the center
top, which takes 179 steps in the shortest move sequence.</p>
<p>Notice that the step count used by the program is longer than the
traditional step count for such puzzles, as normally if the same piece
is moved twice in a row it is counted as only one step, but here it is
counted as two.</p>
<p>The printout of the solution however is in a rather unorthodox form,
as can be easily discerned. As you have probably suspected each of the
steps in the solution printout is a C program which compiles to result
in - surprise surprise! - the original (well almost).</p>
<p>Actually, This program is smarter than merely printing ITSELF in 180
different layouts. It is self-improving, in that the programs it prints
have three advantages over the original:</p>
<p>Just run the executable with no command line args and look at the output. In
order to properly enjoy it you will need two good old programs: <code>xterm(1)</code> and
<code>vi(1)</code> (or <code>vim(1)</code>).
Do the following: open an <code>xterm(1)</code> with precisely 78 lines, and use the tiny font
size for best results. Then <code>vi(1)</code> (<code>vim(1)</code> will also do) the output. Type <code>^F</code>
repeatedly or hold it down and enjoy the show …</p>
<p>The program solves (very very fast) a sliding block puzzle. There are many
variants of such puzzles which are usually made from wood or plastic pieces.
The start position can be recognized by looking at the program itself. The
goal is to move the big piece (2 by 2) to the center top, which takes 179
steps in the shortest move sequence.</p>
<p>Notice that the step count used by the program is longer than the traditional
step count for such puzzles, as normally if the same piece is moved twice in a
row it is counted as only one step, but here it is counted as two.</p>
<p>The printout of the solution however is in a rather unorthodox form, as can be
easily discerned. As you have probably suspected each of the steps in the
solution printout is a C program which compiles to result in - surprise
surprise! - the original (well almost).</p>
<p>Actually, This program is smarter than merely printing ITSELF in 180 different
layouts. It is self-improving, in that the programs it prints have three
advantages over the original:</p>
<ol type="1">
<li><p>Their layout is more precise (Notice the annoying <code>\</code>
at the 10’th line of the original program which is actually a ‘layout
bug’).</p></li>
<li><p>Their binary output does not rely on the source file being in the
same directory, and will not dump core if it doesn’t (like the original
does). :)</p></li>
<li><p>They have much more comments (Not very helpful ones
though).</p></li>
<li><p>Their layout is more precise (Notice the annoying <code>\</code> at the 10’th line of
the original program which is actually a ‘layout bug’).</p></li>
<li><p>Their binary output does not rely on the source file being in the same
directory, and will not dump core if it doesn’t (like the original does). :)</p></li>
<li><p>They have much more comments (Not very helpful ones though).</p></li>
</ol>
<p>In addition as we all know bugs can creep up on us in the most
unexpected of places, and checking that indeed the output is composed of
180 legal C programs by hand can be quite tedious, hence the program
also include a self- test mode. Just run it with the output file as
command line argument. It will then try to compile each of the programs
(printing the line number where the program starts). It will stop where
any compilation fails and the culprit program would be in the file
<code>c.c</code>. The exit code of the self-test will be non-zero in
that case. In case this entry wins, I do hope nobody by the name of ‘c’
also wins this year otherwise that part of the program would have to be
<p>In addition as we all know bugs can creep up on us in the most unexpected of
places, and checking that indeed the output is composed of 180 legal C
programs by hand can be quite tedious, hence the program also include a self-
test mode. Just run it with the output file as command line argument. It will
then try to compile each of the programs (printing the line number where the
program starts). It will stop where any compilation fails and the culprit
program would be in the file <code>c.c</code>. The exit code of the self-test will be
non-zero in that case. In case this entry wins, I do hope nobody by the name
of ‘c’ also wins this year otherwise that part of the program would have to be
changed!</p>
<p>Notice that the self-test does not try to run the result of the
compilations but this can easily be done. Try it and diff the output of
any of the 180 results with the original output. Of course all 180
programs also include the self-test mode.</p>
<h3 id="why-i-think-this-program-is-obfuscated">Why I think this program
is obfuscated</h3>
<p>Notice that the self-test does not try to run the result of the compilations
but this can easily be done. Try it and diff the output of any of the 180
results with the original output. Of course all 180 programs also include the
self-test mode.</p>
<h3 id="why-i-think-this-program-is-obfuscated">Why I think this program is obfuscated</h3>
<ul>
<li><p>Because it says so, and twice is better than once!</p></li>
<li><p>All the usual suspects i.e. <code>?:</code>,
<code>&amp;&amp;</code>, <code>||</code>, <code>,</code> used to
compress code length in the noble tradition of this contest, meaningless
one character variable names, etc…</p></li>
<li><p>The board representation is efficiently compressed hence
obfuscated, and the algorithm that is used to generate possible moves is
extremely efficient.</p>
<p>In fact it can compute several moves in parallel on one processor!
Moreover only the most efficient bitwise logical operations, shift,and
subtraction by one is used. No inefficient conditional tests and jumps
are needed in that part of the program.</p></li>
<li><p>The single expression I’m most proud of, and would have submitted
to the category of ‘best obfuscated short expression’ if there was one
is:</p>
<li><p>All the usual suspects i.e. <code>?:</code>, <code>&amp;&amp;</code>, <code>||</code>, <code>,</code> used to compress code
length in the noble tradition of this contest, meaningless one character
variable names, etc…</p></li>
<li><p>The board representation is efficiently compressed hence obfuscated, and
the algorithm that is used to generate possible moves is extremely efficient.</p>
<p>In fact it can compute several moves in parallel on one processor! Moreover
only the most efficient bitwise logical operations, shift,and subtraction by
one is used. No inefficient conditional tests and jumps are needed in that
part of the program.</p></li>
<li><p>The single expression I’m most proud of, and would have submitted to the
category of ‘best obfuscated short expression’ if there was one is:</p>
<pre><code> s=s^(b=s&amp;s-1^s)</code></pre>
<p>Can you figure out what it does (very efficiently) and how it fits in
the scheme of things?</p></li>
<li><p>IMHO the program is easier to understand before running cpp on
it. It is also shorter that way to be sure.</p></li>
<li><p>It even takes care to obfuscate the comments in the output
programs.</p></li>
<li><p>Having the output programs a bit different than the original is
more interesting.</p></li>
<li><p>I have written an earlier version of the program about half a
year ago and when returning to it now I had to sweat quite a lot to
understand the f***ing mess I’ve made.</p></li>
<p>Can you figure out what it does (very efficiently) and how it fits in the
scheme of things?</p></li>
<li><p>IMHO the program is easier to understand before running cpp on it. It is also
shorter that way to be sure.</p></li>
<li><p>It even takes care to obfuscate the comments in the output programs.</p></li>
<li><p>Having the output programs a bit different than the original is more
interesting.</p></li>
<li><p>I have written an earlier version of the program about half a year ago and
when returning to it now I had to sweat quite a lot to understand the f***ing
mess I’ve made.</p></li>
</ul>
<h3 id="known-bugsproblemswarningsportability-issues">Known
Bugs/problems/warnings/portability issues</h3>
<p>Some <code>cpp</code>s issue a warning about empty macro
parameters.</p>
<p><code>-pedantic</code> informs me that ‘ISO C’ does not allow extra ;
outside of a function, and to this I say to ISO what ???</p>
<p><code>-Wall</code> of course will suggest adding a lot of
parenthesis, function prototypes, and remove some unnecessary
expressions, and to this I say: if I listen to you where is my freedom
to obfuscate in style?</p>
<p>As mentioned earlier if you try to run the original program without
its source in the working directory it will dump core.</p>
<p>The program relies heavily on the ASCII coding system (have I seen
this comment before ?). It also implicitly assumes that
<code>sizeof(int) = sizeof(FILE *)</code>. On systems when that is not
the case expect a core dump…</p>
<h3 id="known-bugsproblemswarningsportability-issues">Known Bugs/problems/warnings/portability issues</h3>
<p>Some <code>cpp</code>s issue a warning about empty macro parameters.</p>
<p><code>-pedantic</code> informs me that ‘ISO C’ does not allow extra ; outside of a
function, and to this I say to ISO what ???</p>
<p><code>-Wall</code> of course will suggest adding a lot of parenthesis, function prototypes,
and remove some unnecessary expressions, and to this I say: if I listen to you
where is my freedom to obfuscate in style?</p>
<p>As mentioned earlier if you try to run the original program without its source
in the working directory it will dump core.</p>
<p>The program relies heavily on the ASCII coding system (have I seen this
comment before ?). It also implicitly assumes that <code>sizeof(int) = sizeof(FILE *)</code>. On systems when that is not the case expect a core dump…</p>
<h3 id="challenges">Challenges</h3>
<p>What use are the <code>;;</code> for ?</p>
<p>Why do I use <code>126&amp;</code> in the program? (except for the
rather obvious fact that it serves as comment obfuscater).</p>
<p>Why not write <code>s^=</code> instead of <code>s=s^</code> In the
expression I’m most proud of ?</p>
<p>Why do I use <code>126&amp;</code> in the program? (except for the rather obvious fact that it
serves as comment obfuscater).</p>
<p>Why not write <code>s^=</code> instead of <code>s=s^</code> In the expression I’m most proud of ?</p>
<p>What is <code>40-(h&amp;62)</code> doing ?</p>
<p>Use the program to solve for a different starting position. It is not
that difficult. Notice however that if there are more than two empty
spaces the outputs would not compile as the layout would not be
sufficient to contain the program.</p>
<p>Use the program to solve for board size different than
<code>4*5</code>. That’s a bit more tricky.</p>
<p>Use the program to solve for a different starting position. It is not that
difficult. Notice however that if there are more than two empty spaces the
outputs would not compile as the layout would not be sufficient to contain the
program.</p>
<p>Use the program to solve for board size different than <code>4*5</code>. That’s a bit more
tricky.</p>
<h3 id="hint-for-the-challenges">Hint for the challenges</h3>
<p>Just try to change the program, and use the self test to see what
happens …</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>
<p>Just try to change the program, and use the self test to see what happens …</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>
<p>For more information, see: https://creativecommons.org/licenses/by-sa/4.0/</p>
<!-- END: this line ends content for HTML phase 21 by: bin/pandoc-wrapper.sh via bin/md2html.sh -->
<!-- START: this line starts content for HTML phase 22 by: bin/output-index-inventory.sh via bin/md2html.sh -->
<!-- START: this line starts content generated by: bin/output-index-inventory.sh -->
<h1 id="inventory-for-2005giljade"><a name="inventory"></a>Inventory for
2005/giljade</h1>
<h1 id="inventory-for-2005giljade"><a name="inventory"></a>Inventory for 2005/giljade</h1>
<p><a href="#top">Jump to top</a></p>
<h2 id="primary-files">Primary files</h2>
<ul>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2005/giljade/giljade.c">giljade.c</a>
- entry source</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2005/giljade/Makefile">Makefile</a>
- entry Makefile</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2005/giljade/giljade.orig.c">giljade.orig.c</a>
- original source</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2005/giljade/test.sh">test.sh</a>
- test tool</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2005/giljade/try.sh">try.sh</a>
- how to run</li>
<li><a href="2005_giljade.tar.bz2">2005_giljade.tar.bz2</a> - download
entry source</li>
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2005/giljade/giljade.c">giljade.c</a> - entry source</li>
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2005/giljade/Makefile">Makefile</a> - entry Makefile</li>
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2005/giljade/giljade.orig.c">giljade.orig.c</a> - original source</li>
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2005/giljade/test.sh">test.sh</a> - test tool</li>
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2005/giljade/try.sh">try.sh</a> - how to run</li>
<li><a href="2005_giljade.tar.bz2">2005_giljade.tar.bz2</a> - download entry source</li>
</ul>
<h2 id="secondary-files">Secondary files</h2>
<ul>
<li><a href="index.html">index.html</a> - entry home page</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2005/giljade/.entry.json">.entry.json</a>
- description of entry in JSON</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2005/giljade/.gitignore">.gitignore</a>
- list of files that should not be committed under git</li>
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2005/giljade/.entry.json">.entry.json</a> - description of entry in JSON</li>
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2005/giljade/.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/2005/giljade/README.md">README.md</a>
- markdown source for index.html</li>
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2005/giljade/README.md">README.md</a> - markdown source for index.html</li>
</ul>
<!-- END: next line ends content generated by: bin/output-index-inventory.sh -->
+60 -101
View File
@@ -123,82 +123,56 @@
<!-- END: this line ends content from: inc/before-content.default.html -->
<!-- START: this line starts content for HTML phase 21 by: bin/pandoc-wrapper.sh via bin/md2html.sh -->
<h1 id="eighteenth-international-obfuscated-c-code-contest">Eighteenth
International Obfuscated C Code Contest</h1>
<h1 id="eighteenth-international-obfuscated-c-code-contest">Eighteenth International Obfuscated C Code Contest</h1>
<h2 id="standard-ioccc-stuff">Standard IOCCC stuff</h2>
<p>View the <code>index.html</code> web page for the given winning entry
for information on how on how to compile the entry and how to run the
winning program. Look at the winning source and try to figure how it
does what it does! You may then wish to look at the Author’s remarks for
even more details.</p>
<p>The IOCCC has a web site and now has a number of international
mirrors. The primary site can be found at <a
href="https://www.ioccc.org/"
class="uri">https://www.ioccc.org/</a>.</p>
<p>Use <code>make(1)</code> to compile entries. It is possible that on
non-Unix / non-Linux systems the <code>Makefile</code> needs to be
changed. See the <code>Makefile</code> for details.</p>
<p>This year we included most of the information included by the
submitters in the <code>README.md</code> files (that were used to build
the <code>index.html</code> web pages).</p>
<p>Read over the <code>Makefile</code> for compile/build issues. Your
system may require certain changes (add or remove a library, add or
remove a <code>#define</code>).</p>
<p>View the <code>index.html</code> web page for the given winning entry for information on how
on how to compile the entry and how to run the winning program.
Look at the winning source and try to figure how it does what it does!
You may then wish to look at the Author’s remarks for even more details.</p>
<p>The IOCCC has a web site and now has a number of international mirrors.
The primary site can be found at <a href="https://www.ioccc.org/" class="uri">https://www.ioccc.org/</a>.</p>
<p>Use <code>make(1)</code> to compile entries. It is possible that on non-Unix / non-Linux
systems the <code>Makefile</code> needs to be changed. See the <code>Makefile</code> for details.</p>
<p>This year we included most of the information included by the submitters
in the <code>README.md</code> files (that were used to build the <code>index.html</code> web pages).</p>
<p>Read over the <code>Makefile</code> for compile/build issues. Your system may require
certain changes (add or remove a library, add or remove a <code>#define</code>).</p>
<p>Some ANSI C compilers are not quite as good as they should be. If
yours is lacking, you may need to compile using <code>gcc</code> instead
of your local compiler.</p>
<h2 id="remarks-on-some-of-the-entries">Remarks on some of the
entries</h2>
<p>We believe you will be impressed with this year’s winning
entries.</p>
yours is lacking, you may need to compile using <code>gcc</code> instead of your
local compiler.</p>
<h2 id="remarks-on-some-of-the-entries">Remarks on some of the entries</h2>
<p>We believe you will be impressed with this year’s winning entries.</p>
<p>In particular:</p>
<ul>
<li><p>The <a href="klausler/index.html">Abuse of the rules
(klausler)</a> used local dictionary data to get around the size
limit.</p></li>
<li><p>The <a href="vince/index.html">Most beauteous visuals (vince)</a>
made clever use of <code>{}</code>s and whitespace in their source code
and during execution.</p></li>
<li><p>The <a href="vik/index.html">Most circuitous walk (vik)</a> entry
is just amazing.</p></li>
<li><p>The <a href="toledo/index.html">Best game (toledo)</a> makes full
use of its single function.</p></li>
<li><p>The <a href="sykes/index.html">Best emulator (sykes)</a> may
allow you to reconnect to your first <a
href="https://en.wikipedia.org/wiki/Commodore_PET">PET</a>.</p></li>
<li><p>Our <a href="persano/index.html">Best of Show (persano)</a> this
year was simply (or non-simply :-) ) the best!</p></li>
<li><p>(And we need only mention (parenthetically speaking) that the <a
href="mikeash/index.html">Best use of parenthesis</a> is self
reproducing).</p></li>
<li><p>The <a href="jetro/index.html">Most sonorous output (jetro)</a>
might <code>sound</code> :-) like a good idea.</p></li>
<li><p>The <a href="giljade/index.html">Best 2D puzzle (giljade)</a>
takes editorial license with expressions as well as the with the <a
href="https://en.wikipedia.org/wiki/Vi">vi editor</a>.</p></li>
<li><p>The <a href="chia/index.html">Most ambiguous language (chia)</a>
entry is really a C program.</p></li>
<li><p>The <a href="boutines/index.html">Most superfluous output
(boutines)</a> entry is simply <a
href="Voronoi">Voronoi</a>-lific!</p></li>
<li><p>Try not to have your sense of good coding offended by the <a
href="timwi/index.html">Most discourteous interpreter (timwi)</a>
entry.</p></li>
<li><p>The <a href="mynx/index.html">Best use of the www (mynx)</a>
doesn’t include those letters.</p></li>
<li><p>You will be puzzled by the <a href="anon/index.html">Best 3D
puzzle (anon)</a> entry; we are sure!</p></li>
<li><p>The <a href="aidan/index.html">Most ingenious puzzle solution
(aidan)</a> might puzzle you more while it puzzles out some puzzles: all
in a puzzling way! :-)</p></li>
<li><p>The <a href="klausler/index.html">Abuse of the rules (klausler)</a> used local dictionary data to
get around the size limit.</p></li>
<li><p>The <a href="vince/index.html">Most beauteous visuals (vince)</a> made clever use of <code>{}</code>s and
whitespace in their source code and during execution.</p></li>
<li><p>The <a href="vik/index.html">Most circuitous walk (vik)</a> entry is just amazing.</p></li>
<li><p>The <a href="toledo/index.html">Best game (toledo)</a> makes full use of its single function.</p></li>
<li><p>The <a href="sykes/index.html">Best emulator (sykes)</a> may allow you to reconnect to your first
<a href="https://en.wikipedia.org/wiki/Commodore_PET">PET</a>.</p></li>
<li><p>Our <a href="persano/index.html">Best of Show (persano)</a> this year was simply (or non-simply :-) ) the best!</p></li>
<li><p>(And we need only mention (parenthetically speaking) that the <a href="mikeash/index.html">Best use of
parenthesis</a> is self reproducing).</p></li>
<li><p>The <a href="jetro/index.html">Most sonorous output (jetro)</a> might <code>sound</code> :-) like a good idea.</p></li>
<li><p>The <a href="giljade/index.html">Best 2D puzzle (giljade)</a> takes editorial license with expressions as well as the
with the <a href="https://en.wikipedia.org/wiki/Vi">vi editor</a>.</p></li>
<li><p>The <a href="chia/index.html">Most ambiguous language (chia)</a> entry is really a C program.</p></li>
<li><p>The <a href="boutines/index.html">Most superfluous output (boutines)</a> entry is simply
<a href="Voronoi">Voronoi</a>-lific!</p></li>
<li><p>Try not to have your sense of good coding offended by the <a href="timwi/index.html">Most
discourteous interpreter (timwi)</a> entry.</p></li>
<li><p>The <a href="mynx/index.html">Best use of the www (mynx)</a> doesn’t include those letters.</p></li>
<li><p>You will be puzzled by the <a href="anon/index.html">Best 3D puzzle (anon)</a> entry; we are sure!</p></li>
<li><p>The <a href="aidan/index.html">Most ingenious puzzle solution (aidan)</a> might puzzle you more while it
puzzles out some puzzles: all in a puzzling way! :-)</p></li>
</ul>
<h3 id="remarks-on-some-of-the-losing-entries">Remarks on some of the
losing entries</h3>
<h3 id="remarks-on-some-of-the-losing-entries">Remarks on some of the losing entries</h3>
<p>There were some outstanding entries that did not win. Unfortunately
some very good entries lost because they:</p>
<ul>
<li><p>depended too much on non-portable side effects in expressions;
and/or</p></li>
<li><p>depended too much on non-portable side effects in expressions; and/or</p></li>
<li><p>depended too much on a particular byte order; and/or</p></li>
<li><p>required the use of a special script, data file or pseudo-machine
language that was not supplied with the entry.</p></li>
@@ -206,54 +180,39 @@ language that was not supplied with the entry.</p></li>
<p>We hope the authors of some of those entries will fix and resubmit
them for the next IOCCC.</p>
<h2 id="final-comments">Final Comments</h2>
<p><strong>IMPORTANT NOTE</strong>: See <a
href="../contact.html">contact.html</a> for up to date contact details
as well as details on how to provide fixes to any of the entries. See
also <a href="../faq.html">the IOCCC FAQ</a> for addition information on
the IOCCC.</p>
<p><strong>IMPORTANT NOTE</strong>: See <a href="../contact.html">contact.html</a> for up to date contact details
as well as details on how to provide fixes to any of the entries.
See also <a href="../faq.html">the IOCCC FAQ</a> for addition information on the IOCCC.</p>
<h1 id="copyright-and-license">Copyright and License</h1>
<p>Copyright (c) 2005,2023, Landon Curt Noll and Leonid A. Broukhis. All
Rights Reserved. This work is licensed under a <a
href="https://creativecommons.org/licenses/by-sa/4.0/">Creative Commons
CC BY-SA 4.0 DEED Attribution-ShareAlike 4.0 International</a> license.
If you do use this work in some form, the <a href="../judges.html">IOCCC
judges</a> would appreciate (but does not require) if you were to <a
href="../contact.html">send us a note about your use</a>.</p>
<p>Copyright (c) 2005,2023, Landon Curt Noll and Leonid A. Broukhis. All Rights Reserved.
This work is licensed under a <a href="https://creativecommons.org/licenses/by-sa/4.0/">Creative Commons CC BY-SA 4.0 DEED Attribution-ShareAlike
4.0 International</a> license.
If you do use this work in some form, the <a href="../judges.html">IOCCC judges</a> would appreciate
(but does not require) if you were to <a href="../contact.html">send us a note about your use</a>.</p>
<!-- END: this line ends content for HTML phase 21 by: bin/pandoc-wrapper.sh via bin/md2html.sh -->
<!-- START: this line starts content for HTML phase 22 by: bin/output-year-index.sh via bin/md2html.sh -->
<!-- START: this line starts content generated by: bin/output-year-index.sh -->
<h1
id="winning-entries-of-2005---the-18th-ioccc"><a name=inventory></a><a name=2005></a>Winning
Entries of 2005 - The 18th IOCCC</h1>
<p><strong>Download IOCCC</strong> <a
href="2005/ioccc.2005.tar.bz2">2005 entry source</a></p>
<h1 id="winning-entries-of-2005---the-18th-ioccc"><a name=inventory></a><a name=2005></a>Winning Entries of 2005 - The 18th IOCCC</h1>
<p><strong>Download IOCCC</strong> <a href="2005/ioccc.2005.tar.bz2">2005 entry source</a></p>
<ul>
<li><a href="aidan/index.html">2005/aidan</a> - Most ingenious puzzle
solution</li>
<li><a href="aidan/index.html">2005/aidan</a> - Most ingenious puzzle solution</li>
<li><a href="anon/index.html">2005/anon</a> - Best 3D puzzle</li>
<li><a href="boutines/index.html">2005/boutines</a> - Most superfluous
output</li>
<li><a href="chia/index.html">2005/chia</a> - Most ambiguous
language</li>
<li><a href="boutines/index.html">2005/boutines</a> - Most superfluous output</li>
<li><a href="chia/index.html">2005/chia</a> - Most ambiguous language</li>
<li><a href="giljade/index.html">2005/giljade</a> - Best 2D puzzle</li>
<li><a href="jetro/index.html">2005/jetro</a> - Most sonorous
output</li>
<li><a href="klausler/index.html">2005/klausler</a> - Abuse of the
rules</li>
<li><a href="mikeash/index.html">2005/mikeash</a> - Best use of
parenthesis</li>
<li><a href="jetro/index.html">2005/jetro</a> - Most sonorous output</li>
<li><a href="klausler/index.html">2005/klausler</a> - Abuse of the rules</li>
<li><a href="mikeash/index.html">2005/mikeash</a> - Best use of parenthesis</li>
<li><a href="mynx/index.html">2005/mynx</a> - Best use of the WWW</li>
<li><a href="persano/index.html">2005/persano</a> - Best of Show</li>
<li><a href="sykes/index.html">2005/sykes</a> - Best Emulator</li>
<li><a href="timwi/index.html">2005/timwi</a> - Most discourteous
interpreter</li>
<li><a href="timwi/index.html">2005/timwi</a> - Most discourteous interpreter</li>
<li><a href="toledo/index.html">2005/toledo</a> - Best Game</li>
<li><a href="vik/index.html">2005/vik</a> - Most circuitous walk</li>
<li><a href="vince/index.html">2005/vince</a> - Most beauteous
visuals</li>
<li><a href="vince/index.html">2005/vince</a> - Most beauteous visuals</li>
</ul>
<p> <strong>Jump to:</strong> <a href="#">top</a></p>
+27 -46
View File
@@ -130,8 +130,8 @@
<h2 id="author"><a name="author"></a>Author:</h2>
<ul>
<li>Name: <a href="../../authors.html#Jetro_Lauha">Jetro Lauha</a><br>
Location: <a href="../../location.html#FI">FI</a> - <em>Republic of
Finland </em> (<em>Finland</em>) <br><br></li>
Location: <a href="../../location.html#FI">FI</a> - <em>Republic of Finland </em> (<em>Finland</em>)
<br><br></li>
</ul>
<!-- END: next line ends content generated by: bin/output-index-author.sh -->
@@ -140,71 +140,52 @@ Finland </em> (<em>Finland</em>) <br><br></li>
<!-- START: this line starts content for HTML phase 21 by: bin/pandoc-wrapper.sh via bin/md2html.sh -->
<h2 id="to-build">To build:</h2>
<p>This entry requires SDL. See <a href="../../faq.html#SDL">3.8 - How
do I compile an IOCCC entry that requires SDL1 or SDL2?</a> for
information on how to install it if you haven’t already.</p>
<p>This entry requires SDL. See <a href="../../faq.html#SDL">3.8 - How do I compile an IOCCC entry that
requires SDL1 or SDL2?</a> for information on how to install it if you
haven’t already.</p>
<p>If you have SDL installed:</p>
<div class="sourceCode" id="cb1"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb1-1"><a href="#cb1-1" aria-hidden="true" tabindex="-1"></a><span class="fu">make</span></span></code></pre></div>
<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">./jetro</span></span></code></pre></div>
<h2 id="judges-remarks">Judges’ remarks:</h2>
<p>We have seen entries with SDL graphics in the past, now it’s time for
SDL sound. This entry can even be run on a computer without a sound card
with an appropriate setting of an environment variable - for that you’ll
have to dig into the SDL documentation.</p>
<p>Can you figure out how the notes are encoded and program a different
melody?</p>
<p>We have seen entries with SDL graphics in the past, now it’s time for SDL
sound. This entry can even be run on a computer without a sound card with an
appropriate setting of an environment variable - for that you’ll have to dig
into the SDL documentation.</p>
<p>Can you figure out how the notes are encoded and program a different melody?</p>
<h2 id="authors-remarks">Author’s remarks:</h2>
<p>To compile the entry you need SDL library, which is used only for
audio output. To run the entry make sure you have audio output
available. The entry plays 22KHz 16 bit mono music with a small
softsynth. When the music plays, you can stop the application by
pressing enter, as the code will just wait with one call to
<code>getchar()</code> before it quits.</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>
<p>To compile the entry you need SDL library, which is used only for audio
output. To run the entry make sure you have audio output available. The entry
plays 22KHz 16 bit mono music with a small softsynth. When the music plays,
you can stop the application by pressing enter, as the code will just wait
with one call to <code>getchar()</code> before it quits.</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>
<p>For more information, see: https://creativecommons.org/licenses/by-sa/4.0/</p>
<!-- END: this line ends content for HTML phase 21 by: bin/pandoc-wrapper.sh via bin/md2html.sh -->
<!-- START: this line starts content for HTML phase 22 by: bin/output-index-inventory.sh via bin/md2html.sh -->
<!-- START: this line starts content generated by: bin/output-index-inventory.sh -->
<h1 id="inventory-for-2005jetro"><a name="inventory"></a>Inventory for
2005/jetro</h1>
<h1 id="inventory-for-2005jetro"><a name="inventory"></a>Inventory for 2005/jetro</h1>
<p><a href="#top">Jump to top</a></p>
<h2 id="primary-files">Primary files</h2>
<ul>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2005/jetro/jetro.c">jetro.c</a>
- entry source</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2005/jetro/Makefile">Makefile</a>
- entry Makefile</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2005/jetro/jetro.orig.c">jetro.orig.c</a>
- original source</li>
<li><a href="2005_jetro.tar.bz2">2005_jetro.tar.bz2</a> - download entry
source</li>
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2005/jetro/jetro.c">jetro.c</a> - entry source</li>
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2005/jetro/Makefile">Makefile</a> - entry Makefile</li>
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2005/jetro/jetro.orig.c">jetro.orig.c</a> - original source</li>
<li><a href="2005_jetro.tar.bz2">2005_jetro.tar.bz2</a> - download entry source</li>
</ul>
<h2 id="secondary-files">Secondary files</h2>
<ul>
<li><a href="index.html">index.html</a> - entry home page</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2005/jetro/.entry.json">.entry.json</a>
- description of entry in JSON</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2005/jetro/.gitignore">.gitignore</a>
- list of files that should not be committed under git</li>
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2005/jetro/.entry.json">.entry.json</a> - description of entry in JSON</li>
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2005/jetro/.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/2005/jetro/README.md">README.md</a>
- markdown source for index.html</li>
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2005/jetro/README.md">README.md</a> - markdown source for index.html</li>
</ul>
<!-- END: next line ends content generated by: bin/output-index-inventory.sh -->
+44 -69
View File
@@ -129,9 +129,9 @@
<h2 id="author"><a name="author"></a>Author:</h2>
<ul>
<li>Name: <a href="../../authors.html#Peter_Klausler">Peter
Klausler</a><br> Location: <a href="../../location.html#US">US</a> -
<em>United States of America</em> (<em>United States</em>) <br><br></li>
<li>Name: <a href="../../authors.html#Peter_Klausler">Peter Klausler</a><br>
Location: <a href="../../location.html#US">US</a> - <em>United States of America</em> (<em>United States</em>)
<br><br></li>
</ul>
<!-- END: next line ends content generated by: bin/output-index-author.sh -->
@@ -146,90 +146,65 @@ Klausler</a><br> Location: <a href="../../location.html#US">US</a> -
<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>To reduce the size of the source, include other people’s data. That
is what Peter suggests when he describes how to generate a critical
header file.</p>
<p>To reduce the size of the source, include other people’s data.
That is what Peter suggests when he describes how to generate
a critical header file.</p>
<p>In other words: make use of other words! :-)</p>
<p>Rules might have to be changed!</p>
<h2 id="authors-remarks">Author’s remarks:</h2>
<p>A useful tool to help one appear extra smart and witty when <a
href="https://en.wikipedia.org/wiki/Internet_Relay_Chat">IRCing</a>, or
even to just be highly annoying.</p>
<p>Finds best anagrams for word or phrase given as program arguments.
Use only lower-case letters in these arguments. Output is sorted firstly
in ascending order of word count (fewer words are better) and secondly
in descending order of word length. Pipe the output into
<code>more(1)</code>/<code>less(1)</code>/<code>head(1)</code> and
you’re likely to find the most amusing possibilities in the first few
screenfuls of output. For example,
<code>./klausler fawlty towers | more</code> quickly prints “waterfowl
sty”. The fewer obscure short words in your system’s dictionary, the
better the quality of the output; indeed, all one-letter words apart
from <code>a</code>, <code>i</code>, and <code>s</code> (for plurals)
are ignored when the dictionary is constructed by
<code>make dict.h</code>.</p>
<p>Some history and explanation: When I noticed the call for entries in
this year’s IOCCC, I submitted two of them. I worked on the first one
very hard to obfuscate it beautifully, using a goofy algorithm,
wonderful two’s-complement arithmetic tricks, and cute formatting. It
was a glorious work so lovely as to make even strong men weep in
admiration… but it didn’t win anything. On the other hand, this crappy
little other program, which was only mildly obfuscated from its original
hacked form, took home an award!</p>
<p>I’m embarrassed to admit that I don’t even know which specific rule
this entry has abused. It’s just yet another anagram generator and it
was written very late one night. And now I honestly do not know how it
works, so please don’t ask. Upon reviewing the program after its
unexpected honor, I guess that it’s remarkable only for its complete
lack of macros, sneaky naming, <code>main()</code> recursion, or other
tricks. 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>
<p>A useful tool to help one appear extra smart and witty when
<a href="https://en.wikipedia.org/wiki/Internet_Relay_Chat">IRCing</a>, or even to
just be highly annoying.</p>
<p>Finds best anagrams for word or phrase given as program arguments. Use only
lower-case letters in these arguments. Output is sorted firstly in ascending
order of word count (fewer words are better) and secondly in descending order
of word length. Pipe the output into <code>more(1)</code>/<code>less(1)</code>/<code>head(1)</code> and you’re likely
to find the most amusing possibilities in the first few screenfuls of output.
For example, <code>./klausler fawlty towers | more</code> quickly prints “waterfowl sty”. The
fewer obscure short words in your system’s dictionary, the better the quality
of the output; indeed, all one-letter words apart from <code>a</code>, <code>i</code>, and <code>s</code> (for
plurals) are ignored when the dictionary is constructed by <code>make dict.h</code>.</p>
<p>Some history and explanation: When I noticed the call for entries in this
year’s IOCCC, I submitted two of them. I worked on the first one very hard to
obfuscate it beautifully, using a goofy algorithm, wonderful two’s-complement
arithmetic tricks, and cute formatting. It was a glorious work so lovely as to
make even strong men weep in admiration… but it didn’t win anything. On the
other hand, this crappy little other program, which was only mildly obfuscated
from its original hacked form, took home an award!</p>
<p>I’m embarrassed to admit that I don’t even know which specific rule this entry
has abused. It’s just yet another anagram generator and it was written very
late one night. And now I honestly do not know how it works, so please don’t
ask. Upon reviewing the program after its unexpected honor, I guess that it’s
remarkable only for its complete lack of macros, sneaky naming, <code>main()</code>
recursion, or other tricks. 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>
<p>For more information, see: https://creativecommons.org/licenses/by-sa/4.0/</p>
<!-- END: this line ends content for HTML phase 21 by: bin/pandoc-wrapper.sh via bin/md2html.sh -->
<!-- START: this line starts content for HTML phase 22 by: bin/output-index-inventory.sh via bin/md2html.sh -->
<!-- START: this line starts content generated by: bin/output-index-inventory.sh -->
<h1 id="inventory-for-2005klausler"><a name="inventory"></a>Inventory
for 2005/klausler</h1>
<h1 id="inventory-for-2005klausler"><a name="inventory"></a>Inventory for 2005/klausler</h1>
<p><a href="#top">Jump to top</a></p>
<h2 id="primary-files">Primary files</h2>
<ul>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2005/klausler/klausler.c">klausler.c</a>
- entry source</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2005/klausler/Makefile">Makefile</a>
- entry Makefile</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2005/klausler/klausler.orig.c">klausler.orig.c</a>
- original source</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2005/klausler/try.sh">try.sh</a>
- how to run</li>
<li><a href="2005_klausler.tar.bz2">2005_klausler.tar.bz2</a> - download
entry source</li>
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2005/klausler/klausler.c">klausler.c</a> - entry source</li>
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2005/klausler/Makefile">Makefile</a> - entry Makefile</li>
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2005/klausler/klausler.orig.c">klausler.orig.c</a> - original source</li>
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2005/klausler/try.sh">try.sh</a> - how to run</li>
<li><a href="2005_klausler.tar.bz2">2005_klausler.tar.bz2</a> - download entry source</li>
</ul>
<h2 id="secondary-files">Secondary files</h2>
<ul>
<li><a href="index.html">index.html</a> - entry home page</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2005/klausler/.entry.json">.entry.json</a>
- description of entry in JSON</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2005/klausler/.gitignore">.gitignore</a>
- list of files that should not be committed under git</li>
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2005/klausler/.entry.json">.entry.json</a> - description of entry in JSON</li>
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2005/klausler/.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/2005/klausler/README.md">README.md</a>
- markdown source for index.html</li>
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2005/klausler/README.md">README.md</a> - markdown source for index.html</li>
</ul>
<!-- END: next line ends content generated by: bin/output-index-inventory.sh -->
+89 -131
View File
@@ -130,8 +130,8 @@
<h2 id="author"><a name="author"></a>Author:</h2>
<ul>
<li>Name: <a href="../../authors.html#Michael_Ash">Michael Ash</a><br>
Location: <a href="../../location.html#US">US</a> - <em>United States of
America</em> (<em>United States</em>) <br><br></li>
Location: <a href="../../location.html#US">US</a> - <em>United States of America</em> (<em>United States</em>)
<br><br></li>
</ul>
<!-- END: next line ends content generated by: bin/output-index-author.sh -->
@@ -144,173 +144,131 @@ America</em> (<em>United States</em>) <br><br></li>
<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.html#2005_mikeash">2005 mikeash bugs</a>.</p>
<p>For more detailed information see <a href="../../bugs.html#2005_mikeash">2005 mikeash bugs</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">./mikeash</span></span></code></pre></div>
<p>NOTE: the author stated that they tested this under i386 machines but
this works under 64-bit (x86_64, arm64) machines too.</p>
<p>NOTE: the author stated that they tested this under i386 machines but this works
under 64-bit (x86_64, arm64) machines too.</p>
<h2 id="try">Try:</h2>
<div class="sourceCode" id="cb4"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb4-1"><a href="#cb4-1" aria-hidden="true" tabindex="-1"></a><span class="ex">./try.sh</span></span></code></pre></div>
<h2 id="judges-remarks">Judges’ remarks:</h2>
<p>Having problems speaking code? Do you <a
href="https://en.wikipedia.org/wiki/Lisp_(programming_language)">LISP</a>?
Parenthetically speaking, this entry takes advantage of C99 features,
while speaking parenthetically. Best of all, it self-reproduces!</p>
<p>Having problems speaking code? Do you <a href="https://en.wikipedia.org/wiki/Lisp_(programming_language)">LISP</a>? Parenthetically
speaking, this entry takes advantage of C99 features, while
speaking parenthetically. Best of all, it self-reproduces!</p>
<p>John McCarthy might not have imagined it quite like this! :-)</p>
<h2 id="authors-remarks">Author’s remarks:</h2>
<p>This program is a self-reproducing program, which is on the IOCCC’s
list of discouraged program types. Worse, it’s a self-reproducing
program written in <a
href="https://en.wikipedia.org/wiki/Common_Lisp">Common Lisp</a>. What’s
this doing as an entry to the IOCCC?</p>
<p>This program is a self-reproducing program, which is on the IOCCC’s list
of discouraged program types. Worse, it’s a self-reproducing program
written in <a href="https://en.wikipedia.org/wiki/Common_Lisp">Common Lisp</a>. What’s this
doing as an entry to the IOCCC?</p>
<p>Start over: this program, when compiled with a C99 compiler, is an
interpreter for an extremely limited and highly broken subset of <a
href="https://en.wikipedia.org/wiki/Common_Lisp">Common Lisp</a>.</p>
<p>It requires C99 because of <code>C99</code>’s ability to declare
variables in the initializer of a <code>for</code> loop. Unfortunately,
C99 mode typically warns about implicitly declared functions, and
preprocessor directives prevent the program from being valid <a
href="https://en.wikipedia.org/wiki/Common_Lisp">Common Lisp</a>. As a
interpreter for an extremely limited and highly broken subset of <a href="https://en.wikipedia.org/wiki/Common_Lisp">Common
Lisp</a>.</p>
<p>It requires C99 because of <code>C99</code>’s ability to declare variables in the
initializer of a <code>for</code> loop. Unfortunately, C99 mode typically warns about
implicitly declared functions, and preprocessor directives prevent the program
from being valid <a href="https://en.wikipedia.org/wiki/Common_Lisp">Common Lisp</a>. As a
result, several warnings will be printed about implicit declarations of
functions. There are also warnings about unknown escape sequences in the
constant string, due to different string escape semantics in C and Lisp,
and some implicit integer-to-pointer conversions due to the
implicitly-declared functions.</p>
constant string, due to different string escape semantics in C and Lisp, and
some implicit integer-to-pointer conversions due to the implicitly-declared
functions.</p>
<p>Try:</p>
<div class="sourceCode" id="cb5"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb5-1"><a href="#cb5-1" aria-hidden="true" tabindex="-1"></a><span class="bu">echo</span> <span class="st">&#39;(format t &quot;~s&quot; (+ 2 2 ))&#39;</span> <span class="kw">|</span> <span class="ex">./mikeash</span></span></code></pre></div>
<p>You should see <code>4"</code> echoed on your command prompt. The
<code>"</code> after the 4 and the lack of a newline are due to the
somewhat broken implementation of the format function. More
sophisticated arithmetic expressions may be used:</p>
<p>You should see <code>4"</code> echoed on your command prompt. The <code>"</code> after the 4 and
the lack of a newline are due to the somewhat broken implementation of
the format function. More sophisticated arithmetic expressions may be
used:</p>
<div class="sourceCode" id="cb6"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb6-1"><a href="#cb6-1" aria-hidden="true" tabindex="-1"></a><span class="bu">echo</span> <span class="st">&#39;(format t &quot;~s&quot; (* (+ 2 2 ) (- 5 (/ 9 3 ))))&#39;</span> <span class="kw">|</span> <span class="ex">./mikeash</span></span></code></pre></div>
<p>This evaluates the expression <code>(2+2) * (5 - 9/3)</code> giving
the correct result, <code>8"</code> (with the same issue of no newline
after the <code>"</code>). Note that due to the highly ad-hoc nature of
the tokenizer, the spaces before the closing parentheses are
mandatory.</p>
<p>The program can also be run in an interactive mode, by simply
executing <code>./mikeash</code> and then typing lisp expressions, but
this is difficult due to the lack of proper editing facilities and the
total lack of error recovery in the interpreter. Typos will most likely
crash the program.</p>
<p>Aside from being required to put spaces between tokens and closing
parentheses, there are other limitations on the dialect of <a
href="https://en.wikipedia.org/wiki/Common_Lisp">Common Lisp</a> that
this program understands:</p>
<p>This evaluates the expression <code>(2+2) * (5 - 9/3)</code> giving the correct result,
<code>8"</code> (with the same issue of no newline after the <code>"</code>). Note that due to the
highly ad-hoc nature of the tokenizer, the spaces before the closing parentheses
are mandatory.</p>
<p>The program can also be run in an interactive mode, by simply executing
<code>./mikeash</code> and then typing lisp expressions, but this is difficult due to the
lack of proper editing facilities and the total lack of error recovery in the
interpreter. Typos will most likely crash the program.</p>
<p>Aside from being required to put spaces between tokens and closing parentheses,
there are other limitations on the dialect of <a href="https://en.wikipedia.org/wiki/Common_Lisp">Common
Lisp</a> that this program understands:</p>
<ul>
<li><p>The only built-in functions are <code>defvar</code>,
<code>format</code>, <code>substitute</code>, <code>char-upcase</code>,
<code>+</code>, <code>-</code>, <code>*</code>, and
<code>/</code>.</p></li>
<li><p>Only one variable is available. This variable is called
<code>q</code>, although any symbol name starting with the letter
<code>q</code> will be mapped to this variable.</p></li>
<li><p>Only the first letter of a function name is significant. For
example, <code>format</code>, <code>f</code>, <code>farm</code>, and
various other words starting with <code>f</code> will all map to the
<code>format</code> function.</p></li>
<li><p>The <code>defvar</code> function completely ignores its first
parameter. It will always store the result of evaluating its second
parameter in <code>q</code>. Unlike in <a
href="https://en.wikipedia.org/wiki/Common_Lisp">Common Lisp</a>,
multiple invocations of <code>defvar</code> on the same variable will
overwrite old values.</p></li>
<li><p>Character constants are limited to <code>#\Newline</code> and
single-character constants such as <code>#\x</code>.</p></li>
<li><p>The <code>char-upcase</code> function will give strange results
if passed something other than a lowercase character.</p></li>
<li><p>The <code>format</code> function takes exactly three parameters.
The first parameter is ignored; output always goes to
<code>stdout</code>. The second parameter must have exactly one
<code>~s</code> format specifier in it, and no other format specifiers
are permitted.</p></li>
<li><p>The only built-in functions are <code>defvar</code>, <code>format</code>, <code>substitute</code>,
<code>char-upcase</code>, <code>+</code>, <code>-</code>, <code>*</code>, and <code>/</code>.</p></li>
<li><p>Only one variable is available. This variable is called <code>q</code>, although any
symbol name starting with the letter <code>q</code> will be mapped to this variable.</p></li>
<li><p>Only the first letter of a function name is significant. For example,
<code>format</code>, <code>f</code>, <code>farm</code>, and various other words starting with <code>f</code> will all map to
the <code>format</code> function.</p></li>
<li><p>The <code>defvar</code> function completely ignores its first parameter. It will always
store the result of evaluating its second parameter in <code>q</code>. Unlike in <a href="https://en.wikipedia.org/wiki/Common_Lisp">Common
Lisp</a>, multiple invocations of
<code>defvar</code> on the same variable will overwrite old values.</p></li>
<li><p>Character constants are limited to <code>#\Newline</code> and single-character
constants such as <code>#\x</code>.</p></li>
<li><p>The <code>char-upcase</code> function will give strange results if passed something
other than a lowercase character.</p></li>
<li><p>The <code>format</code> function takes exactly three parameters. The first parameter is
ignored; output always goes to <code>stdout</code>. The second parameter must have exactly
one <code>~s</code> format specifier in it, and no other format specifiers are permitted.</p></li>
<li><p>The arithmetic functions take exactly two parameters.</p></li>
<li><p>All tokens must be separated from a following <code>)</code> by
whitespace.</p></li>
<li><p>A lot of other things. Notably, the language which this program
interprets is nowhere near <a
href="https://en.wikipedia.org/wiki/Turing_completeness">Turing-complete</a>.</p></li>
<li><p>All tokens must be separated from a following <code>)</code> by whitespace.</p></li>
<li><p>A lot of other things. Notably, the language which this program interprets is
nowhere near
<a href="https://en.wikipedia.org/wiki/Turing_completeness">Turing-complete</a>.</p></li>
</ul>
<p>Basically, the <a
href="https://en.wikipedia.org/wiki/Lisp_(programming_language)">LISP</a>
interpreter is good for some basic math operations, and for running
itself. To do the latter, try this:</p>
<p>Basically, the <a href="https://en.wikipedia.org/wiki/Lisp_(programming_language)">LISP</a> interpreter is good for some basic math operations, and
for running itself. To do the latter, try 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">./mikeash</span> <span class="op">&lt;</span> mikeash.c <span class="op">&gt;</span> mikeash2.c</span>
<span id="cb7-2"><a href="#cb7-2" aria-hidden="true" tabindex="-1"></a><span class="fu">diff</span> mikeash.c mikeash2.c</span></code></pre></div>
<p>The program can also be run from an implementation of <a
href="https://en.wikipedia.org/wiki/Common_Lisp">common lisp</a>. To do
this, run the common lisp compiler and then type the following
command:</p>
<p>The program can also be run from an implementation of <a href="https://en.wikipedia.org/wiki/Common_Lisp">common
lisp</a>. To do
this, run the common lisp compiler and then type the following command:</p>
<pre><code>(load &quot;mikeash.c&quot;)</code></pre>
<p>The source code of <a href="mikeash.c">mikeash.c</a> will be
printed.</p>
<p>The source code of <a href="mikeash.c">mikeash.c</a> will be printed.</p>
<h3 id="obfuscation">Obfuscation</h3>
<p><code>Lispob</code> is obfuscated in several ways. First, it’s
actually two programs in one, which actually share a small amount of
code. Running a C code beautifier will destroy the <a
href="https://en.wikipedia.org/wiki/Lisp_(programming_language)">LISP</a>
program contained within. Second and more importantly, it is very badly
written, which will presumably confuse people who are used to looking at
well-implemented interpreters.</p>
<p>The program comes in at just under 2k of significant characters.
However, this size is exaggerated, because it contains a complete copy
of itself for the self-reproducing <a
href="https://en.wikipedia.org/wiki/Turing_completeness">LISP</a>
program, making it twice the size. This doubling effect made it
something of a challenge to fit inside the IOCCC’s size limit.</p>
<p><code>Lispob</code> is obfuscated in several ways. First, it’s actually two programs
in one, which actually share a small amount of code. Running a C code
beautifier will destroy the <a href="https://en.wikipedia.org/wiki/Lisp_(programming_language)">LISP</a> program contained within. Second and
more importantly, it is very badly written, which will presumably
confuse people who are used to looking at well-implemented interpreters.</p>
<p>The program comes in at just under 2k of significant characters. However, this
size is exaggerated, because it contains a complete copy of itself for the
self-reproducing <a href="https://en.wikipedia.org/wiki/Turing_completeness">LISP</a>
program, making it twice the size. This doubling effect made it something of a
challenge to fit inside the IOCCC’s size limit.</p>
<p>This code should be highly portable. It was tested under Mac OS X and
Linux on i386, but it should run elsewhere. It requires ASCII due to
hardcoding various character constants. Other than this requirement, it
should run anywhere there’s a conforming C99 compiler and a standard C
library.</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>
should run anywhere there’s a conforming C99 compiler and a standard
C library.</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>
<p>For more information, see: https://creativecommons.org/licenses/by-sa/4.0/</p>
<!-- END: this line ends content for HTML phase 21 by: bin/pandoc-wrapper.sh via bin/md2html.sh -->
<!-- START: this line starts content for HTML phase 22 by: bin/output-index-inventory.sh via bin/md2html.sh -->
<!-- START: this line starts content generated by: bin/output-index-inventory.sh -->
<h1 id="inventory-for-2005mikeash"><a name="inventory"></a>Inventory for
2005/mikeash</h1>
<h1 id="inventory-for-2005mikeash"><a name="inventory"></a>Inventory for 2005/mikeash</h1>
<p><a href="#top">Jump to top</a></p>
<h2 id="primary-files">Primary files</h2>
<ul>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2005/mikeash/mikeash.c">mikeash.c</a>
- entry source</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2005/mikeash/Makefile">Makefile</a>
- entry Makefile</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2005/mikeash/mikeash.orig.c">mikeash.orig.c</a>
- original source</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2005/mikeash/try.sh">try.sh</a>
- how to run</li>
<li><a href="2005_mikeash.tar.bz2">2005_mikeash.tar.bz2</a> - download
entry source</li>
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2005/mikeash/mikeash.c">mikeash.c</a> - entry source</li>
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2005/mikeash/Makefile">Makefile</a> - entry Makefile</li>
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2005/mikeash/mikeash.orig.c">mikeash.orig.c</a> - original source</li>
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2005/mikeash/try.sh">try.sh</a> - how to run</li>
<li><a href="2005_mikeash.tar.bz2">2005_mikeash.tar.bz2</a> - download entry source</li>
</ul>
<h2 id="secondary-files">Secondary files</h2>
<ul>
<li><a href="index.html">index.html</a> - entry home page</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2005/mikeash/.entry.json">.entry.json</a>
- description of entry in JSON</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2005/mikeash/.gitignore">.gitignore</a>
- list of files that should not be committed under git</li>
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2005/mikeash/.entry.json">.entry.json</a> - description of entry in JSON</li>
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2005/mikeash/.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/2005/mikeash/README.md">README.md</a>
- markdown source for index.html</li>
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2005/mikeash/README.md">README.md</a> - markdown source for index.html</li>
</ul>
<!-- END: next line ends content generated by: bin/output-index-inventory.sh -->
+51 -85
View File
@@ -129,9 +129,9 @@
<h2 id="author"><a name="author"></a>Author:</h2>
<ul>
<li>Name: <a href="../../authors.html#Anthony_C_Howe">Anthony C.
Howe</a><br> Location: <a href="../../location.html#CA">CA</a> -
<em>Canada</em> <br><br></li>
<li>Name: <a href="../../authors.html#Anthony_C_Howe">Anthony C. Howe</a><br>
Location: <a href="../../location.html#CA">CA</a> - <em>Canada</em>
<br><br></li>
</ul>
<!-- END: next line ends content generated by: bin/output-index-author.sh -->
@@ -141,53 +141,47 @@ Howe</a><br> Location: <a href="../../location.html#CA">CA</a> -
<h2 id="to-build">To build:</h2>
<div class="sourceCode" id="cb1"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb1-1"><a href="#cb1-1" aria-hidden="true" tabindex="-1"></a><span class="fu">make</span></span></code></pre></div>
<p>There is an alternate version that scans for (<em>ONLY</em> scans)
the string <code>https</code> as a starting point. See <a
href="#alternate-code">alternate code</a> below.</p>
<p>There is an alternate version that scans for (<em>ONLY</em> scans) the string <code>https</code>
as a starting point. 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.html#2005_mynx">2005 mynx bugs</a>.</p>
<p>For more detailed information see <a href="../../bugs.html#2005_mynx">2005 mynx bugs</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">./mynx</span> http://<span class="op">&lt;</span>domain<span class="op">&gt;</span></span></code></pre></div>
<p>You can specify a port by appending to the domain <code>:port</code>.
See notes below on the issue of https.</p>
<p>You can specify a port by appending to the domain <code>:port</code>. See notes below on
the issue of https.</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">./mynx</span> http://www.textfiles.com</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">./mynx</span> manual.html</span></code></pre></div>
<h2 id="alternate-code">Alternate code:</h2>
<p>Obviously this will not work with <code>https</code> as it only scans
for <code>http</code> in the URL (if not specified it tries to open it
as a local file). But even if it scanned for <code>https</code> one
would need to do more work as it would have to set up a secure
connection before http commands could be sent. Fortunately or
unfortunately many more websites use https so this entry will not work
as well as it used to. If one were to try and connect to <a
href="https://ioccc.org" class="uri">https://ioccc.org</a> with this
entry they’ll just get a 301 error.</p>
<p>The alternate code is a starting point that scans for
<code>https</code> too (note you have to specify the port in this case)
but that is all it does. It will not work with https websites as it does
not set up a secure connection. But should anyone wish to either come up
with a pipeline (or some other command line) that allows it to work with
https or to update the code to support https they may. Otherwise you
<p>Obviously this will not work with <code>https</code> as it only scans for <code>http</code> in the URL
(if not specified it tries to open it as a local file). But even if it scanned
for <code>https</code> one would need to do more work as it would have to set up a secure
connection before http commands could be sent. Fortunately or unfortunately
many more websites use https so this entry will not work as well as it used to.
If one were to try and connect to <a href="https://ioccc.org" class="uri">https://ioccc.org</a> with this entry they’ll
just get a 301 error.</p>
<p>The alternate code is a starting point that scans for <code>https</code> too (note you have
to specify the port in this case) but that is all it does. It will not work with
https websites as it does not set up a secure connection. But should anyone wish
to either come up with a pipeline (or some other command line) that allows it to
work with https or to update the code to support https they may. Otherwise you
must just appreciate the entry for what it once was.</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>
<p>Use <code>mynx.alt</code> as you would <code>mynx</code>. You’d have
to specify a port at the end of the URL like:</p>
<p>Use <code>mynx.alt</code> as you would <code>mynx</code>. You’d have to specify a port at the end of
the URL like:</p>
<div class="sourceCode" id="cb6"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb6-1"><a href="#cb6-1" aria-hidden="true" tabindex="-1"></a><span class="ex">./mynx.alt</span> https://www.ioccc.org:443</span></code></pre></div>
<p>but again unless you have a clever workaround or hack to the problem,
this sadly won’t work.</p>
<p>but again unless you have a clever workaround or hack to the problem, this sadly
won’t work.</p>
<h2 id="judges-remarks">Judges’ remarks:</h2>
<p>This little <code>mynx</code> will give any <a
href="https://en.wikipedia.org/wiki/Firefox">Fiery Fox</a> a run for its
money. A nice complement to last years winning <a
href="../../2004/hibachi/src/index.html">2004/hibachi</a>. The judges
double dare any eager Obfuscationalists to submit the missing pieces to
<p>This little <code>mynx</code> will give any <a href="https://en.wikipedia.org/wiki/Firefox">Fiery
Fox</a> a run for its money. A nice
complement to last years winning <a href="../../2004/hibachi/src/index.html">2004/hibachi</a>. The
judges double dare any eager Obfuscationalists to submit the missing pieces to
get a functioning LAMP stack.</p>
<h2 id="authors-remarks">Author’s remarks:</h2>
<p>I was rather impressed by last year’s mini webserver. So much so that
@@ -196,75 +190,47 @@ it inspired me to try my hand at writing the client side complement.</p>
<div class="sourceCode" id="cb7"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb7-1"><a href="#cb7-1" aria-hidden="true" tabindex="-1"></a><span class="fu">cc</span> <span class="at">-o</span> mynx mynx.c</span></code></pre></div>
<p>While some others like to be a little different:</p>
<div class="sourceCode" id="cb8"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb8-1"><a href="#cb8-1" aria-hidden="true" tabindex="-1"></a><span class="fu">cc</span> <span class="at">-o</span> mynx mynx.c <span class="at">-lnsl</span> <span class="at">-lsocket</span></span></code></pre></div>
<p>I even managed to figure out a basic configure script, given last
year’s example, which is kinda of useful when you consider how many OSes
put all the network functions in a variety of places. So a simpler build
<p>I even managed to figure out a basic configure script, given last year’s
example, which is kinda of useful when you consider how many OSes put
all the network functions in a variety of places. So a simpler build
command sequence would be:</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="bu">cd</span> source <span class="kw">;</span> <span class="ex">./configure</span> <span class="kw">;</span> <span class="fu">make</span></span></code></pre></div>
<p>After which, the rest of the documentation can be read by saying:</p>
<div class="sourceCode" id="cb10"><pre
class="sourceCode sh"><code class="sourceCode bash"><span id="cb10-1"><a href="#cb10-1" aria-hidden="true" tabindex="-1"></a><span class="ex">./mynx</span> ../manual.html</span></code></pre></div>
<h2 id="copyright-and-cc-by-sa-4.0-license">Copyright and CC BY-SA 4.0
License:</h2>
<p>This file is Copyright (c) 2023 by Landon Curt Noll. All Rights
Reserved. You are free to share and adapt this file under the terms of
this license:</p>
<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">./mynx</span> ../manual.html</span></code></pre></div>
<h2 id="copyright-and-cc-by-sa-4.0-license">Copyright and CC BY-SA 4.0 License:</h2>
<p>This file is Copyright (c) 2023 by Landon Curt Noll. All Rights Reserved.
You are free to share and adapt this file under the terms of this license:</p>
<pre><code>Creative Commons Attribution-ShareAlike 4.0 International (CC BY-SA 4.0)</code></pre>
<p>For more information, see:
https://creativecommons.org/licenses/by-sa/4.0/</p>
<p>For more information, see: https://creativecommons.org/licenses/by-sa/4.0/</p>
<!-- END: this line ends content for HTML phase 21 by: bin/pandoc-wrapper.sh via bin/md2html.sh -->
<!-- START: this line starts content for HTML phase 22 by: bin/output-index-inventory.sh via bin/md2html.sh -->
<!-- START: this line starts content generated by: bin/output-index-inventory.sh -->
<h1 id="inventory-for-2005mynx"><a name="inventory"></a>Inventory for
2005/mynx</h1>
<h1 id="inventory-for-2005mynx"><a name="inventory"></a>Inventory for 2005/mynx</h1>
<p><a href="#top">Jump to top</a></p>
<h2 id="primary-files">Primary files</h2>
<ul>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2005/mynx/mynx.c">mynx.c</a>
- entry source</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2005/mynx/Makefile">Makefile</a>
- entry Makefile</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2005/mynx/mynx.alt.c">mynx.alt.c</a>
- alternative source</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2005/mynx/mynx.orig.c">mynx.orig.c</a>
- original source</li>
<li><a href="manual.html">manual.html</a> - manual for the Mynx web
browser</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2005/mynx/entities.txt">entities.txt</a>
- ISO 8859-1 entitles</li>
<li><a href="source/configure.in">source/configure.in</a> - configure
script description</li>
<li><a href="source/configure">source/configure</a> - pre-built
configure script</li>
<li><a href="source/makefile.in">source/makefile.in</a> - makefile
template</li>
<li><a href="2005_mynx.tar.bz2">2005_mynx.tar.bz2</a> - download entry
source</li>
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2005/mynx/mynx.c">mynx.c</a> - entry source</li>
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2005/mynx/Makefile">Makefile</a> - entry Makefile</li>
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2005/mynx/mynx.alt.c">mynx.alt.c</a> - alternative source</li>
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2005/mynx/mynx.orig.c">mynx.orig.c</a> - original source</li>
<li><a href="manual.html">manual.html</a> - manual for the Mynx web browser</li>
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2005/mynx/entities.txt">entities.txt</a> - ISO 8859-1 entitles</li>
<li><a href="source/configure.in">source/configure.in</a> - configure script description</li>
<li><a href="source/configure">source/configure</a> - pre-built configure script</li>
<li><a href="source/makefile.in">source/makefile.in</a> - makefile template</li>
<li><a href="2005_mynx.tar.bz2">2005_mynx.tar.bz2</a> - download entry source</li>
</ul>
<h2 id="secondary-files">Secondary files</h2>
<ul>
<li><a href="index.html">index.html</a> - entry home page</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2005/mynx/.entry.json">.entry.json</a>
- description of entry in JSON</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2005/mynx/.gitignore">.gitignore</a>
- list of files that should not be committed under git</li>
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2005/mynx/.entry.json">.entry.json</a> - description of entry in JSON</li>
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2005/mynx/.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/2005/mynx/README.md">README.md</a>
- markdown source for index.html</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2005/mynx/source/mynx.c">source/mynx.c</a>
- copy of the entry source</li>
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2005/mynx/README.md">README.md</a> - markdown source for index.html</li>
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2005/mynx/source/mynx.c">source/mynx.c</a> - copy of the entry source</li>
</ul>
<!-- END: next line ends content generated by: bin/output-index-inventory.sh -->
+76 -119
View File
@@ -129,9 +129,9 @@
<h2 id="author"><a name="author"></a>Author:</h2>
<ul>
<li>Name: <a href="../../authors.html#Mauro_Persano">Mauro
Persano</a><br> Location: <a href="../../location.html#BR">BR</a> -
<em>Federative Republic of Brazil</em> (<em>Brazil</em>) <br><br></li>
<li>Name: <a href="../../authors.html#Mauro_Persano">Mauro Persano</a><br>
Location: <a href="../../location.html#BR">BR</a> - <em>Federative Republic of Brazil</em> (<em>Brazil</em>)
<br><br></li>
</ul>
<!-- END: next line ends content generated by: bin/output-index-author.sh -->
@@ -141,129 +141,104 @@ Persano</a><br> Location: <a href="../../location.html#BR">BR</a> -
<h2 id="to-build">To build:</h2>
<div class="sourceCode" id="cb1"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb1-1"><a href="#cb1-1" aria-hidden="true" tabindex="-1"></a><span class="fu">make</span></span></code></pre></div>
<p>There is an alternate version of this entry which should work for
Windows by setting binary mode on <code>stdout</code>. See <a
href="#alternate-code">alternate code</a> below.</p>
<p>There is an alternate version of this entry which should work for Windows by
setting binary mode on <code>stdout</code>. See <a href="#alternate-code">alternate code</a> below.</p>
<h2 id="to-use">To use:</h2>
<div class="sourceCode" id="cb2"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb2-1"><a href="#cb2-1" aria-hidden="true" tabindex="-1"></a><span class="ex">./persano</span> p q [num frames]</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>Open the <a href="https://en.wikipedia.org/wiki/GIF">GIF</a> files
with a viewer capable of displaying animated GIFs and watch closely at
the bottom of the picture (you may need to use <a
href="https://www.lcdf.org/gifsicle/">gifsicle</a> - a great tool to
manipulate animated GIFs - to slow down the animation and to compress
the GIFs generated by the entry).</p>
<p>Open the <a href="https://en.wikipedia.org/wiki/GIF">GIF</a> files with a viewer capable of
displaying animated GIFs and watch closely at the bottom of the picture (you may
need to use <a href="https://www.lcdf.org/gifsicle/">gifsicle</a> - a great tool to
manipulate animated GIFs - to slow down the animation and to compress the GIFs
generated by the entry).</p>
<h2 id="alternate-code">Alternate code:</h2>
<p>This (untested as we have no Windows system) version uses the Windows
API functions <code>_setmode()</code> and <code>_fileno(3)</code> to set
binary mode on <code>stdout</code> which should let it work with
Windows.</p>
<p>This (untested as we have no Windows system) version uses the Windows API
functions <code>_setmode()</code> and <code>_fileno(3)</code> to set binary mode on <code>stdout</code> which should
let it work with Windows.</p>
<h3 id="alternate-build">Alternate build:</h3>
<pre><code>make alt</code></pre>
<h3 id="alternate-use">Alternate use:</h3>
<p>Use <code>persano.alt</code> as you would <code>persano</code>
above.</p>
<p>Use <code>persano.alt</code> as you would <code>persano</code> above.</p>
<h3 id="alternate-try">Alternate 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="ex">./persano.alt</span> 3 16 <span class="op">&gt;</span> knot3-16.gif</span></code></pre></div>
<p>Follow the same instructions, using different tools if necessary, as
the above try section.</p>
<p>Follow the same instructions, using different tools if necessary, as the above
try section.</p>
<h2 id="judges-remarks">Judges’ remarks:</h2>
<p>If your system is one of those that distinguish between text and
binary streams, you must know what to do to switch the standard output
into binary mode (e.g., adding a line to the source code or specifying a
<p>If your system is one of those that distinguish between text and binary
streams, you must know what to do to switch the standard output into
binary mode (e.g., adding a line to the source code or specifying a
linker option).</p>
<p>What needs to be done to fix the problem?</p>
<p>Solving the author’s exercises below may or may not help.</p>
<p>At the time of judging, the approximation of <a
href="https://en.wikipedia.org/wiki/Pi">π</a> used in the program could
not be found on <a href="https://mathworld.wolfram.com"
class="uri">https://mathworld.wolfram.com</a>.</p>
<p>At the time of judging, the approximation of
<a href="https://en.wikipedia.org/wiki/Pi">π</a> used in the program could not be found on
<a href="https://mathworld.wolfram.com" class="uri">https://mathworld.wolfram.com</a>.</p>
<h2 id="authors-remarks">Author’s remarks:</h2>
<p><strong>knot</strong> writes animated GIF images of rendered <a
href="https://en.wikipedia.org/wiki/Torus_knot">torus knots</a> to
standard output.</p>
<p><strong>knot</strong> writes animated GIF images of rendered <a href="https://en.wikipedia.org/wiki/Torus_knot">torus
knots</a> to standard output.</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">./persano</span> p q [num frames]</span></code></pre></div>
<h3 id="description">DESCRIPTION</h3>
<p>A <code>(p,q)</code>-<a
href="https://en.wikipedia.org/wiki/Torus_knot">torus knot</a> is a
closed, non-intersecting curve on the surface of a <a
href="https://en.wikipedia.org/wiki/Torus">torus</a> in R3 that winds
<code>p</code> times around one cycle of the torus and <code>q</code>
times around the other. <code>p</code> and <code>q</code> should be <a
href="https://en.wikipedia.org/wiki/Coprime_integers">coprime</a>;
otherwise, the resulting curve will <em>not</em> be a knot (that is,
imagining the resulting curve as a loop of rubber, there will be a way
to bend, twist and stretch it, without cutting it <a href="#fn1"
class="footnote-ref" id="fnref1" role="doc-noteref"><sup>1</sup></a>,
until it ends up looking just like a circle embedded in R3 <a
href="#fn2" class="footnote-ref" id="fnref2"
role="doc-noteref"><sup>2</sup></a>).</p>
<p>A <code>(p,q)</code>-<a href="https://en.wikipedia.org/wiki/Torus_knot">torus knot</a> is a closed,
non-intersecting curve on the surface of a
<a href="https://en.wikipedia.org/wiki/Torus">torus</a> in R3 that winds <code>p</code> times around
one cycle of the torus and <code>q</code> times around the other. <code>p</code> and <code>q</code> should be
<a href="https://en.wikipedia.org/wiki/Coprime_integers">coprime</a>; otherwise, the
resulting curve will <em>not</em> be a knot (that is, imagining the resulting curve as
a loop of rubber, there will be a way to bend, twist and stretch it, without
cutting it <a href="#fn1" class="footnote-ref" id="fnref1" role="doc-noteref"><sup>1</sup></a>, until it ends up looking just like a circle embedded in R3 <a href="#fn2" class="footnote-ref" id="fnref2" role="doc-noteref"><sup>2</sup></a>).</p>
<p>Sample usage:</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">./persano</span> 3 2 1 <span class="op">&gt;</span> foo.gif</span></code></pre></div>
<p>writes a non-animated GIF (a single frame) stream of a rendered
trefoil knot to the file <code>foo.gif</code>.</p>
<p>writes a non-animated GIF (a single frame) stream of a rendered trefoil
knot to the file <code>foo.gif</code>.</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">./persano</span> 5 2</span></code></pre></div>
<p>writes a GIF stream with a rendering of <a
href="https://en.wikipedia.org/wiki/Solomon%27s_knot">Solomon’s Seal
knot</a> to standard output; since the number of frames is not
specified, an animation with 40 frames will be written.</p>
<p>writes a GIF stream with a rendering of <a href="https://en.wikipedia.org/wiki/Solomon%27s_knot">Solomon’s Seal
knot</a> to standard
output; since the number of frames is not specified, an animation with
40 frames will be written.</p>
<p>Please view the code with 8-character tabs!</p>
<h3 id="output-format">OUTPUT FORMAT</h3>
<p>The program writes fully valid GIF 89 streams.</p>
<p>It is suggested that the output be viewed with a program capable of
displaying animated GIFs, such as almost any graphical HTTP browser.</p>
<p>Due to code size constraints, full <a
href="https://en.wikipedia.org/wiki/LZ77_and_LZ78#LZW">LZW
compression</a> was not implemented <a href="#fn3" class="footnote-ref"
id="fnref3" role="doc-noteref"><sup>3</sup></a>. In fact, the output
images are even somewhat expanded, thanks to GIF overhead.</p>
<p>The GIF format supports only a limited number of bits per pixel, so
the program uses ordered dithering to emulate full RGB output.</p>
<p>Due to code size constraints, full <a href="https://en.wikipedia.org/wiki/LZ77_and_LZ78#LZW">LZW
compression</a> was not
implemented <a href="#fn3" class="footnote-ref" id="fnref3" role="doc-noteref"><sup>3</sup></a>. In fact, the output images are even somewhat expanded, thanks
to GIF overhead.</p>
<p>The GIF format supports only a limited number of bits per pixel, so the
program uses ordered dithering to emulate full RGB output.</p>
<h3 id="portability">PORTABILITY</h3>
<p>The program was tested on Linux, with gcc 3.1; Cygwin, with gcc 3.3;
and Solaris/SPARC, with Sun’s C compiler.</p>
<p>The program was tested on Linux, with gcc 3.1; Cygwin, with gcc 3.3; and
Solaris/SPARC, with Sun’s C compiler.</p>
<p>The only major portability issue should be reliance on ASCII.</p>
<p>It should also be mentioned that the program won’t work on systems
that distinguish between text and binary streams; however, since hardly
anyone uses such systems in this day and age, this is a minor issue. <a
href="#fn4" class="footnote-ref" id="fnref4"
role="doc-noteref"><sup>4</sup></a></p>
<p>It should also be mentioned that the program won’t work on systems that
distinguish between text and binary streams; however, since hardly
anyone uses such systems in this day and age, this is a minor issue. <a href="#fn4" class="footnote-ref" id="fnref4" role="doc-noteref"><sup>4</sup></a></p>
<h3 id="exercises-for-the-reader">EXERCISES FOR THE READER</h3>
<ol type="1">
<li><p>(1 point) The surface is composed of many small polygons. Try to
make it smoother by increasing the number of polygons.</p></li>
<li><p>(2 points) Figure out how to change the radius of the tube cross
section.</p></li>
<li><p>(5 points) Locate the famous transcendental constant <a
href="https://en.wikipedia.org/wiki/Pi">π</a> in the code.</p></li>
<li><p>(1 point) The surface is composed of many small polygons. Try to make it
smoother by increasing the number of polygons.</p></li>
<li><p>(2 points) Figure out how to change the radius of the tube cross section.</p></li>
<li><p>(5 points) Locate the famous transcendental constant
<a href="https://en.wikipedia.org/wiki/Pi">π</a> in the code.</p></li>
</ol>
<h3 id="footnotes">FOOTNOTES</h3>
<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>
<h2 id="copyright-and-cc-by-sa-4.0-license">Copyright and CC BY-SA 4.0 License:</h2>
<p>This file is Copyright (c) 2023 by Landon Curt Noll. All Rights Reserved.
You are free to share and adapt this file under the terms of this license:</p>
<pre><code>Creative Commons Attribution-ShareAlike 4.0 International (CC BY-SA 4.0)</code></pre>
<p>For more information, see:
https://creativecommons.org/licenses/by-sa/4.0/</p>
<section id="footnotes" class="footnotes footnotes-end-of-document"
role="doc-endnotes">
<p>For more information, see: https://creativecommons.org/licenses/by-sa/4.0/</p>
<section id="footnotes" class="footnotes footnotes-end-of-document" role="doc-endnotes">
<hr />
<ol>
<li id="fn1"><p>You can call such a transformation an “ambient isotopy”
if you want to impress people at parties.<a href="#fnref1"
class="footnote-back" role="doc-backlink">↩︎</a></p></li>
<li id="fn2"><p>Also known as the “unknot”, which sounds slightly less
impressive than “ambient isotopy”.<a href="#fnref2"
class="footnote-back" role="doc-backlink">↩︎</a></p></li>
<li id="fn3"><p>Unfortunately (for the author), the convenient excuse
that LZW compression was not implemented in order to avoid the Unisys
patent can no longer be used.<a href="#fnref3" class="footnote-back"
role="doc-backlink">↩︎</a></p></li>
<li id="fn4"><p>;)<a href="#fnref4" class="footnote-back"
role="doc-backlink">↩︎</a></p></li>
<li id="fn1"><p>You can call such a transformation an “ambient isotopy” if you want to
impress people at parties.<a href="#fnref1" class="footnote-back" role="doc-backlink">↩︎</a></p></li>
<li id="fn2"><p>Also known as the “unknot”, which sounds slightly less impressive than
“ambient isotopy”.<a href="#fnref2" class="footnote-back" role="doc-backlink">↩︎</a></p></li>
<li id="fn3"><p>Unfortunately (for the author), the convenient excuse that LZW compression
was not implemented in order to avoid the Unisys patent can no longer be used.<a href="#fnref3" class="footnote-back" role="doc-backlink">↩︎</a></p></li>
<li id="fn4"><p>;)<a href="#fnref4" class="footnote-back" role="doc-backlink">↩︎</a></p></li>
</ol>
</section>
@@ -272,42 +247,24 @@ role="doc-backlink">↩︎</a></p></li>
<!-- START: this line starts content generated by: bin/output-index-inventory.sh -->
<h1 id="inventory-for-2005persano"><a name="inventory"></a>Inventory for
2005/persano</h1>
<h1 id="inventory-for-2005persano"><a name="inventory"></a>Inventory for 2005/persano</h1>
<p><a href="#top">Jump to top</a></p>
<h2 id="primary-files">Primary files</h2>
<ul>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2005/persano/persano.c">persano.c</a>
- entry source</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2005/persano/Makefile">Makefile</a>
- entry Makefile</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2005/persano/persano.alt.c">persano.alt.c</a>
- alternative source</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2005/persano/persano.orig.c">persano.orig.c</a>
- original source</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2005/persano/try.sh">try.sh</a>
- how to run</li>
<li><a href="2005_persano.tar.bz2">2005_persano.tar.bz2</a> - download
entry source</li>
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2005/persano/persano.c">persano.c</a> - entry source</li>
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2005/persano/Makefile">Makefile</a> - entry Makefile</li>
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2005/persano/persano.alt.c">persano.alt.c</a> - alternative source</li>
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2005/persano/persano.orig.c">persano.orig.c</a> - original source</li>
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2005/persano/try.sh">try.sh</a> - how to run</li>
<li><a href="2005_persano.tar.bz2">2005_persano.tar.bz2</a> - download entry source</li>
</ul>
<h2 id="secondary-files">Secondary files</h2>
<ul>
<li><a href="index.html">index.html</a> - entry home page</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2005/persano/.entry.json">.entry.json</a>
- description of entry in JSON</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2005/persano/.gitignore">.gitignore</a>
- list of files that should not be committed under git</li>
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2005/persano/.entry.json">.entry.json</a> - description of entry in JSON</li>
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2005/persano/.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/2005/persano/README.md">README.md</a>
- markdown source for index.html</li>
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2005/persano/README.md">README.md</a> - markdown source for index.html</li>
</ul>
<!-- END: next line ends content generated by: bin/output-index-inventory.sh -->
+155 -223
View File
@@ -129,9 +129,9 @@
<h2 id="author"><a name="author"></a>Author:</h2>
<ul>
<li>Name: <a href="../../authors.html#Stephen_Sykes">Stephen
Sykes</a><br> Location: <a href="../../location.html#FI">FI</a> -
<em>Republic of Finland </em> (<em>Finland</em>) <br><br></li>
<li>Name: <a href="../../authors.html#Stephen_Sykes">Stephen Sykes</a><br>
Location: <a href="../../location.html#FI">FI</a> - <em>Republic of Finland </em> (<em>Finland</em>)
<br><br></li>
</ul>
<!-- END: next line ends content generated by: bin/output-index-author.sh -->
@@ -144,80 +144,66 @@ Sykes</a><br> Location: <a href="../../location.html#FI">FI</a> -
<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.html#2005_sykes">2005 sykes bugs</a>.</p>
<p>For more detailed information see <a href="../../bugs.html#2005_sykes">2005 sykes bugs</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">./sykes</span> binary_file</span></code></pre></div>
<h2 id="try">Try:</h2>
<div class="sourceCode" id="cb4"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb4-1"><a href="#cb4-1" aria-hidden="true" tabindex="-1"></a><span class="ex">./try.sh</span></span></code></pre></div>
<h2 id="judges-remarks">Judges’ remarks:</h2>
<p>For those who fondly remember their first <a
href="https://en.wikipedia.org/wiki/Commodore_PET">PET</a>, this entry
will start you down memory lane … starting with <code>$C000</code> of
course!</p>
<p>We encourage you to try and grok the obfuscated expression on <a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2005/sykes/sykes.c#L56">line
56</a>, after the C pre-processor gets finished with it!</p>
<p>We downloaded the <a
href="https://en.wikipedia.org/wiki/ROM_image">ROM</a> contents to use
the <a href="https://en.wikipedia.org/wiki/Emulator">emulator</a> in <a
href="https://en.wikipedia.org/wiki/Commodore_PET">PET</a> mode as
follows:</p>
<p>For those who fondly remember their first
<a href="https://en.wikipedia.org/wiki/Commodore_PET">PET</a>, this entry will start you
down memory lane … starting with <code>$C000</code> of course!</p>
<p>We encourage you to try and grok the obfuscated expression on <a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2005/sykes/sykes.c#L56">line
56</a>,
after the C pre-processor gets finished with it!</p>
<p>We downloaded the <a href="https://en.wikipedia.org/wiki/ROM_image">ROM</a> contents to use
the <a href="https://en.wikipedia.org/wiki/Emulator">emulator</a> in
<a href="https://en.wikipedia.org/wiki/Commodore_PET">PET</a> mode as follows:</p>
<div class="sourceCode" id="cb5"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb5-1"><a href="#cb5-1" aria-hidden="true" tabindex="-1"></a><span class="fu">wget</span> http://www.zimmers.net/anonftp/pub/cbm/firmware/computers/pet/basic-2-c000.901465-01.bin</span>
<span id="cb5-2"><a href="#cb5-2" aria-hidden="true" tabindex="-1"></a><span class="fu">wget</span> http://www.zimmers.net/anonftp/pub/cbm/firmware/computers/pet/basic-2-d000.901465-02.bin</span>
<span id="cb5-3"><a href="#cb5-3" aria-hidden="true" tabindex="-1"></a><span class="fu">wget</span> http://www.zimmers.net/anonftp/pub/cbm/firmware/computers/pet/edit-2-n.901447-24.bin</span>
<span id="cb5-4"><a href="#cb5-4" aria-hidden="true" tabindex="-1"></a><span class="fu">wget</span> http://www.zimmers.net/anonftp/pub/cbm/firmware/computers/pet/kernal-2.901465-03.bin</span></code></pre></div>
<p>We then created:</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">dd</span> bs=2k count=1 if=/dev/zero of=nullfill.bin</span></code></pre></div>
<p>For your convenience, we have added the above mentioned files to this
entry directory. They were used to form the <code>pet.rom</code>
file.</p>
<p>For your convenience, we have added the above mentioned files to this entry directory.
They were used to form the <code>pet.rom</code> file.</p>
<h2 id="authors-remarks">Author’s remarks:</h2>
<p>This program is not only a complete <a
href="https://en.wikipedia.org/wiki/MOS_Technology_6502#Technical_description">Motorola
6502 processor</a> <a
href="https://en.wikipedia.org/wiki/Emulator">emulator</a>, but also an
emulation of the <a
href="https://en.wikipedia.org/wiki/Commodore_PET">Commodore PET
2001</a>.</p>
<p>This is the second version of the same entry, but this one takes care
to not include any possibly copyrighted items in the info files, to be
sure to not infringe the rules.</p>
<p>This program is not only a complete <a href="https://en.wikipedia.org/wiki/MOS_Technology_6502#Technical_description">Motorola 6502
processor</a>
<a href="https://en.wikipedia.org/wiki/Emulator">emulator</a>, but also an emulation of the
<a href="https://en.wikipedia.org/wiki/Commodore_PET">Commodore PET 2001</a>.</p>
<p>This is the second version of the same entry, but this one takes care to
not include any possibly copyrighted items in the info files, to be sure
to not infringe the rules.</p>
<h3 id="test">Test</h3>
<p>Compile the program, then test the <a
href="https://en.wikipedia.org/wiki/MOS_Technology_6502#Technical_description">6502</a>
<a href="https://en.wikipedia.org/wiki/Emulator">emulation</a> like
this:</p>
<p>Compile the program, then test the
<a href="https://en.wikipedia.org/wiki/MOS_Technology_6502#Technical_description">6502</a>
<a href="https://en.wikipedia.org/wiki/Emulator">emulation</a> 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">./sykes</span> 6502test</span></code></pre></div>
<p>A basic test is done for each instruction and addressing mode, all
tests should pass. At the end of the tests, it loops forever - break out
with control-C.</p>
<p>A basic test is done for each instruction and addressing mode, all tests
should pass. At the end of the tests, it loops forever - break out with
control-C.</p>
<h3 id="pet-emulation">PET EMULATION</h3>
<p>Cast your mind back to 1977… a little company called <a
href="https://en.wikipedia.org/wiki/Commodore_International">Commodore</a>
introduced the <a
href="https://en.wikipedia.org/wiki/Commodore_PET">PET</a>, the Personal
Electronic Transactor.</p>
<p>The <a href="https://en.wikipedia.org/wiki/Computer">machine</a> was
a hit, and <a href="https://en.wikipedia.org/wiki/History">history</a>
was made.</p>
<p>Now you can relive those wonderful times with this <a
href="https://en.wikipedia.org/wiki/Commodore_PET">PET</a> emulator!</p>
<p>Make sure you have a <a
href="https://en.wikipedia.org/wiki/Terminal_emulator">terminal
window</a> of 40x25 chars or bigger, and then run the emulator like
this:</p>
<p>Cast your mind back to 1977… a little company called
<a href="https://en.wikipedia.org/wiki/Commodore_International">Commodore</a> introduced
the <a href="https://en.wikipedia.org/wiki/Commodore_PET">PET</a>, the Personal Electronic
Transactor.</p>
<p>The <a href="https://en.wikipedia.org/wiki/Computer">machine</a> was a hit, and
<a href="https://en.wikipedia.org/wiki/History">history</a> was made.</p>
<p>Now you can relive those wonderful times with this
<a href="https://en.wikipedia.org/wiki/Commodore_PET">PET</a> emulator!</p>
<p>Make sure you have a <a href="https://en.wikipedia.org/wiki/Terminal_emulator">terminal
window</a> of 40x25 chars or
bigger, and then run the emulator like this:</p>
<div class="sourceCode" id="cb8"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb8-1"><a href="#cb8-1" aria-hidden="true" tabindex="-1"></a><span class="ex">./sykes</span> pet.rom</span></code></pre></div>
<p>You should see the startup message. Try typing in some <a
href="https://en.wikipedia.org/wiki/BASIC">BASIC</a> - for instance:</p>
<p>You should see the startup message. Try typing in some
<a href="https://en.wikipedia.org/wiki/BASIC">BASIC</a> - for instance:</p>
<pre><code>PRINT &quot;HELLO, WORLD&quot;</code></pre>
<p>There is an optional numeric parameter, which controls the speed. For
a slower cursor blink, try</p>
<div class="sourceCode" id="cb10"><pre
class="sourceCode sh"><code class="sourceCode bash"><span id="cb10-1"><a href="#cb10-1" aria-hidden="true" tabindex="-1"></a><span class="ex">./sykes</span> pet.rom 6</span></code></pre></div>
<p>There is an optional numeric parameter, which controls the speed. For a
slower cursor blink, try</p>
<div class="sourceCode" id="cb10"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb10-1"><a href="#cb10-1" aria-hidden="true" tabindex="-1"></a><span class="ex">./sykes</span> pet.rom 6</span></code></pre></div>
<p>and for faster</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">./sykes</span> pet.rom 2</span></code></pre></div>
<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">./sykes</span> pet.rom 2</span></code></pre></div>
<p>The default is 4.</p>
<p>The control keys are as follows:</p>
<pre><code>^A HOME
@@ -229,19 +215,15 @@ class="sourceCode sh"><code class="sourceCode bash"><span id="cb11-1"><a href="#
^F cursor forward
^B cursor back
^N cursor down</code></pre>
<p>Supplied also is a short demo program written in <a
href="https://en.wikipedia.org/wiki/BASIC">BASIC</a>. Try typing</p>
<p>Supplied also is a short demo program written in
<a href="https://en.wikipedia.org/wiki/BASIC">BASIC</a>. Try typing</p>
<pre><code>LOAD &quot;DEMO&quot;
RUN</code></pre>
<p>Many other old programs will run in this emulator too. Files with a
<code>.PRG</code> extension should work. (Look, for instance, here: <a
href="http://www.zimmers.net/anonftp/pub/cbm/pet/ALLFILES.html"
class="uri">http://www.zimmers.net/anonftp/pub/cbm/pet/ALLFILES.html</a>,<br />
or try this one: <a
href="http://www.zimmers.net/anonftp/pub/cbm/pet/games/english/dungeon.prg"
class="uri">http://www.zimmers.net/anonftp/pub/cbm/pet/games/english/dungeon.prg</a>)<br />
The filenames must be upper case in order to be loaded by the
emulator.</p>
<p>Many other old programs will run in this emulator too. Files with a <code>.PRG</code>
extension should work. (Look, for instance, here:
<a href="http://www.zimmers.net/anonftp/pub/cbm/pet/ALLFILES.html" class="uri">http://www.zimmers.net/anonftp/pub/cbm/pet/ALLFILES.html</a>,<br />
or try this one: <a href="http://www.zimmers.net/anonftp/pub/cbm/pet/games/english/dungeon.prg" class="uri">http://www.zimmers.net/anonftp/pub/cbm/pet/games/english/dungeon.prg</a>)<br />
The filenames must be upper case in order to be loaded by the emulator.</p>
<p>You can save programs too - try</p>
<pre><code>10 PRINT &quot;HELLO!&quot;
SAVE &quot;HELLO&quot;
@@ -249,190 +231,140 @@ NEW
LOAD &quot;HELLO&quot;
RUN</code></pre>
<p>You also might try typing this to see an ancient <a
href="https://en.wikipedia.org/wiki/Easter_egg_(media)#Software">Easter
egg</a>:</p>
<p>You also might try typing this to see an ancient <a href="https://en.wikipedia.org/wiki/Easter_egg_(media)#Software">Easter egg</a>:</p>
<pre><code>WAIT 6502,12</code></pre>
<h3 id="emulation">6502 EMULATION</h3>
<p>The program is basically a <a
href="https://en.wikipedia.org/wiki/MOS_Technology_6502#Technical_description">6502</a>
<a href="https://en.wikipedia.org/wiki/Emulator">emulator</a>, and it
does NOT need the <a
href="https://en.wikipedia.org/wiki/Commodore_PET">Commodore</a> <a
href="https://en.wikipedia.org/wiki/ROM_image">ROM</a> to work.</p>
<p>Supplied as a demonstration is a compiled-for-<a
href="https://en.wikipedia.org/wiki/MOS_Technology_6502#Technical_description">6502</a>
version a chess program (heh, I found a use for a previous losing entry
:) ). Try:</p>
<div class="sourceCode" id="cb16"><pre
class="sourceCode sh"><code class="sourceCode bash"><span id="cb16-1"><a href="#cb16-1" aria-hidden="true" tabindex="-1"></a><span class="ex">./sykes</span> chess</span></code></pre></div>
<p>It works as you would expect (it plays very badly). There’s no
castling or en-passant, and to win you must actually take the opponent’s
king.</p>
<p>You can write your own programs too, any <a
href="https://en.wikibooks.org/wiki/6502_Assembly">6502 assembler</a>
should work.</p>
<p>The <a href="https://en.wikipedia.org/wiki/Emulator">emulator</a>
loads the supplied file at <code>$C000</code>, and starts execution from
that address also (the reset vector is ignored).</p>
<p>The screen memory begins at <code>$8000</code>, and is
<code>40 columns * 25 rows</code>. Key presses appear when they occur in
memory location <code>$A2</code>, and are <a
href="https://en.wikipedia.org/wiki/Bitwise_operation#OR">OR</a>ed with
<code>$80</code> - this is a way of indicating a fresh character. The
program can frequently check this byte, and when it sees a new
character, it can <a
href="https://en.wikipedia.org/wiki/Bitwise_operation#AND">AND</a> it
with <code>$7F</code> to indicate that it has been read.</p>
<p>The <a
href="https://en.wikipedia.org/wiki/MOS_Technology_6502#Technical_description">6502</a>
<a href="https://en.wikipedia.org/wiki/Emulator">emulator</a> receives
an interrupt 60 times a second or so, you may want to disable interrupts
(with the <code>SEI</code> instruction) if you do not need this.</p>
<p>In <a
href="https://en.wikipedia.org/wiki/MOS_Technology_6502#Technical_description">6502</a>
<a href="https://en.wikipedia.org/wiki/Emulator">emulation</a> mode the
special <a href="https://en.wikipedia.org/wiki/Commodore_PET">PET</a>
character codes are not used and the screen understands normal <a
href="https://en.wikipedia.org/wiki/ASCII#Character_set">ASCII</a>.</p>
<p>Lastly, before <a
href="https://en.wikipedia.org/wiki/Emulator">emulation</a> starts, the
low byte from a <code>time(3)</code> call is placed at address 0 - this
can be used as a random seed.</p>
<p>The program is basically a
<a href="https://en.wikipedia.org/wiki/MOS_Technology_6502#Technical_description">6502</a>
<a href="https://en.wikipedia.org/wiki/Emulator">emulator</a>, and it does NOT need the
<a href="https://en.wikipedia.org/wiki/Commodore_PET">Commodore</a>
<a href="https://en.wikipedia.org/wiki/ROM_image">ROM</a> to work.</p>
<p>Supplied as a demonstration is a
compiled-for-<a href="https://en.wikipedia.org/wiki/MOS_Technology_6502#Technical_description">6502</a>
version a chess program (heh, I found a use for a previous losing entry :) ). Try:</p>
<div class="sourceCode" id="cb16"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb16-1"><a href="#cb16-1" aria-hidden="true" tabindex="-1"></a><span class="ex">./sykes</span> chess</span></code></pre></div>
<p>It works as you would expect (it plays very badly). There’s no castling
or en-passant, and to win you must actually take the opponent’s king.</p>
<p>You can write your own programs too, any <a href="https://en.wikibooks.org/wiki/6502_Assembly">6502
assembler</a> should work.</p>
<p>The <a href="https://en.wikipedia.org/wiki/Emulator">emulator</a> loads the supplied file
at <code>$C000</code>, and starts execution from that address also (the reset vector is
ignored).</p>
<p>The screen memory begins at <code>$8000</code>, and is <code>40 columns * 25 rows</code>.
Key presses appear when they occur in memory location <code>$A2</code>, and are
<a href="https://en.wikipedia.org/wiki/Bitwise_operation#OR">OR</a>ed
with <code>$80</code> - this is a way of indicating a fresh character. The program
can frequently check this byte, and when it sees a new character, it can
<a href="https://en.wikipedia.org/wiki/Bitwise_operation#AND">AND</a> it with <code>$7F</code> to
indicate that it has been read.</p>
<p>The
<a href="https://en.wikipedia.org/wiki/MOS_Technology_6502#Technical_description">6502</a>
<a href="https://en.wikipedia.org/wiki/Emulator">emulator</a> receives an interrupt 60
times a second or so, you may want to disable interrupts (with the <code>SEI</code>
instruction) if you do not need this.</p>
<p>In
<a href="https://en.wikipedia.org/wiki/MOS_Technology_6502#Technical_description">6502</a>
<a href="https://en.wikipedia.org/wiki/Emulator">emulation</a> mode the special
<a href="https://en.wikipedia.org/wiki/Commodore_PET">PET</a> character codes are not used and
the screen understands normal
<a href="https://en.wikipedia.org/wiki/ASCII#Character_set">ASCII</a>.</p>
<p>Lastly, before <a href="https://en.wikipedia.org/wiki/Emulator">emulation</a> starts,
the low byte from a <code>time(3)</code> call is placed at address 0 - this can be used as a
random seed.</p>
<h3 id="technical-description">Technical description</h3>
<p>Most of the program comprises the <a
href="https://en.wikipedia.org/wiki/MOS_Technology_6502#Technical_description">6502</a>
<a href="https://en.wikipedia.org/wiki/Emulator">emulator</a>.
<code>curses</code> is used for the screen and keyboard handling.</p>
<p>Much of the obfuscation comes from the need to squeeze in the <a
href="https://en.wikipedia.org/wiki/MOS_Technology_6502#Technical_description">6502</a>
<a href="https://en.wikipedia.org/wiki/Emulator">emulation</a> as well
as faking enough of the <a
href="https://en.wikipedia.org/wiki/Commodore_PET">PET</a> hardware for
it to work.</p>
<p>If the supplied file is exactly 16384 bytes, the <a
href="https://en.wikipedia.org/wiki/Emulator">emulator</a> assumes it is
a <a href="https://en.wikipedia.org/wiki/Commodore_PET">PET</a> <a
href="https://en.wikipedia.org/wiki/ROM_image">ROM</a>, and goes into
PET emulation mode. Otherwise some PET specific features are skipped
during normal <a
href="https://en.wikipedia.org/wiki/MOS_Technology_6502#Technical_description">6502</a>
<p>Most of the program comprises the
<a href="https://en.wikipedia.org/wiki/MOS_Technology_6502#Technical_description">6502</a>
<a href="https://en.wikipedia.org/wiki/Emulator">emulator</a>. <code>curses</code> is used for the
screen and keyboard handling.</p>
<p>Much of the obfuscation comes from the need to squeeze in the
<a href="https://en.wikipedia.org/wiki/MOS_Technology_6502#Technical_description">6502</a>
<a href="https://en.wikipedia.org/wiki/Emulator">emulation</a> as well as faking enough of
the <a href="https://en.wikipedia.org/wiki/Commodore_PET">PET</a> hardware for it to work.</p>
<p>If the supplied file is exactly 16384 bytes, the
<a href="https://en.wikipedia.org/wiki/Emulator">emulator</a> assumes it is a
<a href="https://en.wikipedia.org/wiki/Commodore_PET">PET</a>
<a href="https://en.wikipedia.org/wiki/ROM_image">ROM</a>, and goes into PET emulation
mode. Otherwise some PET specific features are skipped during normal
<a href="https://en.wikipedia.org/wiki/MOS_Technology_6502#Technical_description">6502</a>
<a href="https://en.wikipedia.org/wiki/Emulator">emulation</a>.</p>
<p>The main processing all happens in a heroic expression containing no
less than 64 ternary operators (after <code>cpp</code>) starting on <a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2005/sykes/sykes.c#L56">line
56</a>. This decodes the <a
href="https://en.wikipedia.org/wiki/MOS_Technology_6502#Technical_description">6502</a>
less than 64 ternary operators (after <code>cpp</code>) starting on <a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2005/sykes/sykes.c#L56">line
56</a>.
This decodes the
<a href="https://en.wikipedia.org/wiki/MOS_Technology_6502#Technical_description">6502</a>
instructions according to a table and executes them.</p>
<p>The addressing mode is decoded in a similar expression starting on <a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2005/sykes/sykes.c#L53">line
<p>The addressing mode is decoded in a similar expression starting on <a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2005/sykes/sykes.c#L53">line
53</a>.</p>
<h3 id="bugs">Bugs</h3>
<p>The machine emulated is an older 40 column <a
href="https://en.wikipedia.org/wiki/Commodore_PET">PET</a>, so 80 column
programs will not show correctly.</p>
<p>There is no <a
href="https://en.wikipedia.org/wiki/Emulator">emulation</a> of <a
href="https://en.wikipedia.org/wiki/Commodore_PET">PET</a> graphics
characters.</p>
<p>The parameter controls the speed of the 60Hz “jiffy clock”, and not
the processor speed. This means many games may run too fast to be usable
- it really depends on the speed of your machine.</p>
<p>Although the PET <a
href="https://en.wikipedia.org/wiki/Emulator">emulator</a> can do
<code>LOAD</code> and <code>SAVE</code>, it cannot <code>VERIFY</code>
or <code>OPEN</code> and <code>CLOSE</code> files.</p>
<p>The <a href="https://en.wikipedia.org/wiki/Commodore_PET">PET</a>
hardware <a href="https://en.wikipedia.org/wiki/Emulator">emulation</a>
is not at all complete - features such as the hardware timers are
completely missing. Some programs will not run correctly.</p>
<p>The <a
href="https://en.wikipedia.org/wiki/MOS_Technology_6502#Technical_description">6502</a>
<a href="https://en.wikipedia.org/wiki/Emulator">emulation</a> does not
include the seldom used decimal mode, or any of the “undocumented”
instructions.</p>
<p>The machine emulated is an older 40 column
<a href="https://en.wikipedia.org/wiki/Commodore_PET">PET</a>, so 80 column programs
will not show correctly.</p>
<p>There is no <a href="https://en.wikipedia.org/wiki/Emulator">emulation</a> of
<a href="https://en.wikipedia.org/wiki/Commodore_PET">PET</a> graphics characters.</p>
<p>The parameter controls the speed of the 60Hz “jiffy clock”, and not the
processor speed. This means many games may run too fast to be usable -
it really depends on the speed of your machine.</p>
<p>Although the PET <a href="https://en.wikipedia.org/wiki/Emulator">emulator</a> can do <code>LOAD</code>
and <code>SAVE</code>, it cannot <code>VERIFY</code> or <code>OPEN</code> and <code>CLOSE</code> files.</p>
<p>The <a href="https://en.wikipedia.org/wiki/Commodore_PET">PET</a> hardware
<a href="https://en.wikipedia.org/wiki/Emulator">emulation</a> is not at all complete -
features such as the hardware timers are completely missing. Some programs will
not run correctly.</p>
<p>The
<a href="https://en.wikipedia.org/wiki/MOS_Technology_6502#Technical_description">6502</a>
<a href="https://en.wikipedia.org/wiki/Emulator">emulation</a> does not include the seldom
used decimal mode, or any of the “undocumented” instructions.</p>
<h3 id="important-note">IMPORTANT NOTE</h3>
<p>I think it is great fun to run the <a
href="https://en.wikipedia.org/wiki/Commodore_PET">PET</a> <a
href="https://en.wikipedia.org/wiki/Emulator">emulation</a> and mess
around with <a
href="https://en.wikipedia.org/wiki/Microsoft">Microsoft</a> <a
href="https://en.wikipedia.org/wiki/BASIC">BASIC</a>. However, this
obviously needs the <a
href="https://en.wikipedia.org/wiki/ROM_image">ROM</a> file to work. My
<p>I think it is great fun to run the
<a href="https://en.wikipedia.org/wiki/Commodore_PET">PET</a>
<a href="https://en.wikipedia.org/wiki/Emulator">emulation</a> and mess around with
<a href="https://en.wikipedia.org/wiki/Microsoft">Microsoft</a>
<a href="https://en.wikipedia.org/wiki/BASIC">BASIC</a>. However, this obviously needs the
<a href="https://en.wikipedia.org/wiki/ROM_image">ROM</a> file to work. My
program is original and completely free of any copyright, but, of
course, the <code>pet.rom</code> is not my work. So I ask the user to
download it from the Internet. This is to avoid directly infringing any
copyright.</p>
course, the <code>pet.rom</code> is not my work. So I ask the user to download it
from the Internet. This is to avoid directly infringing any copyright.</p>
<h3 id="finally">Finally</h3>
<p>What does this do?</p>
<div class="sourceCode" id="cb17"><pre
class="sourceCode sh"><code class="sourceCode bash"><span id="cb17-1"><a href="#cb17-1" aria-hidden="true" tabindex="-1"></a><span class="ex">./sykes</span> pet.rom <span class="at">-1</span></span></code></pre></div>
<div class="sourceCode" id="cb17"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb17-1"><a href="#cb17-1" aria-hidden="true" tabindex="-1"></a><span class="ex">./sykes</span> pet.rom <span class="at">-1</span></span></code></pre></div>
<p>Have fun!</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>
<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>
<p>For more information, see: https://creativecommons.org/licenses/by-sa/4.0/</p>
<!-- END: this line ends content for HTML phase 21 by: bin/pandoc-wrapper.sh via bin/md2html.sh -->
<!-- START: this line starts content for HTML phase 22 by: bin/output-index-inventory.sh via bin/md2html.sh -->
<!-- START: this line starts content generated by: bin/output-index-inventory.sh -->
<h1 id="inventory-for-2005sykes"><a name="inventory"></a>Inventory for
2005/sykes</h1>
<h1 id="inventory-for-2005sykes"><a name="inventory"></a>Inventory for 2005/sykes</h1>
<p><a href="#top">Jump to top</a></p>
<h2 id="primary-files">Primary files</h2>
<ul>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2005/sykes/sykes.c">sykes.c</a>
- entry source</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2005/sykes/Makefile">Makefile</a>
- entry Makefile</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2005/sykes/sykes.orig.c">sykes.orig.c</a>
- original source</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2005/sykes/test.sh">test.sh</a>
- test tool</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2005/sykes/try.sh">try.sh</a>
- how to run</li>
<li><a href="2005_sykes.tar.bz2">2005_sykes.tar.bz2</a> - download entry
source</li>
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2005/sykes/sykes.c">sykes.c</a> - entry source</li>
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2005/sykes/Makefile">Makefile</a> - entry Makefile</li>
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2005/sykes/sykes.orig.c">sykes.orig.c</a> - original source</li>
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2005/sykes/test.sh">test.sh</a> - test tool</li>
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2005/sykes/try.sh">try.sh</a> - how to run</li>
<li><a href="2005_sykes.tar.bz2">2005_sykes.tar.bz2</a> - download entry source</li>
</ul>
<h2 id="secondary-files">Secondary files</h2>
<ul>
<li><a href="index.html">index.html</a> - entry home page</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2005/sykes/.entry.json">.entry.json</a>
- description of entry in JSON</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2005/sykes/.gitignore">.gitignore</a>
- list of files that should not be committed under git</li>
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2005/sykes/.entry.json">.entry.json</a> - description of entry in JSON</li>
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2005/sykes/.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="6502test">6502test</a> - 6502 test utility</li>
<li><a href="DEMO">DEMO</a> - demo for Commodore PET</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2005/sykes/PET">PET</a>
- Commodore PET emulator</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2005/sykes/README.md">README.md</a>
- markdown source for index.html</li>
<li><a href="basic-2-c000.901465-01.bin">basic-2-c000.901465-01.bin</a>
- BASIC binary for Commodore PET</li>
<li><a href="basic-2-d000.901465-02.bin">basic-2-d000.901465-02.bin</a>
- BASIC binary for Commodore PET</li>
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2005/sykes/PET">PET</a> - Commodore PET emulator</li>
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2005/sykes/README.md">README.md</a> - markdown source for index.html</li>
<li><a href="basic-2-c000.901465-01.bin">basic-2-c000.901465-01.bin</a> - BASIC binary for Commodore PET</li>
<li><a href="basic-2-d000.901465-02.bin">basic-2-d000.901465-02.bin</a> - BASIC binary for Commodore PET</li>
<li><a href="chess">chess</a> - chess program for Commodore PET</li>
<li><a href="edit-2-n.901447-24.bin">edit-2-n.901447-24.bin</a> - editor
for Commodore PET</li>
<li><a href="kernel-2.901465-03.bin">kernel-2.901465-03.bin</a> -
Commodore PET kernel</li>
<li><a href="edit-2-n.901447-24.bin">edit-2-n.901447-24.bin</a> - editor for Commodore PET</li>
<li><a href="kernel-2.901465-03.bin">kernel-2.901465-03.bin</a> - Commodore PET kernel</li>
<li><a href="nullfill.bin">nullfill.bin</a> - block of binary zeros</li>
</ul>
+49 -77
View File
@@ -129,9 +129,9 @@
<h2 id="author"><a name="author"></a>Author:</h2>
<ul>
<li>Name: <a href="../../authors.html#Arne_Heizmann">Arne Timwi
Heizmann</a><br> Location: <a href="../../location.html#DE">DE</a> -
<em>Federal Republic of Germany</em> (<em>Germany</em>) <br><br></li>
<li>Name: <a href="../../authors.html#Arne_Heizmann">Arne Timwi Heizmann</a><br>
Location: <a href="../../location.html#DE">DE</a> - <em>Federal Republic of Germany</em> (<em>Germany</em>)
<br><br></li>
</ul>
<!-- END: next line ends content generated by: bin/output-index-author.sh -->
@@ -146,106 +146,78 @@ Heizmann</a><br> Location: <a href="../../location.html#DE">DE</a> -
<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>Unlike most <a href="https://en.wikipedia.org/wiki/Brainfuck">BF</a>
interpreters that we have been receiving for the last few years, this
one, in our opinion, is the most obfuscated albeit the most discourteous
to the language it interprets. A simple 3-character fix will make it
slightly less so.</p>
<p>Quite a few BF programs found on the Net expect byte-based memory,
quite a few exceed the capacity of this interpreter, but there are many
that work. Some small <a
href="https://en.wikipedia.org/wiki/Quine_(computing)">quines</a> work,
some don’t.</p>
<p>Unlike most <a href="https://en.wikipedia.org/wiki/Brainfuck">BF</a> interpreters that we
have been receiving for the last few years, this one, in our opinion, is the
most obfuscated albeit the most discourteous to the language it interprets. A
simple 3-character fix will make it slightly less so.</p>
<p>Quite a few BF programs found on the Net expect byte-based memory, quite a few
exceed the capacity of this interpreter, but there are many that work. Some
small <a href="https://en.wikipedia.org/wiki/Quine_(computing)">quines</a> work, some don’t.</p>
<p>Why?</p>
<h2 id="authors-remarks">Author’s remarks:</h2>
<p>This is an interpreter for the programming language <a
href="https://en.wikipedia.org/wiki/Brainfuck">BrainFuck</a> (BF).</p>
<p>Input must be provided in the following format: First a sequence of
integers separated by whitespace (this will be the input to the BF
program), then a <code>:</code> (colon), then the BF program itself.</p>
<p>This is an interpreter for the programming language
<a href="https://en.wikipedia.org/wiki/Brainfuck">BrainFuck</a> (BF).</p>
<p>Input must be provided in the following format: First a sequence of integers
separated by whitespace (this will be the input to the BF program), then a <code>:</code>
(colon), then the BF program itself.</p>
<p>You must not pass any command-line arguments.</p>
<h3 id="features">Features</h3>
<ul>
<li><p>Supports the complete set of 8 BF instructions
(<code>+-&lt;&gt;[].,</code>).</p></li>
<li><p>Supports the use of alternative characters for some of those
instructions. Use this to obfuscate your BF programs!</p>
<li><p>Supports the complete set of 8 BF instructions (<code>+-&lt;&gt;[].,</code>).</p></li>
<li><p>Supports the use of alternative characters for some of those instructions.
Use this to obfuscate your BF programs!</p>
<p>For a challenge, figure out what this obfuscated BF program does:</p>
<pre><code> J4mzt?Vazexx-20d~&amp;&amp;~AxdUV!x(~Jz&amp;V)x*(P=J)JUN(dizz)xx_!xx&#39;0&amp;{Vz;}&amp;Jj</code></pre>
<p>It takes two integers as input and outputs one integer.</p></li>
<li><p>Ignores all whitespace (newlines, spaces and tabs) in the input
program.</p></li>
<li><p>Ignores all whitespace (newlines, spaces and tabs) in the input program.</p></li>
</ul>
<h3 id="limitations">Limitations</h3>
<p>Since the program, naturally, uses <code>int</code>s, the
calculations must not exceed the range of an <code>int</code>. (But then
again, you can use the integer overflow to further obfuscate your BF
programs in creative ways!)</p>
<p>You are limited to 3125 input integers and 3125 instructions. If you
exceed one of these limits, the behaviour is undefined.</p>
<p>Since the program, naturally, uses <code>int</code>s, the calculations must not exceed the
range of an <code>int</code>. (But then again, you can use the integer overflow to further
obfuscate your BF programs in creative ways!)</p>
<p>You are limited to 3125 input integers and 3125 instructions. If you exceed
one of these limits, the behaviour is undefined.</p>
<h3 id="obfuscations">Obfuscations</h3>
<p>Some of the superficial obfuscations are pretty obvious: I’m using
<code>#define</code>s to make everything look nice and lineal, and the
program is merely a recursive <code>main()</code> function with only a
single <code>return</code> statement which uses nested ternary operators
to make even the pre-processed code unreadable.</p>
<p>However, the more subtle obfuscations relate to the way the program
works. After applying the pre-processing, you will see a lot of
<code>1+1+1</code>…etc., and even if you replace these with their
result, those numbers will still not represent (or even relate to) the
ASCII codes of the BF instructions.</p>
<p>The program will first read in all the input integers, but it will
begin execution immediately and only read program instructions as they
are needed. Yet there is no global variable storing how far it has read!
Perhaps the hardest thing to figure out is how it finds the matching
square brackets.</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>
<p>Some of the superficial obfuscations are pretty obvious: I’m using <code>#define</code>s to
make everything look nice and lineal, and the program is merely a recursive
<code>main()</code> function with only a single <code>return</code> statement which uses nested ternary
operators to make even the pre-processed code unreadable.</p>
<p>However, the more subtle obfuscations relate to the way the program works.
After applying the pre-processing, you will see a lot of <code>1+1+1</code>…etc., and
even if you replace these with their result, those numbers will still not
represent (or even relate to) the ASCII codes of the BF instructions.</p>
<p>The program will first read in all the input integers, but it will begin
execution immediately and only read program instructions as they are needed.
Yet there is no global variable storing how far it has read! Perhaps the
hardest thing to figure out is how it finds the matching square brackets.</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>
<p>For more information, see: https://creativecommons.org/licenses/by-sa/4.0/</p>
<!-- END: this line ends content for HTML phase 21 by: bin/pandoc-wrapper.sh via bin/md2html.sh -->
<!-- START: this line starts content for HTML phase 22 by: bin/output-index-inventory.sh via bin/md2html.sh -->
<!-- START: this line starts content generated by: bin/output-index-inventory.sh -->
<h1 id="inventory-for-2005timwi"><a name="inventory"></a>Inventory for
2005/timwi</h1>
<h1 id="inventory-for-2005timwi"><a name="inventory"></a>Inventory for 2005/timwi</h1>
<p><a href="#top">Jump to top</a></p>
<h2 id="primary-files">Primary files</h2>
<ul>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2005/timwi/timwi.c">timwi.c</a>
- entry source</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2005/timwi/Makefile">Makefile</a>
- entry Makefile</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2005/timwi/timwi.orig.c">timwi.orig.c</a>
- original source</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2005/timwi/try.sh">try.sh</a>
- how to run</li>
<li><a href="2005_timwi.tar.bz2">2005_timwi.tar.bz2</a> - download entry
source</li>
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2005/timwi/timwi.c">timwi.c</a> - entry source</li>
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2005/timwi/Makefile">Makefile</a> - entry Makefile</li>
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2005/timwi/timwi.orig.c">timwi.orig.c</a> - original source</li>
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2005/timwi/try.sh">try.sh</a> - how to run</li>
<li><a href="2005_timwi.tar.bz2">2005_timwi.tar.bz2</a> - download entry source</li>
</ul>
<h2 id="secondary-files">Secondary files</h2>
<ul>
<li><a href="index.html">index.html</a> - entry home page</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2005/timwi/.entry.json">.entry.json</a>
- description of entry in JSON</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2005/timwi/.gitignore">.gitignore</a>
- list of files that should not be committed under git</li>
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2005/timwi/.entry.json">.entry.json</a> - description of entry in JSON</li>
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2005/timwi/.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/2005/timwi/README.md">README.md</a>
- markdown source for index.html</li>
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2005/timwi/README.md">README.md</a> - markdown source for index.html</li>
</ul>
<!-- END: next line ends content generated by: bin/output-index-inventory.sh -->
+72 -106
View File
@@ -129,9 +129,9 @@
<h2 id="author"><a name="author"></a>Author:</h2>
<ul>
<li>Name: <a href="../../authors.html#Oscar_Toledo">Oscar Toledo
G.</a><br> Location: <a href="../../location.html#MX">MX</a> -
<em>United Mexican States</em> (<em>Mexico</em>) <br><br></li>
<li>Name: <a href="../../authors.html#Oscar_Toledo">Oscar Toledo G.</a><br>
Location: <a href="../../location.html#MX">MX</a> - <em>United Mexican States</em> (<em>Mexico</em>)
<br><br></li>
</ul>
<!-- END: next line ends content generated by: bin/output-index-author.sh -->
@@ -147,159 +147,125 @@ G.</a><br> Location: <a href="../../location.html#MX">MX</a> -
<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">./toledo</span> a</span>
<span id="cb3-2"><a href="#cb3-2" aria-hidden="true" tabindex="-1"></a><span class="ex">./toledo</span> a b</span></code></pre></div>
<h2 id="alternate-code">Alternate code:</h2>
<p>Two alternate versions of this entry, <a
href="toledo2.c">toledo2.c</a> and <a href="toledo3.c">toledo3.c</a> are
provided.</p>
<p>Two alternate versions of this entry, <a href="toledo2.c">toledo2.c</a> and
<a href="toledo3.c">toledo3.c</a> are provided.</p>
<h3 id="alternate-build">Alternate build:</h3>
<p>To compile the alternate versions:</p>
<div class="sourceCode" id="cb4"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb4-1"><a href="#cb4-1" aria-hidden="true" tabindex="-1"></a><span class="fu">make</span> alt</span></code></pre></div>
<h3 id="alternate-use">Alternate use:</h3>
<p>Use Use <code>toledo2</code> and <code>toledo3</code> as you would
<code>toledo</code> above.</p>
<p>Use Use <code>toledo2</code> and <code>toledo3</code> as you would <code>toledo</code> above.</p>
<h2 id="judges-remarks">Judges’ remarks:</h2>
<p>Challenge yourself with your ability to look 5, 6 or more moves
ahead. Challenge your knowledge of C operator precedence. The following
is the move analysis via recursion while it executes moves. All while
playing by the rules of C and Chess within a single function!</p>
<p>Challenge yourself with your ability to look 5, 6 or more moves ahead.
Challenge your knowledge of C operator precedence. The following is the
move analysis via recursion while it executes moves. All while playing
by the rules of C and Chess within a single function!</p>
<h3 id="historical-note">Historical note:</h3>
<p>When this entry was submitted the code was a recursive call to
<code>main()</code> - that was it. In 2023 due to problems with
<code>clang</code> <code>main()</code> calls another function,
<code>pain()</code>, which calls itself. But it might be said that the
Chess is still a single function.</p>
<p>When this entry was submitted the code was a recursive call to <code>main()</code> - that
was it. In 2023 due to problems with <code>clang</code> <code>main()</code> calls another function,
<code>pain()</code>, which calls itself. But it might be said that the Chess is still a
single function.</p>
<h2 id="authors-remarks">Author’s remarks:</h2>
<h3 id="what-does-this-program">What does this program</h3>
<p>This is a <a href="https://en.wikipedia.org/wiki/Chess">chess</a>
program, it can work in two modes: two-players, and one player (always
white) against the machine. To get the first mode, run the program
without arguments:</p>
<p>This is a <a href="https://en.wikipedia.org/wiki/Chess">chess</a> program, it can work in
two modes: two-players, and one player (always white) against the machine. To
get the first mode, run the program without arguments:</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">./toledo</span></span></code></pre></div>
<p>The other mode is accessible running the program with one argument
(5-<a href="https://en.wikipedia.org/wiki/Ply_(game_theory)">ply</a>
analysis):</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">./toledo</span> a</span></code></pre></div>
<p>Two arguments for 6-<a
href="https://en.wikipedia.org/wiki/Ply_(game_theory)">ply</a>
<p>Two arguments for 6-<a href="https://en.wikipedia.org/wiki/Ply_(game_theory)">ply</a>
analysis:</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">./toledo</span> a b</span></code></pre></div>
<p>And each successive argument will analyze one <a
href="https://en.wikipedia.org/wiki/Ply_(game_theory)">ply</a> more.
There is no ply limit, but beyond 7 ply is very slow, try it at your own
risk and computing time.</p>
<p>And each successive argument will analyze one
<a href="https://en.wikipedia.org/wiki/Ply_(game_theory)">ply</a> more. There is no ply
limit, but beyond 7 ply is very slow, try it at your own risk and computing
time.</p>
<h3 id="entering-movements">Entering movements</h3>
<p>When it is your turn, you can enter your move, for example, as
<code>d2d4</code> and press the enter key. This will move the pawn at
<code>D2</code> to <code>D4</code>, assuming that a pawn is there (as it
would be in the beginning). The computer will check move legality and
will warn you of illegal moves. All legal chess moves are permitted.</p>
<p>One special case is when you are doing promotion, you must enter the
move with an extra letter indicating the desired piece.</p>
<p>For example <code>f7f8n</code> (supposing you have a pawn on
<code>F7</code>), will promote it to a knight; substitute <code>n</code>
for the desired piece
(<code>N</code>/<code>Q</code>/<code>R</code>/<code>B</code>).</p>
<p>When it is your turn, you can enter your move, for example, as <code>d2d4</code> and press the
enter key. This will move the pawn at <code>D2</code> to <code>D4</code>, assuming that a pawn is
there (as it would be in the beginning). The computer will check move legality
and will warn you of illegal moves. All legal chess moves are permitted.</p>
<p>One special case is when you are doing promotion, you must enter the move with
an extra letter indicating the desired piece.</p>
<p>For example <code>f7f8n</code> (supposing you have a pawn on <code>F7</code>), will promote it to a
knight; substitute <code>n</code> for the desired piece (<code>N</code>/<code>Q</code>/<code>R</code>/<code>B</code>).</p>
<p>Note that the program requires the piece letter; it will not select
automatically a queen, so don’t be surprised if it doesn’t accept your
move.</p>
automatically a queen, so don’t be surprised if it doesn’t accept your move.</p>
<h3 id="game-status">Game status</h3>
<p>The computer will check for checkmate and stalemate. Also, after each
machine move, it will show the score of the position: a higher number is
better for the computer, i.e. worse for you.</p>
<p>The computer will check for checkmate and stalemate. Also, after each machine
move, it will show the score of the position: a higher number is better for
the computer, i.e. worse for you.</p>
<h3 id="quirks">Quirks</h3>
<p>None.</p>
<h3 id="program-operation">Program operation</h3>
<p>This is a good example of a chess program reduced to the essential.
In order to get it into the contest limits, I used short but slow and
unintelligible algorithms.</p>
<p>The interface accounts for only a fraction of the code, the core does
multiples functions: it is called recursively to analyze and evaluate
each <a href="https://en.wikipedia.org/wiki/Ply_(game_theory)">ply</a>,
does <a
href="https://en.wikipedia.org/wiki/Alpha-beta_pruning">alpha-beta
pruning</a>, move generation, machine playing, check detection, illegal
move verification and does moves after they are verified.</p>
<p>It also sets a standard on ultra-mini-chess programs. The player and
the computer can do all legal chess moves.</p>
<p>This is a good example of a chess program reduced to the essential. In order
to get it into the contest limits, I used short but slow and unintelligible
algorithms.</p>
<p>The interface accounts for only a fraction of the code, the core does multiples
functions: it is called recursively to analyze and evaluate each
<a href="https://en.wikipedia.org/wiki/Ply_(game_theory)">ply</a>, does <a href="https://en.wikipedia.org/wiki/Alpha-beta_pruning">alpha-beta
pruning</a>, move generation,
machine playing, check detection, illegal move verification and does moves after
they are verified.</p>
<p>It also sets a standard on ultra-mini-chess programs. The player and the
computer can do all legal chess moves.</p>
<h3 id="additional-features">Additional features</h3>
<p>Other features are:</p>
<ul>
<li>Illegal move verification.</li>
<li><a href="https://en.wikipedia.org/wiki/Checkmate">Checkmate</a>
detection.</li>
<li><a href="https://en.wikipedia.org/wiki/Checkmate">Checkmate</a> detection.</li>
<li>Stalemate detection.</li>
<li>Computer is tough (check 7-<a
href="https://en.wikipedia.org/wiki/Ply_(game_theory)">ply</a>) and even
in 5 ply can give a surprise to amateur players.</li>
<li>Computer is tough (check
7-<a href="https://en.wikipedia.org/wiki/Ply_(game_theory)">ply</a>) and even in 5 ply can give a surprise to
amateur players.</li>
</ul>
<h3 id="obfuscation-tricks">Obfuscation tricks</h3>
<ul>
<li>Only one very modular C function.</li>
<li>Extensive use of the ternary and comma operators; save a hard drive
today.</li>
<li>Extensive use of C operator precedence; all good C programmers
remember it… I cannot.</li>
<li>Extensive use of the ternary and comma operators; save a hard drive today.</li>
<li>Extensive use of C operator precedence; all good C programmers remember
it… I cannot.</li>
<li>Exchanged operands every place possible. Someday someone will
understand it.</li>
<li>Mixed and multifunction expressions on statements, in good old-BASIC
style.</li>
<li>Macros used to hide C syntax: check unbalanced parenthesis and calls
with empty arguments!</li>
<li>Only includes strictly necessary standard headers, the linker takes
care, and compiles faster… but I’m still not seeing the difference.</li>
<li>Uses only one string, very easy to <a
href="https://en.wikipedia.org/wiki/Internationalization_and_localization">i18n</a>
;)</li>
<li>Macros used to hide C syntax: check unbalanced parenthesis and calls with
empty arguments!</li>
<li>Only includes strictly necessary standard headers, the linker takes care,
and compiles faster… but I’m still not seeing the difference.</li>
<li>Uses only one string, very easy to
<a href="https://en.wikipedia.org/wiki/Internationalization_and_localization">i18n</a> ;)</li>
</ul>
<h2 id="copyright-and-cc-by-sa-4.0-license">Copyright and CC BY-SA 4.0
License:</h2>
<p>This file is Copyright (c) 2023 by Landon Curt Noll. All Rights
Reserved. You are free to share and adapt this file under the terms of
this license:</p>
<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>
<p>For more information, see: https://creativecommons.org/licenses/by-sa/4.0/</p>
<!-- END: this line ends content for HTML phase 21 by: bin/pandoc-wrapper.sh via bin/md2html.sh -->
<!-- START: this line starts content for HTML phase 22 by: bin/output-index-inventory.sh via bin/md2html.sh -->
<!-- START: this line starts content generated by: bin/output-index-inventory.sh -->
<h1 id="inventory-for-2005toledo"><a name="inventory"></a>Inventory for
2005/toledo</h1>
<h1 id="inventory-for-2005toledo"><a name="inventory"></a>Inventory for 2005/toledo</h1>
<p><a href="#top">Jump to top</a></p>
<h2 id="primary-files">Primary files</h2>
<ul>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2005/toledo/toledo.c">toledo.c</a>
- entry source</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2005/toledo/Makefile">Makefile</a>
- entry Makefile</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2005/toledo/toledo.orig.c">toledo.orig.c</a>
- original source</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2005/toledo/toledo2.c">toledo2.c</a>
- alternative source</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2005/toledo/toledo3.c">toledo3.c</a>
- alternative source</li>
<li><a href="2005_toledo.tar.bz2">2005_toledo.tar.bz2</a> - download
entry source</li>
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2005/toledo/toledo.c">toledo.c</a> - entry source</li>
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2005/toledo/Makefile">Makefile</a> - entry Makefile</li>
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2005/toledo/toledo.orig.c">toledo.orig.c</a> - original source</li>
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2005/toledo/toledo2.c">toledo2.c</a> - alternative source</li>
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2005/toledo/toledo3.c">toledo3.c</a> - alternative source</li>
<li><a href="2005_toledo.tar.bz2">2005_toledo.tar.bz2</a> - download entry source</li>
</ul>
<h2 id="secondary-files">Secondary files</h2>
<ul>
<li><a href="index.html">index.html</a> - entry home page</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2005/toledo/.entry.json">.entry.json</a>
- description of entry in JSON</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2005/toledo/.gitignore">.gitignore</a>
- list of files that should not be committed under git</li>
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2005/toledo/.entry.json">.entry.json</a> - description of entry in JSON</li>
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2005/toledo/.gitignore">.gitignore</a> - list of files that should not be committed under git</li>
<li><a href=".path">.path</a> - directory path from top directory</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2005/toledo/README.md">README.md</a>
- markdown source for index.html</li>
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2005/toledo/README.md">README.md</a> - markdown source for index.html</li>
</ul>
<!-- END: next line ends content generated by: bin/output-index-inventory.sh -->
+59 -89
View File
@@ -130,8 +130,8 @@
<h2 id="author"><a name="author"></a>Author:</h2>
<ul>
<li>Name: <a href="../../authors.html#Daniel_Vik">Daniel Vik</a><br>
Location: <a href="../../location.html#US">US</a> - <em>United States of
America</em> (<em>United States</em>) <br><br></li>
Location: <a href="../../location.html#US">US</a> - <em>United States of America</em> (<em>United States</em>)
<br><br></li>
</ul>
<!-- END: next line ends content generated by: bin/output-index-author.sh -->
@@ -146,22 +146,19 @@ America</em> (<em>United States</em>) <br><br></li>
<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">./vik</span> maze.map</span></code></pre></div>
<h2 id="judges-remarks">Judges’ remarks:</h2>
<p>An amazing use of the X libraries with twisty code passages, all
different. One risks running in code path circles as <code>main()</code>
is called again and again. Be sure to pay attention to commas! :-)</p>
<p>An amazing use of the X libraries with twisty code passages, all different. One
risks running in code path circles as <code>main()</code> is called again and again. Be
sure to pay attention to commas! :-)</p>
<h2 id="authors-remarks">Author’s remarks:</h2>
<p>This entry is a <a
href="https://en.wikipedia.org/wiki/Wolfenstein">Wolfenstein</a> style
<a
href="https://en.wikipedia.org/wiki/Rendering_(computer_graphics)">graphics
engine</a> where a user can navigate in a <a
href="https://en.wikipedia.org/wiki/3D_computer_graphics">3D</a> world.
The <a href="https://en.wikipedia.org/wiki/Maze">maze</a> has walls with
<a href="https://en.wikipedia.org/wiki/Bitmap_textures">bitmap
textures</a>. The application contains a default world with textures,
but the power of the engine is exposed through user configured <a
href="https://en.wikipedia.org/wiki/Map">maps</a>. User defined worlds
support up to 26 different wall textures that can even be animated. One
<p>This entry is a <a href="https://en.wikipedia.org/wiki/Wolfenstein">Wolfenstein</a> style
<a href="https://en.wikipedia.org/wiki/Rendering_(computer_graphics)">graphics engine</a>
where a user can navigate in a
<a href="https://en.wikipedia.org/wiki/3D_computer_graphics">3D</a> world. The
<a href="https://en.wikipedia.org/wiki/Maze">maze</a> has walls with <a href="https://en.wikipedia.org/wiki/Bitmap_textures">bitmap
textures</a>. The application
contains a default world with textures, but the power of the engine is exposed
through user configured <a href="https://en.wikipedia.org/wiki/Map">maps</a>. User defined
worlds support up to 26 different wall textures that can even be animated. One
example of a user defined world is submitted with the entry.</p>
<h3 id="features">Features</h3>
<p>This program is a complete 3D engine with</p>
@@ -169,18 +166,16 @@ example of a user defined world is submitted with the entry.</p>
<li>Easy configurable maze maps.</li>
<li>Up to 26 different bitmap textures in a maze.</li>
<li>Support for animated bitmap textures.</li>
<li>Uses default bitmaps in case the configured bitmaps can’t be
found.</li>
<li>Uses default bitmaps in case the configured bitmaps can’t be found.</li>
<li>A default map in case none is specified.</li>
<li>Configurable window size.</li>
<li>Navigation using cursor keys (rotate left and right, move forward
and backward).</li>
<li>Navigation using cursor keys (rotate left and right, move forward and
backward).</li>
</ul>
<h3 id="build-and-run">Build and Run</h3>
<p>Compile the source code and link in <a
href="https://en.wikipedia.org/wiki/Xlib">X libraries</a> if necessary.
The program takes three options which have to be typed in a specific
order as described below.</p>
<p>Compile the source code and link in <a href="https://en.wikipedia.org/wiki/Xlib">X
libraries</a> if necessary. The program takes
three options which have to be typed in a specific order as described below.</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">./vik</span> [-w <span class="op">&lt;</span>width<span class="op">&gt;</span>] <span class="pp">[</span><span class="ss">mapfile</span><span class="pp">]</span></span></code></pre></div>
<p>where:</p>
<pre><code>width - Specifies the width of the window
@@ -188,39 +183,33 @@ mapfile - Filename containing a map</code></pre>
<h4 id="examples">Examples</h4>
<p>Start the engine using a built in labyrinth and texture bitmaps:</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">./vik</span></span></code></pre></div>
<p>Start the engine and loads the labyrinth defined in the file <a
href="maze.map">maze.map</a>:</p>
<p>Start the engine and loads the labyrinth defined in the file
<a href="maze.map">maze.map</a>:</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">./vik</span> maze.map</span></code></pre></div>
<p>Start the engine using <a href="maze.map">maze.map</a> in a window
that is 400 pixels wide:</p>
<p>Start the engine using <a href="maze.map">maze.map</a> in a window that is 400 pixels wide:</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">./vik</span> <span class="at">-w</span> 400 maze.map</span></code></pre></div>
<p>Note that the <code>mapfile</code> has to be the last argument and
the <code>-w</code> option if present has to be the first. The map
definition files and the bitmap files should be located in the current
directory.</p>
<p>Note that the <code>mapfile</code> has to be the last argument and the <code>-w</code> option if present
has to be the first. The map definition files and the bitmap files should be
located in the current directory.</p>
<p>Use the cursor keys to navigate through the labyrinth.</p>
<h3 id="creating-mazes">Creating mazes</h3>
<p>A maze consists of a map file and texture bitmap files. The map file
is an ASCII text file where lower case letters represent walls. The
letter tells the engine what bitmap texture file to use. The
<code>*</code> character lets the engine know where to position the
user. The example below shows how a map file can look:</p>
<p>A maze consists of a map file and texture bitmap files. The map file is an
ASCII text file where lower case letters represent walls. The letter tells the
engine what bitmap texture file to use. The <code>*</code> character lets the engine know
where to position the user. The example below shows how a map file can look:</p>
<pre><code>aaaaaaaaaaaaa
a a
a * a
a bbbb cccccccc
c c
cccccccccccccccccccc</code></pre>
<p>The engine loads the map, and creates walls. When a character in the
range <code>a-z</code> is found, the engine will load the corresponding
texture bitmap. The bitmap file must be named <code>*.bmp</code> where
<code>*</code> is substituted with the letter of the wall in the map
(note that only <code>a</code>, <code>b</code> and <code>c</code>
exist).</p>
<p>So to load the map above, the files <code>a.bmp</code>,
<code>b.bmp</code>, and <code>c.bmp</code> should be located in the same
directory as the engine executable (or rather in the current
directory).</p>
<p>The engine loads the map, and creates walls. When a character in the range <code>a-z</code>
is found, the engine will load the corresponding texture bitmap. The bitmap file
must be named <code>*.bmp</code> where <code>*</code> is substituted with the letter of the wall in
the map (note that only <code>a</code>, <code>b</code> and <code>c</code> exist).</p>
<p>So to load the map above, the files <code>a.bmp</code>, <code>b.bmp</code>, and <code>c.bmp</code> should be
located in the same directory as the engine executable (or rather in the
current directory).</p>
<h3 id="obfuscation">Obfuscation</h3>
<p>The program is obfuscated in several ways:</p>
<ul>
@@ -228,70 +217,51 @@ directory).</p>
<li>Use of the <code>?</code> operator.</li>
<li>Recursive calls to <code>main()</code>.</li>
<li>Bad use of <code>for</code> loops and the comma operator.</li>
<li>To make the final obfuscated touch I ran indent which really made
the program unreadable (I guess that is not really the intent with
indent ;) )</li>
<li>To make the final obfuscated touch I ran indent which really made the program
unreadable (I guess that is not really the intent with indent ;) )</li>
</ul>
<h3 id="compiler-warnings">Compiler warnings</h3>
<p>There are no compiler warnings when compiling with <code>-ansi</code>
but there are quite a few warnings from <code>lclint</code>. Mainly
because the program is very optimized for code size.</p>
<p>There are no compiler warnings when compiling with <code>-ansi</code> but there are quite
a few warnings from <code>lclint</code>. Mainly because the program is very optimized for
code size.</p>
<h3 id="limitations">Limitations</h3>
<p>The program only compiles and runs on <a
href="https://en.wikipedia.org/wiki/X_Window_System">X based
<p>The program only compiles and runs on <a href="https://en.wikipedia.org/wiki/X_Window_System">X based
systems</a>.</p>
<p>The program does not run that smooth under <a
href="https://en.wikipedia.org/wiki/Cygwin">Cygwin</a>. It seems to be a
priority issue with Cygwin and it can easily be solved by increasing the
priority of the application a little bit.</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>
<p>The program does not run that smooth under
<a href="https://en.wikipedia.org/wiki/Cygwin">Cygwin</a>. It seems to be a priority issue
with Cygwin and it can easily be solved by increasing the priority of the
application a little bit.</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>
<p>For more information, see: https://creativecommons.org/licenses/by-sa/4.0/</p>
<!-- END: this line ends content for HTML phase 21 by: bin/pandoc-wrapper.sh via bin/md2html.sh -->
<!-- START: this line starts content for HTML phase 22 by: bin/output-index-inventory.sh via bin/md2html.sh -->
<!-- START: this line starts content generated by: bin/output-index-inventory.sh -->
<h1 id="inventory-for-2005vik"><a name="inventory"></a>Inventory for
2005/vik</h1>
<h1 id="inventory-for-2005vik"><a name="inventory"></a>Inventory for 2005/vik</h1>
<p><a href="#top">Jump to top</a></p>
<h2 id="primary-files">Primary files</h2>
<ul>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2005/vik/vik.c">vik.c</a>
- entry source</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2005/vik/Makefile">Makefile</a>
- entry Makefile</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2005/vik/vik.orig.c">vik.orig.c</a>
- original source</li>
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2005/vik/vik.c">vik.c</a> - entry source</li>
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2005/vik/Makefile">Makefile</a> - entry Makefile</li>
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2005/vik/vik.orig.c">vik.orig.c</a> - original source</li>
<li><a href="maze.map">maze.map</a> - maze map</li>
<li><a href="a.bmp">a.bmp</a> - texture bitmap</li>
<li><a href="b.bmp">b.bmp</a> - texture bitmap</li>
<li><a href="c.bmp">c.bmp</a> - texture bitmap</li>
<li><a href="2005_vik.tar.bz2">2005_vik.tar.bz2</a> - download entry
source</li>
<li><a href="2005_vik.tar.bz2">2005_vik.tar.bz2</a> - download entry source</li>
</ul>
<h2 id="secondary-files">Secondary files</h2>
<ul>
<li><a href="index.html">index.html</a> - entry home page</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2005/vik/.entry.json">.entry.json</a>
- description of entry in JSON</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2005/vik/.gitignore">.gitignore</a>
- list of files that should not be committed under git</li>
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2005/vik/.entry.json">.entry.json</a> - description of entry in JSON</li>
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2005/vik/.gitignore">.gitignore</a> - list of files that should not be committed under git</li>
<li><a href=".path">.path</a> - directory path from top directory</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2005/vik/README.md">README.md</a>
- markdown source for index.html</li>
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2005/vik/README.md">README.md</a> - markdown source for index.html</li>
</ul>
<!-- END: next line ends content generated by: bin/output-index-inventory.sh -->
+51 -78
View File
@@ -129,9 +129,9 @@
<h2 id="author"><a name="author"></a>Author:</h2>
<ul>
<li>Name: <a href="../../authors.html#Vincent_Weaver">Vincent
Weaver</a><br> Location: <a href="../../location.html#US">US</a> -
<em>United States of America</em> (<em>United States</em>) <br><br></li>
<li>Name: <a href="../../authors.html#Vincent_Weaver">Vincent Weaver</a><br>
Location: <a href="../../location.html#US">US</a> - <em>United States of America</em> (<em>United States</em>)
<br><br></li>
</ul>
<!-- END: next line ends content generated by: bin/output-index-author.sh -->
@@ -140,18 +140,17 @@ Weaver</a><br> Location: <a href="../../location.html#US">US</a> -
<!-- START: this line starts content for HTML phase 21 by: bin/pandoc-wrapper.sh via bin/md2html.sh -->
<h2 id="to-build">To build:</h2>
<p>Before building, make sure that you have the OpenGL development
libraries installed.</p>
<p>Before building, make sure that you have the OpenGL development libraries
installed.</p>
<div class="sourceCode" id="cb1"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb1-1"><a href="#cb1-1" aria-hidden="true" tabindex="-1"></a><span class="fu">make</span></span></code></pre></div>
<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">./vince</span></span></code></pre></div>
<h2 id="try">Try:</h2>
<p>When running this in the program’s window try hitting space a few
times and see what happens!</p>
<p>When running this in the program’s window try hitting space a few times and see
what happens!</p>
<h2 id="alternate-code">Alternate code:</h2>
<p>The <a href="vince.alt.c">vince.alt.c</a> code of the submission will
run on SGI IRIX and also has the recursive <code>CPP</code> macro (which
sneaked in accidentally) removed.</p>
<p>The <a href="vince.alt.c">vince.alt.c</a> code of the submission will run on SGI IRIX and
also has the recursive <code>CPP</code> macro (which sneaked in accidentally) removed.</p>
<h3 id="alternate-build">Alternate build:</h3>
<p>To compile this alternate version:</p>
<div class="sourceCode" id="cb3"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb3-1"><a href="#cb3-1" aria-hidden="true" tabindex="-1"></a><span class="fu">make</span> alt</span></code></pre></div>
@@ -160,113 +159,87 @@ sneaked in accidentally) removed.</p>
<h3 id="alternate-try">Alternate try:</h3>
<p>Try it just like <code>vince</code> as above.</p>
<h2 id="judges-remarks">Judges’ remarks:</h2>
<p>This beauteous entry makes use of visual <code>{}</code>s and
whitespace to instruct the <a href="https://www.opengl.org">OpenGL</a>
development libraries to create beauteous visuals. Even hitting the
space bar while the program runs produces a “spacey” effect! :-)</p>
<p>NOTE: when hitting space bar make sure that the program window is in
focus!</p>
<p>Challenge: Try modifying the texture to something of your own
design.</p>
<p>This beauteous entry makes use of visual <code>{}</code>s and whitespace to instruct the
<a href="https://www.opengl.org">OpenGL</a> development libraries to create beauteous
visuals. Even hitting the space bar while the program runs produces a “spacey”
effect! :-)</p>
<p>NOTE: when hitting space bar make sure that the program window is in focus!</p>
<p>Challenge: Try modifying the texture to something of your own design.</p>
<h2 id="authors-remarks">Author’s remarks:</h2>
<h3 id="abuse-of-rules">ABUSE OF RULES</h3>
<ul>
<li><p>The executable needs to read in its own source code in order to
run. As long as the source is in the same directory as the executable it
should be able to find it…</p></li>
<li><p>The executable needs to read in its own source code in order to run. As
long as the source is in the same directory as the executable it should be
able to find it…</p></li>
<li><p>The program requires the OpenGL library.</p></li>
<li><p>The program abuses severely the whitespace and <code>{ } ;</code>
exceptions in the file size limits.</p></li>
<li><p>The program abuses severely the whitespace and <code>{ } ;</code> exceptions in the
file size limits.</p></li>
</ul>
<h3 id="requirements">Requirements</h3>
<ul>
<li><p>OpenGL. It works (slowly) with Mesa.</p></li>
<li><p>16bpp graphics capability (but might work at other
depths)</p></li>
<li><p>The original source needs to be in the same directory as the
executable, and the source’s name should be the same as the executable
but with <code>.c</code> on the end.</p></li>
<li><p>16bpp graphics capability (but might work at other depths)</p></li>
<li><p>The original source needs to be in the same directory as the executable,
and the source’s name should be the same as the executable but with <code>.c</code> on the
end.</p></li>
</ul>
<h3 id="background">Background</h3>
<p>I was annoyed after the last IOCCC because I slaved away on a clever
text based game only to find all of the game entries used X11. X11 isn’t
standard C!</p>
<p>So to one up them, I decided to use OpenGL. It’s standard, and most
Unix-like systems these days have either accelerated graphics or else
software rendering.</p>
<p>I was annoyed after the last IOCCC because I slaved away on a clever text
based game only to find all of the game entries used X11. X11 isn’t standard
C!</p>
<p>So to one up them, I decided to use OpenGL. It’s standard, and most Unix-like
systems these days have either accelerated graphics or else software
rendering.</p>
<h3 id="obfuscation">Obfuscation</h3>
<p>It was a challenge getting the source code below the 2k limit. OpenGL
has way too many ‘<code>GRATUITOUSLY_LONG_CONSTANTS</code>’ and
‘<code>glLongStudlyFunctionNames();</code>’.</p>
<p>Therefore, much of the obfuscation comes secondary to just reducing
the code size to fit under the limit while still having some semblance
of a demo.</p>
<p>It was a challenge getting the source code below the 2k limit. OpenGL has way
too many ‘<code>GRATUITOUSLY_LONG_CONSTANTS</code>’ and ‘<code>glLongStudlyFunctionNames();</code>’.</p>
<p>Therefore, much of the obfuscation comes secondary to just reducing the code
size to fit under the limit while still having some semblance of a demo.</p>
<p>There are some interesting abuses scattered about.</p>
<h3 id="usage">Usage</h3>
<p>Try hitting the space bar when the program is running.</p>
<h3 id="for-fun">For Fun</h3>
<p>Try modifying the texture to your own custom design…</p>
<h3 id="thanks">Thanks</h3>
<p>Many thanks to John Clemens for testing this on various machines for
me.</p>
<p>Many thanks to John Clemens for testing this on various machines for me.</p>
<h3 id="errors-you-can-get">Errors you can get</h3>
<ul>
<li>0 = no error.</li>
<li>1 = <a
href="https://en.wikipedia.org/wiki/X_Window_System_protocols_and_architecture">X</a>
<li>1 =
<a href="https://en.wikipedia.org/wiki/X_Window_System_protocols_and_architecture">X</a>
problem.</li>
<li>2 = can’t open <a
href="https://en.wikipedia.org/wiki/GLX">GLX</a>.</li>
<li>2 = can’t open <a href="https://en.wikipedia.org/wiki/GLX">GLX</a>.</li>
<li>3 = can’t open 16bpp visual.</li>
<li>4 = can’t open source file.</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>
<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>
<p>For more information, see: https://creativecommons.org/licenses/by-sa/4.0/</p>
<!-- END: this line ends content for HTML phase 21 by: bin/pandoc-wrapper.sh via bin/md2html.sh -->
<!-- START: this line starts content for HTML phase 22 by: bin/output-index-inventory.sh via bin/md2html.sh -->
<!-- START: this line starts content generated by: bin/output-index-inventory.sh -->
<h1 id="inventory-for-2005vince"><a name="inventory"></a>Inventory for
2005/vince</h1>
<h1 id="inventory-for-2005vince"><a name="inventory"></a>Inventory for 2005/vince</h1>
<p><a href="#top">Jump to top</a></p>
<h2 id="primary-files">Primary files</h2>
<ul>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2005/vince/vince.c">vince.c</a>
- entry source</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2005/vince/Makefile">Makefile</a>
- entry Makefile</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2005/vince/vince.alt.c">vince.alt.c</a>
- alternative source</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2005/vince/vince.orig.c">vince.orig.c</a>
- original source</li>
<li><a href="2005_vince.tar.bz2">2005_vince.tar.bz2</a> - download entry
source</li>
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2005/vince/vince.c">vince.c</a> - entry source</li>
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2005/vince/Makefile">Makefile</a> - entry Makefile</li>
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2005/vince/vince.alt.c">vince.alt.c</a> - alternative source</li>
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2005/vince/vince.orig.c">vince.orig.c</a> - original source</li>
<li><a href="2005_vince.tar.bz2">2005_vince.tar.bz2</a> - download entry source</li>
</ul>
<h2 id="secondary-files">Secondary files</h2>
<ul>
<li><a href="index.html">index.html</a> - entry home page</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2005/vince/.entry.json">.entry.json</a>
- description of entry in JSON</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2005/vince/.gitignore">.gitignore</a>
- list of files that should not be committed under git</li>
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2005/vince/.entry.json">.entry.json</a> - description of entry in JSON</li>
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2005/vince/.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/2005/vince/README.md">README.md</a>
- markdown source for index.html</li>
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2005/vince/README.md">README.md</a> - markdown source for index.html</li>
</ul>
<!-- END: next line ends content generated by: bin/output-index-inventory.sh -->