improved indentation and whitespace for markdown code blocks
All code blocks in markdown have been intended by at least 4 spaces. We add `--tab-stop=8` to all `pandoc(1)` executions in order to set a better tab stop indentation, especially for tab intended code blocks. Changed `bin/pandoc-wrapper.sh` VERSION from "1.5.3 2024-03-26" to "1.6 2024-03-31". Fixed `1991/brnstnd/sorta.README.md` so that the sorta code is code blocks. Removed unneeded paragraph group in copyright in `inc/footer.default.html`. Fixed excess whitespace after list Author on entry `index.html` page. Changed `bin/output-index-author.sh` VERSION from "1.5.2 2024-03-26" to "1.6 2024-03-31". Performed `make www` to perform the above and test under macOS. TODO: Fix the problem of the initial line of code being extra intended. TODO: Fix excess whitespace around code that is inline.
This commit is contained in:
1 parent
b84c27ce02
commit
a996f8d2b8
734 files changed
+16723
-16963
No files matched your search
+34
-35
@@ -1,28 +1,28 @@
|
||||
## To build:
|
||||
|
||||
```sh
|
||||
make
|
||||
make
|
||||
```
|
||||
|
||||
|
||||
## To use:
|
||||
|
||||
```sh
|
||||
./hamaji < a_nonogram_file
|
||||
./hamaji < a_nonogram_file
|
||||
```
|
||||
|
||||
|
||||
## Try:
|
||||
|
||||
```sh
|
||||
./try.sh
|
||||
./try.sh
|
||||
```
|
||||
|
||||
If you have perl installed you should be able to reproduce
|
||||
[dragon.nono](dragon.nono) like:
|
||||
|
||||
```sh
|
||||
perl c2nono.pl hamaji.c | ./hamaji
|
||||
perl c2nono.pl hamaji.c | ./hamaji
|
||||
```
|
||||
|
||||
|
||||
@@ -52,26 +52,25 @@ For example, for a simple problem which shows a glider of [Conway's
|
||||
Game of Life](http://en.wikipedia.org/wiki/Conway's_Game_of_Life):
|
||||
|
||||
```
|
||||
1
|
||||
.
|
||||
112
|
||||
|
||||
1 X
|
||||
1 X
|
||||
3 XXX
|
||||
1
|
||||
.
|
||||
112
|
||||
|
||||
1 X
|
||||
1 X
|
||||
3 XXX
|
||||
```
|
||||
|
||||
the input should be
|
||||
|
||||
```
|
||||
1
|
||||
1
|
||||
3
|
||||
-
|
||||
1
|
||||
1.1
|
||||
2
|
||||
1
|
||||
1
|
||||
3
|
||||
-
|
||||
1
|
||||
1.1
|
||||
2
|
||||
```
|
||||
|
||||
The width and the height of an input puzzle should be less than or
|
||||
@@ -82,9 +81,9 @@ This means the problem is indeed broken. For example, this happens for
|
||||
an input like
|
||||
|
||||
```
|
||||
2
|
||||
-
|
||||
2
|
||||
2
|
||||
-
|
||||
2
|
||||
```
|
||||
|
||||
When this solver cannot find a solution, it prints "`failed`". This
|
||||
@@ -93,29 +92,29 @@ solver cannot solve the input problem. Here is an example input of the
|
||||
former:
|
||||
|
||||
```
|
||||
1
|
||||
1
|
||||
-
|
||||
1
|
||||
1
|
||||
1
|
||||
1
|
||||
-
|
||||
1
|
||||
1
|
||||
```
|
||||
|
||||
There are two solutions:
|
||||
|
||||
```
|
||||
11
|
||||
11
|
||||
|
||||
1 X
|
||||
1 X
|
||||
1 X
|
||||
1 X
|
||||
```
|
||||
|
||||
and
|
||||
|
||||
```
|
||||
11
|
||||
11
|
||||
|
||||
1 X
|
||||
1 X
|
||||
1 X
|
||||
1 X
|
||||
```
|
||||
|
||||
### Detail
|
||||
@@ -183,7 +182,7 @@ This program uses two C99 features. One line comments and `long long`.
|
||||
GCC's `-ansi -pedantic` check should pass:
|
||||
|
||||
```sh
|
||||
cc -ansi -pedantic -std=c99 hamaji.c
|
||||
cc -ansi -pedantic -std=c99 hamaji.c
|
||||
```
|
||||
|
||||
I checked my program with gcc-4.6.2 on linux, llvm-gcc-4.2 on Mac, and
|
||||
@@ -198,7 +197,7 @@ This program won't work if the size of `long long` literal is less than 8.
|
||||
By grepping the source code of gcc
|
||||
|
||||
```sh
|
||||
grep LONG_LONG_TYPE_SIZE gcc/config/*/*
|
||||
grep LONG_LONG_TYPE_SIZE gcc/config/*/*
|
||||
```
|
||||
|
||||
I found long long may be 32bit integers only on AVR.
|
||||
@@ -226,7 +225,7 @@ You can reproduce [dragon.nono](dragon.nono) from [hamaji.c](hamaji.c) using
|
||||
[c2nono.pl](c2nono.pl):
|
||||
|
||||
```sh
|
||||
perl c2nono.pl hamaji.c | ./hamaji
|
||||
perl c2nono.pl hamaji.c | ./hamaji
|
||||
```
|
||||
|
||||
|
||||
|
||||
+35
-37
@@ -135,8 +135,7 @@
|
||||
Location: <a href="../../location.html#JP">JP</a> - <em>Japan</em>
|
||||
<br><br></li>
|
||||
<li>Name: <a href="../../authors.html#Shinichiro_Hamaji">Shinichiro Hamaji</a><br>
|
||||
Location: <a href="../../location.html#JP">JP</a> - <em>Japan</em>
|
||||
<br><br></li>
|
||||
Location: <a href="../../location.html#JP">JP</a> - <em>Japan</em></li>
|
||||
</ul>
|
||||
|
||||
<!-- END: next line ends content generated by: bin/output-index-author.sh -->
|
||||
@@ -145,14 +144,14 @@ Location: <a href="../../location.html#JP">JP</a> - <em>Japan</em>
|
||||
<!-- 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>
|
||||
<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">./hamaji</span> <span class="op"><</span> a_nonogram_file</span></code></pre></div>
|
||||
<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">./hamaji</span> <span class="op"><</span> a_nonogram_file</span></code></pre></div>
|
||||
<h2 id="try">Try:</h2>
|
||||
<div class="sourceCode" id="cb3"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb3-1"><a href="#cb3-1" aria-hidden="true" tabindex="-1"></a><span class="ex">./try.sh</span></span></code></pre></div>
|
||||
<div class="sourceCode" id="cb3"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb3-1"><a href="#cb3-1" aria-hidden="true" tabindex="-1"></a> <span class="ex">./try.sh</span></span></code></pre></div>
|
||||
<p>If you have perl installed you should be able to reproduce
|
||||
<a href="dragon.nono">dragon.nono</a> like:</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">perl</span> c2nono.pl hamaji.c <span class="kw">|</span> <span class="ex">./hamaji</span></span></code></pre></div>
|
||||
<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">perl</span> c2nono.pl hamaji.c <span class="kw">|</span> <span class="ex">./hamaji</span></span></code></pre></div>
|
||||
<h2 id="judges-remarks">Judges’ remarks:</h2>
|
||||
<p>This program solves <a href="http://en.wikipedia.org/wiki/Nonogram">Nonograms</a> which is
|
||||
also known as “Paint by Numbers”.</p>
|
||||
@@ -169,49 +168,48 @@ files and then compare your solution with this program!</p>
|
||||
<a href="https://web.archive.org/web/20130218055139/http://codegolf.com/paint-by-numbers" class="uri">https://web.archive.org/web/20130218055139/http://codegolf.com/paint-by-numbers</a>.</p>
|
||||
<p>For example, for a simple problem which shows a glider of <a href="http://en.wikipedia.org/wiki/Conway's_Game_of_Life">Conway’s
|
||||
Game of Life</a>:</p>
|
||||
<pre><code> 1
|
||||
.
|
||||
112
|
||||
<pre><code> 1
|
||||
.
|
||||
112
|
||||
|
||||
1 X
|
||||
1 X
|
||||
3 XXX
|
||||
</code></pre>
|
||||
1 X
|
||||
1 X
|
||||
3 XXX</code></pre>
|
||||
<p>the input should be</p>
|
||||
<pre><code>1
|
||||
1
|
||||
3
|
||||
-
|
||||
1
|
||||
1.1
|
||||
2</code></pre>
|
||||
<pre><code> 1
|
||||
1
|
||||
3
|
||||
-
|
||||
1
|
||||
1.1
|
||||
2</code></pre>
|
||||
<p>The width and the height of an input puzzle should be less than or
|
||||
equal to 60.</p>
|
||||
<p>When this solver finds the problem has no solution, it prints “<code>invalid</code>”.
|
||||
This means the problem is indeed broken. For example, this happens for
|
||||
an input like</p>
|
||||
<pre><code>2
|
||||
-
|
||||
2</code></pre>
|
||||
<pre><code> 2
|
||||
-
|
||||
2</code></pre>
|
||||
<p>When this solver cannot find a solution, it prints “<code>failed</code>”. This
|
||||
failure can happen when the problem has more than one solution or the
|
||||
solver cannot solve the input problem. Here is an example input of the
|
||||
former:</p>
|
||||
<pre><code>1
|
||||
1
|
||||
-
|
||||
1
|
||||
1</code></pre>
|
||||
<pre><code> 1
|
||||
1
|
||||
-
|
||||
1
|
||||
1</code></pre>
|
||||
<p>There are two solutions:</p>
|
||||
<pre><code> 11
|
||||
<pre><code> 11
|
||||
|
||||
1 X
|
||||
1 X</code></pre>
|
||||
1 X
|
||||
1 X</code></pre>
|
||||
<p>and</p>
|
||||
<pre><code> 11
|
||||
<pre><code> 11
|
||||
|
||||
1 X
|
||||
1 X</code></pre>
|
||||
1 X
|
||||
1 X</code></pre>
|
||||
<h3 id="detail">Detail</h3>
|
||||
<p>Solving Nonogram is
|
||||
<a href="https://en.wikipedia.org/wiki/NP-completeness">NP-complete</a>, so we cannot make
|
||||
@@ -262,7 +260,7 @@ with the well obfuscated code.</p>
|
||||
<h3 id="portability">Portability</h3>
|
||||
<p>This program uses two C99 features. One line comments and <code>long long</code>.
|
||||
GCC’s <code>-ansi -pedantic</code> check should pass:</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">cc</span> <span class="at">-ansi</span> <span class="at">-pedantic</span> <span class="at">-std</span><span class="op">=</span>c99 hamaji.c</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="fu">cc</span> <span class="at">-ansi</span> <span class="at">-pedantic</span> <span class="at">-std</span><span class="op">=</span>c99 hamaji.c</span></code></pre></div>
|
||||
<p>I checked my program with gcc-4.6.2 on linux, llvm-gcc-4.2 on Mac, and
|
||||
clang-3.0 on Mac.</p>
|
||||
<p>Note that the behavior of <code>scanf(3)</code> differs on linux and mac, but this
|
||||
@@ -271,7 +269,7 @@ program supports both semantics.</p>
|
||||
memory layout, undefined evaluation order (e.g., <code>a[i++]=i</code>), etc.
|
||||
This program won’t work if the size of <code>long long</code> literal is less than 8.
|
||||
By grepping the source code of gcc</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="fu">grep</span> LONG_LONG_TYPE_SIZE gcc/config/<span class="pp">*</span>/<span class="pp">*</span></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="fu">grep</span> LONG_LONG_TYPE_SIZE gcc/config/<span class="pp">*</span>/<span class="pp">*</span></span></code></pre></div>
|
||||
<p>I found long long may be 32bit integers only on AVR.</p>
|
||||
<h3 id="a-few-more-things">A few more things</h3>
|
||||
<p>This code is considered as a <a href="http://en.wikipedia.org/wiki/Japanese_New_Year#Postcards">new year’s postcard in
|
||||
@@ -289,7 +287,7 @@ was randomly generated. The <a href="codegolf.nono">codegolf.nono</a> and
|
||||
<a href="https://web.archive.org/web/20130218055139/http://codegolf.com/paint-by-numbers" class="uri">https://web.archive.org/web/20130218055139/http://codegolf.com/paint-by-numbers</a>.</p>
|
||||
<p>You can reproduce <a href="dragon.nono">dragon.nono</a> from <a href="hamaji.c">hamaji.c</a> using
|
||||
<a href="c2nono.pl">c2nono.pl</a>:</p>
|
||||
<div class="sourceCode" id="cb13"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb13-1"><a href="#cb13-1" aria-hidden="true" tabindex="-1"></a><span class="fu">perl</span> c2nono.pl hamaji.c <span class="kw">|</span> <span class="ex">./hamaji</span></span></code></pre></div>
|
||||
<div class="sourceCode" id="cb13"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb13-1"><a href="#cb13-1" aria-hidden="true" tabindex="-1"></a> <span class="fu">perl</span> c2nono.pl hamaji.c <span class="kw">|</span> <span class="ex">./hamaji</span></span></code></pre></div>
|
||||
<!--
|
||||
|
||||
Copyright © 1984-2024 by Landon Curt Noll. All Rights Reserved.
|
||||
|
||||
Reference in new issue
Block a user