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:
Landon Curt Noll committed 2024-04-01 04:48:48 -07:00
1 parent b84c27ce02
commit a996f8d2b8
734 files changed
+16723 -16963

No files matched your search

+4 -4
View File
@@ -1,7 +1,7 @@
## To build:
```sh
make
make
```
@@ -10,7 +10,7 @@ make
The current status of this entry is:
```
STATUS: uses gets() - change to fgets() if possible
STATUS: uses gets() - change to fgets() if possible
```
For more detailed information see [2006 birken bugs](../../bugs.html#2006_birken).
@@ -19,14 +19,14 @@ For more detailed information see [2006 birken bugs](../../bugs.html#2006_birken
## To use:
```sh
./birken < file.tofu
./birken < file.tofu
```
## Try:
```sh
./try.sh
./try.sh
```
etc.
+5 -6
View File
@@ -132,8 +132,7 @@
<h2 id="author"><a name="author"></a>Author:</h2>
<ul>
<li>Name: <a href="../../authors.html#Michael_Birken">Michael Birken</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: uses gets() - change to fgets() if possible</code></pre>
<pre><code> STATUS: uses gets() - change to fgets() if possible</code></pre>
<p>For more detailed information see <a href="../../bugs.html#2006_birken">2006 birken 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">./birken</span> <span class="op">&lt;</span> file.tofu</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">./birken</span> <span class="op">&lt;</span> file.tofu</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>etc.</p>
<h2 id="judges-remarks">Judges’ remarks:</h2>
<p>Q: EDAMAME?</p>
+7 -7
View File
@@ -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 [2006 borsanyi bugs](../../bugs.html#2006_borsanyi).
@@ -19,14 +19,14 @@ For more detailed information see [2006 borsanyi bugs](../../bugs.html#2006_bors
## To use:
```sh
./borsanyi string > file.gif
./borsanyi string > file.gif
```
## Try:
```sh
./try.sh
./try.sh
```
We recommend you input for the filename `example.gif` and for the string
@@ -69,9 +69,9 @@ used. A typical email address is stored in less than 1-2 kilobytes.
### Usage:
```sh
make all
./borsanyi my@example.com > email.gif
my_favourite_gif_viewer email.gif
make all
./borsanyi my@example.com > email.gif
my_favourite_gif_viewer email.gif
```
The address cannot be longer than 42 characters, and may consist of
+8 -9
View File
@@ -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#2006_borsanyi">2006 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> string <span class="op">&gt;</span> file.gif</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> string <span class="op">&gt;</span> file.gif</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>We recommend you input for the filename <code>example.gif</code> and for the string
<code>ioccc@example.com</code>. The script will not overwrite files. It runs the program in
a loop until you answer that you do not wish to make another.</p>
@@ -176,9 +175,9 @@ line. To avoid complications with patent issues the <a href="https://en.wikipedi
compression</a> feature is not
used. A typical email address is stored in less than 1-2 kilobytes.</p>
<h3 id="usage">Usage:</h3>
<div class="sourceCode" id="cb5"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb5-1"><a href="#cb5-1" aria-hidden="true" tabindex="-1"></a><span class="fu">make</span> all</span>
<span id="cb5-2"><a href="#cb5-2" aria-hidden="true" tabindex="-1"></a><span class="ex">./borsanyi</span> my@example.com <span class="op">&gt;</span> email.gif</span>
<span id="cb5-3"><a href="#cb5-3" aria-hidden="true" tabindex="-1"></a><span class="ex">my_favourite_gif_viewer</span> email.gif</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="fu">make</span> all</span>
<span id="cb5-2"><a href="#cb5-2" aria-hidden="true" tabindex="-1"></a> <span class="ex">./borsanyi</span> my@example.com <span class="op">&gt;</span> email.gif</span>
<span id="cb5-3"><a href="#cb5-3" aria-hidden="true" tabindex="-1"></a> <span class="ex">my_favourite_gif_viewer</span> email.gif</span></code></pre></div>
<p>The address cannot be longer than 42 characters, and may consist of
the characters: <code>a-z_A-Z0-9@.-</code>.</p>
<p>The program is (like email addresses are) case insensitive.</p>
+11 -11
View File
@@ -1,14 +1,14 @@
## To build:
```sh
make
make
```
## To use:
```sh
./grothe carrier_freq pixelclock horizontal_total < some_input.txt
./grothe carrier_freq pixelclock horizontal_total < some_input.txt
```
@@ -17,7 +17,7 @@ make
Put on your "electronic ears" and then try:
```sh
./try.sh
./try.sh
```
You may find using
@@ -42,22 +42,22 @@ To be able to run the program you need to determine the following
parameters:
```
carrier_freq - base frequency used to host music
pixelclock - refresh rate of the monitor
horizontal_total - total scan along the horizontal axis
carrier_freq - base frequency used to host music
pixelclock - refresh rate of the monitor
horizontal_total - total scan along the horizontal axis
```
If you have `xvidtune` installed you can get the `pixelclock` and
`horizontal_total` with the following command
```sh
xvidtune -show | head -n 1 | awk '{ print "pixelclock " $2 * 1000000 " horizontal_total = " $6 }'
xvidtune -show | head -n 1 | awk '{ print "pixelclock " $2 * 1000000 " horizontal_total = " $6 }'
```
Example from my laptops:
```sh
./grothe 65000000 10000000 1344 < twinkle.txt
./grothe 65000000 10000000 1344 < twinkle.txt
```
Even if the user gets a setting off, the sound will usually be able to be
@@ -74,19 +74,19 @@ and [Timex Sinclair ZX-81](https://en.wikipedia.org/wiki/ZX81)s.
Olympics Fanfare - from `antang@phakt.usc.edu` - Tony:
```
4-9-91231,2222-321123123-9-91231,2222-32112321
4-9-91231,2222-321123123-9-91231,2222-32112321
```
Twinkle Twinkle Little Star - from `fsufunkyb@aol.com` - Ben Schmidt:
```
1199##9-6633221-9966332-9966332-1199#9-6633221-
1199##9-6633221-9966332-9966332-1199#9-6633221-
```
Generic Arabian Tune - from `rdippold@qualcomm.com` - Ron "Asbestos" Dippold:
```
453,54,4569564459,9#95458,8987453 54
453,54,4569564459,9#95458,8987453 54
```
Others can be found by doing a search for "touch tone phone songs".
+12 -13
View File
@@ -132,8 +132,7 @@
<h2 id="author"><a name="author"></a>Author:</h2>
<ul>
<li>Name: <a href="../../authors.html#Aaron_Grothe">Aaron Grothe</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,12 +141,12 @@ 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">./grothe</span> carrier_freq pixelclock horizontal_total <span class="op">&lt;</span> some_input.txt</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">./grothe</span> carrier_freq pixelclock horizontal_total <span class="op">&lt;</span> some_input.txt</span></code></pre></div>
<h2 id="try">Try:</h2>
<p>Put on your “electronic ears” and then try:</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">./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>You may find using
a tunable scanning electronic ear helps.</p>
<h2 id="judges-remarks">Judges’ remarks:</h2>
@@ -161,14 +160,14 @@ the frequencies for an old fashion touch tone phone, so old songs can be played
by hitting <code>0-9</code>,<code>#</code>, and <code>*</code>.</p>
<p>To be able to run the program you need to determine the following
parameters:</p>
<pre><code>carrier_freq - base frequency used to host music
pixelclock - refresh rate of the monitor
horizontal_total - total scan along the horizontal axis</code></pre>
<pre><code> carrier_freq - base frequency used to host music
pixelclock - refresh rate of the monitor
horizontal_total - total scan along the horizontal axis</code></pre>
<p>If you have <code>xvidtune</code> installed you can get the <code>pixelclock</code> and
<code>horizontal_total</code> with the following command</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">xvidtune</span> <span class="at">-show</span> <span class="kw">|</span> <span class="fu">head</span> <span class="at">-n</span> 1 <span class="kw">|</span> <span class="fu">awk</span> <span class="st">&#39;{ print &quot;pixelclock &quot; $2 * 1000000 &quot; horizontal_total = &quot; $6 }&#39;</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">xvidtune</span> <span class="at">-show</span> <span class="kw">|</span> <span class="fu">head</span> <span class="at">-n</span> 1 <span class="kw">|</span> <span class="fu">awk</span> <span class="st">&#39;{ print &quot;pixelclock &quot; $2 * 1000000 &quot; horizontal_total = &quot; $6 }&#39;</span></span></code></pre></div>
<p>Example from my laptops:</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">./grothe</span> 65000000 10000000 1344 <span class="op">&lt;</span> twinkle.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="ex">./grothe</span> 65000000 10000000 1344 <span class="op">&lt;</span> twinkle.txt</span></code></pre></div>
<p>Even if the user gets a setting off, the sound will usually be able to be
heard on <a href="https://en.wikipedia.org/wiki/AM_broadcasting">AM</a> at a multiple of
the original frequency.</p>
@@ -177,11 +176,11 @@ way back to the <a href="https://en.wikipedia.org/wiki/Altair_8800">Altair compu
and <a href="https://en.wikipedia.org/wiki/ZX81">Timex Sinclair ZX-81</a>s.</p>
<h3 id="several-example-songs">Several example songs</h3>
<p>Olympics Fanfare - from <code>antang@phakt.usc.edu</code> - Tony:</p>
<pre><code>4-9-91231,2222-321123123-9-91231,2222-32112321</code></pre>
<pre><code> 4-9-91231,2222-321123123-9-91231,2222-32112321</code></pre>
<p>Twinkle Twinkle Little Star - from <code>fsufunkyb@aol.com</code> - Ben Schmidt:</p>
<pre><code>1199##9-6633221-9966332-9966332-1199#9-6633221-</code></pre>
<pre><code> 1199##9-6633221-9966332-9966332-1199#9-6633221-</code></pre>
<p>Generic Arabian Tune - from <code>rdippold@qualcomm.com</code> - Ron “Asbestos” Dippold:</p>
<pre><code>453,54,4569564459,9#95458,8987453 54</code></pre>
<pre><code> 453,54,4569564459,9#95458,8987453 54</code></pre>
<p>Others can be found by doing a search for “touch tone phone songs”.</p>
<h3 id="obfuscations">Obfuscations</h3>
<ul>
+5 -5
View File
@@ -1,21 +1,21 @@
## To build:
```sh
make
make
```
## To use:
```sh
./hamre math_expression_string
./hamre math_expression_string
```
## Try:
```sh
./try.sh
./try.sh
```
@@ -43,8 +43,8 @@ by supplying an expression as the first argument, and the normalized
result will be written to `stdout`.
```sh
./hamre '-1+4/3*(2+1/(3/2*(7/2-7/3+1/6)))/2'
2/3
./hamre '-1+4/3*(2+1/(3/2*(7/2-7/3+1/6)))/2'
2/3
```
If you do not supply an argument, the calculator will crash. Other
+6 -7
View File
@@ -132,8 +132,7 @@
<h2 id="author"><a name="author"></a>Author:</h2>
<ul>
<li>Name: <a href="../../authors.html#Steinar_Hamre">Steinar Hamre</a><br>
Location: <a href="../../location.html#NO">NO</a> - <em>Kingdom of Norway</em> (<em>Norway</em>)
<br><br></li>
Location: <a href="../../location.html#NO">NO</a> - <em>Kingdom of Norway</em> (<em>Norway</em>)</li>
</ul>
<!-- END: next line ends content generated by: bin/output-index-author.sh -->
@@ -142,11 +141,11 @@ Location: <a href="../../location.html#NO">NO</a> - <em>Kingdom of Norway</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">./hamre</span> math_expression_string</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">./hamre</span> math_expression_string</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>An irrationally coded source presents rational things!</p>
<p>A rational person might want to attempt the
@@ -163,8 +162,8 @@ an obfuscated one.</p>
supported operators are: <code>+</code>, <code>-</code> (binary and unary), <code>*</code>, <code>/</code> and <code>()</code>. Run it
by supplying an expression as the first argument, and the normalized
result will be written to <code>stdout</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">./hamre</span> <span class="st">&#39;-1+4/3*(2+1/(3/2*(7/2-7/3+1/6)))/2&#39;</span></span>
<span id="cb4-2"><a href="#cb4-2" aria-hidden="true" tabindex="-1"></a><span class="ex">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">./hamre</span> <span class="st">&#39;-1+4/3*(2+1/(3/2*(7/2-7/3+1/6)))/2&#39;</span></span>
<span id="cb4-2"><a href="#cb4-2" aria-hidden="true" tabindex="-1"></a> <span class="ex">2/3</span></span></code></pre></div>
<p>If you do not supply an argument, the calculator will crash. Other
arguments are ignored. Supplying more arguments may further limit the
number of nested operators supported.</p>
+11 -11
View File
@@ -1,27 +1,27 @@
## To build:
```sh
make
make
```
## To use:
```sh
./meyer [SEED]
./meyer [SEED]
```
## Try:
```sh
./meyer [SEED]
./meyer [SEED]
```
For your first input try:
```
a 0 1
a 0 1
```
where `a` is the row (`a`-`i`), `0` is the column (`0`-`8`) and `1` is the
@@ -70,13 +70,13 @@ it is obvious, that object-oriented code isn't '`WYWIWID`' ('what
you write is what it does'). It may be tempting to think that
```
Object o;
Object o;
```
might do something similar as
```c
struct not_an_object o;
struct not_an_object o;
```
But this program reveals that it doesn't. Even worse, this program only
@@ -101,7 +101,7 @@ implementation in a popular object-oriented programming language.
### Starting the game
```sh
./meyer [SEED]
./meyer [SEED]
```
### Gameplay
@@ -119,15 +119,15 @@ breaking the following rule. Any number must be unique in its:
Expected input for your move:
```
row column number
row column number
```
where
```
row: [a-i]
column: [0-8]
number: [1-9].
row: [a-i]
column: [0-8]
number: [1-9].
```
The game can be aborted with `q`.
+12 -13
View File
@@ -132,8 +132,7 @@
<h2 id="author"><a name="author"></a>Author:</h2>
<ul>
<li>Name: <a href="../../authors.html#Raphael_Meyer">Raphael Meyer</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,13 +141,13 @@ 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">./meyer</span> <span class="pp">[</span><span class="ss">SEED</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">./meyer</span> <span class="pp">[</span><span class="ss">SEED</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">./meyer</span> <span class="pp">[</span><span class="ss">SEED</span><span class="pp">]</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">./meyer</span> <span class="pp">[</span><span class="ss">SEED</span><span class="pp">]</span></span></code></pre></div>
<p>For your first input try:</p>
<pre><code>a 0 1</code></pre>
<pre><code> a 0 1</code></pre>
<p>where <code>a</code> is the row (<code>a</code>-<code>i</code>), <code>0</code> is the column (<code>0</code>-<code>8</code>) and <code>1</code> is the
number (<code>1</code>-<code>9</code>).</p>
<p>NOTE: if you do not input three different ‘words’ it will block. You can input
@@ -182,9 +181,9 @@ disoriented program.</p>
<p>Comparing this program to a potential object-oriented implementation,
it is obvious, that object-oriented code isn’t ‘<code>WYWIWID</code>’ (‘what
you write is what it does’). It may be tempting to think that</p>
<pre><code>Object o;</code></pre>
<pre><code> Object o;</code></pre>
<p>might do something similar as</p>
<div class="sourceCode" id="cb6"><pre class="sourceCode c"><code class="sourceCode c"><span id="cb6-1"><a href="#cb6-1" aria-hidden="true" tabindex="-1"></a><span class="kw">struct</span> not_an_object o<span class="op">;</span></span></code></pre></div>
<div class="sourceCode" id="cb6"><pre class="sourceCode c"><code class="sourceCode c"><span id="cb6-1"><a href="#cb6-1" aria-hidden="true" tabindex="-1"></a> <span class="kw">struct</span> not_an_object o<span class="op">;</span></span></code></pre></div>
<p>But this program reveals that it doesn’t. Even worse, this program only
reveals the tip of the iceberg, what kind of black magic is involved in
a simple declaration of an object.</p>
@@ -202,7 +201,7 @@ and <a href="https://en.wikipedia.org/wiki/Polymorphism_(computer_science)">poly
<p>It is left as an exercise to the reader to find a corresponding
implementation in a popular object-oriented programming language.</p>
<h3 id="starting-the-game">Starting the game</h3>
<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">./meyer</span> <span class="pp">[</span><span class="ss">SEED</span><span class="pp">]</span></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">./meyer</span> <span class="pp">[</span><span class="ss">SEED</span><span class="pp">]</span></span></code></pre></div>
<h3 id="gameplay">Gameplay</h3>
<p>It is a <a href="https://en.wikipedia.org/wiki/Sudoku">sudoku</a> based game. The goal of
the game is to be able to do the last valid ‘move’.</p>
@@ -214,11 +213,11 @@ breaking the following rule. Any number must be unique in its:</p>
<li>3x3 block.</li>
</ol>
<p>Expected input for your move:</p>
<pre><code>row column number</code></pre>
<pre><code> row column number</code></pre>
<p>where</p>
<pre><code>row: [a-i]
column: [0-8]
number: [1-9].</code></pre>
<pre><code> row: [a-i]
column: [0-8]
number: [1-9].</code></pre>
<p>The game can be aborted with <code>q</code>.</p>
<p>The one who can do the last move wins the game.</p>
<!--
+34 -34
View File
@@ -3,7 +3,7 @@
Make sure you have the SDL1 (not SDL2!) development environment installed.
```sh
make
make
```
There is alternate version that lets you redefine the width and height and number
@@ -15,8 +15,8 @@ of iterations to use. See [Alternate code](#alternate-code) below.
The current status of this entry is:
```
STATUS: doesn't work with some platforms - please help us fix
STATUS: INABIAF - please **DO NOT** fix
STATUS: doesn't work with some platforms - please help us fix
STATUS: INABIAF - please **DO NOT** fix
```
For more detailed information see [2006 monge bugs](../../bugs.html#2006_monge).
@@ -25,7 +25,7 @@ For more detailed information see [2006 monge bugs](../../bugs.html#2006_monge).
## To use:
```sh
./monge expression ...
./monge expression ...
```
Incorrect formulas will ungracefully crash the program.
@@ -34,7 +34,7 @@ Incorrect formulas will ungracefully crash the program.
## Try:
```sh
./try.sh
./try.sh
```
@@ -50,7 +50,7 @@ To use the default values, the same as [monge.c](monge.c), just do:
```sh
make alt
make alt
```
But if you wish to actually make use of it you will want to redefine one or more
@@ -59,13 +59,13 @@ of the variables `W`, `H` and `I`. The defaults are (respectively) 400, 300 and
the same then do:
```sh
make clobber WIDTH=500 HEIGHT=500 alt
make clobber WIDTH=500 HEIGHT=500 alt
```
If you wish to keep the dimensions the same but change the iterations to 512:
```sh
make clobber ITERATIONS=512 alt
make clobber ITERATIONS=512 alt
```
If you specify a value less than 1 for any of these it sets it back to the
@@ -83,7 +83,7 @@ Use `monge.alt` exactly as you would `monge` above.
### Alternate try:
```sh
./try.alt.sh
./try.alt.sh
```
@@ -110,13 +110,13 @@ effort to work on both `i386` and `x86_64`. Portable it is! :)
0. Compile using the Makefile, or just run:
```sh
gcc monge.c -o monge -O3 `sdl-config --libs --cflags`
gcc monge.c -o monge -O3 `sdl-config --libs --cflags`
```
1. Run:
```sh
./monge "z = 0" "z = z*z + c; Abs2(z) < 4"
./monge "z = 0" "z = z*z + c; Abs2(z) < 4"
```
2. Keep clicking with left or right button to zoom in or out.
@@ -150,21 +150,21 @@ as you like (as understood by the C function `isspace()`).
Supported operations and functions are:
```
Operation | Description
:-------- | :----------
+,-,*,/ | Arithmetic operations, priority of * , / over +,- is
| respected.
|
<,> | Compares the real parts of two complex numbers (the imaginary part
| is ignored). Any number of conditions is allowed, the iteration
| will just stop as soon as one of them fails.
Abs2 | Calculates the squared norm, i.e.: Abs2(a+b*i) is (a*a+b*b)+0*i.
Re | Extract the real part, i.e.: Re(a+b*i) is a+0*i.
Im | Extract the imaginary part, i.e.: Im(a+b*i) is b+0*i.
Exp | Calculates the complex exponential, i.e. Exp(a+b*i) is
| e^a*(cos(b)+sin(b)*i).
Ln | Calculates the principal value of the natural logarithm, i.e.
Ln(a+b*i) is ln(a*a+b*b)/2 + atan(b/a)*i.
Operation | Description
:-------- | :----------
+,-,*,/ | Arithmetic operations, priority of * , / over +,- is
| respected.
|
<,> | Compares the real parts of two complex numbers (the imaginary part
| is ignored). Any number of conditions is allowed, the iteration
| will just stop as soon as one of them fails.
Abs2 | Calculates the squared norm, i.e.: Abs2(a+b*i) is (a*a+b*b)+0*i.
Re | Extract the real part, i.e.: Re(a+b*i) is a+0*i.
Im | Extract the imaginary part, i.e.: Im(a+b*i) is b+0*i.
Exp | Calculates the complex exponential, i.e. Exp(a+b*i) is
| e^a*(cos(b)+sin(b)*i).
Ln | Calculates the principal value of the natural logarithm, i.e.
Ln(a+b*i) is ln(a*a+b*b)/2 + atan(b/a)*i.
```
Here are a few examples of fractals you can draw:
@@ -172,49 +172,49 @@ Here are a few examples of fractals you can draw:
- Mandelbrot:
```sh
./monge "z=1" "z=z*z+c; Abs2(z)<4"
./monge "z=1" "z=z*z+c; Abs2(z)<4"
```
- Mandelbrot (return time variation):
```sh
./monge "z=c" "z=z*z+c; Abs2(z-c)>0.0001"
./monge "z=c" "z=z*z+c; Abs2(z-c)>0.0001"
```
- Julia, for `c=0.31+i*0.5`:
```sh
./monge "z=c; c=0.31+i*0.5" "z=z*z+c; Abs2(z)<4"
./monge "z=c; c=0.31+i*0.5" "z=z*z+c; Abs2(z)<4"
```
- Julia (return time variation), `for c=0.31+i*0.5`:
```sh
./monge "z=c; c=0.31+i*0.5" "z=z*z+c; Abs2(z-c)>0.0001"
./monge "z=c; c=0.31+i*0.5" "z=z*z+c; Abs2(z-c)>0.0001"
```
- Newton, for `x^3-1`:
```sh
./monge "z=c" "p=z; z=0.6666*z+0.3333/(z*z); Abs2(p-z) > 0.001"
./monge "z=c" "p=z; z=0.6666*z+0.3333/(z*z); Abs2(p-z) > 0.001"
```
- Newton-Mandelbrot:
```sh
./monge "z=0" "p=z; z=z-(z*z*z + (c-1)*z - c)/(3*z*z+c-1); Abs2(p-z) > 0.001"
./monge "z=0" "p=z; z=z-(z*z*z + (c-1)*z - c)/(3*z*z+c-1); Abs2(p-z) > 0.001"
```
- Phoenix, Mandelbrot version:
```sh
./monge "z=0; q=0" "t=z; z=z*z+Re(c)+Im(c)*q; q=t; Abs2(z)<4"
./monge "z=0; q=0" "t=z; z=z*z+Re(c)+Im(c)*q; q=t; Abs2(z)<4"
```
- Phoenix, Julia version for `c=0.56667-i*0.5`:
```sh
./monge "z=c; c=0.56667-i*0.5; q=0" "t=z; z=z*z+Re(c)+Im(c)*q; q=t; Abs2(z)<4"
./monge "z=c; c=0.56667-i*0.5; q=0" "t=z; z=z*z+Re(c)+Im(c)*q; q=t; Abs2(z)<4"
```
+35 -36
View File
@@ -132,8 +132,7 @@
<h2 id="author"><a name="author"></a>Author:</h2>
<ul>
<li>Name: <a href="../../authors.html#Maurizio_Monge">Maurizio Monge</a><br>
Location: <a href="../../location.html#IT">IT</a> - <em>Italian Republic</em> (<em>Italy</em>)
<br><br></li>
Location: <a href="../../location.html#IT">IT</a> - <em>Italian Republic</em> (<em>Italy</em>)</li>
</ul>
<!-- END: next line ends content generated by: bin/output-index-author.sh -->
@@ -143,32 +142,32 @@ Location: <a href="../../location.html#IT">IT</a> - <em>Italian Republic</em> (<
<h2 id="to-build">To build:</h2>
<p>Make sure you have the SDL1 (not SDL2!) development environment 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 is alternate version that lets you redefine the width and height and number
of iterations to use. 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: doesn&#39;t work with some platforms - please help us fix
STATUS: INABIAF - please **DO NOT** fix</code></pre>
<pre><code> STATUS: doesn&#39;t work with some platforms - please help us fix
STATUS: INABIAF - please **DO NOT** fix</code></pre>
<p>For more detailed information see <a href="../../bugs.html#2006_monge">2006 monge 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">./monge</span> expression ...</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">./monge</span> expression ...</span></code></pre></div>
<p>Incorrect formulas will ungracefully crash the program.</p>
<h2 id="try">Try:</h2>
<div class="sourceCode" id="cb4"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb4-1"><a href="#cb4-1" aria-hidden="true" tabindex="-1"></a><span class="ex">./try.sh</span></span></code></pre></div>
<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="alternate-code">Alternate code:</h2>
<p>This alternate code lets you specify the width and height of the image as well
as the number of iterations to perform.</p>
<h3 id="alternate-build">Alternate build:</h3>
<p>To use the default values, the same as <a href="monge.c">monge.c</a>, just 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="fu">make</span> alt</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="fu">make</span> alt</span></code></pre></div>
<p>But if you wish to actually make use of it you will want to redefine one or more
of the variables <code>W</code>, <code>H</code> and <code>I</code>. The defaults are (respectively) 400, 300 and
\128. If you wish to change the image size to 500x500 but keep the iterations
the same then do:</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">make</span> clobber WIDTH=500 HEIGHT=500 alt</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">make</span> clobber WIDTH=500 HEIGHT=500 alt</span></code></pre></div>
<p>If you wish to keep the dimensions the same but change the iterations to 512:</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> clobber ITERATIONS=512 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> clobber ITERATIONS=512 alt</span></code></pre></div>
<p>If you specify a value less than 1 for any of these it sets it back to the
default. The value 1 was selected arbitrarily and such a small number as 1 will
not do anything useful but as long as it’s at least 1 it’ll not be redefined.
@@ -177,7 +176,7 @@ anyway.</p>
<h3 id="alternate-use">Alternate use:</h3>
<p>Use <code>monge.alt</code> exactly as you would <code>monge</code> above.</p>
<h3 id="alternate-try">Alternate try:</h3>
<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">./try.alt.sh</span></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">./try.alt.sh</span></span></code></pre></div>
<h2 id="judges-remarks">Judges’ remarks:</h2>
<p>For those who are familiar with the previous <a href="../../authors.html">IOCCC entries</a>,
this program is best described as “<a href="../../1994/tvr/index.html">1994/tvr</a> meets
@@ -194,11 +193,11 @@ effort to work on both <code>i386</code> and <code>x86_64</code>. Portable it is
<ol start="0" type="1">
<li>Compile using the Makefile, or just run:</li>
</ol>
<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> monge.c <span class="at">-o</span> monge <span class="at">-O3</span> <span class="kw">`</span><span class="ex">sdl-config</span> <span class="at">--libs</span> <span class="at">--cflags</span><span class="kw">`</span></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> monge.c <span class="at">-o</span> monge <span class="at">-O3</span> <span class="kw">`</span><span class="ex">sdl-config</span> <span class="at">--libs</span> <span class="at">--cflags</span><span class="kw">`</span></span></code></pre></div>
<ol type="1">
<li>Run:</li>
</ol>
<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">./monge</span> <span class="st">&quot;z = 0&quot;</span> <span class="st">&quot;z = z*z + c; Abs2(z) &lt; 4&quot;</span></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">./monge</span> <span class="st">&quot;z = 0&quot;</span> <span class="st">&quot;z = z*z + c; Abs2(z) &lt; 4&quot;</span></span></code></pre></div>
<ol start="2" type="1">
<li><p>Keep clicking with left or right button to zoom in or out.</p></li>
<li><p>Use the number pad <code>+</code> and <code>-</code> to increase/decrease the iteration count when
@@ -222,54 +221,54 @@ expression must be an assignment (<code>[variable] = [expr]</code>) or a compari
<code>&lt;</code> or <code>&gt;</code> (<code>[expr1] &lt; [expr2]</code> or <code>[expr1] &gt; [expr2]</code>), and you can add spaces
as you like (as understood by the C function <code>isspace()</code>).</p>
<p>Supported operations and functions are:</p>
<pre><code>Operation | Description
:-------- | :----------
+,-,*,/ | Arithmetic operations, priority of * , / over +,- is
| respected.
|
&lt;,&gt; | Compares the real parts of two complex numbers (the imaginary part
| is ignored). Any number of conditions is allowed, the iteration
| will just stop as soon as one of them fails.
Abs2 | Calculates the squared norm, i.e.: Abs2(a+b*i) is (a*a+b*b)+0*i.
Re | Extract the real part, i.e.: Re(a+b*i) is a+0*i.
Im | Extract the imaginary part, i.e.: Im(a+b*i) is b+0*i.
Exp | Calculates the complex exponential, i.e. Exp(a+b*i) is
| e^a*(cos(b)+sin(b)*i).
Ln | Calculates the principal value of the natural logarithm, i.e.
Ln(a+b*i) is ln(a*a+b*b)/2 + atan(b/a)*i.</code></pre>
<pre><code> Operation | Description
:-------- | :----------
+,-,*,/ | Arithmetic operations, priority of * , / over +,- is
| respected.
|
&lt;,&gt; | Compares the real parts of two complex numbers (the imaginary part
| is ignored). Any number of conditions is allowed, the iteration
| will just stop as soon as one of them fails.
Abs2 | Calculates the squared norm, i.e.: Abs2(a+b*i) is (a*a+b*b)+0*i.
Re | Extract the real part, i.e.: Re(a+b*i) is a+0*i.
Im | Extract the imaginary part, i.e.: Im(a+b*i) is b+0*i.
Exp | Calculates the complex exponential, i.e. Exp(a+b*i) is
| e^a*(cos(b)+sin(b)*i).
Ln | Calculates the principal value of the natural logarithm, i.e.
Ln(a+b*i) is ln(a*a+b*b)/2 + atan(b/a)*i.</code></pre>
<p>Here are a few examples of fractals you can draw:</p>
<ul>
<li>Mandelbrot:</li>
</ul>
<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">./monge</span> <span class="st">&quot;z=1&quot;</span> <span class="st">&quot;z=z*z+c; Abs2(z)&lt;4&quot;</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="ex">./monge</span> <span class="st">&quot;z=1&quot;</span> <span class="st">&quot;z=z*z+c; Abs2(z)&lt;4&quot;</span></span></code></pre></div>
<ul>
<li>Mandelbrot (return time variation):</li>
</ul>
<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">./monge</span> <span class="st">&quot;z=c&quot;</span> <span class="st">&quot;z=z*z+c; Abs2(z-c)&gt;0.0001&quot;</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="ex">./monge</span> <span class="st">&quot;z=c&quot;</span> <span class="st">&quot;z=z*z+c; Abs2(z-c)&gt;0.0001&quot;</span></span></code></pre></div>
<ul>
<li>Julia, for <code>c=0.31+i*0.5</code>:</li>
</ul>
<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">./monge</span> <span class="st">&quot;z=c; c=0.31+i*0.5&quot;</span> <span class="st">&quot;z=z*z+c; Abs2(z)&lt;4&quot;</span></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">./monge</span> <span class="st">&quot;z=c; c=0.31+i*0.5&quot;</span> <span class="st">&quot;z=z*z+c; Abs2(z)&lt;4&quot;</span></span></code></pre></div>
<ul>
<li>Julia (return time variation), <code>for c=0.31+i*0.5</code>:</li>
</ul>
<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">./monge</span> <span class="st">&quot;z=c; c=0.31+i*0.5&quot;</span> <span class="st">&quot;z=z*z+c; Abs2(z-c)&gt;0.0001&quot;</span></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">./monge</span> <span class="st">&quot;z=c; c=0.31+i*0.5&quot;</span> <span class="st">&quot;z=z*z+c; Abs2(z-c)&gt;0.0001&quot;</span></span></code></pre></div>
<ul>
<li>Newton, for <code>x^3-1</code>:</li>
</ul>
<div class="sourceCode" id="cb16"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb16-1"><a href="#cb16-1" aria-hidden="true" tabindex="-1"></a><span class="ex">./monge</span> <span class="st">&quot;z=c&quot;</span> <span class="st">&quot;p=z; z=0.6666*z+0.3333/(z*z); Abs2(p-z) &gt; 0.001&quot;</span></span></code></pre></div>
<div class="sourceCode" id="cb16"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb16-1"><a href="#cb16-1" aria-hidden="true" tabindex="-1"></a> <span class="ex">./monge</span> <span class="st">&quot;z=c&quot;</span> <span class="st">&quot;p=z; z=0.6666*z+0.3333/(z*z); Abs2(p-z) &gt; 0.001&quot;</span></span></code></pre></div>
<ul>
<li>Newton-Mandelbrot:</li>
</ul>
<div class="sourceCode" id="cb17"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb17-1"><a href="#cb17-1" aria-hidden="true" tabindex="-1"></a><span class="ex">./monge</span> <span class="st">&quot;z=0&quot;</span> <span class="st">&quot;p=z; z=z-(z*z*z + (c-1)*z - c)/(3*z*z+c-1); Abs2(p-z) &gt; 0.001&quot;</span></span></code></pre></div>
<div class="sourceCode" id="cb17"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb17-1"><a href="#cb17-1" aria-hidden="true" tabindex="-1"></a> <span class="ex">./monge</span> <span class="st">&quot;z=0&quot;</span> <span class="st">&quot;p=z; z=z-(z*z*z + (c-1)*z - c)/(3*z*z+c-1); Abs2(p-z) &gt; 0.001&quot;</span></span></code></pre></div>
<ul>
<li>Phoenix, Mandelbrot version:</li>
</ul>
<div class="sourceCode" id="cb18"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb18-1"><a href="#cb18-1" aria-hidden="true" tabindex="-1"></a><span class="ex">./monge</span> <span class="st">&quot;z=0; q=0&quot;</span> <span class="st">&quot;t=z; z=z*z+Re(c)+Im(c)*q; q=t; Abs2(z)&lt;4&quot;</span></span></code></pre></div>
<div class="sourceCode" id="cb18"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb18-1"><a href="#cb18-1" aria-hidden="true" tabindex="-1"></a> <span class="ex">./monge</span> <span class="st">&quot;z=0; q=0&quot;</span> <span class="st">&quot;t=z; z=z*z+Re(c)+Im(c)*q; q=t; Abs2(z)&lt;4&quot;</span></span></code></pre></div>
<ul>
<li>Phoenix, Julia version for <code>c=0.56667-i*0.5</code>:</li>
</ul>
<div class="sourceCode" id="cb19"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb19-1"><a href="#cb19-1" aria-hidden="true" tabindex="-1"></a><span class="ex">./monge</span> <span class="st">&quot;z=c; c=0.56667-i*0.5; q=0&quot;</span> <span class="st">&quot;t=z; z=z*z+Re(c)+Im(c)*q; q=t; Abs2(z)&lt;4&quot;</span></span></code></pre></div>
<div class="sourceCode" id="cb19"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb19-1"><a href="#cb19-1" aria-hidden="true" tabindex="-1"></a> <span class="ex">./monge</span> <span class="st">&quot;z=c; c=0.56667-i*0.5; q=0&quot;</span> <span class="st">&quot;t=z; z=z*z+Re(c)+Im(c)*q; q=t; Abs2(z)&lt;4&quot;</span></span></code></pre></div>
<h3 id="compilation-and-portability">Compilation and portability</h3>
<p>This program will only work on x86 (with an x87 FPU) or x86_64 machines,
but it requires the SDL library.</p>
+5 -5
View File
@@ -1,7 +1,7 @@
## To build:
```sh
make
make
```
There is an alternate version that supports arrow keys. See the [alternate
@@ -11,7 +11,7 @@ code](#alternate-code) section below.
## To use:
```sh
./night
./night
```
@@ -24,7 +24,7 @@ keys.
### Alternate build:
```sh
make alt
make alt
```
@@ -130,8 +130,8 @@ Keypad support was removed to save space. To restore, modify the
following two macros to:
```c
#define ATG srand(time(0)); initscr(); cbreak(); noecho(); start_color(); keypad(stdscr,1);
#define AGG A&2?KEY_UP:KEY_DOWN:A&1?KEY_RIGHT:KEY_LEFT
#define ATG srand(time(0)); initscr(); cbreak(); noecho(); start_color(); keypad(stdscr,1);
#define AGG A&2?KEY_UP:KEY_DOWN:A&1?KEY_RIGHT:KEY_LEFT
```
Code on!
+6 -7
View File
@@ -132,8 +132,7 @@
<h2 id="author"><a name="author"></a>Author:</h2>
<ul>
<li>Name: <a href="../../authors.html#Christopher_Night">Christopher Night</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,16 +141,16 @@ 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 supports arrow keys. See the <a href="#alternate-code">alternate
code</a> section 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">./night</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">./night</span></span></code></pre></div>
<h2 id="alternate-code">Alternate code:</h2>
<p>This version allows you to use arrow keys instead of the more awkward <code>wasd</code>
keys.</p>
<h3 id="alternate-build">Alternate build:</h3>
<div class="sourceCode" id="cb3"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb3-1"><a href="#cb3-1" aria-hidden="true" tabindex="-1"></a><span class="fu">make</span> alt</span></code></pre></div>
<div class="sourceCode" id="cb3"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb3-1"><a href="#cb3-1" aria-hidden="true" tabindex="-1"></a> <span class="fu">make</span> alt</span></code></pre></div>
<h3 id="alternate-use">Alternate use:</h3>
<p>Use <code>night.alt</code> as you would <code>night</code> above.</p>
<h2 id="judges-remarks">Judges’ remarks:</h2>
@@ -218,8 +217,8 @@ preprocessed code is over 80KB in length, hindering the preprocessor’s ability
to deobfuscate.</p>
<p>Keypad support was removed to save space. To restore, modify the
following two macros to:</p>
<div class="sourceCode" id="cb4"><pre class="sourceCode c"><code class="sourceCode c"><span id="cb4-1"><a href="#cb4-1" aria-hidden="true" tabindex="-1"></a> <span class="pp">#define ATG srand</span><span class="op">(</span><span class="pp">time</span><span class="op">(</span><span class="dv">0</span><span class="op">));</span><span class="pp"> initscr</span><span class="op">();</span><span class="pp"> cbreak</span><span class="op">();</span><span class="pp"> noecho</span><span class="op">();</span><span class="pp"> start_color</span><span class="op">();</span><span class="pp"> keypad</span><span class="op">(</span><span class="pp">stdscr</span><span class="op">,</span><span class="dv">1</span><span class="op">);</span></span>
<span id="cb4-2"><a href="#cb4-2" aria-hidden="true" tabindex="-1"></a> <span class="pp">#define AGG A</span><span class="op">&amp;</span><span class="dv">2</span><span class="op">?</span><span class="pp">KEY_UP</span><span class="op">:</span><span class="pp">KEY_DOWN</span><span class="op">:</span><span class="pp">A</span><span class="op">&amp;</span><span class="dv">1</span><span class="op">?</span><span class="pp">KEY_RIGHT</span><span class="op">:</span><span class="pp">KEY_LEFT</span></span></code></pre></div>
<div class="sourceCode" id="cb4"><pre class="sourceCode c"><code class="sourceCode c"><span id="cb4-1"><a href="#cb4-1" aria-hidden="true" tabindex="-1"></a> <span class="pp">#define ATG srand</span><span class="op">(</span><span class="pp">time</span><span class="op">(</span><span class="dv">0</span><span class="op">));</span><span class="pp"> initscr</span><span class="op">();</span><span class="pp"> cbreak</span><span class="op">();</span><span class="pp"> noecho</span><span class="op">();</span><span class="pp"> start_color</span><span class="op">();</span><span class="pp"> keypad</span><span class="op">(</span><span class="pp">stdscr</span><span class="op">,</span><span class="dv">1</span><span class="op">);</span></span>
<span id="cb4-2"><a href="#cb4-2" aria-hidden="true" tabindex="-1"></a> <span class="pp">#define AGG A</span><span class="op">&amp;</span><span class="dv">2</span><span class="op">?</span><span class="pp">KEY_UP</span><span class="op">:</span><span class="pp">KEY_DOWN</span><span class="op">:</span><span class="pp">A</span><span class="op">&amp;</span><span class="dv">1</span><span class="op">?</span><span class="pp">KEY_RIGHT</span><span class="op">:</span><span class="pp">KEY_LEFT</span></span></code></pre></div>
<p>Code on!</p>
<!--
+8 -8
View File
@@ -1,7 +1,7 @@
## To build:
```sh
make alt
make alt
```
We recommend the alt version so that you can see what this looked like back in 2006.
@@ -12,7 +12,7 @@ code](#original-code) below.
## To use:
```sh
./slone.alt
./slone.alt
```
@@ -25,16 +25,16 @@ value used in `usleep()`. The default is `75000` but you can easily change
it. To do so try:
```sh
make clobber SLEEP=70000 clobber alt
./sloane.alt
make clobber SLEEP=70000 clobber alt
./sloane.alt
```
If you wish to make it like the original, as if the below [Original
code](#original-code) was being used, you can do:
```sh
make SLEEP=0 clobber alt
./sloane.alt
make SLEEP=0 clobber alt
./sloane.alt
```
@@ -47,14 +47,14 @@ Should you wish to see the original you may do so with the original code,
### Original build:
```sh
make clobber all
make clobber all
```
### Original use:
```sh
./sloane
./sloane
```
WARNING: if you are easily overstimulated with fast movement or have
+9 -10
View File
@@ -132,8 +132,7 @@
<h2 id="author"><a name="author"></a>Author:</h2>
<ul>
<li>Name: <a href="../../authors.html#Andy_Sloane">Andy Sloane</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,31 +141,31 @@ 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> alt</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> alt</span></code></pre></div>
<p>We recommend the alt version so that you can see what this looked like back in 2006.
If you wish to see the original faster version see <a href="#original-code">original
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">./slone.alt</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">./slone.alt</span></span></code></pre></div>
<h2 id="try">Try:</h2>
<p>The alternate version, which we recommend that you use in order to see what is
happening with modern systems, and to not flash too quickly, which can be
problematic for some people, can be configured to different speeds by way of the
value used in <code>usleep()</code>. The default is <code>75000</code> but you can easily change
it. To do so try:</p>
<div class="sourceCode" id="cb3"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb3-1"><a href="#cb3-1" aria-hidden="true" tabindex="-1"></a><span class="fu">make</span> clobber SLEEP=70000 clobber alt</span>
<span id="cb3-2"><a href="#cb3-2" aria-hidden="true" tabindex="-1"></a><span class="ex">./sloane.alt</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="fu">make</span> clobber SLEEP=70000 clobber alt</span>
<span id="cb3-2"><a href="#cb3-2" aria-hidden="true" tabindex="-1"></a> <span class="ex">./sloane.alt</span></span></code></pre></div>
<p>If you wish to make it like the original, as if the below <a href="#original-code">Original
code</a> was being used, you can do:</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> SLEEP=0 clobber alt</span>
<span id="cb4-2"><a href="#cb4-2" aria-hidden="true" tabindex="-1"></a><span class="ex">./sloane.alt</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">make</span> SLEEP=0 clobber alt</span>
<span id="cb4-2"><a href="#cb4-2" aria-hidden="true" tabindex="-1"></a> <span class="ex">./sloane.alt</span></span></code></pre></div>
<h2 id="original-code">Original code:</h2>
<p>Should you wish to see the original you may do so with the original code,
<a href="sloane.c">sloane.c</a>.</p>
<h3 id="original-build">Original build:</h3>
<div class="sourceCode" id="cb5"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb5-1"><a href="#cb5-1" aria-hidden="true" tabindex="-1"></a><span class="fu">make</span> clobber all</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="fu">make</span> clobber all</span></code></pre></div>
<h3 id="original-use">Original use:</h3>
<div class="sourceCode" id="cb6"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb6-1"><a href="#cb6-1" aria-hidden="true" tabindex="-1"></a><span class="ex">./sloane</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">./sloane</span></span></code></pre></div>
<p>WARNING: if you are easily overstimulated with fast movement or have
photosensitivity please be careful running this version and instead see the
above!</p>
+33 -33
View File
@@ -1,25 +1,25 @@
## To build:
```sh
make
make
```
## To use:
```sh
./stewart width_and_height iterations file > file.xbm
convert file.xbm file.png
./stewart width_and_height iterations file > file.xbm
convert file.xbm file.png
```
where `file` is one of:
```
altar box box2 box3 build carpet circles cross cross2 cross3
crystal curve diamonds diamonds2 dragon dragon2 dragon3
fern gasket gasket_mod gasket_mod2 ioccc maze octagon
pentagon pentagons rings rings2 spirals spirals2 spirals3
spirals4 squares stars stars2 tree tree2 tree3 tree4 triangle
altar box box2 box3 build carpet circles cross cross2 cross3
crystal curve diamonds diamonds2 dragon dragon2 dragon3
fern gasket gasket_mod gasket_mod2 ioccc maze octagon
pentagon pentagons rings rings2 spirals spirals2 spirals3
spirals4 squares stars stars2 tree tree2 tree3 tree4 triangle
```
NOTE: you cannot specify a different width from height; it's one number.
@@ -30,7 +30,7 @@ NOTE: `convert(1)` belongs to [ImageMagick](https://imagemagick.org/index.php).
## Try:
```sh
./try.sh
./try.sh
```
After running the program on a few files it will ask you if you wish to run it
@@ -59,16 +59,16 @@ a reasonably experienced user who can parse formats in their mind. :-)
The program should be run with the following
```sh
./stewart <m> <n> <ifs>
./stewart <m> <n> <ifs>
```
where:
```
m = The size of the picture (picture will be m X m in size).
n = The number of iterations to run (More will make for a
clearer picture).
ifs = The file to use as input.
m = The size of the picture (picture will be m X m in size).
n = The number of iterations to run (More will make for a
clearer picture).
ifs = The file to use as input.
```
The program will spit out an [XBM image](https://en.wikipedia.org/wiki/X_BitMap)
@@ -78,7 +78,7 @@ are 3. Wrong arguments will cause the program to bomb out.
#### Example:
```sh
./stewart 1024 1000000 gasket > gasket.xbm
./stewart 1024 1000000 gasket > gasket.xbm
```
### Compilation/Testing
@@ -109,13 +109,13 @@ another kind of fractal, those from the [Iterated Function System
The format of the input file is as follows:
```
<num ifs> <x min> <y min> <x max> <y max>
<a> <b> <c> <d> <e> <f> <p>
<a> <b> <c> <d> <e> <f> <p>
<a> <b> <c> <d> <e> <f> <p>
.
.
.
<num ifs> <x min> <y min> <x max> <y max>
<a> <b> <c> <d> <e> <f> <p>
<a> <b> <c> <d> <e> <f> <p>
<a> <b> <c> <d> <e> <f> <p>
.
.
.
```
This file describe an IFS.
@@ -123,20 +123,20 @@ This file describe an IFS.
One of the most well known would be the [Sierpinski Gasket](gasket):
```
3 0 0 1 1
.5 0 0 .5 0 0 .33
.5 0 0 .5 .5 0 .33
.5 0 0 .5 .25 .433 .34
3 0 0 1 1
.5 0 0 .5 0 0 .33
.5 0 0 .5 .5 0 .33
.5 0 0 .5 .25 .433 .34
```
or the [fern](fern):
```
4 -5.5 0 5.5 11
0 0 0 .16 0 0 .01
.85 .04 -.04 .85 0 1.6 .85
.2 -.26 .23 .22 0 1.6 .07
-.15 .28 .26 .24 0 .44 .07
4 -5.5 0 5.5 11
0 0 0 .16 0 0 .01
.85 .04 -.04 .85 0 1.6 .85
.2 -.26 .23 .22 0 1.6 .07
-.15 .28 .26 .24 0 .44 .07
```
etc...
@@ -158,8 +158,8 @@ The `a b c d e f` are used to iterative find points that lie in the IFS
from the algorithm
```
x = a * prevx + b * prevy + e;
y = c * prevx + d * prevy + f;
x = a * prevx + b * prevy + e;
y = c * prevx + d * prevy + f;
```
The `p` is for the probability that the equation will run.
+34 -35
View File
@@ -132,8 +132,7 @@
<h2 id="author"><a name="author"></a>Author:</h2>
<ul>
<li>Name: <a href="../../authors.html#Thomas_Stewart">Thomas Stewart</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,20 +141,20 @@ 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">./stewart</span> width_and_height iterations file <span class="op">&gt;</span> file.xbm</span>
<span id="cb2-2"><a href="#cb2-2" aria-hidden="true" tabindex="-1"></a><span class="ex">convert</span> file.xbm file.png</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">./stewart</span> width_and_height iterations file <span class="op">&gt;</span> file.xbm</span>
<span id="cb2-2"><a href="#cb2-2" aria-hidden="true" tabindex="-1"></a> <span class="ex">convert</span> file.xbm file.png</span></code></pre></div>
<p>where <code>file</code> is one of:</p>
<pre><code>altar box box2 box3 build carpet circles cross cross2 cross3
crystal curve diamonds diamonds2 dragon dragon2 dragon3
fern gasket gasket_mod gasket_mod2 ioccc maze octagon
pentagon pentagons rings rings2 spirals spirals2 spirals3
spirals4 squares stars stars2 tree tree2 tree3 tree4 triangle</code></pre>
<pre><code> altar box box2 box3 build carpet circles cross cross2 cross3
crystal curve diamonds diamonds2 dragon dragon2 dragon3
fern gasket gasket_mod gasket_mod2 ioccc maze octagon
pentagon pentagons rings rings2 spirals spirals2 spirals3
spirals4 squares stars stars2 tree tree2 tree3 tree4 triangle</code></pre>
<p>NOTE: you cannot specify a different width from height; it’s one number.</p>
<p>NOTE: <code>convert(1)</code> belongs to <a href="https://imagemagick.org/index.php">ImageMagick</a>.</p>
<h2 id="try">Try:</h2>
<div class="sourceCode" id="cb4"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb4-1"><a href="#cb4-1" aria-hidden="true" tabindex="-1"></a><span class="ex">./try.sh</span></span></code></pre></div>
<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>After running the program on a few files it will ask you if you wish to run it
on the remaining files.</p>
<p>The script will try converting the xbm files created by the program to png
@@ -172,17 +171,17 @@ a reasonably experienced user who can parse formats in their mind. :-)</p>
<h2 id="authors-remarks">Author’s remarks:</h2>
<h3 id="execution">Execution</h3>
<p>The program should be run with the following</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">./stewart</span> <span class="op">&lt;</span>m<span class="op">&gt;</span> <span class="op">&lt;</span>n<span class="op">&gt;</span> <span class="op">&lt;</span>ifs<span class="op">&gt;</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">./stewart</span> <span class="op">&lt;</span>m<span class="op">&gt;</span> <span class="op">&lt;</span>n<span class="op">&gt;</span> <span class="op">&lt;</span>ifs<span class="op">&gt;</span></span></code></pre></div>
<p>where:</p>
<pre><code>m = The size of the picture (picture will be m X m in size).
n = The number of iterations to run (More will make for a
clearer picture).
ifs = The file to use as input.</code></pre>
<pre><code> m = The size of the picture (picture will be m X m in size).
n = The number of iterations to run (More will make for a
clearer picture).
ifs = The file to use as input.</code></pre>
<p>The program will spit out an <a href="https://en.wikipedia.org/wiki/X_BitMap">XBM image</a>
on standard out. Minimal checking is done on the arguments mainly that there
are 3. Wrong arguments will cause the program to bomb out.</p>
<h4 id="example">Example:</h4>
<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">./stewart</span> 1024 1000000 gasket <span class="op">&gt;</span> gasket.xbm</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">./stewart</span> 1024 1000000 gasket <span class="op">&gt;</span> gasket.xbm</span></code></pre></div>
<h3 id="compilationtesting">Compilation/Testing</h3>
<p>The program compiles without warning with <code>gcc -ansi -Wall</code>.
<code>lint</code> also seems to like the code. This must be a bug in <code>lint</code>.</p>
@@ -200,25 +199,25 @@ another kind of fractal, those from the <a href="https://en.wikipedia.org/wiki/I
(IFS)</a>.</p>
<h3 id="input-file">Input File</h3>
<p>The format of the input file is as follows:</p>
<pre><code>&lt;num ifs&gt; &lt;x min&gt; &lt;y min&gt; &lt;x max&gt; &lt;y max&gt;
&lt;a&gt; &lt;b&gt; &lt;c&gt; &lt;d&gt; &lt;e&gt; &lt;f&gt; &lt;p&gt;
&lt;a&gt; &lt;b&gt; &lt;c&gt; &lt;d&gt; &lt;e&gt; &lt;f&gt; &lt;p&gt;
&lt;a&gt; &lt;b&gt; &lt;c&gt; &lt;d&gt; &lt;e&gt; &lt;f&gt; &lt;p&gt;
.
.
.</code></pre>
<pre><code> &lt;num ifs&gt; &lt;x min&gt; &lt;y min&gt; &lt;x max&gt; &lt;y max&gt;
&lt;a&gt; &lt;b&gt; &lt;c&gt; &lt;d&gt; &lt;e&gt; &lt;f&gt; &lt;p&gt;
&lt;a&gt; &lt;b&gt; &lt;c&gt; &lt;d&gt; &lt;e&gt; &lt;f&gt; &lt;p&gt;
&lt;a&gt; &lt;b&gt; &lt;c&gt; &lt;d&gt; &lt;e&gt; &lt;f&gt; &lt;p&gt;
.
.
.</code></pre>
<p>This file describe an IFS.</p>
<p>One of the most well known would be the <a href="gasket">Sierpinski Gasket</a>:</p>
<pre><code>3 0 0 1 1
.5 0 0 .5 0 0 .33
.5 0 0 .5 .5 0 .33
.5 0 0 .5 .25 .433 .34</code></pre>
<pre><code> 3 0 0 1 1
.5 0 0 .5 0 0 .33
.5 0 0 .5 .5 0 .33
.5 0 0 .5 .25 .433 .34</code></pre>
<p>or the <a href="fern">fern</a>:</p>
<pre><code>4 -5.5 0 5.5 11
0 0 0 .16 0 0 .01
.85 .04 -.04 .85 0 1.6 .85
.2 -.26 .23 .22 0 1.6 .07
-.15 .28 .26 .24 0 .44 .07</code></pre>
<pre><code> 4 -5.5 0 5.5 11
0 0 0 .16 0 0 .01
.85 .04 -.04 .85 0 1.6 .85
.2 -.26 .23 .22 0 1.6 .07
-.15 .28 .26 .24 0 .44 .07</code></pre>
<p>etc…</p>
<p>Included in my submission will be a tarball of some IFS files,
including one that attempts (not very well) to mimic the IOCCC logo
@@ -231,8 +230,8 @@ enough to condense it down to something that is coherent.</p>
in the XBM image file.</p>
<p>The <code>a b c d e f</code> are used to iterative find points that lie in the IFS
from the algorithm</p>
<pre><code>x = a * prevx + b * prevy + e;
y = c * prevx + d * prevy + f;</code></pre>
<pre><code> x = a * prevx + b * prevy + e;
y = c * prevx + d * prevy + f;</code></pre>
<p>The <code>p</code> is for the probability that the equation will run.</p>
<h3 id="obfuscations">Obfuscations</h3>
<p>The main obfuscation is using a <code>void *</code> as my only variable (aside from
+41 -41
View File
@@ -1,7 +1,7 @@
## To build:
```sh
make
make
```
There is an alt version based on the author's remarks. The [try.sh](try.sh)
@@ -14,7 +14,7 @@ specifically see the [Alternate code](#alternate-code) section 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 [2006 sykes1 bugs](../../bugs.html#2006_sykes1).
@@ -23,7 +23,7 @@ For more detailed information see [2006 sykes1 bugs](../../bugs.html#2006_sykes1
## To use:
```sh
./sykes1
./sykes1
```
Next point your browser to the file: `sykes1.html`.
@@ -32,7 +32,7 @@ Next point your browser to the file: `sykes1.html`.
## Try:
```sh
./sykes1 10
./sykes1 10
```
Refresh your browser.
@@ -40,7 +40,7 @@ Refresh your browser.
You might also try:
```sh
./try.sh
./try.sh
```
This will run both the original entry and the alt code to show some differences.
@@ -53,24 +53,24 @@ maximum:
```sh
time ./sykes1 19186
time ./sykes1 19186
```
This was done on a Rocky Linux 9.2 server with `Intel(R) Core(TM) i9-9900K CPU @
3.60GHz` with 16 cores (via HyperThreading):
```
real 6m35.524s
user 6m35.159s
sys 0m0.002s
real 6m35.524s
user 6m35.159s
sys 0m0.002s
```
and done with macOS Sonoma with the Max M1 chip:
```
real 7m10.786s
user 7m8.322s
sys 0m0.110s
real 7m10.786s
user 7m8.322s
sys 0m0.110s
```
@@ -82,7 +82,7 @@ This alternate code is based on the author's remarks.
### Alternate build:
```sh
make alt
make alt
```
@@ -97,7 +97,7 @@ The [try.sh](try.sh) script will use both versions to show some differences. You
can do so like:
```sh
./try.sh
./try.sh
```
@@ -107,7 +107,7 @@ Read the [sykes1.html](sykes1.html) page source.
Now then read the C source. Confused? :-) If it's not clear try:
```sh
diff -s sykes1.c sykes1.html
diff -s sykes1.c sykes1.html
```
For extra credit, understand what happens when you give this entry
@@ -139,7 +139,7 @@ need to be very lucky indeed to stumble across a solution.
Compile the program, then test that it works:
```sh
./sykes1
./sykes1
```
Shortly you should see the first solution pop out on your screen. It
@@ -155,7 +155,7 @@ cube. Rendered in glorious 3D color.
Want to see another solution? Try:
```sh
./sykes1 some_number
./sykes1 some_number
```
The program will discard solutions up to the number, and output numbered
@@ -166,7 +166,7 @@ Try some more - there are exactly `19186` solutions to choose from.
If you have a fast machine you might try the last solution:
```sh
./sykes1 19186
./sykes1 19186
```
On my machine this takes about half an hour to run.
@@ -179,9 +179,9 @@ the pieces into the cube one by one. The cube pieces are defined near
the start of the program:
```c
int s[ ] = { 186, 94, 1426, 3098
,1047 , 122 , 1082 , 3083 , 1039
, 569 , 527 , 1054 , 531 } ;
int s[ ] = { 186, 94, 1426, 3098
,1047 , 122 , 1082 , 3083 , 1039
, 569 , 527 , 1054 , 531 } ;
```
Each piece is a bitmap, and represents a 3x3x3 cube.
@@ -190,38 +190,38 @@ For instance the first piece is `186` - this is `010111010` in binary.
Written out like this you can see that it is the cross shaped piece:
```
010
111
010
010
111
010
```
The other pieces are defined similarly. Most of the rest require more
than one layer, such as piece 3 (`1426`):
```
000
000
010
000
000
010
110
010
010
110
010
010
```
Imagine the two layers on top of each other, and you should see this
shape:
```
+---------+
/ +----+ /|
+-/ /| / |
|+----+ |/ +
|| | + /
+| | /
| | /
| | /
| |/
+----+
+---------+
/ +----+ /|
+-/ /| / |
|+----+ |/ +
|| | + /
+| | /
| | /
| | /
| |/
+----+
```
@@ -234,7 +234,7 @@ For example, if you modify line 13 of the source like this, the program
will solve for a different piece set:
```c
int s[ ] = { 187, 94, 402, 3098
int s[ ] = { 187, 94, 402, 3098
```
And of course you can make your own.
+42 -43
View File
@@ -132,8 +132,7 @@
<h2 id="author"><a name="author"></a>Author:</h2>
<ul>
<li>Name: <a href="../../authors.html#Stephen_Sykes">Stephen Sykes</a><br>
Location: <a href="../../location.html#FI">FI</a> - <em>Republic of Finland </em> (<em>Finland</em>)
<br><br></li>
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,49 +141,49 @@ 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>
<p>There is an alt version based on the author’s remarks. The <a href="try.sh">try.sh</a>
script will compile and use both but if you wish to see the alternate version
specifically see the <a href="#alternate-code">Alternate code</a> section 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#2006_sykes1">2006 sykes1 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">./sykes1</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">./sykes1</span></span></code></pre></div>
<p>Next point your browser to the file: <code>sykes1.html</code>.</p>
<h2 id="try">Try:</h2>
<div class="sourceCode" id="cb4"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb4-1"><a href="#cb4-1" aria-hidden="true" tabindex="-1"></a><span class="ex">./sykes1</span> 10</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">./sykes1</span> 10</span></code></pre></div>
<p>Refresh your browser.</p>
<p>You might also 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">./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>This will run both the original entry and the alt code to show some differences.</p>
<h3 id="also-try">Also try:</h3>
<p>If you have all day :-) and wish to find out how fast your machine can solve the
maximum:</p>
<div class="sourceCode" id="cb6"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb6-1"><a href="#cb6-1" aria-hidden="true" tabindex="-1"></a><span class="bu">time</span> ./sykes1 19186</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="bu">time</span> ./sykes1 19186</span></code></pre></div>
<p>This was done on a Rocky Linux 9.2 server with <code>Intel(R) Core(TM) i9-9900K CPU @ 3.60GHz</code> with 16 cores (via HyperThreading):</p>
<pre><code>real 6m35.524s
user 6m35.159s
sys 0m0.002s</code></pre>
<pre><code> real 6m35.524s
user 6m35.159s
sys 0m0.002s</code></pre>
<p>and done with macOS Sonoma with the Max M1 chip:</p>
<pre><code>real 7m10.786s
user 7m8.322s
sys 0m0.110s</code></pre>
<pre><code> real 7m10.786s
user 7m8.322s
sys 0m0.110s</code></pre>
<h2 id="alternate-code">Alternate code:</h2>
<p>This alternate code is based on the author’s remarks.</p>
<h3 id="alternate-build">Alternate build:</h3>
<div class="sourceCode" id="cb9"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb9-1"><a href="#cb9-1" aria-hidden="true" tabindex="-1"></a><span class="fu">make</span> alt</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">make</span> alt</span></code></pre></div>
<h3 id="alternate-use">Alternate use:</h3>
<p>Use <code>sykes1.alt</code> as you would <code>sykes1</code> above.</p>
<h3 id="alternate-try">Alternate try:</h3>
<p>The <a href="try.sh">try.sh</a> script will use both versions to show some differences. You
can do so like:</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">./try.sh</span></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">./try.sh</span></span></code></pre></div>
<h2 id="judges-remarks">Judges’ remarks:</h2>
<p>Read the <a href="sykes1.html">sykes1.html</a> page source.
Now then read the C source. Confused? :-) If it’s not clear try:</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">diff</span> <span class="at">-s</span> sykes1.c sykes1.html</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">diff</span> <span class="at">-s</span> sykes1.c sykes1.html</span></code></pre></div>
<p>For extra credit, understand what happens when you give this entry
an negative number argument, and why.</p>
<p>See the author’s remarks for how to make your own shapes as well.</p>
@@ -201,7 +200,7 @@ together. I have not known anyone to solve it in this way - you would
need to be very lucky indeed to stumble across a solution.</p>
<h3 id="instructions">Instructions</h3>
<p>Compile the program, then test that it works:</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">./sykes1</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="ex">./sykes1</span></span></code></pre></div>
<p>Shortly you should see the first solution pop out on your screen. It
shows you how to build the cube piece by piece, rendered in glorious
3D ASCII.</p>
@@ -211,53 +210,53 @@ open the file <a href="sykes1.html">sykes1.html</a>. This html file is just a co
the browser display for you a nice animated GIF, showing you how to build the
cube. Rendered in glorious 3D color.</p>
<p>Want to see another solution? Try:</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">./sykes1</span> some_number</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">./sykes1</span> some_number</span></code></pre></div>
<p>The program will discard solutions up to the number, and output numbered
solution. Refresh your browser window to see the new solution.</p>
<p>Try some more - there are exactly <code>19186</code> solutions to choose from.</p>
<p>If you have a fast machine you might try the last solution:</p>
<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">./sykes1</span> 19186</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">./sykes1</span> 19186</span></code></pre></div>
<p>On my machine this takes about half an hour to run.</p>
<h3 id="implementation">Implementation</h3>
<p>The implementation is an optimized recursive algorithm that tries to fit
the pieces into the cube one by one. The cube pieces are defined near
the start of the program:</p>
<div class="sourceCode" id="cb15"><pre class="sourceCode c"><code class="sourceCode c"><span id="cb15-1"><a href="#cb15-1" aria-hidden="true" tabindex="-1"></a><span class="dt">int</span> s<span class="op">[</span> <span class="op">]</span> <span class="op">=</span> <span class="op">{</span> <span class="dv">186</span><span class="op">,</span> <span class="dv">94</span><span class="op">,</span> <span class="dv">1426</span><span class="op">,</span> <span class="dv">3098</span></span>
<span id="cb15-2"><a href="#cb15-2" aria-hidden="true" tabindex="-1"></a> <span class="op">,</span><span class="dv">1047</span> <span class="op">,</span> <span class="dv">122</span> <span class="op">,</span> <span class="dv">1082</span> <span class="op">,</span> <span class="dv">3083</span> <span class="op">,</span> <span class="dv">1039</span></span>
<span id="cb15-3"><a href="#cb15-3" aria-hidden="true" tabindex="-1"></a> <span class="op">,</span> <span class="dv">569</span> <span class="op">,</span> <span class="dv">527</span> <span class="op">,</span> <span class="dv">1054</span> <span class="op">,</span> <span class="dv">531</span> <span class="op">}</span> <span class="op">;</span></span></code></pre></div>
<div class="sourceCode" id="cb15"><pre class="sourceCode c"><code class="sourceCode c"><span id="cb15-1"><a href="#cb15-1" aria-hidden="true" tabindex="-1"></a> <span class="dt">int</span> s<span class="op">[</span> <span class="op">]</span> <span class="op">=</span> <span class="op">{</span> <span class="dv">186</span><span class="op">,</span> <span class="dv">94</span><span class="op">,</span> <span class="dv">1426</span><span class="op">,</span> <span class="dv">3098</span></span>
<span id="cb15-2"><a href="#cb15-2" aria-hidden="true" tabindex="-1"></a> <span class="op">,</span><span class="dv">1047</span> <span class="op">,</span> <span class="dv">122</span> <span class="op">,</span> <span class="dv">1082</span> <span class="op">,</span> <span class="dv">3083</span> <span class="op">,</span> <span class="dv">1039</span></span>
<span id="cb15-3"><a href="#cb15-3" aria-hidden="true" tabindex="-1"></a> <span class="op">,</span> <span class="dv">569</span> <span class="op">,</span> <span class="dv">527</span> <span class="op">,</span> <span class="dv">1054</span> <span class="op">,</span> <span class="dv">531</span> <span class="op">}</span> <span class="op">;</span></span></code></pre></div>
<p>Each piece is a bitmap, and represents a 3x3x3 cube.</p>
<p>For instance the first piece is <code>186</code> - this is <code>010111010</code> in binary.
Written out like this you can see that it is the cross shaped piece:</p>
<pre><code>010
111
010</code></pre>
<pre><code> 010
111
010</code></pre>
<p>The other pieces are defined similarly. Most of the rest require more
than one layer, such as piece 3 (<code>1426</code>):</p>
<pre><code>000
000
010
<pre><code> 000
000
010
110
010
010</code></pre>
110
010
010</code></pre>
<p>Imagine the two layers on top of each other, and you should see this
shape:</p>
<pre><code> +---------+
/ +----+ /|
+-/ /| / |
|+----+ |/ +
|| | + /
+| | /
| | /
| | /
| |/
+----+</code></pre>
<pre><code> +---------+
/ +----+ /|
+-/ /| / |
|+----+ |/ +
|| | + /
+| | /
| | /
| | /
| |/
+----+</code></pre>
<h3 id="making-your-own-shapes">Making your own shapes</h3>
<p>The program is in fact a general solver - you can change the shape of
the pieces, and provided that a solution is possible, it will be found.</p>
<p>For example, if you modify line 13 of the source like this, the program
will solve for a different piece set:</p>
<div class="sourceCode" id="cb19"><pre class="sourceCode c"><code class="sourceCode c"><span id="cb19-1"><a href="#cb19-1" aria-hidden="true" tabindex="-1"></a><span class="dt">int</span> s<span class="op">[</span> <span class="op">]</span> <span class="op">=</span> <span class="op">{</span> <span class="dv">187</span><span class="op">,</span> <span class="dv">94</span><span class="op">,</span> <span class="dv">402</span><span class="op">,</span> <span class="dv">3098</span></span></code></pre></div>
<div class="sourceCode" id="cb19"><pre class="sourceCode c"><code class="sourceCode c"><span id="cb19-1"><a href="#cb19-1" aria-hidden="true" tabindex="-1"></a> <span class="dt">int</span> s<span class="op">[</span> <span class="op">]</span> <span class="op">=</span> <span class="op">{</span> <span class="dv">187</span><span class="op">,</span> <span class="dv">94</span><span class="op">,</span> <span class="dv">402</span><span class="op">,</span> <span class="dv">3098</span></span></code></pre></div>
<p>And of course you can make your own.</p>
<p>After the pieces are defined, the first thing the program does it to
fit them into a 4x4 cube. It collects every possible placing of each
+3 -3
View File
@@ -1,21 +1,21 @@
## To build:
```sh
make
make
```
## To use:
```sh
./sykes2
./sykes2
```
## Try:
```sh
./try.sh
./try.sh
```
This will repeatedly remake the program and run it then sleep for one second for
+4 -5
View File
@@ -132,8 +132,7 @@
<h2 id="author"><a name="author"></a>Author:</h2>
<ul>
<li>Name: <a href="../../authors.html#Stephen_Sykes">Stephen Sykes</a><br>
Location: <a href="../../location.html#FI">FI</a> - <em>Republic of Finland </em> (<em>Finland</em>)
<br><br></li>
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,11 +141,11 @@ 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>
<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">./sykes2</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">./sykes2</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>This will repeatedly remake the program and run it then sleep for one second for
a nice show of time.</p>
<h2 id="judges-comments">Judges’ Comments:</h2>
+8 -8
View File
@@ -1,14 +1,14 @@
## To build:
```sh
make
make
```
## To use:
```sh
./toledo1 [0-9][0-9]
./toledo1 [0-9][0-9]
```
where `[0-9][0-9]` is a two digit number.
@@ -17,7 +17,7 @@ where `[0-9][0-9]` is a two digit number.
## Try:
```sh
./try.sh
./try.sh
```
@@ -39,11 +39,11 @@ If not, this program does it, just run it with an argument
giving initial position.
```sh
./toledo1 11 # start is A8
./toledo1 18 # start is H8
./toledo1 81 # start is A1
./toledo1 88 # start is H1
./toledo1 44 # start is D5
./toledo1 11 # start is A8
./toledo1 18 # start is H8
./toledo1 81 # start is A1
./toledo1 88 # start is H1
./toledo1 44 # start is D5
```
It will print move order. The algorithm is so simple that you can read
+9 -10
View File
@@ -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 -->
@@ -142,12 +141,12 @@ Location: <a href="../../location.html#MX">MX</a> - <em>United Mexican States</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="ex">./toledo1</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="ss">0</span><span class="pp">-</span><span class="ss">9</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">./toledo1</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="ss">0</span><span class="pp">-</span><span class="ss">9</span><span class="pp">]</span></span></code></pre></div>
<p>where <code>[0-9][0-9]</code> is a two digit number.</p>
<h2 id="try">Try:</h2>
<div class="sourceCode" id="cb3"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb3-1"><a href="#cb3-1" aria-hidden="true" tabindex="-1"></a><span class="ex">./try.sh</span></span></code></pre></div>
<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>For most of the arguments (e.g. those above) the resulting path
is not circular, but at least one starting point yields a circular path.</p>
@@ -158,11 +157,11 @@ be expected, and some dump core?</p>
visit the 64 squares without repeating them?</p>
<p>If not, this program does it, just run it with an argument
giving initial position.</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">./toledo1</span> 11 <span class="co"># start is A8</span></span>
<span id="cb4-2"><a href="#cb4-2" aria-hidden="true" tabindex="-1"></a><span class="ex">./toledo1</span> 18 <span class="co"># start is H8</span></span>
<span id="cb4-3"><a href="#cb4-3" aria-hidden="true" tabindex="-1"></a><span class="ex">./toledo1</span> 81 <span class="co"># start is A1</span></span>
<span id="cb4-4"><a href="#cb4-4" aria-hidden="true" tabindex="-1"></a><span class="ex">./toledo1</span> 88 <span class="co"># start is H1</span></span>
<span id="cb4-5"><a href="#cb4-5" aria-hidden="true" tabindex="-1"></a><span class="ex">./toledo1</span> 44 <span class="co"># start is D5</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">./toledo1</span> 11 <span class="co"># start is A8</span></span>
<span id="cb4-2"><a href="#cb4-2" aria-hidden="true" tabindex="-1"></a> <span class="ex">./toledo1</span> 18 <span class="co"># start is H8</span></span>
<span id="cb4-3"><a href="#cb4-3" aria-hidden="true" tabindex="-1"></a> <span class="ex">./toledo1</span> 81 <span class="co"># start is A1</span></span>
<span id="cb4-4"><a href="#cb4-4" aria-hidden="true" tabindex="-1"></a> <span class="ex">./toledo1</span> 88 <span class="co"># start is H1</span></span>
<span id="cb4-5"><a href="#cb4-5" aria-hidden="true" tabindex="-1"></a> <span class="ex">./toledo1</span> 44 <span class="co"># start is D5</span></span></code></pre></div>
<p>It will print move order. The algorithm is so simple that you can read
it in the source code. At the first glance it can appear checkered.
Nevertheless, don’t be dismayed, jar, jar. :-)</p>
+43 -44
View File
@@ -1,7 +1,7 @@
## To build:
```sh
make
make
```
There is [alternate code](#alternate-code) that is based on the author's notes
@@ -14,7 +14,7 @@ that it should be fine, after the proper header files were added.
The current status of this entry is:
```
STATUS: INABIAF - please **DO NOT** fix
STATUS: INABIAF - please **DO NOT** fix
```
For more detailed information see [2006 toledo2 bugs](../../bugs.html#2006_toledo2).
@@ -23,7 +23,7 @@ For more detailed information see [2006 toledo2 bugs](../../bugs.html#2006_toled
## To use:
```sh
./toledo2
./toledo2
```
To end execution press `ctrl-z`. As mentioned in the author's remarks and in the
@@ -34,16 +34,15 @@ does not seem to happen in macOS or linux in 2023.
## Try:
```sh
./toledo2
./toledo2
```
and then type in the following:
```
10 PRINT "HELLO WORLD!"
LIST
RUN
10 PRINT "HELLO WORLD!"
LIST
RUN
```
To end the program hit ctrl-z.
@@ -58,7 +57,7 @@ functions in place of `read(2)` and `write(2)`.
### Alternate build:
```sh
make alt
make alt
```
@@ -114,21 +113,21 @@ Type using uppercase letters. Here are three example programs. Press Enter after
each line:
```basic
10 PRINT "Hello, world!"
LIST
RUN
10 PRINT "Hello, world!"
LIST
RUN
10 FOR A=1 TO 10
20 PRINT A\
30 NEXT A\
LIST\
RUN
10 FOR A=1 TO 10
20 PRINT A\
30 NEXT A\
LIST\
RUN
10 INPUT A
20 INPUT B
30 PRINT A+B
LIST
RUN
10 INPUT A
20 INPUT B
30 PRINT A+B
LIST
RUN
```
Press Ctrl+Z to quit. By the way, the segmentation fault is
@@ -157,13 +156,13 @@ To import them, you must run the emulator with an argument, by
example:
```sh
./toledo2 DDT.COM
./toledo2 DDT.COM
```
When the `>` prompt appears, do:
```
IMPORT DDT.COM
IMPORT DDT.COM
```
When it ends, do `HALT`, so the file is closed, and you can start
@@ -197,9 +196,9 @@ It is easy if your platform has `getch()`/`kbhit()` and
ANSI terminal:
```
read --> Z=kbhit()?getch():0
write --> putchar(7[o])
system --> nothing
read --> Z=kbhit()?getch():0
write --> putchar(7[o])
system --> nothing
```
@@ -232,33 +231,33 @@ separates them in one of three common forms. A lot of ternary operators selects
the instruction.
```
o[0] = B register o[1] = C register
o[2] = D register o[3] = E register
o[4] = H register o[5] = L register
o[6] = Flags o[7] = A or accumulator
o[0] = B register o[1] = C register
o[2] = D register o[3] = E register
o[4] = H register o[5] = L register
o[6] = Flags o[7] = A or accumulator
```
The following instructions do peripheral operation:
```
76 Quits emulator
DB 00 Reads key pressed status
DB 01 Reads key
DB 02 Reads byte from file (Carry=EOF)
D3 xx Writes byte from acc. to console
ED ED 02 Reads sector
ED ED 03 Writes sector
76 Quits emulator
DB 00 Reads key pressed status
DB 01 Reads key
DB 02 Reads byte from file (Carry=EOF)
D3 xx Writes byte from acc. to console
ED ED 02 Reads sector
ED ED 03 Writes sector
```
Memory addresses:
```
FBFA = Low source/target direction
FBFB - High source/target direction
FBFC - Sector
FBFD - Low cylinder
FBFE - High cylinder
FBFF - Drive.
FBFA = Low source/target direction
FBFB - High source/target direction
FBFC - Sector
FBFD - Low cylinder
FBFE - High cylinder
FBFF - Drive.
```
The BIOS is tailor made for this emulator, and helps to simplify it.
+44 -45
View File
@@ -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 -->
@@ -142,31 +141,31 @@ Location: <a href="../../location.html#MX">MX</a> - <em>United Mexican States</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>
<p>There is <a href="#alternate-code">alternate code</a> that is based on the author’s notes
for DOS/Windows. This cannot be tested by us, not even to compile, but it appears
that it should be fine, after the proper header files were added.</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#2006_toledo2">2006 toledo2 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">./toledo2</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">./toledo2</span></span></code></pre></div>
<p>To end execution press <code>ctrl-z</code>. As mentioned in the author’s remarks and in the
below section, it is supposed to crash on termination though some noted this
does not seem to happen in macOS or linux in 2023.</p>
<h2 id="try">Try:</h2>
<div class="sourceCode" id="cb4"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb4-1"><a href="#cb4-1" aria-hidden="true" tabindex="-1"></a><span class="ex">./toledo2</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">./toledo2</span></span></code></pre></div>
<p>and then type in the following:</p>
<pre><code>10 PRINT &quot;HELLO WORLD!&quot;
LIST
RUN</code></pre>
<pre><code> 10 PRINT &quot;HELLO WORLD!&quot;
LIST
RUN</code></pre>
<p>To end the program hit ctrl-z.</p>
<h2 id="alternate-code">Alternate code:</h2>
<p>This version, as noted, should work for DOS/Windows. It uses non-standard
functions in place of <code>read(2)</code> and <code>write(2)</code>.</p>
<h3 id="alternate-build">Alternate build:</h3>
<div class="sourceCode" id="cb6"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb6-1"><a href="#cb6-1" aria-hidden="true" tabindex="-1"></a><span class="fu">make</span> alt</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">make</span> alt</span></code></pre></div>
<h3 id="alternate-use">Alternate use:</h3>
<p>The author noted that for PC/DOS you will have to add <code>ANSI.SYS</code> to your
<code>CONFIG.SYS</code> but this is also something we can’t test.</p>
@@ -204,21 +203,21 @@ the very first volume of <a href="https://en.wikipedia.org/wiki/Dr._Dobb%27s_Jou
Journal</a>.</p>
<p>Type using uppercase letters. Here are three example programs. Press Enter after
each line:</p>
<pre class="basic"><code>10 PRINT &quot;Hello, world!&quot;
LIST
RUN
<pre class="basic"><code> 10 PRINT &quot;Hello, world!&quot;
LIST
RUN
10 FOR A=1 TO 10
20 PRINT A\
30 NEXT A\
LIST\
RUN
10 FOR A=1 TO 10
20 PRINT A\
30 NEXT A\
LIST\
RUN
10 INPUT A
20 INPUT B
30 PRINT A+B
LIST
RUN</code></pre>
10 INPUT A
20 INPUT B
30 PRINT A+B
LIST
RUN</code></pre>
<p>Press Ctrl+Z to quit. By the way, the segmentation fault is
normal at this point.</p>
<p>All good programmers started learning
@@ -237,9 +236,9 @@ from the <code>SOURCE</code> directory:</p>
PIP.COM STAT.COM SUBMIT.COM XSUB.COM</code></pre>
<p>To import them, you must run the emulator with an argument, by
example:</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">./toledo2</span> DDT.COM</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">./toledo2</span> DDT.COM</span></code></pre></div>
<p>When the <code>&gt;</code> prompt appears, do:</p>
<pre><code>IMPORT DDT.COM</code></pre>
<pre><code> IMPORT DDT.COM</code></pre>
<p>When it ends, do <code>HALT</code>, so the file is closed, and you can start
the same process with another file.</p>
<p>At this time I have tested successfully the following software
@@ -261,9 +260,9 @@ bit 2) and <code>C</code> (Carry, bit 0).</p>
<h3 id="porting-it">Porting it</h3>
<p>It is easy if your platform has <code>getch()</code>/<code>kbhit()</code> and
ANSI terminal:</p>
<pre><code>read --&gt; Z=kbhit()?getch():0
write --&gt; putchar(7[o])
system --&gt; nothing</code></pre>
<pre><code> read --&gt; Z=kbhit()?getch():0
write --&gt; putchar(7[o])
system --&gt; nothing</code></pre>
<p>Notice that you’ll have to do <code>#include &lt;conio.h&gt;</code> as well.</p>
<p>Also add the following to trap Ctrl-C:</p>
<pre><code>#include &lt;signal.h&gt;
@@ -282,25 +281,25 @@ counter</a> is the <code>c</code> pointer and
main loop reads every <a href="https://en.wikipedia.org/wiki/Opcode">opcode</a> and
separates them in one of three common forms. A lot of ternary operators selects
the instruction.</p>
<pre><code>o[0] = B register o[1] = C register
o[2] = D register o[3] = E register
o[4] = H register o[5] = L register
o[6] = Flags o[7] = A or accumulator</code></pre>
<pre><code> o[0] = B register o[1] = C register
o[2] = D register o[3] = E register
o[4] = H register o[5] = L register
o[6] = Flags o[7] = A or accumulator</code></pre>
<p>The following instructions do peripheral operation:</p>
<pre><code>76 Quits emulator
DB 00 Reads key pressed status
DB 01 Reads key
DB 02 Reads byte from file (Carry=EOF)
D3 xx Writes byte from acc. to console
ED ED 02 Reads sector
ED ED 03 Writes sector</code></pre>
<pre><code> 76 Quits emulator
DB 00 Reads key pressed status
DB 01 Reads key
DB 02 Reads byte from file (Carry=EOF)
D3 xx Writes byte from acc. to console
ED ED 02 Reads sector
ED ED 03 Writes sector</code></pre>
<p>Memory addresses:</p>
<pre><code>FBFA = Low source/target direction
FBFB - High source/target direction
FBFC - Sector
FBFD - Low cylinder
FBFE - High cylinder
FBFF - Drive.</code></pre>
<pre><code> FBFA = Low source/target direction
FBFB - High source/target direction
FBFC - Sector
FBFD - Low cylinder
FBFE - High cylinder
FBFF - Drive.</code></pre>
<p>The BIOS is tailor made for this emulator, and helps to simplify it.</p>
<h3 id="other-notes">Other notes</h3>
<ul>
+11 -11
View File
@@ -1,7 +1,7 @@
## To build:
```sh
make
make
```
The author provided two alternate versions, one which adds a status bar and
@@ -12,14 +12,14 @@ tested with Windows. See [alternate code](#alternate-code) below.
## To use:
```sh
./toledo3 [1 | 2 | 3 [b]]
./toledo3 [1 | 2 | 3 [b]]
```
## Try:
```sh
./toledo3 1
./toledo3 1
```
@@ -63,13 +63,13 @@ Is An IOCCC Entry'). Pointing and clicking to move pieces is the only required
action, and of course the command-line options:
```sh
./toledo3 # Two-players mode (useful if you don't have a board at hand)
./toledo3 1 # Human white - Computer black, level 1 (fast)
./toledo3 2 # Human white - Computer black, level 2 (medium)
./toledo3 3 # Human white - Computer black, level 3 (slow)
./toledo3 1 b # Human black - Computer white, level 1 (fast)
./toledo3 2 b # Human black - Computer white, level 2 (medium)
./toledo3 3 b # Human black - Computer white, level 3 (slow)
./toledo3 # Two-players mode (useful if you don't have a board at hand)
./toledo3 1 # Human white - Computer black, level 1 (fast)
./toledo3 2 # Human white - Computer black, level 2 (medium)
./toledo3 3 # Human white - Computer black, level 3 (slow)
./toledo3 1 b # Human black - Computer white, level 1 (fast)
./toledo3 2 b # Human black - Computer white, level 2 (medium)
./toledo3 3 b # Human black - Computer white, level 3 (slow)
```
The computer will check that your moves are legal. Full legal
@@ -98,7 +98,7 @@ Because it is resource-hungry, I strongly recommend to compile it
using maximum optimization. With GCC you can use:
```sh
gcc -O3 -fexpensive-optimizations prog.c -o prog -lX11
gcc -O3 -fexpensive-optimizations prog.c -o prog -lX11
```
### KNOWN "FEATURES"
+12 -13
View File
@@ -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 -->
@@ -142,14 +141,14 @@ Location: <a href="../../location.html#MX">MX</a> - <em>United Mexican States</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>
<p>The author provided two alternate versions, one which adds a status bar and
another that makes it text only. The author also provided a version that they
tested with Windows. 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">./toledo3</span> [1 <span class="kw">|</span> <span class="ex">2</span> <span class="kw">|</span> <span class="ex">3</span> <span class="pp">[</span><span class="ss">b</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">./toledo3</span> [1 <span class="kw">|</span> <span class="ex">2</span> <span class="kw">|</span> <span class="ex">3</span> <span class="pp">[</span><span class="ss">b</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">./toledo3</span> 1</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">./toledo3</span> 1</span></code></pre></div>
<h2 id="alternate-code">Alternate code:</h2>
<p>The author provided two additional versions, <a href="toledo3-sbar.c">toledo3-sbar.c</a>
and <a href="toledo3-txt.c">toledo3-txt.c</a>. Respectively these create a status bar and
@@ -173,13 +172,13 @@ the code for Deep Blue.</p>
<p>So I managed to do a graphical X11 chess program (‘<code>WYSIAIE</code>’, or ‘What You See
Is An IOCCC Entry’). Pointing and clicking to move pieces is the only required
action, and of course the command-line options:</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">./toledo3</span> <span class="co"># Two-players mode (useful if you don&#39;t have a board at hand)</span></span>
<span id="cb4-2"><a href="#cb4-2" aria-hidden="true" tabindex="-1"></a><span class="ex">./toledo3</span> 1 <span class="co"># Human white - Computer black, level 1 (fast)</span></span>
<span id="cb4-3"><a href="#cb4-3" aria-hidden="true" tabindex="-1"></a><span class="ex">./toledo3</span> 2 <span class="co"># Human white - Computer black, level 2 (medium)</span></span>
<span id="cb4-4"><a href="#cb4-4" aria-hidden="true" tabindex="-1"></a><span class="ex">./toledo3</span> 3 <span class="co"># Human white - Computer black, level 3 (slow)</span></span>
<span id="cb4-5"><a href="#cb4-5" aria-hidden="true" tabindex="-1"></a><span class="ex">./toledo3</span> 1 b <span class="co"># Human black - Computer white, level 1 (fast)</span></span>
<span id="cb4-6"><a href="#cb4-6" aria-hidden="true" tabindex="-1"></a><span class="ex">./toledo3</span> 2 b <span class="co"># Human black - Computer white, level 2 (medium)</span></span>
<span id="cb4-7"><a href="#cb4-7" aria-hidden="true" tabindex="-1"></a><span class="ex">./toledo3</span> 3 b <span class="co"># Human black - Computer white, level 3 (slow)</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">./toledo3</span> <span class="co"># Two-players mode (useful if you don&#39;t have a board at hand)</span></span>
<span id="cb4-2"><a href="#cb4-2" aria-hidden="true" tabindex="-1"></a> <span class="ex">./toledo3</span> 1 <span class="co"># Human white - Computer black, level 1 (fast)</span></span>
<span id="cb4-3"><a href="#cb4-3" aria-hidden="true" tabindex="-1"></a> <span class="ex">./toledo3</span> 2 <span class="co"># Human white - Computer black, level 2 (medium)</span></span>
<span id="cb4-4"><a href="#cb4-4" aria-hidden="true" tabindex="-1"></a> <span class="ex">./toledo3</span> 3 <span class="co"># Human white - Computer black, level 3 (slow)</span></span>
<span id="cb4-5"><a href="#cb4-5" aria-hidden="true" tabindex="-1"></a> <span class="ex">./toledo3</span> 1 b <span class="co"># Human black - Computer white, level 1 (fast)</span></span>
<span id="cb4-6"><a href="#cb4-6" aria-hidden="true" tabindex="-1"></a> <span class="ex">./toledo3</span> 2 b <span class="co"># Human black - Computer white, level 2 (medium)</span></span>
<span id="cb4-7"><a href="#cb4-7" aria-hidden="true" tabindex="-1"></a> <span class="ex">./toledo3</span> 3 b <span class="co"># Human black - Computer white, level 3 (slow)</span></span></code></pre></div>
<p>The computer will check that your moves are legal. Full legal
chess moves are allowed, except minor promotions on human side.</p>
<p>The game will continue up to its logical conclusion, you make
@@ -197,7 +196,7 @@ optimizations use valuable IOCCC characters.</p>
number generator.</p>
<p>Because it is resource-hungry, I strongly recommend to compile it
using maximum optimization. With GCC you can use:</p>
<div class="sourceCode" id="cb5"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb5-1"><a href="#cb5-1" aria-hidden="true" tabindex="-1"></a><span class="fu">gcc</span> <span class="at">-O3</span> <span class="at">-fexpensive-optimizations</span> prog.c <span class="at">-o</span> prog <span class="at">-lX11</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="fu">gcc</span> <span class="at">-O3</span> <span class="at">-fexpensive-optimizations</span> prog.c <span class="at">-o</span> prog <span class="at">-lX11</span></span></code></pre></div>
<h3 id="known-features">KNOWN “FEATURES”</h3>
<ol type="1">
<li><p>Because this is my second X11 program (the first was