build index.html for all winners
Updated manifest as per recent file changes. Updated winner `.winner.json` to reflect the manifest changes. Added [bin/all_run.sh](bin/all_run.sh) tool to run a command over all winning entries. These tools had slight improvements in the help usage message: * bin/gen-author.sh VERSION="1.3.1 2024-01-16" * bin/gen-inventory.sh VERSION="1.0.1 2024-01-16" * bin/pandoc_wrapper.sh VERSION="1.3.1 2024-01-16" * bin/subst.default.sh VERSION="1.1.1 2024-01-16" * bin/subst.winner-index.sh VERSION="1.1.1 2024-01-16" The `bin/readme2index.sh` tool was improved so that if the `index.html` file exists and the tool forms the exact same content, then the file `index.html` file is NOT touched. * bin/readme2index.sh VERSION="1.1 2024-01-16" We used the following command to generate `index.html` files for all winning entries: ```sh bin/all_run.sh -v 3 bin/readme2index.sh ``` NOTE: We have not (yet) built HTML files above the winner directory level (e.g., no year level nor top level HTML), nor have be built non-index HTML files for winners. NOTE: By default we are running `pandoc(1)` with: ``` --fail-if-warnings=true ``` This means that any problems with markdown to HTML generates an error. This is done to be sure that the HTML conversion is clean. We had to fix the following `README.md` files: * `2000/rince/README.md` The reference [^2] was never used. We made a guess that [^2] applies to the same spot as [^1]. Perhaps there is a better spot where [^2] applies? NOTE: For every reference, there MUST be some place where that reference is used. * 2012/vik/README.md The string "$...$" is assumed to be a TeX encoded string. NOTE: Every "$..$" needs to be backslashed as in "\$..\$". * 2018/burton1/README.md The reference [2] was duplicated. We changed the second [2] to [3]. NOTE: Every reference needs to have a unique number. * 2020/carlini/README.md The string "$...$" is assumed to be a TeX encoded string. NOTE: Every "$..$" needs to be backslashed as in "\$..\$". We also found 2 errors in the `author/author_handle.json` file set: * author/Anonymous_2001.json The `author/Anonymous_2001.json` file was missing. * author/Jari_Arkko.json The winner ID for `1989_jar.1` had a typo.
This commit is contained in:
1 parent
893cd915b6
commit
c1466f5165
350 files changed
+95242
-4217
No files matched your search
+457
-13
@@ -1,4 +1,6 @@
|
||||
<!DOCTYPE html>
|
||||
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
||||
<!-- START: two lines up starts content from: inc/top.default.html -->
|
||||
<!-- -->
|
||||
<!-- !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
|
||||
<!-- !!! DO NOT MODIFY THIS FILE - This file is generated by a tool !!! -->
|
||||
@@ -6,27 +8,469 @@
|
||||
<!-- !!! DO NOT MODIFY THIS FILE - This file is generated by a tool !!! -->
|
||||
<!-- !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
|
||||
<!-- -->
|
||||
<!-- file: 2005/aidan/index.html created by: fake.gen_index.sh version: 1.0.5 2023-10-31 -->
|
||||
<html lang="en">
|
||||
<!-- END: this line ends content from: inc/top.default.html -->
|
||||
<!-- -->
|
||||
<!-- This file was formed by the tool: bin/readme2index.sh version: 1.1 2024-01-16 -->
|
||||
<!-- -->
|
||||
<!-- START: this line starts content from: inc/head.default.html -->
|
||||
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>2005 aidan</title>
|
||||
<meta name="description" content="IOCCC year: 2005 IOCCC winner: aidan winner index page">
|
||||
<meta name="keywords" content="IOCCC,2005,aidan,winner index page">
|
||||
<link rel="stylesheet" href="/temp-test-ioccc/ioccc.css">
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=yes">
|
||||
<title>2005/aidan</title>
|
||||
<meta name="description" content="2005 IOCCC winner aidan">
|
||||
<meta name="keywords" content="IOCCC, 2005, IOCCC 2005, IOCCC winner, aidan">
|
||||
</head>
|
||||
|
||||
<!-- END: this line ends content from: inc/head.default.html -->
|
||||
<!-- START: this line starts content from: inc/body.default.html -->
|
||||
|
||||
<body>
|
||||
|
||||
<h1>2005 aidan</h1>
|
||||
<!-- END: this line ends content from: inc/body.default.html -->
|
||||
<!-- START: this line starts content from: inc/header.default.html -->
|
||||
|
||||
<p>XXX - fake content until readme2index is working - XXX</p>
|
||||
<div class="header">
|
||||
<img src="/temp-test-ioccc/png/ioccc.png" alt="IOCCC image by Matt Zucker" width=300 height=110>
|
||||
<h1>The International Obfuscated C Code Contest</h1>
|
||||
<h2>2005/aidan</h2>
|
||||
</div>
|
||||
|
||||
<hr style="width:50%;text-align:left;margin-left:0">
|
||||
<!-- END: this line ends content from: inc/header.default.html -->
|
||||
<!-- START: this line starts content from: inc/topnav.first.html -->
|
||||
|
||||
<!-- Start Nu Html Checker -->
|
||||
<p><a href="https://validator.w3.org/nu/?doc=https%3A%2F%2Fioccc-src.github.io%2Ftemp-test-ioccc%2F2005%2Faidan%2Findex.html">Nu Html check https://ioccc-src.github.io/temp-test-ioccc/2005/aidan/index.html</a></p>
|
||||
<!-- End Nu Html Checker -->
|
||||
<div class="topnav">
|
||||
<a class="Left Disabled" href="#">first entry</a>
|
||||
<a class="Left" href="../index.html">↑ 2005 ↑</a>
|
||||
<a class="Left" href="../anon/index.html">anon →</a>
|
||||
<a class="Right" href="#inventory">Inventory</a>
|
||||
</div>
|
||||
|
||||
<!-- END: this line ends content from: inc/topnav.first.html -->
|
||||
<!-- START: this line starts content from: inc/begin-row.default.html -->
|
||||
|
||||
<div class="row">
|
||||
|
||||
<!-- END: this line ends content from: inc/begin-row.default.html -->
|
||||
<!-- START: this line starts content from: inc/begin-leftcolumn.default.html -->
|
||||
|
||||
<div class="leftcolumn">
|
||||
|
||||
<!-- END: this line ends content from: inc/begin-leftcolumn.default.html -->
|
||||
<!-- START: this line starts content from: inc/sidenav.default.html -->
|
||||
|
||||
<div class="sidenav">
|
||||
<a href="#content">Jump to contents</a>
|
||||
</div>
|
||||
<hr>
|
||||
<div class="sidenav">
|
||||
<a href="/temp-test-ioccc/index.html">IOCCC Home</a>
|
||||
<a href="/temp-test-ioccc/years.html">Winning Entries</a>
|
||||
<a href="/temp-test-ioccc/winners.html">People who have won</a>
|
||||
</div>
|
||||
<hr>
|
||||
<div class="sidenav">
|
||||
<a href="/temp-test-ioccc/news.html">IOCCC News</a>
|
||||
<a href="/temp-test-ioccc/faq.html#submit">How to enter the IOCCC</a>
|
||||
<a href="/temp-test-ioccc/faq.html">FAQ</a>
|
||||
</div>
|
||||
<hr>
|
||||
<div class="sidenav">
|
||||
<a href="/temp-test-ioccc/bugs.html">Bugs & (mis)features</a>
|
||||
<a href="/temp-test-ioccc/faq.html#fix_a_winner">Fixing IOCCC winners</a>
|
||||
<a href="/temp-test-ioccc/faq.html#fix_web_site">Fixing the web site</a>
|
||||
<a href="/temp-test-ioccc/faq.html#fix_author">Fixing winner info</a>
|
||||
<a href="/temp-test-ioccc/thanks-for-help.html">Thanks for the help</a>
|
||||
</div>
|
||||
<hr>
|
||||
<div class="sidenav">
|
||||
<a href="/temp-test-ioccc/judges.html">The IOCCC Judges</a>
|
||||
<a href="/temp-test-ioccc/contact.html">Contacting the IOCCC</a>
|
||||
</div>
|
||||
<hr>
|
||||
<div class="sidenav">
|
||||
<a href="#top">Jump to top</a>
|
||||
</div>
|
||||
|
||||
<!-- END: this line ends content from: inc/sidenav.default.html -->
|
||||
<!-- START: this line starts content from: inc/end-leftcolumn.default.html -->
|
||||
|
||||
</div>
|
||||
|
||||
<!-- END: this line ends content from: inc/end-leftcolumn.default.html -->
|
||||
<!-- START: this line starts content from: inc/begin-rightcolumn.default.html -->
|
||||
|
||||
<div class="rightcolumn">
|
||||
|
||||
<!-- END: this line ends content from: inc/begin-rightcolumn.default.html -->
|
||||
<!-- START: this line starts content from: inc/before-content.default.html -->
|
||||
|
||||
<a name="content"></a>
|
||||
|
||||
<!-- END: this line ends content from: inc/before-content.default.html -->
|
||||
<!-- START: this line starts content generated by: bin/gen-author.sh -->
|
||||
|
||||
<p><a name="author"><strong>Author:</strong></a> <br><br>Name: <a
|
||||
href="/temp-test-ioccc/winners.html#Aidan_Thornton">Aidan
|
||||
Thornton</a><br> Location: <a
|
||||
href="/temp-test-ioccc/location.html#GB">GB</a></p>
|
||||
|
||||
<!-- END: next line ends content generated by: bin/gen-author.sh -->
|
||||
<h2 id="to-build">To build:</h2>
|
||||
<div class="sourceCode" id="cb1"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb1-1"><a href="#cb1-1" aria-hidden="true" tabindex="-1"></a><span class="fu">make</span></span></code></pre></div>
|
||||
<p>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"><</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"><stdio.h></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"><</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"><</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"><<</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">&</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"><</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">]++<</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"><</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"><</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">></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"><</span><span class="dv">81</span><span class="op">;</span>printf<span class="op">(</span><span class="st">"</span><span class="sc">\n%s</span><span class="st">!</span><span class="sc">\n\n</span><span class="st">"</span><span class="op">,</span>z<span class="op">?</span><span class="st">"Fail"</span><span class="op">:</span></span>
|
||||
<span id="cb7-7"><a href="#cb7-7" aria-hidden="true" tabindex="-1"></a><span class="st">"Success"</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"><</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">"</span><span class="sc">%c</span><span class="st"> </span><span class="sc">%s</span><span class="st">"</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">'.'</span><span class="op">),(++</span>n<span class="op">%</span><span class="dv">3</span><span class="op">?</span><span class="st">""</span><span class="op">:</span>n<span class="op">%</span><span class="dv">9</span><span class="op">?</span><span class="st">"| "</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">"</span><span class="sc">\n</span><span class="st">"</span><span class="op">:</span>n<span class="op">%</span><span class="dv">81</span><span class="op">?</span><span class="st">"</span><span class="sc">\n</span><span class="st">------+-------+------</span><span class="sc">\n</span><span class="st">"</span><span class="op">:</span><span class="st">"</span><span class="sc">\n\n</span><span class="st">"</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"><</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"><</span>seed<span class="op">></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>&</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>
|
||||
<!-- START: this line starts content generated by: bin/gen-inventory.sh -->
|
||||
|
||||
<h1 id="inventory-for-2005aidan"><a name="inventory"></a>Inventory for
|
||||
2005/aidan</h1>
|
||||
<h2 id="primary-files">Primary files</h2>
|
||||
<ul>
|
||||
<li><a href="index.html">index.html</a> - winner home page</li>
|
||||
<li><a
|
||||
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2005/aidan/aidan.c">aidan.c</a>
|
||||
- winning source</li>
|
||||
<li><a
|
||||
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2005/aidan/Makefile">Makefile</a>
|
||||
- winner 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
|
||||
winning source</li>
|
||||
</ul>
|
||||
<h2 id="secondary-files">Secondary files</h2>
|
||||
<ul>
|
||||
<li><a
|
||||
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/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/.winner.json">.winner.json</a>
|
||||
- description of winner in JSON</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/gen-inventory.sh -->
|
||||
<!-- START: this line starts content from: inc/after-content.default.html -->
|
||||
|
||||
<!-- END: this line ends content from: inc/after-content.default.html -->
|
||||
<!-- START: this line starts content from: inc/end-rightcolumn.default.html -->
|
||||
|
||||
</div>
|
||||
|
||||
<!-- END: this line ends content from: inc/end-rightcolumn.default.html -->
|
||||
<!-- START: this line starts content from: inc/end-row.default.html -->
|
||||
|
||||
</div>
|
||||
|
||||
<!-- END: this line ends content from: inc/end-row.default.html -->
|
||||
<!-- START: this line starts content from: inc/footer.default.html -->
|
||||
|
||||
<div class="footer">
|
||||
<hr>
|
||||
<h2>Coda</h2>
|
||||
<p><a href="https://validator.w3.org/nu/?doc=https%3A%2F%2Fioccc-src.github.io%2Ftemp-test-ioccc%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 -->
|
||||
Reference in new issue
Block a user