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
+14
-14
@@ -1,21 +1,21 @@
|
||||
## To build:
|
||||
|
||||
```sh
|
||||
make
|
||||
make
|
||||
```
|
||||
|
||||
|
||||
## To use:
|
||||
|
||||
```sh
|
||||
./akari [ input_file | - ] [ output_file | - ] [even]
|
||||
./akari [ input_file | - ] [ output_file | - ] [even]
|
||||
```
|
||||
|
||||
|
||||
## Try:
|
||||
|
||||
```sh
|
||||
./try.sh
|
||||
./try.sh
|
||||
```
|
||||
|
||||
|
||||
@@ -57,10 +57,10 @@ keep odd pixels on odd [scanlines](https://en.wikipedia.org/wiki/Scan_line).
|
||||
### Examples:
|
||||
|
||||
```sh
|
||||
gcc akari.c -o akari
|
||||
./akari < example.ppm > odd_output.ppm
|
||||
./akari - - even < example.ppm > even_output.ppm
|
||||
./akari example.ppm odd_output.ppm
|
||||
gcc akari.c -o akari
|
||||
./akari < example.ppm > odd_output.ppm
|
||||
./akari - - even < example.ppm > even_output.ppm
|
||||
./akari example.ppm odd_output.ppm
|
||||
```
|
||||
|
||||
`Akari` accepts 3 input formats:
|
||||
@@ -83,7 +83,7 @@ ASCII art. Since the source code is formatted as ASCII art, it's only
|
||||
natural to try:
|
||||
|
||||
```sh
|
||||
./akari akari.c akari2.c
|
||||
./akari akari.c akari2.c
|
||||
```
|
||||
|
||||
`akari2.c` is also a valid C program, and accepts up to 1 argument.
|
||||
@@ -92,29 +92,29 @@ expanded output to `stdout`. If the extra argument is specified, the
|
||||
output text will also pass through a rot13 filter.
|
||||
|
||||
```sh
|
||||
gcc akari2.c -o akari2
|
||||
./akari2 < input.txt > expanded_output.txt
|
||||
./akari2 rot13 < input.txt > expanded_and_rot13_output.txt
|
||||
gcc akari2.c -o akari2
|
||||
./akari2 < input.txt > expanded_output.txt
|
||||
./akari2 rot13 < input.txt > expanded_and_rot13_output.txt
|
||||
```
|
||||
|
||||
You can combine the two programs together to have just a regular rot13
|
||||
filter:
|
||||
|
||||
```sh
|
||||
./akari2 rot13 < input.txt | ./akari > rot13.txt
|
||||
./akari2 rot13 < input.txt | ./akari > rot13.txt
|
||||
```
|
||||
|
||||
Of course, we wouldn't stop with just 2 programs, you can downsample
|
||||
the source *again* and get yet another C program:
|
||||
|
||||
```sh
|
||||
./akari < akari.c | ./akari > akari3.c
|
||||
./akari < akari.c | ./akari > akari3.c
|
||||
```
|
||||
|
||||
We must go deeper:
|
||||
|
||||
```sh
|
||||
./akari < akari.c | ./akari | ./akari > akari4.c
|
||||
./akari < akari.c | ./akari | ./akari > akari4.c
|
||||
```
|
||||
|
||||
`akari3.c` and `akari4.c` are still (mostly valid) C programs.
|
||||
|
||||
+15
-16
@@ -132,8 +132,7 @@
|
||||
<h2 id="author"><a name="author"></a>Author:</h2>
|
||||
<ul>
|
||||
<li>Name: <a href="../../authors.html#Don_Yang">Don Yang</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>)</li>
|
||||
</ul>
|
||||
|
||||
<!-- END: next line ends content generated by: bin/output-index-author.sh -->
|
||||
@@ -142,11 +141,11 @@ Location: <a href="../../location.html#US">US</a> - <em>United States of America
|
||||
<!-- 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">./akari</span> [ input_file <span class="kw">|</span> <span class="ex">-</span> ] [ output_file <span class="kw">|</span> <span class="ex">-</span> ] <span class="pp">[</span><span class="ss">even</span><span class="pp">]</span></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">./akari</span> [ input_file <span class="kw">|</span> <span class="ex">-</span> ] [ output_file <span class="kw">|</span> <span class="ex">-</span> ] <span class="pp">[</span><span class="ss">even</span><span class="pp">]</span></span></code></pre></div>
|
||||
<h2 id="try">Try:</h2>
|
||||
<div class="sourceCode" id="cb3"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb3-1"><a href="#cb3-1" aria-hidden="true" tabindex="-1"></a><span class="ex">./try.sh</span></span></code></pre></div>
|
||||
<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><code>Akari</code> is an image downsampling utility that accepts 3 input formats:</p>
|
||||
<ul>
|
||||
@@ -172,10 +171,10 @@ will read from <code>stdin</code>.</p>
|
||||
<a href="https://en.wikipedia.org/wiki/Scan_line">scanlines</a>. By default <code>Akari</code> will
|
||||
keep odd pixels on odd <a href="https://en.wikipedia.org/wiki/Scan_line">scanlines</a>.</p>
|
||||
<h3 id="examples">Examples:</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">gcc</span> akari.c <span class="at">-o</span> akari</span>
|
||||
<span id="cb4-2"><a href="#cb4-2" aria-hidden="true" tabindex="-1"></a><span class="ex">./akari</span> <span class="op"><</span> example.ppm <span class="op">></span> odd_output.ppm</span>
|
||||
<span id="cb4-3"><a href="#cb4-3" aria-hidden="true" tabindex="-1"></a><span class="ex">./akari</span> <span class="at">-</span> <span class="at">-</span> even <span class="op"><</span> example.ppm <span class="op">></span> even_output.ppm</span>
|
||||
<span id="cb4-4"><a href="#cb4-4" aria-hidden="true" tabindex="-1"></a><span class="ex">./akari</span> example.ppm odd_output.ppm</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">gcc</span> akari.c <span class="at">-o</span> akari</span>
|
||||
<span id="cb4-2"><a href="#cb4-2" aria-hidden="true" tabindex="-1"></a> <span class="ex">./akari</span> <span class="op"><</span> example.ppm <span class="op">></span> odd_output.ppm</span>
|
||||
<span id="cb4-3"><a href="#cb4-3" aria-hidden="true" tabindex="-1"></a> <span class="ex">./akari</span> <span class="at">-</span> <span class="at">-</span> even <span class="op"><</span> example.ppm <span class="op">></span> even_output.ppm</span>
|
||||
<span id="cb4-4"><a href="#cb4-4" aria-hidden="true" tabindex="-1"></a> <span class="ex">./akari</span> example.ppm odd_output.ppm</span></code></pre></div>
|
||||
<p><code>Akari</code> accepts 3 input formats:</p>
|
||||
<ul>
|
||||
<li><a href="https://netpbm.sourceforge.net/doc/pgm.html">PGM</a>
|
||||
@@ -193,22 +192,22 @@ the included <a href="example.ppm">example.ppm</a>.</p>
|
||||
<p>Anything that is not parsable as <code>PGM</code> or <code>PPM</code> will be downsampled as
|
||||
ASCII art. Since the source code is formatted as ASCII art, it’s only
|
||||
natural to try:</p>
|
||||
<div class="sourceCode" id="cb5"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb5-1"><a href="#cb5-1" aria-hidden="true" tabindex="-1"></a><span class="ex">./akari</span> akari.c akari2.c</span></code></pre></div>
|
||||
<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">./akari</span> akari.c akari2.c</span></code></pre></div>
|
||||
<p><code>akari2.c</code> is also a valid C program, and accepts up to 1 argument.
|
||||
By default, this second program reads text from <code>stdin</code> and writes
|
||||
expanded output to <code>stdout</code>. If the extra argument is specified, the
|
||||
output text will also pass through a rot13 filter.</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">gcc</span> akari2.c <span class="at">-o</span> akari2</span>
|
||||
<span id="cb6-2"><a href="#cb6-2" aria-hidden="true" tabindex="-1"></a><span class="ex">./akari2</span> <span class="op"><</span> input.txt <span class="op">></span> expanded_output.txt</span>
|
||||
<span id="cb6-3"><a href="#cb6-3" aria-hidden="true" tabindex="-1"></a><span class="ex">./akari2</span> rot13 <span class="op"><</span> input.txt <span class="op">></span> expanded_and_rot13_output.txt</span></code></pre></div>
|
||||
<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">gcc</span> akari2.c <span class="at">-o</span> akari2</span>
|
||||
<span id="cb6-2"><a href="#cb6-2" aria-hidden="true" tabindex="-1"></a> <span class="ex">./akari2</span> <span class="op"><</span> input.txt <span class="op">></span> expanded_output.txt</span>
|
||||
<span id="cb6-3"><a href="#cb6-3" aria-hidden="true" tabindex="-1"></a> <span class="ex">./akari2</span> rot13 <span class="op"><</span> input.txt <span class="op">></span> expanded_and_rot13_output.txt</span></code></pre></div>
|
||||
<p>You can combine the two programs together to have just a regular rot13
|
||||
filter:</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">./akari2</span> rot13 <span class="op"><</span> input.txt <span class="kw">|</span> <span class="ex">./akari</span> <span class="op">></span> rot13.txt</span></code></pre></div>
|
||||
<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">./akari2</span> rot13 <span class="op"><</span> input.txt <span class="kw">|</span> <span class="ex">./akari</span> <span class="op">></span> rot13.txt</span></code></pre></div>
|
||||
<p>Of course, we wouldn’t stop with just 2 programs, you can downsample
|
||||
the source <em>again</em> and get yet another C program:</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">./akari</span> <span class="op"><</span> akari.c <span class="kw">|</span> <span class="ex">./akari</span> <span class="op">></span> akari3.c</span></code></pre></div>
|
||||
<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">./akari</span> <span class="op"><</span> akari.c <span class="kw">|</span> <span class="ex">./akari</span> <span class="op">></span> akari3.c</span></code></pre></div>
|
||||
<p>We must go deeper:</p>
|
||||
<div class="sourceCode" id="cb9"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb9-1"><a href="#cb9-1" aria-hidden="true" tabindex="-1"></a><span class="ex">./akari</span> <span class="op"><</span> akari.c <span class="kw">|</span> <span class="ex">./akari</span> <span class="kw">|</span> <span class="ex">./akari</span> <span class="op">></span> akari4.c</span></code></pre></div>
|
||||
<div class="sourceCode" id="cb9"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb9-1"><a href="#cb9-1" aria-hidden="true" tabindex="-1"></a> <span class="ex">./akari</span> <span class="op"><</span> akari.c <span class="kw">|</span> <span class="ex">./akari</span> <span class="kw">|</span> <span class="ex">./akari</span> <span class="op">></span> akari4.c</span></code></pre></div>
|
||||
<p><code>akari3.c</code> and <code>akari4.c</code> are still (mostly valid) C programs.
|
||||
<code>gcc -Wall</code> will output a few warnings, but still produce output
|
||||
executables. The output executables each print a message to <code>stdout</code>.</p>
|
||||
|
||||
+11
-11
@@ -1,7 +1,7 @@
|
||||
## To build:
|
||||
|
||||
```sh
|
||||
make
|
||||
make
|
||||
```
|
||||
|
||||
|
||||
@@ -10,20 +10,20 @@ make
|
||||
Zoom out and make your terminal window 53 or more lines deep.
|
||||
|
||||
```sh
|
||||
./blakely < blakely.c | head -300
|
||||
./blakely < blakely.c | head -300
|
||||
```
|
||||
|
||||
|
||||
## Try:
|
||||
|
||||
```sh
|
||||
./try.sh
|
||||
./try.sh
|
||||
```
|
||||
|
||||
For those who have a lot of time, try:
|
||||
|
||||
```sh
|
||||
./blakely < t0_3.dat
|
||||
./blakely < t0_3.dat
|
||||
```
|
||||
|
||||
though one might or might not need to kill it, depending on your boredom
|
||||
@@ -41,7 +41,7 @@ If you have enough time to spare, put the plan of your garden in a text file,
|
||||
and run:
|
||||
|
||||
```sh
|
||||
./blakely - < garden.txt
|
||||
./blakely - < garden.txt
|
||||
```
|
||||
|
||||
|
||||
@@ -55,7 +55,7 @@ over tabs.
|
||||
In order to see the main feature of the code, type:
|
||||
|
||||
```sh
|
||||
./blakely < blakely.c
|
||||
./blakely < blakely.c
|
||||
```
|
||||
|
||||
and wait for about four seconds before using Ctrl-C (or whatever) to end the program. The
|
||||
@@ -73,7 +73,7 @@ the first 15 decimal places of pi after 4 time steps. This was setup using the
|
||||
other feature of the program which can be demonstrated as follows:
|
||||
|
||||
```sh
|
||||
./blakely - < 3.dat
|
||||
./blakely - < 3.dat
|
||||
```
|
||||
|
||||
The program will first display the grid given in [3.dat](3.dat), and then three
|
||||
@@ -82,7 +82,7 @@ grids will take a substantial amount of time. The final grid has been put into
|
||||
[evolve_to_3.dat](evolve_to_3.dat), and if you type
|
||||
|
||||
```sh
|
||||
./blakely < evolve_to_3.dat
|
||||
./blakely < evolve_to_3.dat
|
||||
```
|
||||
|
||||
then the 3 will reappear after three time steps.
|
||||
@@ -213,9 +213,9 @@ without expanding to collide with the digits' evolution.
|
||||
Groups of cells such as singletons, pairs, and larger groups like
|
||||
|
||||
```
|
||||
* * * * * * * * * *
|
||||
*****************
|
||||
* * * * * * * * * *
|
||||
* * * * * * * * * *
|
||||
*****************
|
||||
* * * * * * * * * *
|
||||
```
|
||||
|
||||
were useful in this regard.
|
||||
|
||||
+12
-13
@@ -132,8 +132,7 @@
|
||||
<h2 id="author"><a name="author"></a>Author:</h2>
|
||||
<ul>
|
||||
<li>Name: <a href="../../authors.html#Philip_Blakely">Philip Blakely</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>
|
||||
Location: <a href="../../location.html#GB">GB</a> - <em>United Kingdom of Great Britain and Northern Ireland</em> (<em>United Kingdom</em>)</li>
|
||||
</ul>
|
||||
|
||||
<!-- END: next line ends content generated by: bin/output-index-author.sh -->
|
||||
@@ -142,14 +141,14 @@ Location: <a href="../../location.html#GB">GB</a> - <em>United Kingdom of Great
|
||||
<!-- 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>
|
||||
<p>Zoom out and make your terminal window 53 or more lines deep.</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">./blakely</span> <span class="op"><</span> blakely.c <span class="kw">|</span> <span class="fu">head</span> <span class="at">-300</span></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">./blakely</span> <span class="op"><</span> blakely.c <span class="kw">|</span> <span class="fu">head</span> <span class="at">-300</span></span></code></pre></div>
|
||||
<h2 id="try">Try:</h2>
|
||||
<div class="sourceCode" id="cb3"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb3-1"><a href="#cb3-1" aria-hidden="true" tabindex="-1"></a><span class="ex">./try.sh</span></span></code></pre></div>
|
||||
<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>For those who have a lot of time, try:</p>
|
||||
<div class="sourceCode" id="cb4"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb4-1"><a href="#cb4-1" aria-hidden="true" tabindex="-1"></a><span class="ex">./blakely</span> <span class="op"><</span> t0_3.dat</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="ex">./blakely</span> <span class="op"><</span> t0_3.dat</span></code></pre></div>
|
||||
<p>though one might or might not need to kill it, depending on your boredom
|
||||
threshold.</p>
|
||||
<h2 id="judges-remarks">Judges’ remarks:</h2>
|
||||
@@ -159,14 +158,14 @@ if given its own source as input, and allows to check if your garden
|
||||
is a <a href="http://en.wikipedia.org/wiki/Garden_of_Eden_%28cellular_automaton%29">Garden of Eden</a>, all in one source.</p>
|
||||
<p>If you have enough time to spare, put the plan of your garden in a text file,
|
||||
and run:</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">./blakely</span> <span class="at">-</span> <span class="op"><</span> garden.txt</span></code></pre></div>
|
||||
<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">./blakely</span> <span class="at">-</span> <span class="op"><</span> garden.txt</span></code></pre></div>
|
||||
<h2 id="authors-remarks">Author’s remarks:</h2>
|
||||
<p>This program uses a well-known algorithm in order to display pi to fifteen
|
||||
decimal places. The source-layout itself demonstrates the importance of using
|
||||
the correct amount of whitespace in code and the clear superiority of spaces
|
||||
over tabs.</p>
|
||||
<p>In order to see the main feature of the code, type:</p>
|
||||
<div class="sourceCode" id="cb6"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb6-1"><a href="#cb6-1" aria-hidden="true" tabindex="-1"></a><span class="ex">./blakely</span> <span class="op"><</span> blakely.c</span></code></pre></div>
|
||||
<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">./blakely</span> <span class="op"><</span> blakely.c</span></code></pre></div>
|
||||
<p>and wait for about four seconds before using Ctrl-C (or whatever) to end the program. The
|
||||
results are best viewed in a terminal window at least 60 characters
|
||||
high and wide. Alternatively, redirect the output to a separate file
|
||||
@@ -177,12 +176,12 @@ Life</a>”, using standard input as a starting grid. The
|
||||
layout of the source-code is such that it evolves to a digital representation of
|
||||
the first 15 decimal places of pi after 4 time steps. This was setup using the
|
||||
other feature of the program which can be demonstrated as follows:</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">./blakely</span> <span class="at">-</span> <span class="op"><</span> 3.dat</span></code></pre></div>
|
||||
<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">./blakely</span> <span class="at">-</span> <span class="op"><</span> 3.dat</span></code></pre></div>
|
||||
<p>The program will first display the grid given in <a href="3.dat">3.dat</a>, and then three
|
||||
more grids (taking a few minutes to display the last). Waiting for any more
|
||||
grids will take a substantial amount of time. The final grid has been put into
|
||||
<a href="evolve_to_3.dat">evolve_to_3.dat</a>, and if you type</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">./blakely</span> <span class="op"><</span> evolve_to_3.dat</span></code></pre></div>
|
||||
<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">./blakely</span> <span class="op"><</span> evolve_to_3.dat</span></code></pre></div>
|
||||
<p>then the 3 will reappear after three time steps.</p>
|
||||
<p>As should now be clear, this use of the program will attempt to evolve a given setup
|
||||
backwards in time according to the Life rules. The resulting grid is clearly not
|
||||
@@ -282,9 +281,9 @@ will not collide when evolving.</p>
|
||||
into. Therefore it was necessary to add some regions that would quickly die off
|
||||
without expanding to collide with the digits’ evolution.
|
||||
Groups of cells such as singletons, pairs, and larger groups like</p>
|
||||
<pre><code>* * * * * * * * * *
|
||||
*****************
|
||||
* * * * * * * * * *</code></pre>
|
||||
<pre><code> * * * * * * * * * *
|
||||
*****************
|
||||
* * * * * * * * * *</code></pre>
|
||||
<p>were useful in this regard.</p>
|
||||
<p>Other problems were keywords which need to be all in one
|
||||
string, keywords requiring space after them, and
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
## To build:
|
||||
|
||||
```sh
|
||||
make
|
||||
make
|
||||
```
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@ make
|
||||
The current status of this entry is:
|
||||
|
||||
```
|
||||
STATUS: INABIAF - please **DO NOT** fix
|
||||
STATUS: INABIAF - please **DO NOT** fix
|
||||
```
|
||||
|
||||
For more detailed information see [2011 borsanyi bugs](../../bugs.html#2011_borsanyi).
|
||||
@@ -19,14 +19,14 @@ For more detailed information see [2011 borsanyi bugs](../../bugs.html#2011_bors
|
||||
## To use:
|
||||
|
||||
```sh
|
||||
./borsanyi < some_data_file
|
||||
./borsanyi < some_data_file
|
||||
```
|
||||
|
||||
|
||||
## Try:
|
||||
|
||||
```sh
|
||||
./try.sh
|
||||
./try.sh
|
||||
```
|
||||
|
||||
|
||||
|
||||
@@ -132,8 +132,7 @@
|
||||
<h2 id="author"><a name="author"></a>Author:</h2>
|
||||
<ul>
|
||||
<li>Name: <a href="../../authors.html#Szabolcs_Borsanyi">Szabolcs Borsanyi</a><br>
|
||||
Location: <a href="../../location.html#DE">DE</a> - <em>Federal Republic of Germany</em> (<em>Germany</em>)
|
||||
<br><br></li>
|
||||
Location: <a href="../../location.html#DE">DE</a> - <em>Federal Republic of Germany</em> (<em>Germany</em>)</li>
|
||||
</ul>
|
||||
|
||||
<!-- END: next line ends content generated by: bin/output-index-author.sh -->
|
||||
@@ -142,15 +141,15 @@ Location: <a href="../../location.html#DE">DE</a> - <em>Federal Republic of Germ
|
||||
<!-- 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>
|
||||
<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>
|
||||
<pre><code> STATUS: INABIAF - please **DO NOT** fix</code></pre>
|
||||
<p>For more detailed information see <a href="../../bugs.html#2011_borsanyi">2011 borsanyi 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">./borsanyi</span> <span class="op"><</span> some_data_file</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">./borsanyi</span> <span class="op"><</span> some_data_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>
|
||||
<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>This is a nice quick <a href="https://en.wikipedia.org/wiki/Histogram">histogram</a>
|
||||
plotter. A useful utility when you need to look at the distribution of some
|
||||
|
||||
+19
-20
@@ -1,7 +1,7 @@
|
||||
## To build:
|
||||
|
||||
```sh
|
||||
make
|
||||
make
|
||||
```
|
||||
|
||||
|
||||
@@ -10,8 +10,8 @@ make
|
||||
The current status of this entry is:
|
||||
|
||||
```
|
||||
STATUS: missing or dead link - please provide them
|
||||
STATUS: INABIAF - please **DO NOT** fix
|
||||
STATUS: missing or dead link - please provide them
|
||||
STATUS: INABIAF - please **DO NOT** fix
|
||||
```
|
||||
|
||||
For more detailed information see [2011 dlowe bugs](../../bugs.html#2011_dlowe).
|
||||
@@ -20,7 +20,7 @@ For more detailed information see [2011 dlowe bugs](../../bugs.html#2011_dlowe).
|
||||
## To use:
|
||||
|
||||
```sh
|
||||
./dlowe -<n_iterations> corpus1/ [...] corpus0/ < start.net > trained.net
|
||||
./dlowe -<n_iterations> corpus1/ [...] corpus0/ < start.net > trained.net
|
||||
```
|
||||
|
||||
NOTE: In the above command, the directory args MUST end in a `/`.
|
||||
@@ -28,7 +28,7 @@ NOTE: In the above command, the directory args MUST end in a `/`.
|
||||
Then to use `trained.net`:
|
||||
|
||||
```sh
|
||||
./dlowe file [file ...] < trained.net
|
||||
./dlowe file [file ...] < trained.net
|
||||
```
|
||||
|
||||
|
||||
@@ -37,7 +37,7 @@ Then to use `trained.net`:
|
||||
Try these pre-trained networks:
|
||||
|
||||
```sh
|
||||
./try.sh
|
||||
./try.sh
|
||||
```
|
||||
|
||||
NOTE: The `dlowe-aux-data/` directory, which [try.sh](try.sh) refers to, was
|
||||
@@ -45,7 +45,7 @@ created by:
|
||||
|
||||
|
||||
```sh
|
||||
tar -jxf dlowe-aux-data.tar.bz2
|
||||
tar -jxf dlowe-aux-data.tar.bz2
|
||||
```
|
||||
|
||||
|
||||
@@ -64,8 +64,8 @@ The `ioccc-winlose-trained.net` was trained using the
|
||||
[earlystop.pl](earlystop.pl) tool:
|
||||
|
||||
```sh
|
||||
rm -f ioccc-winlose-trained.net
|
||||
./earlystop.pl ioccc-winlose-trained.net ioccc_won_training/ ioccc_lost_training/ ioccc_won_test/ ioccc_lost_test/
|
||||
rm -f ioccc-winlose-trained.net
|
||||
./earlystop.pl ioccc-winlose-trained.net ioccc_won_training/ ioccc_lost_training/ ioccc_won_test/ ioccc_lost_test/
|
||||
```
|
||||
|
||||
where:
|
||||
@@ -90,9 +90,9 @@ that did not win were flushed to `/dev/null`.
|
||||
The [earlystop.pl](earlystop.pl) tool wrote:
|
||||
|
||||
```
|
||||
training 1 to 1001...
|
||||
training 1001 to 2001...
|
||||
prior error = 56.746974766043; current error = 58.095691135305
|
||||
training 1 to 1001...
|
||||
training 1001 to 2001...
|
||||
prior error = 56.746974766043; current error = 58.095691135305
|
||||
```
|
||||
|
||||
The resulting `ioccc-winlose-trained.net` file was included in the
|
||||
@@ -102,7 +102,7 @@ The [dlowe.c](dlowe.c) was explicitly excluded from this trailing set, so this
|
||||
test is interesting:
|
||||
|
||||
```sh
|
||||
./dlowe dlowe.c < dlowe-aux-data/ioccc-winlose-trained.net
|
||||
./dlowe dlowe.c < dlowe-aux-data/ioccc-winlose-trained.net
|
||||
```
|
||||
|
||||
NOTE: this is done in [try.sh](try.sh).
|
||||
@@ -111,7 +111,7 @@ NOTE: this is done in [try.sh](try.sh).
|
||||
The match of [dlowe.c](dlowe.c) to the lose/win trailed network was:
|
||||
|
||||
```
|
||||
dlowe.c 0.125108
|
||||
dlowe.c 0.125108
|
||||
```
|
||||
|
||||
NOTE: The non-artificially intelligent decisions of the IOCCC judges include random
|
||||
@@ -128,7 +128,7 @@ data sets on which to test:
|
||||
We created the [english-trained.net](dlowe-aux-data/english-trained.net) as follows:
|
||||
|
||||
```sh
|
||||
./dlowe -8000 dlowe-aux-data/english-1/ dlowe-aux-data/english-0/ < /dev/null > dlowe-aux-data/english-trained.net
|
||||
./dlowe -8000 dlowe-aux-data/english-1/ dlowe-aux-data/english-0/ < /dev/null > dlowe-aux-data/english-trained.net
|
||||
```
|
||||
|
||||
- [dlowe-aux-data/english-0/](dlowe-aux-data/english-0/)
|
||||
@@ -140,7 +140,7 @@ We created the [english-trained.net](dlowe-aux-data/english-trained.net) as foll
|
||||
We created the [png-trained.net](dlowe-aux-data/png-trained.net) as follows:
|
||||
|
||||
```sh
|
||||
./dlowe -8000 png-1/ png-0/ < /dev/null > dlowe-aux-data/png-trained.net
|
||||
./dlowe -8000 png-1/ png-0/ < /dev/null > dlowe-aux-data/png-trained.net
|
||||
```
|
||||
|
||||
- [dlowe-aux-data/png-0/](dlowe-aux-data/png-0/)
|
||||
@@ -152,7 +152,7 @@ We created the [png-trained.net](dlowe-aux-data/png-trained.net) as follows:
|
||||
We created the [xor-trained.net](dlowe-aux-data/xor-trained.net) as follows:
|
||||
|
||||
```sh
|
||||
./dlowe -8000 dlowe-aux-data/xor-1/ dlowe-aux-data/xor-0/ < /dev/null > dlowe-aux-data/xor-trained.net
|
||||
./dlowe -8000 dlowe-aux-data/xor-1/ dlowe-aux-data/xor-0/ < /dev/null > dlowe-aux-data/xor-trained.net
|
||||
```
|
||||
|
||||
- [dlowe-aux-data/xor-0](dlowe-aux-data/xor-0/)
|
||||
@@ -190,7 +190,7 @@ The neurons' activation function is the logistic function `1 / (1 + e ^ -x)`.
|
||||
### Classifying
|
||||
|
||||
```sh
|
||||
./dlowe file [file ...] < trained.net
|
||||
./dlowe file [file ...] < trained.net
|
||||
```
|
||||
|
||||
To classify files, one specifies a trained network (on `stdin`) and one or more
|
||||
@@ -205,9 +205,8 @@ trained, but it's geared toward interpretation as a *probability* or a
|
||||
|
||||
### Training
|
||||
|
||||
|
||||
```sh
|
||||
./dlowe -<n_iterations> corpus1/ [...] corpus0/ < start.net > end.net
|
||||
./dlowe -<n_iterations> corpus1/ [...] corpus0/ < start.net > end.net
|
||||
```
|
||||
|
||||
**NOTE**: The directory args **must end in a** `/` for them to work.
|
||||
|
||||
+20
-21
@@ -132,8 +132,7 @@
|
||||
<h2 id="author"><a name="author"></a>Author:</h2>
|
||||
<ul>
|
||||
<li>Name: <a href="../../authors.html#J_David_Lowe">J. David Lowe</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>)</li>
|
||||
</ul>
|
||||
|
||||
<!-- END: next line ends content generated by: bin/output-index-author.sh -->
|
||||
@@ -142,23 +141,23 @@ Location: <a href="../../location.html#US">US</a> - <em>United States of America
|
||||
<!-- 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>
|
||||
<h3 id="bugs-and-misfeatures">Bugs and (Mis)features:</h3>
|
||||
<p>The current status of this entry is:</p>
|
||||
<pre><code>STATUS: missing or dead link - please provide them
|
||||
STATUS: INABIAF - please **DO NOT** fix</code></pre>
|
||||
<pre><code> STATUS: missing or dead link - please provide them
|
||||
STATUS: INABIAF - please **DO NOT** fix</code></pre>
|
||||
<p>For more detailed information see <a href="../../bugs.html#2011_dlowe">2011 dlowe 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">./dlowe</span> <span class="at">-</span><span class="op"><</span>n_iterations<span class="op">></span> corpus1/ <span class="pp">[</span><span class="ss">...</span><span class="pp">]</span> corpus0/ <span class="op"><</span> start.net <span class="op">></span> trained.net</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">./dlowe</span> <span class="at">-</span><span class="op"><</span>n_iterations<span class="op">></span> corpus1/ <span class="pp">[</span><span class="ss">...</span><span class="pp">]</span> corpus0/ <span class="op"><</span> start.net <span class="op">></span> trained.net</span></code></pre></div>
|
||||
<p>NOTE: In the above command, the directory args MUST end in a <code>/</code>.</p>
|
||||
<p>Then to use <code>trained.net</code>:</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">./dlowe</span> file [file ...] <span class="op"><</span> trained.net</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="ex">./dlowe</span> file [file ...] <span class="op"><</span> trained.net</span></code></pre></div>
|
||||
<h2 id="try">Try:</h2>
|
||||
<p>Try these pre-trained networks:</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">./try.sh</span></span></code></pre></div>
|
||||
<div class="sourceCode" id="cb5"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb5-1"><a href="#cb5-1" aria-hidden="true" tabindex="-1"></a> <span class="ex">./try.sh</span></span></code></pre></div>
|
||||
<p>NOTE: The <code>dlowe-aux-data/</code> directory, which <a href="try.sh">try.sh</a> refers to, was
|
||||
created by:</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">tar</span> <span class="at">-jxf</span> dlowe-aux-data.tar.bz2</span></code></pre></div>
|
||||
<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">tar</span> <span class="at">-jxf</span> dlowe-aux-data.tar.bz2</span></code></pre></div>
|
||||
<h2 id="judges-remarks">Judges’ remarks:</h2>
|
||||
<p>This entry is a ghoulish example of a brain (dead?) neural network classifier.
|
||||
It comes with a set of corpora for you to try.</p>
|
||||
@@ -167,8 +166,8 @@ It comes with a set of corpora for you to try.</p>
|
||||
on the C code of entries that were supplied to the 20Th IOCCC.</p>
|
||||
<p>The <code>ioccc-winlose-trained.net</code> was trained using the
|
||||
<a href="earlystop.pl">earlystop.pl</a> tool:</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">rm</span> <span class="at">-f</span> ioccc-winlose-trained.net</span>
|
||||
<span id="cb7-2"><a href="#cb7-2" aria-hidden="true" tabindex="-1"></a><span class="ex">./earlystop.pl</span> ioccc-winlose-trained.net ioccc_won_training/ ioccc_lost_training/ ioccc_won_test/ ioccc_lost_test/</span></code></pre></div>
|
||||
<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">rm</span> <span class="at">-f</span> ioccc-winlose-trained.net</span>
|
||||
<span id="cb7-2"><a href="#cb7-2" aria-hidden="true" tabindex="-1"></a> <span class="ex">./earlystop.pl</span> ioccc-winlose-trained.net ioccc_won_training/ ioccc_lost_training/ ioccc_won_test/ ioccc_lost_test/</span></code></pre></div>
|
||||
<p>where:</p>
|
||||
<ul>
|
||||
<li><p><code>ioccc_won_training/</code>
|
||||
@@ -185,17 +184,17 @@ plus 1/2 of the C code winning entries from prior IOCCC contests</p></li>
|
||||
<p>NOTE: The above directories were not shipped and everything from the entries
|
||||
that did not win were flushed to <code>/dev/null</code>.</p>
|
||||
<p>The <a href="earlystop.pl">earlystop.pl</a> tool wrote:</p>
|
||||
<pre><code>training 1 to 1001...
|
||||
training 1001 to 2001...
|
||||
prior error = 56.746974766043; current error = 58.095691135305</code></pre>
|
||||
<pre><code> training 1 to 1001...
|
||||
training 1001 to 2001...
|
||||
prior error = 56.746974766043; current error = 58.095691135305</code></pre>
|
||||
<p>The resulting <code>ioccc-winlose-trained.net</code> file was included in the
|
||||
<a href="dlowe-aux-data.tar.bz2">dlowe-aux-data.tar.bz2</a> tarball.</p>
|
||||
<p>The <a href="dlowe.c">dlowe.c</a> was explicitly excluded from this trailing set, so this
|
||||
test is interesting:</p>
|
||||
<div class="sourceCode" id="cb9"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb9-1"><a href="#cb9-1" aria-hidden="true" tabindex="-1"></a><span class="ex">./dlowe</span> dlowe.c <span class="op"><</span> dlowe-aux-data/ioccc-winlose-trained.net</span></code></pre></div>
|
||||
<div class="sourceCode" id="cb9"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb9-1"><a href="#cb9-1" aria-hidden="true" tabindex="-1"></a> <span class="ex">./dlowe</span> dlowe.c <span class="op"><</span> dlowe-aux-data/ioccc-winlose-trained.net</span></code></pre></div>
|
||||
<p>NOTE: this is done in <a href="try.sh">try.sh</a>.</p>
|
||||
<p>The match of <a href="dlowe.c">dlowe.c</a> to the lose/win trailed network was:</p>
|
||||
<pre><code>dlowe.c 0.125108</code></pre>
|
||||
<pre><code> dlowe.c 0.125108</code></pre>
|
||||
<p>NOTE: The non-artificially intelligent decisions of the IOCCC judges include random
|
||||
quirks and their non-linear judgment calls not found in the ioccc trained network.
|
||||
Just because C code is or isn’t scored highly by this network does not
|
||||
@@ -204,7 +203,7 @@ mean it will win or lose a future IOCCC. On the other hand … it just might!</p
|
||||
<p>While we cannot supply you with the losing IOCCC source code, the author did supply a number
|
||||
data sets on which to test:</p>
|
||||
<p>We created the <a href="dlowe-aux-data/english-trained.net">english-trained.net</a> as follows:</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">./dlowe</span> <span class="at">-8000</span> dlowe-aux-data/english-1/ dlowe-aux-data/english-0/ <span class="op"><</span> /dev/null <span class="op">></span> dlowe-aux-data/english-trained.net</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">./dlowe</span> <span class="at">-8000</span> dlowe-aux-data/english-1/ dlowe-aux-data/english-0/ <span class="op"><</span> /dev/null <span class="op">></span> dlowe-aux-data/english-trained.net</span></code></pre></div>
|
||||
<ul>
|
||||
<li><p><a href="dlowe-aux-data/english-0/">dlowe-aux-data/english-0/</a>
|
||||
Non-English (French) text</p></li>
|
||||
@@ -212,7 +211,7 @@ Non-English (French) text</p></li>
|
||||
English (non-French) text</p></li>
|
||||
</ul>
|
||||
<p>We created the <a href="dlowe-aux-data/png-trained.net">png-trained.net</a> as follows:</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">./dlowe</span> <span class="at">-8000</span> png-1/ png-0/ <span class="op"><</span> /dev/null <span class="op">></span> dlowe-aux-data/png-trained.net</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">./dlowe</span> <span class="at">-8000</span> png-1/ png-0/ <span class="op"><</span> /dev/null <span class="op">></span> dlowe-aux-data/png-trained.net</span></code></pre></div>
|
||||
<ul>
|
||||
<li><p><a href="dlowe-aux-data/png-0/">dlowe-aux-data/png-0/</a>
|
||||
Non-png (gif) images</p></li>
|
||||
@@ -220,7 +219,7 @@ Non-png (gif) images</p></li>
|
||||
png (non-gif) images</p></li>
|
||||
</ul>
|
||||
<p>We created the <a href="dlowe-aux-data/xor-trained.net">xor-trained.net</a> as follows:</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">./dlowe</span> <span class="at">-8000</span> dlowe-aux-data/xor-1/ dlowe-aux-data/xor-0/ <span class="op"><</span> /dev/null <span class="op">></span> dlowe-aux-data/xor-trained.net</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="ex">./dlowe</span> <span class="at">-8000</span> dlowe-aux-data/xor-1/ dlowe-aux-data/xor-0/ <span class="op"><</span> /dev/null <span class="op">></span> dlowe-aux-data/xor-trained.net</span></code></pre></div>
|
||||
<ul>
|
||||
<li><p><a href="dlowe-aux-data/xor-0/">dlowe-aux-data/xor-0</a>
|
||||
Data that XORs to 0</p></li>
|
||||
@@ -243,7 +242,7 @@ which can be trained, using on-line
|
||||
neuron.</p>
|
||||
<p>The neurons’ activation function is the logistic function <code>1 / (1 + e ^ -x)</code>.</p>
|
||||
<h3 id="classifying">Classifying</h3>
|
||||
<div class="sourceCode" id="cb14"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb14-1"><a href="#cb14-1" aria-hidden="true" tabindex="-1"></a><span class="ex">./dlowe</span> file [file ...] <span class="op"><</span> trained.net</span></code></pre></div>
|
||||
<div class="sourceCode" id="cb14"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb14-1"><a href="#cb14-1" aria-hidden="true" tabindex="-1"></a> <span class="ex">./dlowe</span> file [file ...] <span class="op"><</span> trained.net</span></code></pre></div>
|
||||
<p>To classify files, one specifies a trained network (on <code>stdin</code>) and one or more
|
||||
files to classify. The program will output one line per successfully-classified
|
||||
file to <code>stderr</code>, with the filename and the classification: a number between 0
|
||||
@@ -252,7 +251,7 @@ and 1.</p>
|
||||
trained, but it’s geared toward interpretation as a <em>probability</em> or a
|
||||
<em>confidence</em>.</p>
|
||||
<h3 id="training">Training</h3>
|
||||
<div class="sourceCode" id="cb15"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb15-1"><a href="#cb15-1" aria-hidden="true" tabindex="-1"></a><span class="ex">./dlowe</span> <span class="at">-</span><span class="op"><</span>n_iterations<span class="op">></span> corpus1/ <span class="pp">[</span><span class="ss">...</span><span class="pp">]</span> corpus0/ <span class="op"><</span> start.net <span class="op">></span> end.net</span></code></pre></div>
|
||||
<div class="sourceCode" id="cb15"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb15-1"><a href="#cb15-1" aria-hidden="true" tabindex="-1"></a> <span class="ex">./dlowe</span> <span class="at">-</span><span class="op"><</span>n_iterations<span class="op">></span> corpus1/ <span class="pp">[</span><span class="ss">...</span><span class="pp">]</span> corpus0/ <span class="op"><</span> start.net <span class="op">></span> end.net</span></code></pre></div>
|
||||
<p><strong>NOTE</strong>: The directory args <strong>must end in a</strong> <code>/</code> for them to work.</p>
|
||||
<p>To train a network, one specifies a starting network (on <code>stdin</code>), two or more
|
||||
corpora (directories containing training data), and the number of training
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
## To build:
|
||||
|
||||
```sh
|
||||
make
|
||||
make
|
||||
```
|
||||
|
||||
|
||||
## To use:
|
||||
|
||||
```sh
|
||||
./eastman
|
||||
./eastman
|
||||
```
|
||||
|
||||
NOTE: to restore your cursor in your shell, try `reset`.
|
||||
@@ -20,7 +20,7 @@ Run the program. Quit it (ctrl-c/intr). Resize your terminal window. Run it
|
||||
again. Try doing this a number of times with different sizes each time.
|
||||
|
||||
```sh
|
||||
./eastman
|
||||
./eastman
|
||||
```
|
||||
|
||||
NOTE: to restore your cursor in your shell, try `reset`.
|
||||
@@ -61,7 +61,7 @@ program is running, though. It only checks the size once, when it starts up.
|
||||
To compile:
|
||||
|
||||
```sh
|
||||
cc -lm eastman.c
|
||||
cc -lm eastman.c
|
||||
```
|
||||
|
||||
|
||||
|
||||
@@ -132,8 +132,7 @@
|
||||
<h2 id="author"><a name="author"></a>Author:</h2>
|
||||
<ul>
|
||||
<li>Name: <a href="../../authors.html#Peter_Eastman">Peter Eastman</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>)</li>
|
||||
</ul>
|
||||
|
||||
<!-- END: next line ends content generated by: bin/output-index-author.sh -->
|
||||
@@ -142,14 +141,14 @@ Location: <a href="../../location.html#US">US</a> - <em>United States of America
|
||||
<!-- 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">./eastman</span></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">./eastman</span></span></code></pre></div>
|
||||
<p>NOTE: to restore your cursor in your shell, try <code>reset</code>.</p>
|
||||
<h2 id="try">Try:</h2>
|
||||
<p>Run the program. Quit it (ctrl-c/intr). Resize your terminal window. Run it
|
||||
again. Try doing this a number of times with different sizes each time.</p>
|
||||
<div class="sourceCode" id="cb3"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb3-1"><a href="#cb3-1" aria-hidden="true" tabindex="-1"></a><span class="ex">./eastman</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">./eastman</span></span></code></pre></div>
|
||||
<p>NOTE: to restore your cursor in your shell, try <code>reset</code>.</p>
|
||||
<h2 id="judges-remarks">Judges’ remarks:</h2>
|
||||
<p>This round program will generate a classic spherical result!</p>
|
||||
@@ -174,7 +173,7 @@ is also just part of the texture, not an actual raytraced shadow.</p>
|
||||
so try enlarging the window to get higher resolution. Don’t resize while the
|
||||
program is running, though. It only checks the size once, when it starts up.</p>
|
||||
<p>To compile:</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">cc</span> <span class="at">-lm</span> eastman.c</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">cc</span> <span class="at">-lm</span> eastman.c</span></code></pre></div>
|
||||
<h3 id="portability">Portability</h3>
|
||||
<p>It should be completely portable. I’ve tested with gcc on Mac OS X 10.7 (Lion)
|
||||
and Fedora 10. I would expect it to work in any Unix-like environment.</p>
|
||||
|
||||
+48
-40
@@ -1,7 +1,7 @@
|
||||
## To build:
|
||||
|
||||
```sh
|
||||
make
|
||||
make
|
||||
```
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@ make
|
||||
The current status of this entry is:
|
||||
|
||||
```
|
||||
STATUS: INABIAF - please **DO NOT** fix
|
||||
STATUS: INABIAF - please **DO NOT** fix
|
||||
```
|
||||
|
||||
For more detailed information see [2011 fredriksson bugs](../../bugs.html#2011_fredriksson).
|
||||
@@ -19,14 +19,14 @@ For more detailed information see [2011 fredriksson bugs](../../bugs.html#2011_f
|
||||
## To use:
|
||||
|
||||
```sh
|
||||
./fredriksson [-icvtnk#] regexp < file
|
||||
./fredriksson [-icvtnk#] regexp < file
|
||||
```
|
||||
|
||||
|
||||
## Try:
|
||||
|
||||
```sh
|
||||
./try.sh
|
||||
./try.sh
|
||||
```
|
||||
|
||||
NOTE: you need to be allowed to change your stack size or else the last command
|
||||
@@ -56,7 +56,7 @@ Implements a variant of `grep`.
|
||||
To search regexp from file, do:
|
||||
|
||||
```sh
|
||||
./fredriksson [-icvtnk#] regexp < file
|
||||
./fredriksson [-icvtnk#] regexp < file
|
||||
```
|
||||
|
||||
Pipes might not work, see the section Limitations.
|
||||
@@ -79,8 +79,8 @@ This version of `grep` recognizes two more options, not present in normal
|
||||
[edit-distance](https://en.wikipedia.org/wiki/Edit_distance)). E.g.
|
||||
"`obfuscated`" matches "`obfuscation`"
|
||||
with one deletion and two mismatches. Likewise, "`obfuscate`" and
|
||||
"`oversimplify`" match with 7 [edit
|
||||
operations](https://en.wikipedia.org/wiki/Edit_distance#Formal_definition_and_properties).
|
||||
"`oversimplify`" match with 7
|
||||
[edit operations](https://en.wikipedia.org/wiki/Edit_distance#Formal_definition_and_properties).
|
||||
The default is `-k0` (i.e. exact match).
|
||||
|
||||
* `-t` Add local transpositions to the set of allowed
|
||||
@@ -124,13 +124,13 @@ Just say
|
||||
|
||||
|
||||
```sh
|
||||
./fredriksson -k3 cat < file
|
||||
./fredriksson -k3 cat < file
|
||||
```
|
||||
|
||||
* Like with `cat`, you can append line numbers too:
|
||||
|
||||
```sh
|
||||
./fredriksson -nk3 cat < file
|
||||
./fredriksson -nk3 cat < file
|
||||
```
|
||||
|
||||
|
||||
@@ -173,7 +173,9 @@ Just say
|
||||
* Depending on the file, it might require a lot of stack space. If the
|
||||
program segfaults (because of this), say
|
||||
|
||||
ulimit -s unlimited
|
||||
```sh
|
||||
ulimit -s unlimited
|
||||
```
|
||||
|
||||
cross your fingers, hope it is enough, and try again.
|
||||
|
||||
@@ -185,14 +187,14 @@ Just say
|
||||
to be 'gcc', but any compiler would work, provided that it supports
|
||||
C99, or long lines as an extension. This code has been tested on:
|
||||
|
||||
- GNU/Linux FC4, i386, gcc
|
||||
- GNU/Linux FC7, x86_64, gcc 4.1.2, tcc 0.9.24 and icc 10.0
|
||||
- GNU/Linux FC9, x86_64, gcc 4.?.?
|
||||
- GNU/Linux CentOS 5, gcc 4.1.2
|
||||
- GNU/Linux Ubuntu 11.04, gcc 4.5.2
|
||||
- SunOS 5.8, UltraSPARC IIIi, gcc 4.1.2
|
||||
- SunOS 5.9, UltraSPARC IIIi, gcc 4.1.1 and Sun ONE Studio 8 CC
|
||||
- AIX 5.3, IBM eServer p5-550, gcc 3.3.3 and AIX CC Version 6
|
||||
- GNU/Linux FC4, i386, gcc
|
||||
- GNU/Linux FC7, x86_64, gcc 4.1.2, tcc 0.9.24 and icc 10.0
|
||||
- GNU/Linux FC9, x86_64, gcc 4.?.?
|
||||
- GNU/Linux CentOS 5, gcc 4.1.2
|
||||
- GNU/Linux Ubuntu 11.04, gcc 4.5.2
|
||||
- SunOS 5.8, UltraSPARC IIIi, gcc 4.1.2
|
||||
- SunOS 5.9, UltraSPARC IIIi, gcc 4.1.1 and Sun ONE Studio 8 CC
|
||||
- AIX 5.3, IBM eServer p5-550, gcc 3.3.3 and AIX CC Version 6
|
||||
|
||||
(Btw, tcc has its roots in IOCCC...)
|
||||
|
||||
@@ -205,7 +207,9 @@ Just say
|
||||
extracts and builds that, and then calls it. More precisely, the command
|
||||
to build is
|
||||
|
||||
gcc -O3 ag.c -o ag
|
||||
```sh
|
||||
gcc -O3 ag.c -o ag
|
||||
```
|
||||
|
||||
To change that you need to edit the char array `p[]` and (possibly) two
|
||||
specially encoded constants, `-~('('*'(')` and `'C'*' '-'-'`.
|
||||
@@ -216,29 +220,29 @@ Just say
|
||||
from the submitted entry.)
|
||||
|
||||
* The code demonstrates several useful programming paradigms, such as:
|
||||
- recursion to remove all loops
|
||||
- subroutines (`main()` contains several logical subroutines,
|
||||
selected by the first argument)
|
||||
- function pointers
|
||||
- recursion to remove all loops
|
||||
- subroutines (`main()` contains several logical subroutines,
|
||||
selected by the first argument)
|
||||
- function pointers
|
||||
|
||||
* Algorithmically, it incorporates the following:
|
||||
- (inverse) Burrows-Wheeler transform (used also e.g. in `bzip2(1)`)
|
||||
- data compression (really expansion :-), run-length-encoding,
|
||||
unary coding (this is why it is expansion rather than compression)
|
||||
- approximate string matching
|
||||
- dynamic programming to compute the edit distance
|
||||
- parallel computation in sequential computers (by packing
|
||||
several objects into a single `long`, to speed up the dynamic
|
||||
programming)
|
||||
- self extracting, compiling and running code
|
||||
- (inverse) Burrows-Wheeler transform (used also e.g. in `bzip2(1)`)
|
||||
- data compression (really expansion :-), run-length-encoding,
|
||||
unary coding (this is why it is expansion rather than compression)
|
||||
- approximate string matching
|
||||
- dynamic programming to compute the edit distance
|
||||
- parallel computation in sequential computers (by packing
|
||||
several objects into a single `long`, to speed up the dynamic
|
||||
programming)
|
||||
- self extracting, compiling and running code
|
||||
|
||||
* As a C program, it demonstrates that
|
||||
- a C subset without reserved words is complete enough,
|
||||
excluding data type specific things (`int`, `char`, `void` ...)
|
||||
- only letters are needed (i.e. the digits `0-9` are not)
|
||||
- only one statement is enough to code any program (plus
|
||||
variable definitions)
|
||||
- white space has other uses than just indenting the code
|
||||
- a C subset without reserved words is complete enough,
|
||||
excluding data type specific things (`int`, `char`, `void` ...)
|
||||
- only letters are needed (i.e. the digits `0-9` are not)
|
||||
- only one statement is enough to code any program (plus
|
||||
variable definitions)
|
||||
- white space has other uses than just indenting the code
|
||||
|
||||
* It also shows the power of boolean logic and bitwise arithmetic.
|
||||
|
||||
@@ -256,12 +260,16 @@ Just say
|
||||
|
||||
* No numerical values, other than in the initialized char array, try
|
||||
|
||||
./fredriksson -ck0 [0-9] < fredriksson.c
|
||||
```sh
|
||||
./fredriksson -ck0 [0-9] < fredriksson.c
|
||||
```
|
||||
|
||||
This should print 1, as there is a number `3` in the char array (only).
|
||||
You can also try
|
||||
|
||||
./fredriksson -ck0 [0-9] < ag.c
|
||||
```sh
|
||||
./fredriksson -ck0 [0-9] < ag.c
|
||||
```
|
||||
|
||||
after running `fredriksson` at least once (since this generates that
|
||||
`ag.c` file), and this should print 0.
|
||||
|
||||
+36
-33
@@ -132,8 +132,7 @@
|
||||
<h2 id="author"><a name="author"></a>Author:</h2>
|
||||
<ul>
|
||||
<li>Name: <a href="../../authors.html#Kimmo_Fredriksson">Kimmo Fredriksson</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>)</li>
|
||||
</ul>
|
||||
|
||||
<!-- END: next line ends content generated by: bin/output-index-author.sh -->
|
||||
@@ -142,15 +141,15 @@ Location: <a href="../../location.html#FI">FI</a> - <em>Republic of Finland </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>
|
||||
<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>
|
||||
<pre><code> STATUS: INABIAF - please **DO NOT** fix</code></pre>
|
||||
<p>For more detailed information see <a href="../../bugs.html#2011_fredriksson">2011 fredriksson 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">./fredriksson</span> <span class="pp">[-</span><span class="ss">icvtnk#</span><span class="pp">]</span> regexp <span class="op"><</span> file</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">./fredriksson</span> <span class="pp">[-</span><span class="ss">icvtnk#</span><span class="pp">]</span> regexp <span class="op"><</span> file</span></code></pre></div>
|
||||
<h2 id="try">Try:</h2>
|
||||
<div class="sourceCode" id="cb4"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb4-1"><a href="#cb4-1" aria-hidden="true" tabindex="-1"></a><span class="ex">./try.sh</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="ex">./try.sh</span></span></code></pre></div>
|
||||
<p>NOTE: you need to be allowed to change your stack size or else the last command
|
||||
in the script would likely cause the program to dump core, which is why the
|
||||
script checks the exit code of <code>ulimit</code> first.</p>
|
||||
@@ -166,7 +165,7 @@ program and calls it. As an exercise, try writing the compressor.</p>
|
||||
<p>Implements a variant of <code>grep</code>.</p>
|
||||
<h3 id="usage">Usage</h3>
|
||||
<p>To search regexp from file, do:</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">./fredriksson</span> <span class="pp">[-</span><span class="ss">icvtnk#</span><span class="pp">]</span> regexp <span class="op"><</span> file</span></code></pre></div>
|
||||
<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">./fredriksson</span> <span class="pp">[-</span><span class="ss">icvtnk#</span><span class="pp">]</span> regexp <span class="op"><</span> file</span></code></pre></div>
|
||||
<p>Pipes might not work, see the section Limitations.
|
||||
The options <code>-i</code>, <code>-c</code>, <code>-v</code> and <code>-n</code> are the classic ones:</p>
|
||||
<ul>
|
||||
@@ -184,8 +183,8 @@ matches (aka
|
||||
<a href="https://en.wikipedia.org/wiki/Edit_distance">edit-distance</a>). E.g.
|
||||
“<code>obfuscated</code>” matches “<code>obfuscation</code>”
|
||||
with one deletion and two mismatches. Likewise, “<code>obfuscate</code>” and
|
||||
“<code>oversimplify</code>” match with 7 <a href="https://en.wikipedia.org/wiki/Edit_distance#Formal_definition_and_properties">edit
|
||||
operations</a>.
|
||||
“<code>oversimplify</code>” match with 7
|
||||
<a href="https://en.wikipedia.org/wiki/Edit_distance#Formal_definition_and_properties">edit operations</a>.
|
||||
The default is <code>-k0</code> (i.e. exact match).</p></li>
|
||||
<li><p><code>-t</code> Add local transpositions to the set of allowed
|
||||
<a href="https://en.wikipedia.org/wiki/Edit_distance#Formal_definition_and_properties">edit-operations</a>.
|
||||
@@ -221,11 +220,11 @@ expressions by putting <code>]</code> as the first character, and putting <code>
|
||||
<li>You can use this in place of <a href="https://en.wikipedia.org/wiki/Cat_(Unix)">cat</a>.
|
||||
Just say</li>
|
||||
</ul>
|
||||
<div class="sourceCode" id="cb6"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb6-1"><a href="#cb6-1" aria-hidden="true" tabindex="-1"></a><span class="ex">./fredriksson</span> <span class="at">-k3</span> cat <span class="op"><</span> file</span></code></pre></div>
|
||||
<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">./fredriksson</span> <span class="at">-k3</span> cat <span class="op"><</span> file</span></code></pre></div>
|
||||
<ul>
|
||||
<li>Like with <code>cat</code>, you can append line numbers too:</li>
|
||||
</ul>
|
||||
<div class="sourceCode" id="cb7"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb7-1"><a href="#cb7-1" aria-hidden="true" tabindex="-1"></a><span class="ex">./fredriksson</span> <span class="at">-nk3</span> cat <span class="op"><</span> file</span></code></pre></div>
|
||||
<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">./fredriksson</span> <span class="at">-nk3</span> cat <span class="op"><</span> file</span></code></pre></div>
|
||||
<h3 id="other-features">Other features</h3>
|
||||
<ul>
|
||||
<li><p>It is assumed that the user knows how to feed correct input to the
|
||||
@@ -255,42 +254,44 @@ input has this limit, as using the edit operations can make the string
|
||||
longer. However, no assumptions are made for <code>sizeof(long)</code>. In fact,
|
||||
you can easily use <code>long long</code> instead,</p></li>
|
||||
<li><p>Depending on the file, it might require a lot of stack space. If the
|
||||
program segfaults (because of this), say</p>
|
||||
<p>ulimit -s unlimited</p>
|
||||
<p>cross your fingers, hope it is enough, and try again.</p></li>
|
||||
program segfaults (because of this), say</p></li>
|
||||
</ul>
|
||||
<div class="sourceCode" id="cb8"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb8-1"><a href="#cb8-1" aria-hidden="true" tabindex="-1"></a> <span class="bu">ulimit</span> <span class="at">-s</span> unlimited</span></code></pre></div>
|
||||
<p>cross your fingers, hope it is enough, and try again.</p>
|
||||
<ul>
|
||||
<li><p>Assumes C99 standard, because of the one very long line. Most C compilers
|
||||
handle this just fine even in C89 mode, though.</p></li>
|
||||
<li><p>The code should be reasonably portable, it assumes standard ASCII codes
|
||||
for each char, and that a C compiler is on <code>$PATH</code>; the latter is hard coded
|
||||
to be ‘gcc’, but any compiler would work, provided that it supports
|
||||
C99, or long lines as an extension. This code has been tested on:</p>
|
||||
<ul>
|
||||
<li>GNU/Linux FC4, i386, gcc</li>
|
||||
<li>GNU/Linux FC7, x86_64, gcc 4.1.2, tcc 0.9.24 and icc 10.0</li>
|
||||
<li>GNU/Linux FC9, x86_64, gcc 4.?.?</li>
|
||||
<li>GNU/Linux CentOS 5, gcc 4.1.2</li>
|
||||
<li>GNU/Linux Ubuntu 11.04, gcc 4.5.2</li>
|
||||
<li>SunOS 5.8, UltraSPARC IIIi, gcc 4.1.2</li>
|
||||
<li>SunOS 5.9, UltraSPARC IIIi, gcc 4.1.1 and Sun ONE Studio 8 CC</li>
|
||||
<li>AIX 5.3, IBM eServer p5-550, gcc 3.3.3 and AIX CC Version 6</li>
|
||||
</ul>
|
||||
C99, or long lines as an extension. This code has been tested on:</p></li>
|
||||
<li><p>GNU/Linux FC4, i386, gcc</p></li>
|
||||
<li><p>GNU/Linux FC7, x86_64, gcc 4.1.2, tcc 0.9.24 and icc 10.0</p></li>
|
||||
<li><p>GNU/Linux FC9, x86_64, gcc 4.?.?</p></li>
|
||||
<li><p>GNU/Linux CentOS 5, gcc 4.1.2</p></li>
|
||||
<li><p>GNU/Linux Ubuntu 11.04, gcc 4.5.2</p></li>
|
||||
<li><p>SunOS 5.8, UltraSPARC IIIi, gcc 4.1.2</p></li>
|
||||
<li><p>SunOS 5.9, UltraSPARC IIIi, gcc 4.1.1 and Sun ONE Studio 8 CC</p></li>
|
||||
<li><p>AIX 5.3, IBM eServer p5-550, gcc 3.3.3 and AIX CC Version 6</p>
|
||||
<p>(Btw, tcc has its roots in IOCCC…)</p></li>
|
||||
</ul>
|
||||
<h3 id="obfuscations-a.k.a.-spoilers">Obfuscations (a.k.a. spoilers…)</h3>
|
||||
<ul>
|
||||
<li><p>The initialized char array includes the source code of the real program,
|
||||
<li>The initialized char array includes the source code of the real program,
|
||||
as well as its name and commands to build and run it, all
|
||||
<a href="https://en.wikipedia.org/wiki/Burrows-Wheeler_transform">Burrows-Wheeler</a>
|
||||
-transformed, then run-length-encoded with unary coding. The main program
|
||||
extracts and builds that, and then calls it. More precisely, the command
|
||||
to build is</p>
|
||||
<pre><code> gcc -O3 ag.c -o ag</code></pre>
|
||||
to build is</li>
|
||||
</ul>
|
||||
<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">gcc</span> <span class="at">-O3</span> ag.c <span class="at">-o</span> ag</span></code></pre></div>
|
||||
<p>To change that you need to edit the char array <code>p[]</code> and (possibly) two
|
||||
specially encoded constants, <code>-~('('*'(')</code> and <code>'C'*' '-'-'</code>.
|
||||
The extracted source (<code>ag.c</code>) is obfuscated as well.</p>
|
||||
<p>(The original version also deleted the generated source and the
|
||||
corresponding binary after running it, but this feature was removed
|
||||
from the submitted entry.)</p></li>
|
||||
from the submitted entry.)</p>
|
||||
<ul>
|
||||
<li><p>The code demonstrates several useful programming paradigms, such as:</p>
|
||||
<ul>
|
||||
<li>recursion to remove all loops</li>
|
||||
@@ -330,13 +331,15 @@ complexity.</p></li>
|
||||
if-then-else constructs (also, no ternary <code>?:</code> constructs are present).
|
||||
Two’s complement representation of integers is also abused. E.g. instead
|
||||
of writing <code>x++</code> or <code>x-1</code>, it is much better to write <code>x=-~x</code> and <code>~-x</code>.</p></li>
|
||||
<li><p>No numerical values, other than in the initialized char array, try</p>
|
||||
<pre><code> ./fredriksson -ck0 [0-9] < fredriksson.c</code></pre>
|
||||
<li><p>No numerical values, other than in the initialized char array, try</p></li>
|
||||
</ul>
|
||||
<div class="sourceCode" id="cb10"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb10-1"><a href="#cb10-1" aria-hidden="true" tabindex="-1"></a> <span class="ex">./fredriksson</span> <span class="at">-ck0</span> <span class="pp">[</span><span class="ss">0</span><span class="pp">-</span><span class="ss">9</span><span class="pp">]</span> <span class="op"><</span> fredriksson.c</span></code></pre></div>
|
||||
<p>This should print 1, as there is a number <code>3</code> in the char array (only).
|
||||
You can also try</p>
|
||||
<pre><code> ./fredriksson -ck0 [0-9] < ag.c</code></pre>
|
||||
<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">./fredriksson</span> <span class="at">-ck0</span> <span class="pp">[</span><span class="ss">0</span><span class="pp">-</span><span class="ss">9</span><span class="pp">]</span> <span class="op"><</span> ag.c</span></code></pre></div>
|
||||
<p>after running <code>fredriksson</code> at least once (since this generates that
|
||||
<code>ag.c</code> file), and this should print 0.</p></li>
|
||||
<code>ag.c</code> file), and this should print 0.</p>
|
||||
<ul>
|
||||
<li><p>The source code is best viewed with cat (or using the program itself),
|
||||
instead of some editor. (This is a somewhat system dependent thing.)</p>
|
||||
<p>One reason for this is that the code builds (some of the) constant
|
||||
|
||||
@@ -1,21 +1,21 @@
|
||||
## To build:
|
||||
|
||||
```sh
|
||||
make
|
||||
make
|
||||
```
|
||||
|
||||
|
||||
## To use:
|
||||
|
||||
```sh
|
||||
echo "some text" | ./goren
|
||||
echo "some text" | ./goren
|
||||
```
|
||||
|
||||
|
||||
## Try:
|
||||
|
||||
```sh
|
||||
./try.sh
|
||||
./try.sh
|
||||
```
|
||||
|
||||
|
||||
@@ -28,13 +28,13 @@ In the words of [René François Ghislain Magritte Magritte](http://en.wikipedia
|
||||
One may ask the surrealist question:
|
||||
|
||||
```sh
|
||||
echo 'If | is just a representation of a pipe, then how can data stuff it?' | ./goren
|
||||
echo 'If | is just a representation of a pipe, then how can data stuff it?' | ./goren
|
||||
```
|
||||
|
||||
However if one takes a firm stand and declares:
|
||||
|
||||
```sh
|
||||
echo '| is just a representation of a pipe because I say so! So stuff it!' | ./goren
|
||||
echo '| is just a representation of a pipe because I say so! So stuff it!' | ./goren
|
||||
```
|
||||
|
||||
something happens! Why?
|
||||
@@ -56,8 +56,8 @@ a pipe. But what IS a pipe? This program tries to provide an answer.
|
||||
Magritte's [test for pipes](http://en.wikipedia.org/wiki/The_Treachery_of_Images) is:
|
||||
|
||||
```
|
||||
The famous pipe. How people reproached me for it! And yet, could
|
||||
you stuff my pipe? No, it's just a representation, is it not?
|
||||
The famous pipe. How people reproached me for it! And yet, could
|
||||
you stuff my pipe? No, it's just a representation, is it not?
|
||||
```
|
||||
|
||||
Accordingly, this program only approves pipes which can be used for
|
||||
|
||||
@@ -132,8 +132,7 @@
|
||||
<h2 id="author"><a name="author"></a>Author:</h2>
|
||||
<ul>
|
||||
<li>Name: <a href="../../authors.html#Uri_Goren">Uri Goren</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>)</li>
|
||||
</ul>
|
||||
|
||||
<!-- END: next line ends content generated by: bin/output-index-author.sh -->
|
||||
@@ -142,11 +141,11 @@ Location: <a href="../../location.html#IL">IL</a> - <em>State of Israel</em> (<e
|
||||
<!-- 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="bu">echo</span> <span class="st">"some text"</span> <span class="kw">|</span> <span class="ex">./goren</span></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="bu">echo</span> <span class="st">"some text"</span> <span class="kw">|</span> <span class="ex">./goren</span></span></code></pre></div>
|
||||
<h2 id="try">Try:</h2>
|
||||
<div class="sourceCode" id="cb3"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb3-1"><a href="#cb3-1" aria-hidden="true" tabindex="-1"></a><span class="ex">./try.sh</span></span></code></pre></div>
|
||||
<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>In the words of <a href="http://en.wikipedia.org/wiki/Rene_Magritte">René François Ghislain Magritte Magritte</a>:</p>
|
||||
<figure>
|
||||
@@ -154,9 +153,9 @@ Location: <a href="../../location.html#IL">IL</a> - <em>State of Israel</em> (<e
|
||||
<figcaption aria-hidden="true">This is not a pipe</figcaption>
|
||||
</figure>
|
||||
<p>One may ask the surrealist question:</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="bu">echo</span> <span class="st">'If | is just a representation of a pipe, then how can data stuff it?'</span> <span class="kw">|</span> <span class="ex">./goren</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="bu">echo</span> <span class="st">'If | is just a representation of a pipe, then how can data stuff it?'</span> <span class="kw">|</span> <span class="ex">./goren</span></span></code></pre></div>
|
||||
<p>However if one takes a firm stand and declares:</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">'| is just a representation of a pipe because I say so! So stuff it!'</span> <span class="kw">|</span> <span class="ex">./goren</span></span></code></pre></div>
|
||||
<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">'| is just a representation of a pipe because I say so! So stuff it!'</span> <span class="kw">|</span> <span class="ex">./goren</span></span></code></pre></div>
|
||||
<p>something happens! Why?</p>
|
||||
<h2 id="authors-remarks">Author’s remarks:</h2>
|
||||
<p>This program was written in homage to <a href="http://en.wikipedia.org/wiki/Rene_Magritte">Rene
|
||||
@@ -168,8 +167,8 @@ using conditions.</p>
|
||||
<p>In this work, Magritte points out that a picture of a pipe is not
|
||||
a pipe. But what IS a pipe? This program tries to provide an answer.</p>
|
||||
<p>Magritte’s <a href="http://en.wikipedia.org/wiki/The_Treachery_of_Images">test for pipes</a> is:</p>
|
||||
<pre><code>The famous pipe. How people reproached me for it! And yet, could
|
||||
you stuff my pipe? No, it's just a representation, is it not?</code></pre>
|
||||
<pre><code> The famous pipe. How people reproached me for it! And yet, could
|
||||
you stuff my pipe? No, it's just a representation, is it not?</code></pre>
|
||||
<p>Accordingly, this program only approves pipes which can be used for
|
||||
stuffing data.</p>
|
||||
<p>One thing I tried to achieve is condition free programming. Many
|
||||
|
||||
+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.
|
||||
|
||||
+6
-6
@@ -1,21 +1,21 @@
|
||||
## To build:
|
||||
|
||||
```sh
|
||||
make
|
||||
make
|
||||
```
|
||||
|
||||
|
||||
## To use:
|
||||
|
||||
```sh
|
||||
./hou 'expression'
|
||||
./hou 'expression'
|
||||
```
|
||||
|
||||
|
||||
## Try:
|
||||
|
||||
```sh
|
||||
./try.sh
|
||||
./try.sh
|
||||
```
|
||||
|
||||
As the script asks you, what does the last one mean? Can you get it to report a
|
||||
@@ -33,8 +33,8 @@ source code. What does it mean?
|
||||
The calculator obeys the precedence rules and allows parenthesis.
|
||||
|
||||
```sh
|
||||
./hou '1+2*3'
|
||||
./hou '(1+2)*3'
|
||||
./hou '1+2*3'
|
||||
./hou '(1+2)*3'
|
||||
```
|
||||
|
||||
What exactly does the text formatting do?
|
||||
@@ -42,7 +42,7 @@ What exactly does the text formatting do?
|
||||
What does this evaluate to in C?
|
||||
|
||||
```c
|
||||
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~+
|
||||
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~+
|
||||
```
|
||||
|
||||
|
||||
|
||||
+7
-8
@@ -132,8 +132,7 @@
|
||||
<h2 id="author"><a name="author"></a>Author:</h2>
|
||||
<ul>
|
||||
<li>Name: <a href="../../authors.html#Qiming_HOU">Qiming HOU</a><br>
|
||||
Location: <a href="../../location.html#CN">CN</a> - <em>People’s Republic of China</em> (<em>China</em>)
|
||||
<br><br></li>
|
||||
Location: <a href="../../location.html#CN">CN</a> - <em>People’s Republic of China</em> (<em>China</em>)</li>
|
||||
</ul>
|
||||
|
||||
<!-- END: next line ends content generated by: bin/output-index-author.sh -->
|
||||
@@ -142,11 +141,11 @@ Location: <a href="../../location.html#CN">CN</a> - <em>People’s Republic of C
|
||||
<!-- 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">./hou</span> <span class="st">'expression'</span></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">./hou</span> <span class="st">'expression'</span></span></code></pre></div>
|
||||
<h2 id="try">Try:</h2>
|
||||
<div class="sourceCode" id="cb3"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb3-1"><a href="#cb3-1" aria-hidden="true" tabindex="-1"></a><span class="ex">./try.sh</span></span></code></pre></div>
|
||||
<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>As the script asks you, what does the last one mean? Can you get it to report a
|
||||
different value? Hint: it’s in this file, kind of.</p>
|
||||
<h2 id="judges-remarks">Judges’ remarks:</h2>
|
||||
@@ -155,11 +154,11 @@ warnings under the most strict pedantic mode of gcc and clang.</p>
|
||||
<p>The first example, along with the correct result appears in the
|
||||
source code. What does it mean?</p>
|
||||
<p>The calculator obeys the precedence rules and allows parenthesis.</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">./hou</span> <span class="st">'1+2*3'</span></span>
|
||||
<span id="cb4-2"><a href="#cb4-2" aria-hidden="true" tabindex="-1"></a><span class="ex">./hou</span> <span class="st">'(1+2)*3'</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="ex">./hou</span> <span class="st">'1+2*3'</span></span>
|
||||
<span id="cb4-2"><a href="#cb4-2" aria-hidden="true" tabindex="-1"></a> <span class="ex">./hou</span> <span class="st">'(1+2)*3'</span></span></code></pre></div>
|
||||
<p>What exactly does the text formatting do?</p>
|
||||
<p>What does this evaluate to in C?</p>
|
||||
<div class="sourceCode" id="cb5"><pre class="sourceCode c"><code class="sourceCode c"><span id="cb5-1"><a href="#cb5-1" aria-hidden="true" tabindex="-1"></a><span class="op">+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~+</span></span></code></pre></div>
|
||||
<div class="sourceCode" id="cb5"><pre class="sourceCode c"><code class="sourceCode c"><span id="cb5-1"><a href="#cb5-1" aria-hidden="true" tabindex="-1"></a> <span class="op">+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~+</span></span></code></pre></div>
|
||||
<h3 id="self-documenting-source">Self documenting source</h3>
|
||||
<p>Comments would almost be redundant. :-}</p>
|
||||
<h3 id="the-ascii-art-is-valid-c-code">The ASCII art is valid C code</h3>
|
||||
|
||||
@@ -1,21 +1,21 @@
|
||||
## To build:
|
||||
|
||||
```sh
|
||||
make
|
||||
make
|
||||
```
|
||||
|
||||
|
||||
## To use:
|
||||
|
||||
```sh
|
||||
./konno lower_case_word
|
||||
./konno lower_case_word
|
||||
```
|
||||
|
||||
|
||||
## Try:
|
||||
|
||||
```sh
|
||||
./try.sh
|
||||
./try.sh
|
||||
```
|
||||
|
||||
|
||||
|
||||
@@ -132,8 +132,7 @@
|
||||
<h2 id="author"><a name="author"></a>Author:</h2>
|
||||
<ul>
|
||||
<li>Name: <a href="../../authors.html#Taketo_Konno">Taketo Konno</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 -->
|
||||
@@ -142,11 +141,11 @@ 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">./konno</span> lower_case_word</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">./konno</span> lower_case_word</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>
|
||||
<h2 id="judges-remarks">Judges’ remarks:</h2>
|
||||
<p>This tiny program outputs what looks like a tiny keyboard.
|
||||
OK, so the letters are missing. But that is no problem because
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
## To build:
|
||||
|
||||
```sh
|
||||
make
|
||||
make
|
||||
```
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@ make
|
||||
The current status of this entry is:
|
||||
|
||||
```
|
||||
STATUS: doesn't work with some platforms - please help us fix
|
||||
STATUS: doesn't work with some platforms - please help us fix
|
||||
```
|
||||
|
||||
For more detailed information see [2011 richards bugs](../../bugs.html#2011_richards).
|
||||
@@ -19,14 +19,14 @@ For more detailed information see [2011 richards bugs](../../bugs.html#2011_rich
|
||||
## To use:
|
||||
|
||||
```sh
|
||||
echo expression | ./richards
|
||||
echo expression | ./richards
|
||||
```
|
||||
|
||||
|
||||
## Try:
|
||||
|
||||
```sh
|
||||
./try.sh
|
||||
./try.sh
|
||||
```
|
||||
|
||||
|
||||
|
||||
@@ -132,8 +132,7 @@
|
||||
<h2 id="author"><a name="author"></a>Author:</h2>
|
||||
<ul>
|
||||
<li>Name: <a href="../../authors.html#Gregor_Richards">Gregor Richards</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>)</li>
|
||||
</ul>
|
||||
|
||||
<!-- END: next line ends content generated by: bin/output-index-author.sh -->
|
||||
@@ -142,15 +141,15 @@ Location: <a href="../../location.html#US">US</a> - <em>United States of America
|
||||
<!-- 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>
|
||||
<h3 id="bugs-and-misfeatures">Bugs and (Mis)features:</h3>
|
||||
<p>The current status of this entry is:</p>
|
||||
<pre><code>STATUS: doesn't work with some platforms - please help us fix</code></pre>
|
||||
<pre><code> STATUS: doesn't work with some platforms - please help us fix</code></pre>
|
||||
<p>For more detailed information see <a href="../../bugs.html#2011_richards">2011 richards 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="bu">echo</span> expression <span class="kw">|</span> <span class="ex">./richards</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="bu">echo</span> expression <span class="kw">|</span> <span class="ex">./richards</span></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>
|
||||
<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>Oh no, yet another
|
||||
<a href="https://en.wikipedia.org/wiki/Dc_(computer_program)">dc</a>-style calculator? (see
|
||||
|
||||
+11
-11
@@ -3,7 +3,7 @@
|
||||
If you have X11 installed:
|
||||
|
||||
```sh
|
||||
make
|
||||
make
|
||||
```
|
||||
|
||||
There are two alternate versions, [one that lets you reconfigure the
|
||||
@@ -14,7 +14,7 @@ Windows](toledo.alt2.c). See [Alternate code](#alternate-code) below.
|
||||
## To use:
|
||||
|
||||
```sh
|
||||
./toledo
|
||||
./toledo
|
||||
```
|
||||
|
||||
|
||||
@@ -36,13 +36,13 @@ have the right names you can define the macros `FIRE`, `FORWARD`, `BACKWARD`,
|
||||
`LEFT`, `RIGHT`, `WIDTH` and `HEIGHT`. Here are the defaults:
|
||||
|
||||
```
|
||||
FIRE= XK_BackSpace:XK_Tab
|
||||
FORWARD= XK_Up:XK_w
|
||||
BACKWARD= XK_Down:XK_s
|
||||
LEFT= XK_Left:XK_a
|
||||
RIGHT= XK_Right:XK_d
|
||||
WIDTH= 512
|
||||
HEIGHT= 288
|
||||
FIRE= XK_BackSpace:XK_Tab
|
||||
FORWARD= XK_Up:XK_w
|
||||
BACKWARD= XK_Down:XK_s
|
||||
LEFT= XK_Left:XK_a
|
||||
RIGHT= XK_Right:XK_d
|
||||
WIDTH= 512
|
||||
HEIGHT= 288
|
||||
```
|
||||
|
||||
but you can change them about however you like, even with other keys. For
|
||||
@@ -50,7 +50,7 @@ instance to swap `LEFT` and `RIGHT`:
|
||||
|
||||
|
||||
```sh
|
||||
make clobber LEFT=XK_Right:XK_d RIGHT=XK_Left:XK_a alt
|
||||
make clobber LEFT=XK_Right:XK_d RIGHT=XK_Left:XK_a alt
|
||||
```
|
||||
|
||||
but you can specify something completely else and you can pick and choose which
|
||||
@@ -76,7 +76,7 @@ Like Oscar's previous winning X11 program for the 19th IOCCC, if
|
||||
you remove both the X11 include files and replace them with
|
||||
|
||||
```c
|
||||
#include "layer.c"
|
||||
#include "layer.c"
|
||||
```
|
||||
|
||||
you ought to be able to compile and run this program on Windows.
|
||||
|
||||
+12
-13
@@ -132,8 +132,7 @@
|
||||
<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>
|
||||
Location: <a href="../../location.html#MX">MX</a> - <em>United Mexican States</em> (<em>Mexico</em>)</li>
|
||||
</ul>
|
||||
|
||||
<!-- END: next line ends content generated by: bin/output-index-author.sh -->
|
||||
@@ -143,12 +142,12 @@ Location: <a href="../../location.html#MX">MX</a> - <em>United Mexican States</e
|
||||
|
||||
<h2 id="to-build">To build:</h2>
|
||||
<p>If you have X11 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>
|
||||
<div class="sourceCode" id="cb1"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb1-1"><a href="#cb1-1" aria-hidden="true" tabindex="-1"></a> <span class="fu">make</span></span></code></pre></div>
|
||||
<p>There are two alternate versions, <a href="toledo.alt.c">one that lets you reconfigure the
|
||||
controls and size</a> and <a href="toledo.alt2.c">another that should work for
|
||||
Windows</a>. 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">./toledo</span></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">./toledo</span></span></code></pre></div>
|
||||
<h2 id="alternate-code">Alternate code:</h2>
|
||||
<p>The first alt version, <a href="toledo.alt.c">toledo.alt.c</a>, allows you to reconfigure
|
||||
the controls and the dimensions more easily.</p>
|
||||
@@ -160,16 +159,16 @@ cannot be tested by us.</p>
|
||||
included header file, <a href="keysym.h">keysym.h</a>, to find the correct macros. Once you
|
||||
have the right names you can define the macros <code>FIRE</code>, <code>FORWARD</code>, <code>BACKWARD</code>,
|
||||
<code>LEFT</code>, <code>RIGHT</code>, <code>WIDTH</code> and <code>HEIGHT</code>. Here are the defaults:</p>
|
||||
<pre><code>FIRE= XK_BackSpace:XK_Tab
|
||||
FORWARD= XK_Up:XK_w
|
||||
BACKWARD= XK_Down:XK_s
|
||||
LEFT= XK_Left:XK_a
|
||||
RIGHT= XK_Right:XK_d
|
||||
WIDTH= 512
|
||||
HEIGHT= 288</code></pre>
|
||||
<pre><code> FIRE= XK_BackSpace:XK_Tab
|
||||
FORWARD= XK_Up:XK_w
|
||||
BACKWARD= XK_Down:XK_s
|
||||
LEFT= XK_Left:XK_a
|
||||
RIGHT= XK_Right:XK_d
|
||||
WIDTH= 512
|
||||
HEIGHT= 288</code></pre>
|
||||
<p>but you can change them about however you like, even with other keys. For
|
||||
instance to swap <code>LEFT</code> and <code>RIGHT</code>:</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> clobber LEFT=XK_Right:XK_d RIGHT=XK_Left:XK_a alt</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">make</span> clobber LEFT=XK_Right:XK_d RIGHT=XK_Left:XK_a alt</span></code></pre></div>
|
||||
<p>but you can specify something completely else and you can pick and choose which
|
||||
controls you wish to redefine. You might also wish to change the dimensions of
|
||||
the game, <code>WIDTH</code> and <code>HEIGHT</code> which have an arbitrarily selected lower limit as
|
||||
@@ -185,7 +184,7 @@ the source early on, right before the code gets hard to follow, or using the
|
||||
<a href="#alternate-code">alternate version</a>.</p>
|
||||
<p>Like Oscar’s previous winning X11 program for the 19th IOCCC, if
|
||||
you remove both the X11 include files and replace them with</p>
|
||||
<div class="sourceCode" id="cb5"><pre class="sourceCode c"><code class="sourceCode c"><span id="cb5-1"><a href="#cb5-1" aria-hidden="true" tabindex="-1"></a><span class="pp">#include </span><span class="im">"layer.c"</span></span></code></pre></div>
|
||||
<div class="sourceCode" id="cb5"><pre class="sourceCode c"><code class="sourceCode c"><span id="cb5-1"><a href="#cb5-1" aria-hidden="true" tabindex="-1"></a> <span class="pp">#include </span><span class="im">"layer.c"</span></span></code></pre></div>
|
||||
<p>you ought to be able to compile and run this program on Windows.
|
||||
NOTE: this is what <a href="toledo.alt2.c">toledo.alt2.c</a> is for.</p>
|
||||
<h2 id="authors-remarks">Author’s remarks:</h2>
|
||||
|
||||
+12
-12
@@ -1,7 +1,7 @@
|
||||
## To build:
|
||||
|
||||
```sh
|
||||
make
|
||||
make
|
||||
```
|
||||
|
||||
There is an alternate version that should work for Windows. See [alternate
|
||||
@@ -13,7 +13,7 @@ code](#alternate-code) below.
|
||||
The current status of this entry is:
|
||||
|
||||
```
|
||||
STATUS: INABIAF - please **DO NOT** fix
|
||||
STATUS: INABIAF - please **DO NOT** fix
|
||||
```
|
||||
|
||||
For more detailed information see [2011 vik bugs](../../bugs.html#2011_vik).
|
||||
@@ -22,20 +22,20 @@ For more detailed information see [2011 vik bugs](../../bugs.html#2011_vik).
|
||||
## To use:
|
||||
|
||||
```sh
|
||||
./vik file.mod > audio_file.raw
|
||||
./vik file.mod > audio_file.raw
|
||||
```
|
||||
|
||||
If you have `mplayer(1)`:
|
||||
|
||||
|
||||
```sh
|
||||
./vik file.mod | mplayer -demuxer rawaudio -
|
||||
./vik file.mod | mplayer -demuxer rawaudio -
|
||||
```
|
||||
|
||||
Alternatively, you can convert the file to a WAV:
|
||||
|
||||
```sh
|
||||
./vik file.mod > file.raw; ./raw2wav file.raw > file.wav
|
||||
./vik file.mod > file.raw; ./raw2wav file.raw > file.wav
|
||||
```
|
||||
|
||||
and then play `file.wav` with a program that can play WAV files.
|
||||
@@ -44,7 +44,7 @@ and then play `file.wav` with a program that can play WAV files.
|
||||
## Try:
|
||||
|
||||
```sh
|
||||
./try.sh
|
||||
./try.sh
|
||||
```
|
||||
|
||||
The script checks that you have `mplayer(1)` installed and if it is it will pipe
|
||||
@@ -67,7 +67,7 @@ This version is based on the author's remarks and it should work for Windows.
|
||||
Assuming that `make` is similar enough try:
|
||||
|
||||
```sh
|
||||
make alt
|
||||
make alt
|
||||
```
|
||||
|
||||
|
||||
@@ -88,7 +88,7 @@ initialization for?
|
||||
Does it take your system a long time to compile? You may want to do:
|
||||
|
||||
```sh
|
||||
cc -S vik.c
|
||||
cc -S vik.c
|
||||
```
|
||||
|
||||
and examine the resulting assembly file `vik.s`. On some platforms
|
||||
@@ -154,7 +154,7 @@ Bertilsson, also known as Deelite:
|
||||
Compiling for Unix systems (including cygwin) is straight forward:
|
||||
|
||||
```sh
|
||||
gcc -o vik vik.c
|
||||
gcc -o vik vik.c
|
||||
```
|
||||
|
||||
### Usage
|
||||
@@ -163,13 +163,13 @@ gcc -o vik vik.c
|
||||
#### Convert MOD file to raw 44.1kHz stereo audio file
|
||||
|
||||
```sh
|
||||
./vik mad_world.mod > audio_file.raw
|
||||
./vik mad_world.mod > audio_file.raw
|
||||
```
|
||||
|
||||
#### Listen to the MOD file (streaming to mplayer)
|
||||
|
||||
```sh
|
||||
./vik randowan.mod | mplayer -demuxer rawaudio -
|
||||
./vik randowan.mod | mplayer -demuxer rawaudio -
|
||||
```
|
||||
|
||||
(Don't forget the last `-` as it makes mplayer read from `stdin`.)
|
||||
@@ -211,7 +211,7 @@ the program with this platform, the following line can be added after
|
||||
the main declaration in order for the program to run correctly:
|
||||
|
||||
```c
|
||||
_setmode(_fileno(stdout), 0x8000);
|
||||
_setmode(_fileno(stdout), 0x8000);
|
||||
```
|
||||
|
||||
NOTE: this is what the [alternate version](#alternate-code) is for.
|
||||
|
||||
+13
-14
@@ -132,8 +132,7 @@
|
||||
<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>)</li>
|
||||
</ul>
|
||||
|
||||
<!-- END: next line ends content generated by: bin/output-index-author.sh -->
|
||||
@@ -142,22 +141,22 @@ Location: <a href="../../location.html#US">US</a> - <em>United States of America
|
||||
<!-- 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>
|
||||
<p>There is an alternate version that should work for Windows. 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>
|
||||
<pre><code> STATUS: INABIAF - please **DO NOT** fix</code></pre>
|
||||
<p>For more detailed information see <a href="../../bugs.html#2011_vik">2011 vik 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">./vik</span> file.mod <span class="op">></span> audio_file.raw</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">./vik</span> file.mod <span class="op">></span> audio_file.raw</span></code></pre></div>
|
||||
<p>If you have <code>mplayer(1)</code>:</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> file.mod <span class="kw">|</span> <span class="ex">mplayer</span> <span class="at">-demuxer</span> rawaudio <span class="at">-</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="ex">./vik</span> file.mod <span class="kw">|</span> <span class="ex">mplayer</span> <span class="at">-demuxer</span> rawaudio <span class="at">-</span></span></code></pre></div>
|
||||
<p>Alternatively, you can convert the file to a WAV:</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">./vik</span> file.mod <span class="op">></span> file.raw<span class="kw">;</span> <span class="ex">./raw2wav</span> file.raw <span class="op">></span> file.wav</span></code></pre></div>
|
||||
<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">./vik</span> file.mod <span class="op">></span> file.raw<span class="kw">;</span> <span class="ex">./raw2wav</span> file.raw <span class="op">></span> file.wav</span></code></pre></div>
|
||||
<p>and then play <code>file.wav</code> with a program that can play WAV files.</p>
|
||||
<h2 id="try">Try:</h2>
|
||||
<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">./try.sh</span></span></code></pre></div>
|
||||
<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">./try.sh</span></span></code></pre></div>
|
||||
<p>The script checks that you have <code>mplayer(1)</code> installed and if it is it will pipe
|
||||
<code>vik</code> to <code>mplayer</code>. In this case it will also use <code>raw2wav</code> to convert the file
|
||||
to a WAV file. If <code>mplayer(1)</code> cannot be found it will just use <code>raw2wav</code>. This
|
||||
@@ -169,7 +168,7 @@ Archive</a>.</p>
|
||||
<p>This version is based on the author’s remarks and it should work for Windows.</p>
|
||||
<h3 id="alternate-build">Alternate build:</h3>
|
||||
<p>Assuming that <code>make</code> is similar enough try:</p>
|
||||
<div class="sourceCode" id="cb7"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb7-1"><a href="#cb7-1" aria-hidden="true" tabindex="-1"></a><span class="fu">make</span> alt</span></code></pre></div>
|
||||
<div class="sourceCode" id="cb7"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb7-1"><a href="#cb7-1" aria-hidden="true" tabindex="-1"></a> <span class="fu">make</span> alt</span></code></pre></div>
|
||||
<h3 id="alternate-use">Alternate use:</h3>
|
||||
<p>Use <code>vik.alt</code> as you would <code>vik</code> above.</p>
|
||||
<h2 id="judges-remarks">Judges’ remarks:</h2>
|
||||
@@ -179,7 +178,7 @@ in a most pleasing manner if you don’t like tremolo or vibrato.</p>
|
||||
initialized 32MB array. Can you tell what that partial
|
||||
initialization for?</p>
|
||||
<p>Does it take your system a long time to compile? You may want to do:</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">-S</span> vik.c</span></code></pre></div>
|
||||
<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">-S</span> vik.c</span></code></pre></div>
|
||||
<p>and examine the resulting assembly file <code>vik.s</code>. On some platforms
|
||||
the assembly file is about 128MB in size!</p>
|
||||
<p>NOTE: The <a href="randowan.mod">randowan.mod</a> and <a href="mad_world.mod">mad_world.mod</a> files were
|
||||
@@ -226,12 +225,12 @@ Bertilsson, also known as Deelite:</p>
|
||||
</ol>
|
||||
<h3 id="build">Build</h3>
|
||||
<p>Compiling for Unix systems (including cygwin) is straight forward:</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">gcc</span> <span class="at">-o</span> vik vik.c</span></code></pre></div>
|
||||
<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">gcc</span> <span class="at">-o</span> vik vik.c</span></code></pre></div>
|
||||
<h3 id="usage">Usage</h3>
|
||||
<h4 id="convert-mod-file-to-raw-44.1khz-stereo-audio-file">Convert MOD file to raw 44.1kHz stereo audio file</h4>
|
||||
<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">./vik</span> mad_world.mod <span class="op">></span> audio_file.raw</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="ex">./vik</span> mad_world.mod <span class="op">></span> audio_file.raw</span></code></pre></div>
|
||||
<h4 id="listen-to-the-mod-file-streaming-to-mplayer">Listen to the MOD file (streaming to mplayer)</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="ex">./vik</span> randowan.mod <span class="kw">|</span> <span class="ex">mplayer</span> <span class="at">-demuxer</span> rawaudio <span class="at">-</span></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">./vik</span> randowan.mod <span class="kw">|</span> <span class="ex">mplayer</span> <span class="at">-demuxer</span> rawaudio <span class="at">-</span></span></code></pre></div>
|
||||
<p>(Don’t forget the last <code>-</code> as it makes mplayer read from <code>stdin</code>.)</p>
|
||||
<h3 id="obfuscation">Obfuscation</h3>
|
||||
<p>The IOCCC rules did not put a limit on the entropy of the source code,
|
||||
@@ -257,7 +256,7 @@ that the program relies on writing binary data to <code>stdout</code>.</p>
|
||||
<p>Microsoft compilers adds a carriage return to newlines, and to compile
|
||||
the program with this platform, the following line can be added after
|
||||
the main declaration in order for the program to run correctly:</p>
|
||||
<div class="sourceCode" id="cb12"><pre class="sourceCode c"><code class="sourceCode c"><span id="cb12-1"><a href="#cb12-1" aria-hidden="true" tabindex="-1"></a>_setmode<span class="op">(</span>_fileno<span class="op">(</span>stdout<span class="op">),</span> <span class="bn">0x8000</span><span class="op">);</span></span></code></pre></div>
|
||||
<div class="sourceCode" id="cb12"><pre class="sourceCode c"><code class="sourceCode c"><span id="cb12-1"><a href="#cb12-1" aria-hidden="true" tabindex="-1"></a> _setmode<span class="op">(</span>_fileno<span class="op">(</span>stdout<span class="op">),</span> <span class="bn">0x8000</span><span class="op">);</span></span></code></pre></div>
|
||||
<p>NOTE: this is what the <a href="#alternate-code">alternate version</a> is for.</p>
|
||||
<h3 id="limitations">Limitations</h3>
|
||||
<p>The program only runs when a valid MOD file is passed as argument. If
|
||||
|
||||
+10
-10
@@ -1,7 +1,7 @@
|
||||
## To build:
|
||||
|
||||
```sh
|
||||
make
|
||||
make
|
||||
```
|
||||
|
||||
There is an alternate version which should work for Windows which distinguishes
|
||||
@@ -11,7 +11,7 @@ binary mode from text mode. See [alternate code](#alternate-code) below.
|
||||
## To use:
|
||||
|
||||
```sh
|
||||
./zucker > image.ppm
|
||||
./zucker > image.ppm
|
||||
```
|
||||
|
||||
Now open `image.ppm` with your image viewer of choice.
|
||||
@@ -20,7 +20,7 @@ Now open `image.ppm` with your image viewer of choice.
|
||||
## Try:
|
||||
|
||||
```sh
|
||||
./try.sh
|
||||
./try.sh
|
||||
```
|
||||
|
||||
After running `try.sh`, open the PPM images `ioccc.ppm`, `hello.ppm` and
|
||||
@@ -37,7 +37,7 @@ that distinguish binary and text.
|
||||
### Alternate build:
|
||||
|
||||
```sh
|
||||
make alt
|
||||
make alt
|
||||
```
|
||||
|
||||
|
||||
@@ -69,7 +69,7 @@ This program makes pretty pictures. To see the default output, try
|
||||
running
|
||||
|
||||
```sh
|
||||
./zucker > ioccc2011.ppm
|
||||
./zucker > ioccc2011.ppm
|
||||
```
|
||||
|
||||
On the author's 2.5 GHz MacBook Pro, this command takes approximately 1 minute
|
||||
@@ -83,7 +83,7 @@ Netpbm files, and are available on multiple platforms.
|
||||
With macOS you can type at the command line:
|
||||
|
||||
```sh
|
||||
open ioccc2021.ppm
|
||||
open ioccc2021.ppm
|
||||
```
|
||||
|
||||
and it will open image in the default application Preview.app.
|
||||
@@ -91,7 +91,7 @@ and it will open image in the default application Preview.app.
|
||||
To use ImageMagick you might do something like:
|
||||
|
||||
```sh
|
||||
convert ioccc2011.ppm ioccc2011.png
|
||||
convert ioccc2011.ppm ioccc2011.png
|
||||
```
|
||||
|
||||
and then open `ioccc2011.png` in your viewer of choice.
|
||||
@@ -99,7 +99,7 @@ and then open `ioccc2011.png` in your viewer of choice.
|
||||
To use GraphicsMagick you might do something like:
|
||||
|
||||
```sh
|
||||
gm convert ioccc2011.ppm ioccc2011.png
|
||||
gm convert ioccc2011.ppm ioccc2011.png
|
||||
```
|
||||
|
||||
and then open `ioccc2011.png` in your viewer of choice.
|
||||
@@ -108,14 +108,14 @@ Aside from the default image, you may create your own by running the
|
||||
program as follows:
|
||||
|
||||
```sh
|
||||
./zucker "your text" > image.ppm
|
||||
./zucker "your text" > image.ppm
|
||||
```
|
||||
|
||||
To mitigate long runtime, the program can be invoked in a "preview"
|
||||
mode by appending `-preview` to the command line arguments, like so:
|
||||
|
||||
```sh
|
||||
./zucker faster\! -preview > image.ppm
|
||||
./zucker faster\! -preview > image.ppm
|
||||
```
|
||||
|
||||
If your platform distinguishes between binary and text streams, you may need to
|
||||
|
||||
+11
-12
@@ -132,8 +132,7 @@
|
||||
<h2 id="author"><a name="author"></a>Author:</h2>
|
||||
<ul>
|
||||
<li>Name: <a href="../../authors.html#Matt_Zucker">Matt Zucker</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>)</li>
|
||||
</ul>
|
||||
|
||||
<!-- END: next line ends content generated by: bin/output-index-author.sh -->
|
||||
@@ -142,14 +141,14 @@ Location: <a href="../../location.html#US">US</a> - <em>United States of America
|
||||
<!-- 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>
|
||||
<p>There is an alternate version which should work for Windows which distinguishes
|
||||
binary mode from text mode. 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">./zucker</span> <span class="op">></span> image.ppm</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">./zucker</span> <span class="op">></span> image.ppm</span></code></pre></div>
|
||||
<p>Now open <code>image.ppm</code> with your image viewer of choice.</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>
|
||||
<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>After running <code>try.sh</code>, open the PPM images <code>ioccc.ppm</code>, <code>hello.ppm</code> and
|
||||
<code>image2.ppm</code> with your image viewer of choice.</p>
|
||||
<h2 id="alternate-code">Alternate code:</h2>
|
||||
@@ -157,7 +156,7 @@ binary mode from text mode. See <a href="#alternate-code">alternate code</a> bel
|
||||
binary mode on <code>stdout</code> which the author noted would be necessary for systems
|
||||
that distinguish binary and text.</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>
|
||||
<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>zucker.alt</code> as you would <code>zucker</code> above.</p>
|
||||
<h3 id="alternate-try">Alternate try:</h3>
|
||||
@@ -171,7 +170,7 @@ The vector font is proportional.</p>
|
||||
<h4 id="what-it-does">What it does:</h4>
|
||||
<p>This program makes pretty pictures. To see the default output, try
|
||||
running</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">./zucker</span> <span class="op">></span> ioccc2011.ppm</span></code></pre></div>
|
||||
<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">./zucker</span> <span class="op">></span> ioccc2011.ppm</span></code></pre></div>
|
||||
<p>On the author’s 2.5 GHz MacBook Pro, this command takes approximately 1 minute
|
||||
and 18 seconds to run – your runtime may vary. You will need an image viewer
|
||||
capable of displaying <a href="https://en.wikipedia.org/wiki/Netpbm">Netpbm images</a> in
|
||||
@@ -180,20 +179,20 @@ well; otherwise <a href="http://www.imagemagick.org/">ImageMagick</a> and/or
|
||||
<a href="http://www.graphicsmagick.org/">GraphicsMagick</a> are both capable of displaying
|
||||
Netpbm files, and are available on multiple platforms.</p>
|
||||
<p>With macOS you can type at the command line:</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">open</span> ioccc2021.ppm</span></code></pre></div>
|
||||
<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">open</span> ioccc2021.ppm</span></code></pre></div>
|
||||
<p>and it will open image in the default application Preview.app.</p>
|
||||
<p>To use ImageMagick you might do something like:</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">convert</span> ioccc2011.ppm ioccc2011.png</span></code></pre></div>
|
||||
<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">convert</span> ioccc2011.ppm ioccc2011.png</span></code></pre></div>
|
||||
<p>and then open <code>ioccc2011.png</code> in your viewer of choice.</p>
|
||||
<p>To use GraphicsMagick you might do something like:</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">gm</span> convert ioccc2011.ppm ioccc2011.png</span></code></pre></div>
|
||||
<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">gm</span> convert ioccc2011.ppm ioccc2011.png</span></code></pre></div>
|
||||
<p>and then open <code>ioccc2011.png</code> in your viewer of choice.</p>
|
||||
<p>Aside from the default image, you may create your own by running the
|
||||
program as follows:</p>
|
||||
<div class="sourceCode" id="cb9"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb9-1"><a href="#cb9-1" aria-hidden="true" tabindex="-1"></a><span class="ex">./zucker</span> <span class="st">"your text"</span> <span class="op">></span> image.ppm</span></code></pre></div>
|
||||
<div class="sourceCode" id="cb9"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb9-1"><a href="#cb9-1" aria-hidden="true" tabindex="-1"></a> <span class="ex">./zucker</span> <span class="st">"your text"</span> <span class="op">></span> image.ppm</span></code></pre></div>
|
||||
<p>To mitigate long runtime, the program can be invoked in a “preview”
|
||||
mode by appending <code>-preview</code> to the command line arguments, like so:</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">./zucker</span> faster<span class="dt">\!</span> <span class="at">-preview</span> <span class="op">></span> image.ppm</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="ex">./zucker</span> faster<span class="dt">\!</span> <span class="at">-preview</span> <span class="op">></span> image.ppm</span></code></pre></div>
|
||||
<p>If your platform distinguishes between binary and text streams, you may need to
|
||||
insert some code to reopen standard output in binary mode at the start of
|
||||
<code>main()</code> (the provided <a href="#alternate-code">alternate version</a> will set binary mode
|
||||
|
||||
Reference in new issue
Block a user