Files
ioccc/2005/aidan/index.html
T
Landon Curt Noll ffb738af07 create new status.json model
Changed the model of `status.json` model.

Updated `status.json` IOCCC_status_version from  "0.2 2023-05-22"
to "1.0 2024-03-09".

Updated FAQ 2.6, improving how IOCCC entries announced.

Moved `bin/ioccc-status.sh` to `tmp/ioccc-status.sh`
now that we have a new status.json model for
which this tool no longer fits (sorry tm Canada 🇨🇦).

Added `status.md` markdown to explain the `status.json` model.

Added `status.html` to both display the contents of `status.json`
and render the contents of `status.md` as HTML.

Added `bin/status2html.sh` to convert `status.json`
into HTML for the `status.html` file.

Added `bin/gen-status.sh` to form `status.json`
and `status.html` files.

Added `make gen_status` to top level Makefile.

Performed `make www` to complete all of the above.
2024-03-10 10:05:08 -07:00

507 lines
32 KiB
HTML
Raw Blame History

This file contains invisible Unicode characters
This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<!-- START: two lines up starts content from: inc/top.default.html -->
<!-- -->
<!-- !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<!-- !!! DO NOT MODIFY THIS FILE - This file is generated by a tool !!! -->
<!-- !!! DO NOT MODIFY THIS FILE - This file is generated by a tool !!! -->
<!-- !!! DO NOT MODIFY THIS FILE - This file is generated by a tool !!! -->
<!-- !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<!-- -->
<!-- END: this line ends content from: inc/top.default.html -->
<!-- -->
<!-- This web page was formed via the tool: bin/readme2index.sh -->
<!-- -->
<!-- The content of main section of this web page came from: 2005/aidan/README.md -->
<!-- -->
<!-- !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<!-- !!! Do not modify this web page, instead modify the file: 2005/aidan/README.md -->
<!-- !!! Do not modify this web page, instead modify the file: 2005/aidan/README.md -->
<!-- !!! Do not modify this web page, instead modify the file: 2005/aidan/README.md -->
<!-- !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<!-- -->
<!-- Markdown content was converted into HTML via the tool: bin/md2html.sh -->
<!-- -->
<!-- START: this line starts content from: inc/head.default.html -->
<head>
<link rel="stylesheet" href="../../ioccc.css">
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=yes">
<title>2005/aidan - Most ingenious puzzle solution</title>
<meta name="description" content="2005 IOCCC entry aidan - Most ingenious puzzle solution">
<meta name="keywords" content="IOCCC, 2005, IOCCC 2005, IOCCC entry, aidan, Most ingenious puzzle solution">
</head>
<!-- END: this line ends content from: inc/head.default.html -->
<!-- START: this line starts content from: inc/body.default.html -->
<body>
<!-- END: this line ends content from: inc/body.default.html -->
<!-- START: this line starts content from: inc/header.default.html -->
<div class="header">
<img src="../../png/ioccc.png" alt="IOCCC image by Matt Zucker" width=300 height=110>
<h1>The International Obfuscated C Code Contest</h1>
<h2>2005/aidan - Most ingenious puzzle solution</h2>
</div>
<!-- END: this line ends content from: inc/header.default.html -->
<!-- START: this line starts content from: inc/topnav.first.html -->
<div class="topnav">
<a class="Left Disabled" href="#">first entry</a>
<a class="Left" href="../index.html">&uarr; 2005 &uarr;</a>
<a class="Left" href="../anon/index.html">anon &rarr;</a>
<a class="Right" href="https://github.com/ioccc-src/temp-test-ioccc/2005/aidan/aidan.c">C code</a>
<a class="Right" href="https://github.com/ioccc-src/temp-test-ioccc/2005/aidan/Makefile">Makefile</a>
<a class="Right" href="#inventory">Inventory</a>
</div>
<!-- END: this line ends content from: inc/topnav.first.html -->
<!-- START: this line starts content from: inc/begin-row.default.html -->
<div class="row">
<!-- END: this line ends content from: inc/begin-row.default.html -->
<!-- START: this line starts content from: inc/begin-leftcolumn.default.html -->
<div class="leftcolumn">
<!-- END: this line ends content from: inc/begin-leftcolumn.default.html -->
<!-- START: this line starts content from: inc/sidenav.default.html -->
<div class="sidenav">
<a href="#content">Jump to contents</a>
</div>
<hr>
<div class="sidenav">
<a href="../../index.html">IOCCC Home</a>
<a href="../../years.html">Winning Entries</a>
<a href="../../authors.html">People who have won</a>
<a href="../../location.html">Location of authors</a>
</div>
<hr>
<div class="sidenav">
<a href="../../news.html">IOCCC News</a>
<a href="../../status.html">Contest status</a>
<a href="../../faq.html#submit">How to enter the IOCCC</a>
<a href="../../faq.html">FAQ</a>
</div>
<hr>
<div class="sidenav">
<a href="../../bugs.html">Bugs &amp; (mis)features</a>
<a href="../../faq.html#fix_an_entry">Fixing IOCCC entries</a>
<a href="../../faq.html#fix_web_site">Fixing the web site</a>
<a href="../../faq.html#fix_author">Fixing author info</a>
<a href="../../thanks-for-help.html">Thanks for the help</a>
</div>
<hr>
<div class="sidenav">
<a href="../../judges.html">The IOCCC Judges</a>
<a href="../../contact.html">Contacting the IOCCC</a>
</div>
<hr>
<div class="sidenav">
<a href="#top">Jump to top</a>
</div>
<!-- END: this line ends content from: inc/sidenav.default.html -->
<!-- START: this line starts content from: inc/end-leftcolumn.default.html -->
</div>
<!-- END: this line ends content from: inc/end-leftcolumn.default.html -->
<!-- START: this line starts content from: inc/begin-rightcolumn.default.html -->
<div class="rightcolumn">
<!-- END: this line ends content from: inc/begin-rightcolumn.default.html -->
<!-- START: this line starts content from: inc/before-content.default.html -->
<a name="content"></a>
<!-- END: this line ends content from: inc/before-content.default.html -->
<!-- START: this line starts content for HTML phase 20 by: bin/output-index-author.sh via bin/md2html.sh -->
<!-- START: this line starts content generated by: bin/output-index-author.sh -->
<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>
</ul>
<!-- END: next line ends content generated by: bin/output-index-author.sh -->
<!-- END: this line ends content for HTML phase 20 by: bin/output-index-author.sh via bin/md2html.sh -->
<!-- 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>
<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>
<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>
<span id="cb2-3"><a href="#cb2-3" aria-hidden="true" tabindex="-1"></a><span class="ex">./aidan</span> seed</span></code></pre></div>
<p>where <code>seed</code> is a number.</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>
<h3 id="alternate-build">Alternate build:</h3>
<div class="sourceCode" id="cb4"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb4-1"><a href="#cb4-1" aria-hidden="true" tabindex="-1"></a><span class="fu">make</span> alt</span></code></pre></div>
<h3 id="alternate-use">Alternate use:</h3>
<p>Use <code>aidan.alt</code> as you would <code>aidan</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">./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><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>
<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
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>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>
<li>sudoku file: <a href="insane3.sudoku">insane3.sudoku</a></li>
<li>sudoku file: <a href="insane4.sudoku">insane4.sudoku</a></li>
<li>sudoku file: <a href="insane5.sudoku">insane5.sudoku</a></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>
<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
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>
<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>
<pre><code> . . . | 1 . . | 7 4 .
. 5 . | . 9 . | . 3 2
. . 6 | 7 . . | 9 . .
------+-------+------
4 . . | 8 . . | . . .
. 2 . | . . . | . 1 .
. . . | . . 9 | . . 5
------+-------+------
. . 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>
<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>
<span id="cb7-4"><a href="#cb7-4" aria-hidden="true" tabindex="-1"></a><span class="dt">int</span> i<span class="op">[</span><span class="dv">82</span><span class="op">],</span>s<span class="op">[</span><span class="dv">81</span><span class="op">],</span>v<span class="op">[</span><span class="dv">9</span><span class="op">],</span>n<span class="op">,</span>p<span class="op">,</span>z<span class="op">;</span><span class="dt">int</span> main<span class="op">(</span><span class="dt">void</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>getchar<span class="op">()^</span><span class="dv">48</span><span class="op">;</span><span class="cf">if</span><span class="op">(</span>p<span class="op">==</span></span>
<span id="cb7-5"><a href="#cb7-5" aria-hidden="true" tabindex="-1"></a><span class="dv">30</span><span class="op">)</span>p<span class="op">=</span><span class="dv">0</span><span class="op">;</span><span class="cf">if</span><span class="op">(</span>p<span class="op">&lt;</span><span class="dv">10</span><span class="op">)</span>i<span class="op">[</span>n<span class="op">++]=</span>p<span class="op">;}</span>i<span class="op">[</span><span class="dv">81</span><span class="op">]=</span><span class="dv">0</span><span class="op">;</span>p<span class="op">=-</span><span class="dv">1</span><span class="op">;</span>f<span class="op">:</span>S<span class="op">(</span>n<span class="op">%</span><span class="dv">9</span><span class="op">)</span>S<span class="op">(</span>n<span class="op">/</span><span class="dv">9</span><span class="op">)</span>S<span class="op">(</span>n<span class="op">%</span><span class="dv">9</span><span class="op">/</span><span class="dv">3</span><span class="op">+</span>n<span class="op">/</span><span class="dv">27</span><span class="op">*</span><span class="dv">3</span><span class="op">)</span><span class="cf">if</span><span class="op">(</span>p<span class="op">&gt;</span><span class="dv">80</span><span class="op">)</span><span class="cf">goto</span></span>
<span id="cb7-6"><a href="#cb7-6" aria-hidden="true" tabindex="-1"></a>d<span class="op">;</span><span class="cf">for</span><span class="op">(</span>n<span class="op">=</span>p<span class="op">;</span>i<span class="op">[++</span>p<span class="op">];);</span>s<span class="op">[</span>p<span class="op">]=</span>n<span class="op">;</span>i<span class="op">[</span>p<span class="op">]=</span><span class="dv">1</span><span class="op">;</span><span class="cf">goto</span> f<span class="op">;</span>d<span class="op">:</span>z<span class="op">=</span>p<span class="op">&lt;</span><span class="dv">81</span><span class="op">;</span>printf<span class="op">(</span><span class="st">&quot;</span><span class="sc">\n%s</span><span class="st">!</span><span class="sc">\n\n</span><span class="st">&quot;</span><span class="op">,</span>z<span class="op">?</span><span class="st">&quot;Fail&quot;</span><span class="op">:</span></span>
<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>
</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>
<pre><code>--- insane1.sudoku --
. . 4 | . . . | . 5 6
5 . . | . 7 2 | . . .
. . 1 | . . . | 8 . .
------+-------+------
. . . | . . . | . . .
. . . | 6 9 3 | . . 5
. . . | . . . | 7 3 4
------+-------+------
. 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>
<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>
<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>
<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>
<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>
<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>
<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>
<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>
<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>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>
<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>
</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>
<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>
<h3 id="compiler-warnings">Compiler warnings</h3>
<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>
</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>
<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><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><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>
</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>
<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>
<!-- 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>
<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>
</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=".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>
</ul>
<!-- END: next line ends content generated by: bin/output-index-inventory.sh -->
<!-- END: this line ends content for HTML phase 22 by: bin/output-index-inventory.sh via bin/md2html.sh -->
<!-- START: this line starts content from: inc/after-content.default.html -->
<!-- END: this line ends content from: inc/after-content.default.html -->
<!-- START: this line starts content from: inc/end-rightcolumn.default.html -->
</div>
<!-- END: this line ends content from: inc/end-rightcolumn.default.html -->
<!-- START: this line starts content from: inc/end-row.default.html -->
</div>
<!-- END: this line ends content from: inc/end-row.default.html -->
<!-- START: this line starts content from: inc/footer.default.html -->
<div class="footer">
<hr>
<h2>Coda</h2>
<p><a href="https://validator.w3.org/nu/?doc=https%3A%2F%2Fioccc-src.github.io%2Ftemp-test-ioccc%2F2005%2Faidan%2Findex.html">Nu HTML check this web page</a></p>
<p><a href="#top">Jump to top</a> <a href="#content">Jump to Content</a> <a href="#inventory">Jump to Inventory</a></p>
</div>
<!-- END: this line ends content from: inc/footer.default.html -->
<!-- START: this line starts content from: inc/bottom.default.html -->
</body>
</html>
<!-- END: this line ends content from: inc/bottom.default.html -->