add hack-a-round for language specified markdown code blocks

When language is specified in a markdown code block such as:

````
```c
    printf("Hello, world!\n");
```
````

is used, the resulting HTML as produced by `pandoc(1)` combined
with our revised `ioccc.css` is not intent the code block well.

A temporary "_hack-a-round_" is to turn the "markdown code language
specifier" into an HTML comment.  For example:

````
```<!---c-->
    printf("Hello, world!\n");
```
````

This commits turns off existing markdown code language specifiers
for now, while preserving our ability to restore them in the future
when a better  "_hack-a-round_" to the "markdown code language
specifier" problem is found.

The HTML impact if this "_hack-a-round_" is to produce HTML that
looks like this:

```
<pre class="&lt;!---c--&gt;"><code> .. </code></pre>
```

We might be able to create a complex set of classes for each markdown
code language (there won't be very many) in `ioccc.css`, or we might
find a more general CSS (or maybe `pandoc(1)`?) solution.

For now, this hack-a-round will have to do.
This commit is contained in:
Landon Curt Noll committed 2024-04-04 14:50:38 -07:00
1 parent 3919df50fb
commit b66c79254a
700 files changed
+7052 -7056

No files matched your search

+4 -4
View File
@@ -1,13 +1,13 @@
## To build:
```sh
```<!---sh-->
make all
```
## To use:
```sh
```<!---sh-->
./anonymous
```
@@ -22,7 +22,7 @@ as the alternate code. See below for the tattoo side-by-side with the code.
### Alternate build:
```sh
```<!---sh-->
make alt
```
@@ -31,7 +31,7 @@ as the alternate code. See below for the tattoo side-by-side with the code.
NOTE: this version might not work on some systems like macOS.
```sh
```<!---sh-->
./anonymous.alt
```
+4 -4
View File
@@ -141,19 +141,19 @@ 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> all</span></code></pre></div>
<pre class="&lt;!---sh--&gt;"><code> make all</code></pre>
<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">./anonymous</span></span></code></pre></div>
<pre class="&lt;!---sh--&gt;"><code> ./anonymous</code></pre>
<h2 id="alternate-code">Alternate code:</h2>
<p>The original version of this entry was added, by request,
in order to show the code that was turned into the
<a href="https://web.archive.org/web/20070120220721/https://thomasscovell.com/tattoo.php">tattoo</a>,
as the alternate code. See below for the tattoo side-by-side with the code.</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>
<pre class="&lt;!---sh--&gt;"><code> make alt</code></pre>
<h3 id="alternate-use">Alternate use:</h3>
<p>NOTE: this version might not work on some systems like macOS.</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">./anonymous.alt</span></span></code></pre></div>
<pre class="&lt;!---sh--&gt;"><code> ./anonymous.alt</code></pre>
<h2 id="judges-remarks">Judges’ remarks:</h2>
<p>The author was too embarrassed that they could write such trash, so I
promised to protect their identity. I will say that the author of this
+7 -7
View File
@@ -1,6 +1,6 @@
## To build:
```sh
```<!---sh-->
make all
```
@@ -22,7 +22,7 @@ For more detailed information see [1984 decot bugs](../../bugs.html#1984_decot).
## To use:
```sh
```<!---sh-->
./decot
```
@@ -36,14 +36,14 @@ can use this version.
### Alternate build:
```sh
```<!---sh-->
make alt
```
### Alternate use:
```sh
```<!---sh-->
./decot.alt
```
@@ -61,13 +61,13 @@ the judges offer this one comment: understand remarks!
Some new (in 1984) compilers disliked line 15 of the original source, so we
changed it from:
```c
```<!---c-->
for(signal=0;*k * x * __FILE__ *i;) do {
```
to:
```c
```<!---c-->
for(signal=0;*k *x * __FILE__ *i;) do {
```
@@ -75,7 +75,7 @@ To see what we mean look at the [original source file](decot.orig.c). The
[alternate code](decot.alt.c) is the version that has this modification. The
fixed version has instead:
```c
```<!---c-->
for(signal=0;*k *= * __FILE__ *i;) do {
```
+7 -7
View File
@@ -141,7 +141,7 @@ 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> all</span></code></pre></div>
<pre class="&lt;!---sh--&gt;"><code> make all</code></pre>
<p>NOTE: there is an <a href="#alternate-code">alternate version</a> which will only work if
you have an old enough compiler or a compiler that supports <code>-traditional-cpp</code>.
The original code was fixed in 2023 to not require this.</p>
@@ -150,15 +150,15 @@ The original code was fixed in 2023 to not require this.</p>
<pre><code> STATUS: INABIAF - please **DO NOT** fix</code></pre>
<p>For more detailed information see <a href="../../bugs.html#1984_decot">1984 decot 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">./decot</span></span></code></pre></div>
<pre class="&lt;!---sh--&gt;"><code> ./decot</code></pre>
<h2 id="alternate-code">Alternate code:</h2>
<p>This alternate code, the original, requires a compiler that supports
<code>-traditional-cpp</code> or an old enough compiler. If you have such a compiler you
can use this version.</p>
<h3 id="alternate-build">Alternate build:</h3>
<div class="sourceCode" id="cb4"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb4-1"><a href="#cb4-1" aria-hidden="true" tabindex="-1"></a> <span class="fu">make</span> alt</span></code></pre></div>
<pre class="&lt;!---sh--&gt;"><code> make alt</code></pre>
<h3 id="alternate-use">Alternate use:</h3>
<div class="sourceCode" id="cb5"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb5-1"><a href="#cb5-1" aria-hidden="true" tabindex="-1"></a> <span class="ex">./decot.alt</span></span></code></pre></div>
<pre class="&lt;!---sh--&gt;"><code> ./decot.alt</code></pre>
<h2 id="judges-remarks">Judges’ remarks:</h2>
<p>This program prints out what looks like a fragment of C code.</p>
<p>Is this a <strong>bug</strong> or is this a <strong>feature</strong>? To help choose
@@ -166,13 +166,13 @@ the judges offer this one comment: understand remarks!</p>
<h3 id="historical-remarks">Historical remarks:</h3>
<p>Some new (in 1984) compilers disliked line 15 of the original source, so we
changed it from:</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="cf">for</span><span class="op">(</span>signal<span class="op">=</span><span class="dv">0</span><span class="op">;*</span>k <span class="op">*</span> x <span class="op">*</span> __FILE__ <span class="op">*</span>i<span class="op">;)</span> <span class="cf">do</span> <span class="op">{</span></span></code></pre></div>
<pre class="&lt;!---c--&gt;"><code> for(signal=0;*k * x * __FILE__ *i;) do {</code></pre>
<p>to:</p>
<div class="sourceCode" id="cb7"><pre class="sourceCode c"><code class="sourceCode c"><span id="cb7-1"><a href="#cb7-1" aria-hidden="true" tabindex="-1"></a> <span class="cf">for</span><span class="op">(</span>signal<span class="op">=</span><span class="dv">0</span><span class="op">;*</span>k <span class="op">*</span>x <span class="op">*</span> __FILE__ <span class="op">*</span>i<span class="op">;)</span> <span class="cf">do</span> <span class="op">{</span></span></code></pre></div>
<pre class="&lt;!---c--&gt;"><code> for(signal=0;*k *x * __FILE__ *i;) do {</code></pre>
<p>To see what we mean look at the <a href="decot.orig.c">original source file</a>. The
<a href="decot.alt.c">alternate code</a> is the version that has this modification. The
fixed version has instead:</p>
<div class="sourceCode" id="cb8"><pre class="sourceCode c"><code class="sourceCode c"><span id="cb8-1"><a href="#cb8-1" aria-hidden="true" tabindex="-1"></a> <span class="cf">for</span><span class="op">(</span>signal<span class="op">=</span><span class="dv">0</span><span class="op">;*</span>k <span class="op">*=</span> <span class="op">*</span> __FILE__ <span class="op">*</span>i<span class="op">;)</span> <span class="cf">do</span> <span class="op">{</span></span></code></pre></div>
<pre class="&lt;!---c--&gt;"><code> for(signal=0;*k *= * __FILE__ *i;) do {</code></pre>
<h2 id="authors-remarks">Author’s remarks:</h2>
<p>No remarks were provided by the author.</p>
<!--
+5 -5
View File
@@ -1,13 +1,13 @@
## To build:
```sh
```<!---sh-->
make all
```
## To use:
```sh
```<!---sh-->
./laman <positive number>
```
@@ -17,7 +17,7 @@
The program accepts ONE POSITIVE number. Seeing is believing, so try things
like:
```sh
```<!---sh-->
./try.sh
./laman 4
@@ -33,14 +33,14 @@ This code should run you in circles.
Some new compilers (in 1984) dislike lines 6 and 10 of the source, so we changed
them from:
```c
```<!---c-->
;++f)a[ b<<5|c] =d++,b+ =e;for( f=0;f<O
<<5|c]^ =a[b<<5 |c]^=a[ (k-(b+1 ))<<5|c]
```
to:
```c
```<!---c-->
;++f)a[ b<<5|c] =d++,b+= e;for( f=0;f<O
<<5|c]^= a[b<<5 |c]^=a[ (k-(b+1 ))<<5|c]
```
+11 -11
View File
@@ -141,26 +141,26 @@ Location: <a href="../../location.html#ZZ">ZZ</a> - <em>Unknown location</em></l
<!-- 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> all</span></code></pre></div>
<pre class="&lt;!---sh--&gt;"><code> make all</code></pre>
<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">./laman</span> <span class="op">&lt;</span>positive number<span class="op">&gt;</span></span></code></pre></div>
<pre class="&lt;!---sh--&gt;"><code> ./laman &lt;positive number&gt;</code></pre>
<h2 id="try">Try:</h2>
<p>The program accepts ONE POSITIVE number. Seeing is believing, so try things
like:</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>
<span id="cb3-2"><a href="#cb3-2" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb3-3"><a href="#cb3-3" aria-hidden="true" tabindex="-1"></a> <span class="ex">./laman</span> 4</span>
<span id="cb3-4"><a href="#cb3-4" aria-hidden="true" tabindex="-1"></a> <span class="ex">./laman</span> 9</span>
<span id="cb3-5"><a href="#cb3-5" aria-hidden="true" tabindex="-1"></a> <span class="ex">./laman</span> 16</span></code></pre></div>
<pre class="&lt;!---sh--&gt;"><code> ./try.sh
./laman 4
./laman 9
./laman 16</code></pre>
<p>This code should run you in circles.</p>
<h2 id="judges-remarks">Judges’ remarks:</h2>
<p>Some new compilers (in 1984) dislike lines 6 and 10 of the source, so we changed
them from:</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="op">;++</span>f<span class="op">)</span>a<span class="op">[</span> b<span class="op">&lt;&lt;</span><span class="dv">5</span><span class="op">|</span>c<span class="op">]</span> <span class="op">=</span>d<span class="op">++,</span>b<span class="op">+</span> <span class="op">=</span>e<span class="op">;</span><span class="cf">for</span><span class="op">(</span> f<span class="op">=</span><span class="dv">0</span><span class="op">;</span>f<span class="op">&lt;</span>O</span>
<span id="cb4-2"><a href="#cb4-2" aria-hidden="true" tabindex="-1"></a> <span class="op">&lt;&lt;</span><span class="dv">5</span><span class="op">|</span>c<span class="op">]^</span> <span class="op">=</span>a<span class="op">[</span>b<span class="op">&lt;&lt;</span><span class="dv">5</span> <span class="op">|</span>c<span class="op">]^=</span>a<span class="op">[</span> <span class="op">(</span>k<span class="op">-(</span>b<span class="op">+</span><span class="dv">1</span> <span class="op">))&lt;&lt;</span><span class="dv">5</span><span class="op">|</span>c<span class="op">]</span></span></code></pre></div>
<pre class="&lt;!---c--&gt;"><code> ;++f)a[ b&lt;&lt;5|c] =d++,b+ =e;for( f=0;f&lt;O
&lt;&lt;5|c]^ =a[b&lt;&lt;5 |c]^=a[ (k-(b+1 ))&lt;&lt;5|c]</code></pre>
<p>to:</p>
<div class="sourceCode" id="cb5"><pre class="sourceCode c"><code class="sourceCode c"><span id="cb5-1"><a href="#cb5-1" aria-hidden="true" tabindex="-1"></a> <span class="op">;++</span>f<span class="op">)</span>a<span class="op">[</span> b<span class="op">&lt;&lt;</span><span class="dv">5</span><span class="op">|</span>c<span class="op">]</span> <span class="op">=</span>d<span class="op">++,</span>b<span class="op">+=</span> e<span class="op">;</span><span class="cf">for</span><span class="op">(</span> f<span class="op">=</span><span class="dv">0</span><span class="op">;</span>f<span class="op">&lt;</span>O</span>
<span id="cb5-2"><a href="#cb5-2" aria-hidden="true" tabindex="-1"></a> <span class="op">&lt;&lt;</span><span class="dv">5</span><span class="op">|</span>c<span class="op">]^=</span> a<span class="op">[</span>b<span class="op">&lt;&lt;</span><span class="dv">5</span> <span class="op">|</span>c<span class="op">]^=</span>a<span class="op">[</span> <span class="op">(</span>k<span class="op">-(</span>b<span class="op">+</span><span class="dv">1</span> <span class="op">))&lt;&lt;</span><span class="dv">5</span><span class="op">|</span>c<span class="op">]</span></span></code></pre></div>
<pre class="&lt;!---c--&gt;"><code> ;++f)a[ b&lt;&lt;5|c] =d++,b+= e;for( f=0;f&lt;O
&lt;&lt;5|c]^= a[b&lt;&lt;5 |c]^=a[ (k-(b+1 ))&lt;&lt;5|c]</code></pre>
<p>I hope you have a C beautifier!</p>
<h2 id="authors-remarks">Author’s remarks:</h2>
<p>No remarks were provided by the author.</p>
+12 -12
View File
@@ -1,6 +1,6 @@
## To build:
```sh
```<!---sh-->
make alt
```
@@ -24,7 +24,7 @@ For more detailed information see [1984 mullender bugs](../../bugs.html#1984_mul
## To use:
```sh
```<!---sh-->
./mullender.alt [microseconds]
```
@@ -48,7 +48,7 @@ which is probably not as uncommon as you think :-).
## Try:
```sh
```<!---sh-->
./mullender.alt
./mullender.alt 5000 # wait for 5000 microseconds and see what happens
@@ -72,14 +72,14 @@ machine dependent code was discouraged.
### Original build:
```sh
```<!---sh-->
make all
```
### Original use:
```sh
```<!---sh-->
./mullender
```
@@ -137,19 +137,19 @@ Repo](https://github.com/dspinellis/unix-history-repo/tree/Research-Release).
`gentab.c` can be built like:
```sh
```<!---sh-->
make gentab
```
### gentab use:
```sh
```<!---sh-->
./gentab file
```
### gentab try:
```sh
```<!---sh-->
./gentab gentab > g.c
```
@@ -256,7 +256,7 @@ separate.
The [PDP](https://en.wikipedia.org/wiki/Programmed_Data_Processor) and
[VAX](https://en.wikipedia.org/wiki/VAX) codes implement the same algorithm:
```c
```<!---c-->
for (;;) {
write(1, " :-)\b\b\b\b", 9);
delay();
@@ -284,7 +284,7 @@ We started with writing the
We both knew [PDP-11](https://en.wikipedia.org/wiki/PDP-11) assembly so that was
no problem. The assembly code we came up with is as follows:
```asm
```<!---asm-->
pdp:
mov pc,r4
tst -(r4)
@@ -331,7 +331,7 @@ VAX code in C and massaged the
program that we came up with is as follows:
```asm
```<!---asm-->
vax: .word 0400 + (pdp - vax) / 2 - 1
1:
pushl $9
@@ -389,7 +389,7 @@ extracted the machine code from the object file.
> NOTE from judges: see [gentab.c](gentab.c) for a copy of this file that can be
compiled in modern systems.
```c
```<!---c-->
#include <stdio.h>
#include <a.out.h>
+103 -103
View File
@@ -144,7 +144,7 @@ Location: <a href="../../location.html#NL">NL</a> - <em>Kingdom of the Netherlan
<!-- 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>
<pre class="&lt;!---sh--&gt;"><code> make alt</code></pre>
<p>NOTE: the original code will not work on any system other than
<a href="https://en.wikipedia.org/wiki/VAX-11">VAX-11</a> and
<a href="https://en.wikipedia.org/wiki/PDP-11">PDP-11</a> and this is why we encourage you
@@ -155,7 +155,7 @@ the original version.</p>
<pre><code> STATUS: INABIAF - please **DO NOT** fix</code></pre>
<p>For more detailed information see <a href="../../bugs.html#1984_mullender">1984 mullender 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">./mullender.alt</span> <span class="pp">[</span><span class="ss">microseconds</span><span class="pp">]</span></span></code></pre></div>
<pre class="&lt;!---sh--&gt;"><code> ./mullender.alt [microseconds]</code></pre>
<p>Hit ctrl-c/intr to exit the program.</p>
<p>The default microseconds is 190000 as this is approximately how long it slept in
the original entry but it can be no lower than 5000 as any lower doesn’t work
@@ -169,13 +169,13 @@ overflow!</p>
<p>BTW: is there such a thing as too fast a CPU ? :-) Actually yes for certain code
which is probably not as uncommon as you think :-).</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">./mullender.alt</span></span>
<span id="cb4-2"><a href="#cb4-2" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb4-3"><a href="#cb4-3" aria-hidden="true" tabindex="-1"></a> <span class="ex">./mullender.alt</span> 5000 <span class="co"># wait for 5000 microseconds and see what happens</span></span>
<span id="cb4-4"><a href="#cb4-4" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb4-5"><a href="#cb4-5" aria-hidden="true" tabindex="-1"></a> <span class="ex">./mullender.alt</span> 20000 <span class="co"># wait for 20000 microseconds and see what happens</span></span>
<span id="cb4-6"><a href="#cb4-6" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb4-7"><a href="#cb4-7" aria-hidden="true" tabindex="-1"></a> <span class="ex">./mullender.alt</span> 100000 <span class="co"># wait for 100000 microseconds and see what happens</span></span></code></pre></div>
<pre class="&lt;!---sh--&gt;"><code> ./mullender.alt
./mullender.alt 5000 # wait for 5000 microseconds and see what happens
./mullender.alt 20000 # wait for 20000 microseconds and see what happens
./mullender.alt 100000 # wait for 100000 microseconds and see what happens</code></pre>
<p>What happens if you hit enter after it reaches the end of the line? Why? What
happens after some time of waiting?</p>
<h2 id="original-code">Original code:</h2>
@@ -184,9 +184,9 @@ happens after some time of waiting?</p>
<a href="https://en.wikipedia.org/wiki/PDP-11">PDP-11</a>. In the following years, 1985 on,
machine dependent code was discouraged.</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> all</span></code></pre></div>
<pre class="&lt;!---sh--&gt;"><code> make all</code></pre>
<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">./mullender</span></span></code></pre></div>
<pre class="&lt;!---sh--&gt;"><code> ./mullender</code></pre>
<h2 id="judges-remarks">Judges’ remarks:</h2>
<p>Without question, this C program is the one of the most obfuscated C program
that has ever been received! Like all great contest entries, it resulted in a
@@ -225,11 +225,11 @@ in the <em>fabulous</em> <a href="https://github.com/dspinellis/unix-history-rep
Repo</a>.</p>
<h3 id="gentab-build">gentab build:</h3>
<p><code>gentab.c</code> can be built like:</p>
<div class="sourceCode" id="cb7"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb7-1"><a href="#cb7-1" aria-hidden="true" tabindex="-1"></a> <span class="fu">make</span> gentab</span></code></pre></div>
<pre class="&lt;!---sh--&gt;"><code> make gentab</code></pre>
<h3 id="gentab-use">gentab use:</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">./gentab</span> file</span></code></pre></div>
<pre class="&lt;!---sh--&gt;"><code> ./gentab file</code></pre>
<h3 id="gentab-try">gentab try:</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="ex">./gentab</span> gentab <span class="op">&gt;</span> g.c</span></code></pre></div>
<pre class="&lt;!---sh--&gt;"><code> ./gentab gentab &gt; g.c</code></pre>
<p>NOTE: it is highly unlikely that you will be able to run the output of <code>gentab</code>
but it should at least compile.</p>
<h2 id="authors-remarks">Author’s remarks:</h2>
@@ -312,10 +312,10 @@ that branches over the VAX code. The PDP and VAX codes are thus completely
separate.</p>
<p>The <a href="https://en.wikipedia.org/wiki/Programmed_Data_Processor">PDP</a> and
<a href="https://en.wikipedia.org/wiki/VAX">VAX</a> codes implement the same algorithm:</p>
<div class="sourceCode" id="cb10"><pre class="sourceCode c"><code class="sourceCode c"><span id="cb10-1"><a href="#cb10-1" aria-hidden="true" tabindex="-1"></a> <span class="cf">for</span> <span class="op">(;;)</span> <span class="op">{</span></span>
<span id="cb10-2"><a href="#cb10-2" aria-hidden="true" tabindex="-1"></a> write<span class="op">(</span><span class="dv">1</span><span class="op">,</span> <span class="st">&quot; :-)</span><span class="sc">\b\b\b\b</span><span class="st">&quot;</span><span class="op">,</span> <span class="dv">9</span><span class="op">);</span></span>
<span id="cb10-3"><a href="#cb10-3" aria-hidden="true" tabindex="-1"></a> delay<span class="op">();</span></span>
<span id="cb10-4"><a href="#cb10-4" aria-hidden="true" tabindex="-1"></a> <span class="op">}</span></span></code></pre></div>
<pre class="&lt;!---c--&gt;"><code> for (;;) {
write(1, &quot; :-)\b\b\b\b&quot;, 9);
delay();
}</code></pre>
<p>The result is that the symbols <code>:-)</code> move across the screen. <code>delay</code> is
implemented differently on the
<a href="https://en.wikipedia.org/wiki/Programmed_Data_Processor">PDP</a>, where we used a
@@ -333,18 +333,18 @@ simple.</p>
<a href="https://en.wikipedia.org/wiki/Programmed_Data_Processor">PDP</a> code in assembly.
We both knew <a href="https://en.wikipedia.org/wiki/PDP-11">PDP-11</a> assembly so that was
no problem. The assembly code we came up with is as follows:</p>
<div class="sourceCode" id="cb11"><pre class="sourceCode asm"><code class="sourceCode fasm"><span id="cb11-1"><a href="#cb11-1" aria-hidden="true" tabindex="-1"></a> <span class="fu">pdp:</span></span>
<span id="cb11-2"><a href="#cb11-2" aria-hidden="true" tabindex="-1"></a> <span class="bu">mov</span> pc<span class="op">,</span>r4</span>
<span id="cb11-3"><a href="#cb11-3" aria-hidden="true" tabindex="-1"></a> tst <span class="op">-(</span>r4<span class="op">)</span></span>
<span id="cb11-4"><a href="#cb11-4" aria-hidden="true" tabindex="-1"></a> <span class="bu">sub</span> <span class="op">$</span><span class="bn">9</span><span class="op">,</span> r4</span>
<span id="cb11-5"><a href="#cb11-5" aria-hidden="true" tabindex="-1"></a> <span class="bu">mov</span> r4<span class="op">,</span><span class="fl">0</span><span class="bn">f</span></span>
<span id="cb11-6"><a href="#cb11-6" aria-hidden="true" tabindex="-1"></a> <span class="bu">mov</span> <span class="op">$</span><span class="bn">1</span><span class="op">,</span> r0</span>
<span id="cb11-7"><a href="#cb11-7" aria-hidden="true" tabindex="-1"></a> sys <span class="dv">4</span><span class="co">; 0:0; 9</span></span>
<span id="cb11-8"><a href="#cb11-8" aria-hidden="true" tabindex="-1"></a> <span class="bu">mov</span> <span class="op">$</span><span class="bn">1000</span><span class="op">,</span> r2</span>
<span id="cb11-9"><a href="#cb11-9" aria-hidden="true" tabindex="-1"></a> 1:</span>
<span id="cb11-10"><a href="#cb11-10" aria-hidden="true" tabindex="-1"></a> sys <span class="dv">55</span></span>
<span id="cb11-11"><a href="#cb11-11" aria-hidden="true" tabindex="-1"></a> sob r2<span class="op">,</span><span class="bn">1b</span></span>
<span id="cb11-12"><a href="#cb11-12" aria-hidden="true" tabindex="-1"></a> br pdp</span></code></pre></div>
<pre class="&lt;!---asm--&gt;"><code> pdp:
mov pc,r4
tst -(r4)
sub $9, r4
mov r4,0f
mov $1, r0
sys 4; 0:0; 9
mov $1000, r2
1:
sys 55
sob r2,1b
br pdp</code></pre>
<p>This is not the code we originally wrote, but it is the code that we ultimately
used in the program. The string to be printed is shared by the
<a href="https://en.wikipedia.org/wiki/VAX">VAX</a> and the
@@ -373,26 +373,26 @@ VAX <a href="https://en.wikipedia.org/wiki/Assembly_language">assembly</a>, we w
VAX code in C and massaged the
<a href="https://en.wikipedia.org/wiki/Compiler">compiler</a> output. The VAX assembly
program that we came up with is as follows:</p>
<div class="sourceCode" id="cb12"><pre class="sourceCode asm"><code class="sourceCode fasm"><span id="cb12-1"><a href="#cb12-1" aria-hidden="true" tabindex="-1"></a> <span class="fu">vax:</span> .<span class="dt">word</span> <span class="dv">0400</span> <span class="op">+</span> <span class="op">(</span>pdp <span class="op">-</span> vax<span class="op">)</span> <span class="op">/</span> <span class="dv">2</span> <span class="op">-</span> <span class="dv">1</span></span>
<span id="cb12-2"><a href="#cb12-2" aria-hidden="true" tabindex="-1"></a> 1:</span>
<span id="cb12-3"><a href="#cb12-3" aria-hidden="true" tabindex="-1"></a> pushl <span class="op">$</span><span class="bn">9</span></span>
<span id="cb12-4"><a href="#cb12-4" aria-hidden="true" tabindex="-1"></a> pushal str</span>
<span id="cb12-5"><a href="#cb12-5" aria-hidden="true" tabindex="-1"></a> pushl <span class="op">$</span><span class="bn">1</span></span>
<span id="cb12-6"><a href="#cb12-6" aria-hidden="true" tabindex="-1"></a> calls <span class="op">$</span><span class="bn">3</span><span class="op">,</span> write</span>
<span id="cb12-7"><a href="#cb12-7" aria-hidden="true" tabindex="-1"></a> cvtwl <span class="op">$</span><span class="bn">32767</span><span class="op">,</span> r2</span>
<span id="cb12-8"><a href="#cb12-8" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb12-9"><a href="#cb12-9" aria-hidden="true" tabindex="-1"></a> 2:</span>
<span id="cb12-10"><a href="#cb12-10" aria-hidden="true" tabindex="-1"></a> decl r2</span>
<span id="cb12-11"><a href="#cb12-11" aria-hidden="true" tabindex="-1"></a> jneq <span class="dv">2</span><span class="er">b</span></span>
<span id="cb12-12"><a href="#cb12-12" aria-hidden="true" tabindex="-1"></a> jbr <span class="bn">1b</span></span>
<span id="cb12-13"><a href="#cb12-13" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb12-14"><a href="#cb12-14" aria-hidden="true" tabindex="-1"></a> <span class="fu">write:</span> .<span class="dt">word</span> <span class="dv">0</span></span>
<span id="cb12-15"><a href="#cb12-15" aria-hidden="true" tabindex="-1"></a> chmk <span class="op">$</span><span class="bn">4</span></span>
<span id="cb12-16"><a href="#cb12-16" aria-hidden="true" tabindex="-1"></a> <span class="cf">ret</span></span>
<span id="cb12-17"><a href="#cb12-17" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb12-18"><a href="#cb12-18" aria-hidden="true" tabindex="-1"></a> <span class="fu">str:</span> .ascii <span class="st">&quot; :-)\b\b\b\b&quot;</span></span>
<span id="cb12-19"><a href="#cb12-19" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb12-20"><a href="#cb12-20" aria-hidden="true" tabindex="-1"></a> <span class="fu">pdp:</span> .<span class="dt">word</span> <span class="dv">4548</span><span class="op">,</span> <span class="dv">3044</span><span class="op">,</span> <span class="dv">58820</span><span class="op">,</span> <span class="dv">9</span><span class="op">,</span> <span class="dv">4407</span><span class="op">,</span> <span class="dv">6</span><span class="op">,</span> <span class="dv">5568</span><span class="op">,</span> <span class="dv">1</span><span class="op">,</span> <span class="dv">35076</span><span class="op">,</span> <span class="dv">0</span><span class="op">,</span> <span class="dv">9</span><span class="op">,</span> <span class="dv">5570</span><span class="op">,</span> <span class="dv">512</span><span class="op">,</span> <span class="dv">35117</span><span class="op">,</span> <span class="dv">32386</span><span class="op">,</span> <span class="dv">496</span></span></code></pre></div>
<pre class="&lt;!---asm--&gt;"><code> vax: .word 0400 + (pdp - vax) / 2 - 1
1:
pushl $9
pushal str
pushl $1
calls $3, write
cvtwl $32767, r2
2:
decl r2
jneq 2b
jbr 1b
write: .word 0
chmk $4
ret
str: .ascii &quot; :-)\b\b\b\b&quot;
pdp: .word 4548, 3044, 58820, 9, 4407, 6, 5568, 1, 35076, 0, 9, 5570, 512, 35117, 32386, 496</code></pre>
<p>The first word (after the label <code>vax</code>) is the
<a href="https://en.wikipedia.org/wiki/Programmed_Data_Processor">PDP</a> <a href="https://en.wikipedia.org/wiki/Branch_(computer_science)">branch
instruction</a>.
@@ -426,59 +426,59 @@ extracted the machine code from the object file.</p>
<p>NOTE from judges: see <a href="gentab.c">gentab.c</a> for a copy of this file that can be
compiled in modern systems.</p>
</blockquote>
<div class="sourceCode" id="cb13"><pre class="sourceCode c"><code class="sourceCode c"><span id="cb13-1"><a href="#cb13-1" aria-hidden="true" tabindex="-1"></a> <span class="pp">#include </span><span class="im">&lt;stdio.h&gt;</span></span>
<span id="cb13-2"><a href="#cb13-2" aria-hidden="true" tabindex="-1"></a> <span class="pp">#include </span><span class="im">&lt;a.out.h&gt;</span></span>
<span id="cb13-3"><a href="#cb13-3" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb13-4"><a href="#cb13-4" aria-hidden="true" tabindex="-1"></a> main<span class="op">(</span>argc<span class="op">,</span> argv<span class="op">)</span> <span class="dt">char</span> <span class="op">**</span>argv<span class="op">;</span></span>
<span id="cb13-5"><a href="#cb13-5" aria-hidden="true" tabindex="-1"></a> <span class="op">{</span></span>
<span id="cb13-6"><a href="#cb13-6" aria-hidden="true" tabindex="-1"></a> <span class="dt">register</span> <span class="dt">FILE</span> <span class="op">*</span>fp<span class="op">;</span></span>
<span id="cb13-7"><a href="#cb13-7" aria-hidden="true" tabindex="-1"></a> <span class="dt">register</span> <span class="dt">short</span> pos <span class="op">=</span> <span class="dv">0</span><span class="op">,</span> c<span class="op">,</span> n<span class="op">;</span></span>
<span id="cb13-8"><a href="#cb13-8" aria-hidden="true" tabindex="-1"></a> <span class="dt">register</span> <span class="dt">char</span> <span class="op">*</span>fmt<span class="op">;</span></span>
<span id="cb13-9"><a href="#cb13-9" aria-hidden="true" tabindex="-1"></a> <span class="cf">if</span> <span class="op">(</span>argc <span class="op">!=</span> <span class="dv">2</span><span class="op">)</span> <span class="op">{</span></span>
<span id="cb13-10"><a href="#cb13-10" aria-hidden="true" tabindex="-1"></a> fprintf <span class="op">(</span>stderr<span class="op">,</span> <span class="st">&quot;Usage: </span><span class="sc">%s</span><span class="st"> file</span><span class="sc">\n</span><span class="st">&quot;</span><span class="op">,</span> argv<span class="op">[</span><span class="dv">0</span><span class="op">]);</span></span>
<span id="cb13-11"><a href="#cb13-11" aria-hidden="true" tabindex="-1"></a> exit <span class="op">(</span><span class="dv">1</span><span class="op">);</span></span>
<span id="cb13-12"><a href="#cb13-12" aria-hidden="true" tabindex="-1"></a> <span class="op">}</span></span>
<span id="cb13-13"><a href="#cb13-13" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb13-14"><a href="#cb13-14" aria-hidden="true" tabindex="-1"></a> <span class="cf">if</span> <span class="op">((</span>fp <span class="op">=</span> fopen<span class="op">(</span>argv<span class="op">[</span><span class="dv">1</span><span class="op">],</span> <span class="st">&quot;r&quot;</span><span class="op">))</span> <span class="op">==</span> NULL<span class="op">)</span> <span class="op">{</span></span>
<span id="cb13-15"><a href="#cb13-15" aria-hidden="true" tabindex="-1"></a> fprintf<span class="op">(</span>stderr<span class="op">,</span> <span class="st">&quot;</span><span class="sc">%s</span><span class="st">: can&#39;t open </span><span class="sc">%s\n</span><span class="st">&quot;</span><span class="op">,</span> argv<span class="op">[</span><span class="dv">0</span><span class="op">],</span> argv<span class="op">[</span><span class="dv">1</span><span class="op">]);</span></span>
<span id="cb13-16"><a href="#cb13-16" aria-hidden="true" tabindex="-1"></a> exit<span class="op">(</span><span class="dv">2</span><span class="op">);</span></span>
<span id="cb13-17"><a href="#cb13-17" aria-hidden="true" tabindex="-1"></a> <span class="op">}</span></span>
<span id="cb13-18"><a href="#cb13-18" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb13-19"><a href="#cb13-19" aria-hidden="true" tabindex="-1"></a> fseek <span class="op">(</span>fp<span class="op">,</span> <span class="op">(</span><span class="dt">long</span><span class="op">)</span> <span class="kw">sizeof</span> <span class="op">(</span><span class="kw">struct</span> exec<span class="op">),</span> <span class="dv">0</span><span class="op">);</span></span>
<span id="cb13-20"><a href="#cb13-20" aria-hidden="true" tabindex="-1"></a> printf<span class="op">(</span><span class="st">&quot;/* portable between VAX and PDP11 */</span><span class="sc">\n\n</span><span class="st">&quot;</span><span class="op">);</span></span>
<span id="cb13-21"><a href="#cb13-21" aria-hidden="true" tabindex="-1"></a> printf <span class="op">(</span><span class="st">&quot;short main[] = {</span><span class="sc">\n</span><span class="st">&quot;</span><span class="op">);</span></span>
<span id="cb13-22"><a href="#cb13-22" aria-hidden="true" tabindex="-1"></a> <span class="cf">for</span> <span class="op">(;;)</span> <span class="op">{</span></span>
<span id="cb13-23"><a href="#cb13-23" aria-hidden="true" tabindex="-1"></a> <span class="cf">if</span> <span class="op">(</span>pos <span class="op">==</span> <span class="dv">0</span><span class="op">)</span></span>
<span id="cb13-24"><a href="#cb13-24" aria-hidden="true" tabindex="-1"></a> printf<span class="op">(</span><span class="st">&quot;</span><span class="sc">\t</span><span class="st">&quot;</span><span class="op">);</span></span>
<span id="cb13-25"><a href="#cb13-25" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb13-26"><a href="#cb13-26" aria-hidden="true" tabindex="-1"></a> c<span class="op">=</span>getc<span class="op">(</span>fp<span class="op">)</span> <span class="op">&amp;</span> <span class="bn">0377</span><span class="op">;</span></span>
<span id="cb13-27"><a href="#cb13-27" aria-hidden="true" tabindex="-1"></a> <span class="cf">if</span> <span class="op">(</span>feof<span class="op">(</span>fp<span class="op">))</span> <span class="cf">break</span><span class="op">;</span></span>
<span id="cb13-28"><a href="#cb13-28" aria-hidden="true" tabindex="-1"></a> n <span class="op">=</span> getc<span class="op">(</span>fp<span class="op">)</span> <span class="op">&lt;&lt;</span> <span class="dv">8</span><span class="op">|</span>c<span class="op">;</span></span>
<span id="cb13-29"><a href="#cb13-29" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb13-30"><a href="#cb13-30" aria-hidden="true" tabindex="-1"></a> <span class="cf">switch</span> <span class="op">(</span>rand<span class="op">()</span> <span class="op">%</span> <span class="dv">5</span><span class="op">)</span> <span class="op">{</span></span>
<span id="cb13-31"><a href="#cb13-31" aria-hidden="true" tabindex="-1"></a> <span class="cf">case</span> <span class="dv">0</span><span class="op">:</span></span>
<span id="cb13-32"><a href="#cb13-32" aria-hidden="true" tabindex="-1"></a> <span class="cf">case</span> <span class="dv">1</span><span class="op">:</span></span>
<span id="cb13-33"><a href="#cb13-33" aria-hidden="true" tabindex="-1"></a> fmt <span class="op">=</span> <span class="st">&quot;</span><span class="sc">%d</span><span class="st">&quot;</span><span class="op">;</span> <span class="cf">break</span><span class="op">;</span></span>
<span id="cb13-34"><a href="#cb13-34" aria-hidden="true" tabindex="-1"></a> <span class="cf">case</span> <span class="dv">2</span><span class="op">:</span></span>
<span id="cb13-35"><a href="#cb13-35" aria-hidden="true" tabindex="-1"></a> fmt <span class="op">=</span> <span class="st">&quot;</span><span class="sc">%u</span><span class="st">&quot;</span><span class="op">;</span> <span class="cf">break</span><span class="op">;</span></span>
<span id="cb13-36"><a href="#cb13-36" aria-hidden="true" tabindex="-1"></a> <span class="cf">case</span> <span class="dv">3</span><span class="op">:</span></span>
<span id="cb13-37"><a href="#cb13-37" aria-hidden="true" tabindex="-1"></a> fmt <span class="op">=</span> <span class="st">&quot;0</span><span class="sc">%o</span><span class="st">&quot;</span><span class="op">;</span> <span class="cf">break</span><span class="op">;</span></span>
<span id="cb13-38"><a href="#cb13-38" aria-hidden="true" tabindex="-1"></a> <span class="cf">case</span> <span class="dv">4</span><span class="op">:</span></span>
<span id="cb13-39"><a href="#cb13-39" aria-hidden="true" tabindex="-1"></a> fmt <span class="op">=</span> <span class="st">&quot;0x</span><span class="sc">%x</span><span class="st">&quot;</span><span class="op">;</span> <span class="cf">break</span><span class="op">;</span></span>
<span id="cb13-40"><a href="#cb13-40" aria-hidden="true" tabindex="-1"></a> <span class="op">}</span></span>
<span id="cb13-41"><a href="#cb13-41" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb13-42"><a href="#cb13-42" aria-hidden="true" tabindex="-1"></a> <span class="cf">if</span> <span class="op">(</span><span class="dv">32</span> <span class="op">&lt;=</span> n <span class="op">&amp;&amp;</span> n <span class="op">&lt;</span> <span class="dv">127</span> <span class="op">&amp;&amp;</span> <span class="op">(</span>rand<span class="op">()</span> <span class="op">%</span> <span class="dv">4</span><span class="op">))</span> fmt <span class="op">=</span> <span class="st">&quot;&#39;</span><span class="sc">%c</span><span class="st">&#39;&quot;</span><span class="op">;</span></span>
<span id="cb13-43"><a href="#cb13-43" aria-hidden="true" tabindex="-1"></a> printf<span class="op">(</span>n <span class="op">&lt;</span> <span class="dv">8</span> <span class="op">?</span> <span class="st">&quot;</span><span class="sc">%d</span><span class="st">&quot;</span> <span class="op">:</span> fmt<span class="op">,</span> n<span class="op">);</span></span>
<span id="cb13-44"><a href="#cb13-44" aria-hidden="true" tabindex="-1"></a> printf<span class="op">(</span><span class="st">&quot;,&quot;</span><span class="op">);</span></span>
<span id="cb13-45"><a href="#cb13-45" aria-hidden="true" tabindex="-1"></a> <span class="cf">if</span> <span class="op">(</span>pos<span class="op">++</span> <span class="op">==</span> <span class="dv">8</span><span class="op">)</span> <span class="op">{</span></span>
<span id="cb13-46"><a href="#cb13-46" aria-hidden="true" tabindex="-1"></a> printf<span class="op">(</span><span class="st">&quot;</span><span class="sc">\n</span><span class="st">&quot;</span><span class="op">);</span></span>
<span id="cb13-47"><a href="#cb13-47" aria-hidden="true" tabindex="-1"></a> pos <span class="op">=</span> <span class="dv">0</span><span class="op">;</span></span>
<span id="cb13-48"><a href="#cb13-48" aria-hidden="true" tabindex="-1"></a> <span class="op">}</span></span>
<span id="cb13-49"><a href="#cb13-49" aria-hidden="true" tabindex="-1"></a> <span class="cf">else</span> printf<span class="op">(</span><span class="st">&quot; &quot;</span><span class="op">);</span></span>
<span id="cb13-50"><a href="#cb13-50" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb13-51"><a href="#cb13-51" aria-hidden="true" tabindex="-1"></a> printf<span class="op">(</span><span class="st">&quot;};</span><span class="sc">\n</span><span class="st">&quot;</span><span class="op">);</span></span>
<span id="cb13-52"><a href="#cb13-52" aria-hidden="true" tabindex="-1"></a> <span class="op">}</span></span>
<span id="cb13-53"><a href="#cb13-53" aria-hidden="true" tabindex="-1"></a> <span class="op">}</span></span></code></pre></div>
<pre class="&lt;!---c--&gt;"><code> #include &lt;stdio.h&gt;
#include &lt;a.out.h&gt;
main(argc, argv) char **argv;
{
register FILE *fp;
register short pos = 0, c, n;
register char *fmt;
if (argc != 2) {
fprintf (stderr, &quot;Usage: %s file\n&quot;, argv[0]);
exit (1);
}
if ((fp = fopen(argv[1], &quot;r&quot;)) == NULL) {
fprintf(stderr, &quot;%s: can&#39;t open %s\n&quot;, argv[0], argv[1]);
exit(2);
}
fseek (fp, (long) sizeof (struct exec), 0);
printf(&quot;/* portable between VAX and PDP11 */\n\n&quot;);
printf (&quot;short main[] = {\n&quot;);
for (;;) {
if (pos == 0)
printf(&quot;\t&quot;);
c=getc(fp) &amp; 0377;
if (feof(fp)) break;
n = getc(fp) &lt;&lt; 8|c;
switch (rand() % 5) {
case 0:
case 1:
fmt = &quot;%d&quot;; break;
case 2:
fmt = &quot;%u&quot;; break;
case 3:
fmt = &quot;0%o&quot;; break;
case 4:
fmt = &quot;0x%x&quot;; break;
}
if (32 &lt;= n &amp;&amp; n &lt; 127 &amp;&amp; (rand() % 4)) fmt = &quot;&#39;%c&#39;&quot;;
printf(n &lt; 8 ? &quot;%d&quot; : fmt, n);
printf(&quot;,&quot;);
if (pos++ == 8) {
printf(&quot;\n&quot;);
pos = 0;
}
else printf(&quot; &quot;);
printf(&quot;};\n&quot;);
}
}</code></pre>
<p>As can be seen, there is a slight preference for decimal, and also a character
format is sometimes used, but only if the data is a printable ASCII character.</p>
<p>When we ran this program, we were almost completely satisfied with the result.
+2 -2
View File
@@ -1,13 +1,13 @@
## To build:
```sh
```<!---sh-->
make all
```
## Try:
```sh
```<!---sh-->
./applin
```
+2 -2
View File
@@ -144,9 +144,9 @@ 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> all</span></code></pre></div>
<pre class="&lt;!---sh--&gt;"><code> make all</code></pre>
<h2 id="try">Try:</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">./applin</span></span></code></pre></div>
<pre class="&lt;!---sh--&gt;"><code> ./applin</code></pre>
<h2 id="judges-remarks">Judges’ remarks:</h2>
<p>One liner programs are short but twisted. This “Hello, world!” version
certainly takes its time saying hello.</p>
+4 -4
View File
@@ -1,20 +1,20 @@
## To build:
```sh
```<!---sh-->
make all
```
## To use:
```sh
```<!---sh-->
./august
```
## Try:
```sh
```<!---sh-->
./try.sh
```
@@ -22,7 +22,7 @@ If you have the `primes(6)` tool (sometimes part of [BSD
Games](https://github.com/vattam/BSDGames)) you can see
what of the output in the first `N` (say `15` or `25`) lines are primes:
```sh
```<!---sh-->
./primes.sh # 15
./primes.sh 25
```
+5 -5
View File
@@ -141,16 +141,16 @@ Location: <a href="../../location.html#SE">SE</a> - <em>Kingdom of Sweden</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> all</span></code></pre></div>
<pre class="&lt;!---sh--&gt;"><code> make all</code></pre>
<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">./august</span></span></code></pre></div>
<pre class="&lt;!---sh--&gt;"><code> ./august</code></pre>
<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>
<pre class="&lt;!---sh--&gt;"><code> ./try.sh</code></pre>
<p>If you have the <code>primes(6)</code> tool (sometimes part of <a href="https://github.com/vattam/BSDGames">BSD
Games</a>) you can see
what of the output in the first <code>N</code> (say <code>15</code> or <code>25</code>) lines are primes:</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">./primes.sh</span> <span class="co"># 15</span></span>
<span id="cb4-2"><a href="#cb4-2" aria-hidden="true" tabindex="-1"></a> <span class="ex">./primes.sh</span> 25</span></code></pre></div>
<pre class="&lt;!---sh--&gt;"><code> ./primes.sh # 15
./primes.sh 25</code></pre>
<p>Note that <code>try.sh</code> will run this script anyway, telling you where to get
<code>primes(6)</code> if you don’t have it installed, but it will only run with the
default value of 15, rather than trying several different values.</p>
+7 -7
View File
@@ -1,13 +1,13 @@
## To build:
```sh
```<!---sh-->
make alt
```
## To use:
```sh
```<!---sh-->
./lycklama.alt < some_file
```
@@ -24,13 +24,13 @@ call with a configurable time to sleep. The default is 500 microseconds but you
reconfigure it like:
```sh
```<!---sh-->
make SLEEP=700 clobber alt
```
which would set it at 700. Then, whether you use the default value or not, try:
```sh
```<!---sh-->
./try.alt.sh
```
@@ -45,21 +45,21 @@ modern systems.
### Original build:
```sh
```<!---sh-->
make all
```
### Original use:
```sh
```<!---sh-->
./lycklama < some_file
```
### Original try:
```sh
```<!---sh-->
./lycklama < lycklama.c
./lycklama < lycklama.alt.c
./lycklama < lycklama.orig.c
+10 -10
View File
@@ -141,9 +141,9 @@ Location: <a href="../../location.html#ZZ">ZZ</a> - <em>Unknown location</em></l
<!-- 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>
<pre class="&lt;!---sh--&gt;"><code> make alt</code></pre>
<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">./lycklama.alt</span> <span class="op">&lt;</span> some_file</span></code></pre></div>
<pre class="&lt;!---sh--&gt;"><code> ./lycklama.alt &lt; some_file</code></pre>
<p>To see why we recommend the alternate version instead of the original version,
see below and the <a href="#original-code">Original code</a> section.</p>
<h2 id="try">Try:</h2>
@@ -152,23 +152,23 @@ original, slows down the output so that you can see what it looked like back in
This will be more enjoyable. It is slowed down by the <code>usleep(3)</code> library
call with a configurable time to sleep. The default is 500 microseconds but you can
reconfigure it like:</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> SLEEP=700 clobber alt</span></code></pre></div>
<pre class="&lt;!---sh--&gt;"><code> make SLEEP=700 clobber alt</code></pre>
<p>which would set it at 700. Then, whether you use the default value or not, try:</p>
<div class="sourceCode" id="cb4"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb4-1"><a href="#cb4-1" aria-hidden="true" tabindex="-1"></a> <span class="ex">./try.alt.sh</span></span></code></pre></div>
<pre class="&lt;!---sh--&gt;"><code> ./try.alt.sh</code></pre>
<h2 id="original-code">Original code:</h2>
<p>As explained above, because modern systems run this entry way too fast to fully
appreciate what it does, we encourage you to first try the alternate version.
After this, however, you might wish to try the original version, fixed for
modern systems.</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> all</span></code></pre></div>
<pre class="&lt;!---sh--&gt;"><code> make all</code></pre>
<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">./lycklama</span> <span class="op">&lt;</span> some_file</span></code></pre></div>
<pre class="&lt;!---sh--&gt;"><code> ./lycklama &lt; some_file</code></pre>
<h3 id="original-try">Original try:</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">./lycklama</span> <span class="op">&lt;</span> lycklama.c</span>
<span id="cb7-2"><a href="#cb7-2" aria-hidden="true" tabindex="-1"></a> <span class="ex">./lycklama</span> <span class="op">&lt;</span> lycklama.alt.c</span>
<span id="cb7-3"><a href="#cb7-3" aria-hidden="true" tabindex="-1"></a> <span class="ex">./lycklama</span> <span class="op">&lt;</span> lycklama.orig.c</span>
<span id="cb7-4"><a href="#cb7-4" aria-hidden="true" tabindex="-1"></a> <span class="ex">./lycklama</span> <span class="op">&lt;</span> Makefile</span></code></pre></div>
<pre class="&lt;!---sh--&gt;"><code> ./lycklama &lt; lycklama.c
./lycklama &lt; lycklama.alt.c
./lycklama &lt; lycklama.orig.c
./lycklama &lt; Makefile</code></pre>
<h2 id="judges-remarks">Judges’ remarks:</h2>
<p>Run the program, redirecting a file into it, and notice how it redisplays it.
The program itself looks like tty noise.</p>
+5 -5
View File
@@ -1,6 +1,6 @@
## To build:
```sh
```<!---sh-->
make all
```
@@ -10,7 +10,7 @@ There is alternate code which allows one to change the size of the maze. See
### To run:
```sh
```<!---sh-->
./shapiro
```
@@ -23,7 +23,7 @@ of the maze. The alt code allows one to easily do this.
### Alternate build:
```sh
```<!---sh-->
make alt
```
@@ -32,7 +32,7 @@ of the maze. The alt code allows one to easily do this.
If you wish to change the value you can do it like:
```sh
```<!---sh-->
make clobber SIZE=5 alt
```
@@ -41,7 +41,7 @@ error. If it's <= 0 || >= 5000 then it is set to 39, the default.
You might also wish to try:
```sh
```<!---sh-->
./try.alt.sh
```
+5 -5
View File
@@ -141,23 +141,23 @@ Location: <a href="../../location.html#US">US</a> - <em>United States of America
<!-- START: this line starts content for HTML phase 21 by: bin/pandoc-wrapper.sh via bin/md2html.sh -->
<h2 id="to-build">To build:</h2>
<div class="sourceCode" id="cb1"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb1-1"><a href="#cb1-1" aria-hidden="true" tabindex="-1"></a> <span class="fu">make</span> all</span></code></pre></div>
<pre class="&lt;!---sh--&gt;"><code> make all</code></pre>
<p>There is alternate code which allows one to change the size of the maze. See
<a href="#alternate-code">Alternate code</a> below.</p>
<h3 id="to-run">To run:</h3>
<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">./shapiro</span></span></code></pre></div>
<pre class="&lt;!---sh--&gt;"><code> ./shapiro</code></pre>
<h2 id="alternate-code">Alternate code:</h2>
<p>The code has a define <code>C</code> set to 39 but this can be modified to change the size
of the maze. The alt code allows one to easily do this.</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>
<pre class="&lt;!---sh--&gt;"><code> make alt</code></pre>
<h3 id="alternate-try">Alternate try:</h3>
<p>If you wish to change the value you can do it like:</p>
<div class="sourceCode" id="cb4"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb4-1"><a href="#cb4-1" aria-hidden="true" tabindex="-1"></a> <span class="fu">make</span> clobber SIZE=5 alt</span></code></pre></div>
<pre class="&lt;!---sh--&gt;"><code> make clobber SIZE=5 alt</code></pre>
<p>Note that if it is not a number then obviously there will be a compilation
error. If it’s &lt;= 0 || &gt;= 5000 then it is set to 39, the default.</p>
<p>You might also wish to try:</p>
<div class="sourceCode" id="cb5"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb5-1"><a href="#cb5-1" aria-hidden="true" tabindex="-1"></a> <span class="ex">./try.alt.sh</span></span></code></pre></div>
<pre class="&lt;!---sh--&gt;"><code> ./try.alt.sh</code></pre>
<p>This script will compile the program five times with a random value and then
prompt you in an infinite loop for values to try, exiting only if non-digits are
in the input.</p>
+7 -7
View File
@@ -1,6 +1,6 @@
## To build:
```sh
```<!---sh-->
make all
```
@@ -11,7 +11,7 @@ more details on it.
## To use:
```sh
```<!---sh-->
./sicherman < file
echo foo | ./sicherman
@@ -23,7 +23,7 @@ more details on it.
## Try:
```sh
```<!---sh-->
./try.sh
```
@@ -43,7 +43,7 @@ audience.
Although this will be built if the original fails to compile you can do it
manually like:
```sh
```<!---sh-->
make alt
```
@@ -52,14 +52,14 @@ In this case it will be built as `sicherman.alt`.
### Alternate use:
```sh
```<!---sh-->
./sicherman.alt < file
```
### Alternate try:
```sh
```<!---sh-->
./try.alt.sh
```
@@ -80,7 +80,7 @@ on a line. Now enter the letters 'n' through 'z'. But to borrow a quote
from Richard Stallman: If you think you understand what this code
does, then you don't, so read it again! Explain why:
```sh
```<!---sh-->
./sicherman < sicherman.c | ./sicherman | diff - ./sicherman.c
```
+12 -12
View File
@@ -141,19 +141,19 @@ 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> all</span></code></pre></div>
<pre class="&lt;!---sh--&gt;"><code> make all</code></pre>
<p>There is another version that will be compiled in case the first fails. This
should happen automatically. See <a href="#alternate-code">Alternate code</a> below for
more details on it.</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">./sicherman</span> <span class="op">&lt;</span> file</span>
<span id="cb2-2"><a href="#cb2-2" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb2-3"><a href="#cb2-3" aria-hidden="true" tabindex="-1"></a> <span class="bu">echo</span> foo <span class="kw">|</span> <span class="ex">./sicherman</span></span>
<span id="cb2-4"><a href="#cb2-4" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb2-5"><a href="#cb2-5" aria-hidden="true" tabindex="-1"></a> <span class="ex">./sicherman</span></span>
<span id="cb2-6"><a href="#cb2-6" aria-hidden="true" tabindex="-1"></a> <span class="co"># type or paste some text, making sure to hit enter after each line typed</span></span></code></pre></div>
<pre class="&lt;!---sh--&gt;"><code> ./sicherman &lt; file
echo foo | ./sicherman
./sicherman
# type or paste some text, making sure to hit enter after each line typed</code></pre>
<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>
<pre class="&lt;!---sh--&gt;"><code> ./try.sh</code></pre>
<h2 id="alternate-code">Alternate code:</h2>
<p>The <a href="sicherman.alt.c">sicherman.alt.c</a> is a slight change in the fixed version
(fixed so it does not require <code>-traditional-cpp</code>) in that it has two args to
@@ -164,12 +164,12 @@ audience.</p>
<h3 id="alternate-build">Alternate build:</h3>
<p>Although this will be built if the original fails to compile you can do it
manually like:</p>
<div class="sourceCode" id="cb4"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb4-1"><a href="#cb4-1" aria-hidden="true" tabindex="-1"></a> <span class="fu">make</span> alt</span></code></pre></div>
<pre class="&lt;!---sh--&gt;"><code> make alt</code></pre>
<p>In this case it will be built as <code>sicherman.alt</code>.</p>
<h3 id="alternate-use">Alternate use:</h3>
<div class="sourceCode" id="cb5"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb5-1"><a href="#cb5-1" aria-hidden="true" tabindex="-1"></a> <span class="ex">./sicherman.alt</span> <span class="op">&lt;</span> file</span></code></pre></div>
<pre class="&lt;!---sh--&gt;"><code> ./sicherman.alt &lt; file</code></pre>
<h3 id="alternate-try">Alternate try:</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">./try.alt.sh</span></span></code></pre></div>
<pre class="&lt;!---sh--&gt;"><code> ./try.alt.sh</code></pre>
<h2 id="judges-remarks">Judges’ remarks:</h2>
<p>This program abuses the C preprocessor so much that some <code>cpp</code>s fail to strip
out all of the comments on the first pass! If you were able to understand
@@ -182,7 +182,7 @@ Like the program says, what’s that mean?</p>
on a line. Now enter the letters ‘n’ through ‘z’. But to borrow a quote
from Richard Stallman: If you think you understand what this code
does, then you don’t, so read it again! Explain why:</p>
<div class="sourceCode" id="cb7"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb7-1"><a href="#cb7-1" aria-hidden="true" tabindex="-1"></a> <span class="ex">./sicherman</span> <span class="op">&lt;</span> sicherman.c <span class="kw">|</span> <span class="ex">./sicherman</span> <span class="kw">|</span> <span class="fu">diff</span> <span class="at">-</span> ./sicherman.c</span></code></pre></div>
<pre class="&lt;!---sh--&gt;"><code> ./sicherman &lt; sicherman.c | ./sicherman | diff - ./sicherman.c</code></pre>
<p>results in diff reporting a difference on some machines.</p>
<h2 id="authors-remarks">Author’s remarks:</h2>
<p>No remarks were provided by the author.</p>
+3 -3
View File
@@ -1,20 +1,20 @@
## To build:
```sh
```<!---sh-->
make all
```
## To use:
```sh
```<!---sh-->
./applin
```
## Try:
```sh
```<!---sh-->
./applin.c
```
+3 -3
View File
@@ -141,11 +141,11 @@ Location: <a href="../../location.html#US">US</a> - <em>United States of America
<!-- START: this line starts content for HTML phase 21 by: bin/pandoc-wrapper.sh via bin/md2html.sh -->
<h2 id="to-build">To build:</h2>
<div class="sourceCode" id="cb1"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb1-1"><a href="#cb1-1" aria-hidden="true" tabindex="-1"></a> <span class="fu">make</span> all</span></code></pre></div>
<pre class="&lt;!---sh--&gt;"><code> make all</code></pre>
<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">./applin</span></span></code></pre></div>
<pre class="&lt;!---sh--&gt;"><code> ./applin</code></pre>
<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">./applin.c</span></span></code></pre></div>
<pre class="&lt;!---sh--&gt;"><code> ./applin.c</code></pre>
<h2 id="judges-remarks">Judges’ remarks:</h2>
<p>The judges were so amused by this little program that we created an
award just for it. This program is portable to the C and Fortran 77
+2 -2
View File
@@ -1,6 +1,6 @@
## To build:
```sh
```<!---sh-->
make all
```
@@ -18,7 +18,7 @@ For more detailed information see [1986 august bugs](../../bugs.html#1986_august
## Try:
```sh
```<!---sh-->
./august
```
+2 -2
View File
@@ -141,13 +141,13 @@ Location: <a href="../../location.html#SE">SE</a> - <em>Kingdom of Sweden</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> all</span></code></pre></div>
<pre class="&lt;!---sh--&gt;"><code> make all</code></pre>
<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>
<p>For more detailed information see <a href="../../bugs.html#1986_august">1986 august bugs</a>.</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">./august</span></span></code></pre></div>
<pre class="&lt;!---sh--&gt;"><code> ./august</code></pre>
<h2 id="judges-remarks">Judges’ remarks:</h2>
<p>This program computes a specific mathematical value. Simply compile
and give it an infinite amount of stack space and CPU time. Otherwise
+3 -3
View File
@@ -1,20 +1,20 @@
## To build:
```sh
```<!---sh-->
make all
```
## To use:
```sh
```<!---sh-->
./bright some_file
```
## Try:
```sh
```<!---sh-->
./try.sh
```
+3 -3
View File
@@ -141,11 +141,11 @@ Location: <a href="../../location.html#US">US</a> - <em>United States of America
<!-- START: this line starts content for HTML phase 21 by: bin/pandoc-wrapper.sh via bin/md2html.sh -->
<h2 id="to-build">To build:</h2>
<div class="sourceCode" id="cb1"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb1-1"><a href="#cb1-1" aria-hidden="true" tabindex="-1"></a> <span class="fu">make</span> all</span></code></pre></div>
<pre class="&lt;!---sh--&gt;"><code> make all</code></pre>
<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">./bright</span> some_file</span></code></pre></div>
<pre class="&lt;!---sh--&gt;"><code> ./bright some_file</code></pre>
<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>
<pre class="&lt;!---sh--&gt;"><code> ./try.sh</code></pre>
<h2 id="judges-remarks">Judges’ remarks:</h2>
<p>Compile this program and give a filename as an argument.</p>
<p>Mr. Bright exploits the C pre-processor, similar variables and
+3 -3
View File
@@ -1,13 +1,13 @@
## To build:
```sh
```<!---sh-->
make all
```
## To use:
```sh
```<!---sh-->
./hague 2>/dev/null
# enter some text
```
@@ -15,7 +15,7 @@
## Try:
```sh
```<!---sh-->
./try.sh
```
+4 -4
View File
@@ -141,12 +141,12 @@ Location: <a href="../../location.html#GB">GB</a> - <em>United Kingdom of Great
<!-- START: this line starts content for HTML phase 21 by: bin/pandoc-wrapper.sh via bin/md2html.sh -->
<h2 id="to-build">To build:</h2>
<div class="sourceCode" id="cb1"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb1-1"><a href="#cb1-1" aria-hidden="true" tabindex="-1"></a> <span class="fu">make</span> all</span></code></pre></div>
<pre class="&lt;!---sh--&gt;"><code> make all</code></pre>
<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">./hague</span> <span class="dv">2</span><span class="op">&gt;</span>/dev/null</span>
<span id="cb2-2"><a href="#cb2-2" aria-hidden="true" tabindex="-1"></a> <span class="co"># enter some text</span></span></code></pre></div>
<pre class="&lt;!---sh--&gt;"><code> ./hague 2&gt;/dev/null
# enter some text</code></pre>
<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>
<pre class="&lt;!---sh--&gt;"><code> ./try.sh</code></pre>
<p>Note that you can run the program without feeding it anything and then type in a
message and line by line it will show the right output. Notice also how certain
characters will print a <code>?</code>.</p>
+2 -2
View File
@@ -1,13 +1,13 @@
## To build:
```sh
```<!---sh-->
make all
```
## Try:
```sh
```<!---sh-->
./holloway
```
+2 -2
View File
@@ -141,9 +141,9 @@ 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> all</span></code></pre></div>
<pre class="&lt;!---sh--&gt;"><code> make all</code></pre>
<h2 id="try">Try:</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">./holloway</span></span></code></pre></div>
<pre class="&lt;!---sh--&gt;"><code> ./holloway</code></pre>
<h2 id="judges-remarks">Judges’ remarks:</h2>
<p>Believe it or not, this is the old standard “Hello, world” program
performed in a very complex way. The judges and the author defy you
+4 -4
View File
@@ -1,6 +1,6 @@
## To build:
```sh
```<!---sh-->
make all
```
@@ -18,7 +18,7 @@ if nothing else.
## To use:
```sh
```<!---sh-->
./marshall
```
@@ -36,14 +36,14 @@ instead offer the problematic code as an alternate version whereas
To see if your compiler has the problems noted:
```sh
```<!---sh-->
make alt
```
### Alternate use:
```sh
```<!---sh-->
./marshall.alt
```
+4 -4
View File
@@ -162,7 +162,7 @@ because of the call to <code>_exit()</code> (see below).</p>
enable the optimiser clang will generate code that prints the string twice and
dumps core just like before! What about the call to <code>_exit()</code>?</p>
<p>The call was:</p>
<div class="sourceCode" id="cb1"><pre class="sourceCode c"><code class="sourceCode c"><span id="cb1-1"><a href="#cb1-1" aria-hidden="true" tabindex="-1"></a> _exit<span class="op">(</span>argv<span class="op">[(</span><span class="dt">int</span><span class="op">)*</span>argc<span class="op">-</span><span class="dv">2</span><span class="op">/</span>cc<span class="op">[</span><span class="dv">1</span><span class="op">*(</span><span class="dt">int</span><span class="op">)*</span>argc<span class="op">]|-</span><span class="dv">1</span><span class="op">&lt;&lt;</span><span class="dv">4</span><span class="op">]);</span></span></code></pre></div>
<pre class="&lt;!---c--&gt;"><code> _exit(argv[(int)*argc-2/cc[1*(int)*argc]|-1&lt;&lt;4]);</code></pre>
<p>Changing it to not refer to these variables and just exit 1 and the problems
disappear!</p>
<h3 id="macos">macOS</h3>
@@ -172,9 +172,9 @@ it works fine but if it’s disabled it prints out the string and then enters an
infinite loop!</p>
<p>After we fix the infinite loop if we change the <code>_exit()</code> call in macOS and
disable the optimiser we might get something like:</p>
<div class="sourceCode" id="cb2"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb2-1"><a href="#cb2-1" aria-hidden="true" tabindex="-1"></a> <span class="ex">$</span> ./marshall</span>
<span id="cb2-2"><a href="#cb2-2" aria-hidden="true" tabindex="-1"></a> <span class="ex">choo</span> choo</span>
<span id="cb2-3"><a href="#cb2-3" aria-hidden="true" tabindex="-1"></a> <span class="ex">Segmentation</span> fault: 11</span></code></pre></div>
<pre class="&lt;!---sh--&gt;"><code> $ ./marshall
choo choo
Segmentation fault: 11</code></pre>
<p>Observe how it doesn’t print it twice. But of course it segfaults so it’s not
right either.</p>
<p>If the optimiser is enabled, however, we will see that it works fine before the
+2 -2
View File
@@ -54,7 +54,7 @@ dumps core just like before! What about the call to `_exit()`?
The call was:
```c
```<!---c-->
_exit(argv[(int)*argc-2/cc[1*(int)*argc]|-1<<4]);
```
@@ -72,7 +72,7 @@ infinite loop!
After we fix the infinite loop if we change the `_exit()` call in macOS and
disable the optimiser we might get something like:
```sh
```<!---sh-->
$ ./marshall
choo choo
Segmentation fault: 11
+4 -4
View File
@@ -141,7 +141,7 @@ 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> all</span></code></pre></div>
<pre class="&lt;!---sh--&gt;"><code> make all</code></pre>
<p>NOTE: we FORCE disable the optimiser due to a funny problem with different
compilers and systems. See below and <a href="compilers.html">compilers.html</a> for details.</p>
<p>There is an <a href="#alternate-code">alternate version</a>. The reason is a funny problem:
@@ -152,7 +152,7 @@ might work but the other one would not. We describe this in more detail in
<a href="compilers.html">compilers.html</a> and we encourage you to read it for entertainment
if nothing else.</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">./marshall</span></span></code></pre></div>
<pre class="&lt;!---sh--&gt;"><code> ./marshall</code></pre>
<h2 id="alternate-code">Alternate code:</h2>
<p>Due to the different <a href="compilers.html">conflicting problems</a> with gcc and clang, we
instead offer the problematic code as an alternate version whereas
@@ -160,9 +160,9 @@ instead offer the problematic code as an alternate version whereas
<code>_exit()</code> commented out, changing the value passed into <code>_exit()</code> to <code>1</code>.</p>
<h3 id="alternate-build">Alternate build:</h3>
<p>To see if your compiler has the problems noted:</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> alt</span></code></pre></div>
<pre class="&lt;!---sh--&gt;"><code> make alt</code></pre>
<h3 id="alternate-use">Alternate use:</h3>
<div class="sourceCode" id="cb4"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb4-1"><a href="#cb4-1" aria-hidden="true" tabindex="-1"></a> <span class="ex">./marshall.alt</span></span></code></pre></div>
<pre class="&lt;!---sh--&gt;"><code> ./marshall.alt</code></pre>
<p>Does it work in your system? That is does it not segfault, does it print it only
once and does it not enter an infinite loop? Or more generally does it print the
text exactly once and then exit?</p>
+2 -2
View File
@@ -1,13 +1,13 @@
## To build:
```sh
```<!---sh-->
make all
```
## Try:
```sh
```<!---sh-->
./pawka
```
+2 -2
View File
@@ -141,9 +141,9 @@ Location: <a href="../../location.html#ZZ">ZZ</a> - <em>Unknown location</em></l
<!-- 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> all</span></code></pre></div>
<pre class="&lt;!---sh--&gt;"><code> make all</code></pre>
<h2 id="try">Try:</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">./pawka</span></span></code></pre></div>
<pre class="&lt;!---sh--&gt;"><code> ./pawka</code></pre>
<h2 id="judges-remarks">Judges’ remarks:</h2>
<p>The judges found this entry to be one of hardest to read without the
aid of <code>/lib/cpp</code> and a good editor. When run, the program asks if it
+3 -3
View File
@@ -1,13 +1,13 @@
## To build:
```sh
```<!---sh-->
make all
```
## To use:
```sh
```<!---sh-->
./stein $(printf "\015\015"); echo
```
@@ -24,7 +24,7 @@ The `\015` in the above `printf(1)` command produces a control-N.
One some machines, a control-M control-N arg is needed
to get the command to output cleanly:
```sh
```<!---sh-->
./stein $(printf "\014\015"); echo
```
+3 -3
View File
@@ -141,9 +141,9 @@ Location: <a href="../../location.html#ZZ">ZZ</a> - <em>Unknown location</em></l
<!-- 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> all</span></code></pre></div>
<pre class="&lt;!---sh--&gt;"><code> make all</code></pre>
<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">./stein</span> <span class="va">$(</span><span class="bu">printf</span> <span class="st">&quot;\015\015&quot;</span><span class="va">)</span><span class="kw">;</span> <span class="bu">echo</span></span></code></pre></div>
<pre class="&lt;!---sh--&gt;"><code> ./stein $(printf &quot;\015\015&quot;); echo</code></pre>
<h2 id="judges-remarks">Judges’ remarks:</h2>
<p>NOTE: to avoid problems with news and mail, the single line was split
into 3 lines. Join all lines into a single line to recreate
@@ -151,7 +151,7 @@ the original file.</p>
<p>The <code>\015</code> in the above <code>printf(1)</code> command produces a control-N.</p>
<p>One some machines, a control-M control-N arg is needed
to get the command to output cleanly:</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">./stein</span> <span class="va">$(</span><span class="bu">printf</span> <span class="st">&quot;\014\015&quot;</span><span class="va">)</span><span class="kw">;</span> <span class="bu">echo</span></span></code></pre></div>
<pre class="&lt;!---sh--&gt;"><code> ./stein $(printf &quot;\014\015&quot;); echo</code></pre>
<p>Your system may require another set of characters.
In time, you will figure out what it does. :-)</p>
<h2 id="authors-remarks">Author’s remarks:</h2>
+2 -2
View File
@@ -1,13 +1,13 @@
## To build:
```sh
```<!---sh-->
make all
```
## To use:
```sh
```<!---sh-->
./wall
```
+2 -2
View File
@@ -141,9 +141,9 @@ 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> all</span></code></pre></div>
<pre class="&lt;!---sh--&gt;"><code> make all</code></pre>
<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">./wall</span></span></code></pre></div>
<pre class="&lt;!---sh--&gt;"><code> ./wall</code></pre>
<h2 id="judges-remarks">Judges’ remarks:</h2>
<p>The original version did not have a ‘;’ character in the first line.
This caused a number of System V C pre-preprocessors to gripe about a
+3 -3
View File
@@ -1,13 +1,13 @@
## To build:
```sh
```<!---sh-->
make all
```
## To use:
```sh
```<!---sh-->
some_command | ./biggar | od -c
./biggar < file | od -c
@@ -16,7 +16,7 @@
## Try:
```sh
```<!---sh-->
./try.sh
```
+5 -5
View File
@@ -141,13 +141,13 @@ Location: <a href="../../location.html#ZZ">ZZ</a> - <em>Unknown location</em></l
<!-- 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> all</span></code></pre></div>
<pre class="&lt;!---sh--&gt;"><code> make all</code></pre>
<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">some_command</span> <span class="kw">|</span> <span class="ex">./biggar</span> <span class="kw">|</span> <span class="fu">od</span> <span class="at">-c</span></span>
<span id="cb2-2"><a href="#cb2-2" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb2-3"><a href="#cb2-3" aria-hidden="true" tabindex="-1"></a> <span class="ex">./biggar</span> <span class="op">&lt;</span> file <span class="kw">|</span> <span class="fu">od</span> <span class="at">-c</span></span></code></pre></div>
<pre class="&lt;!---sh--&gt;"><code> some_command | ./biggar | od -c
./biggar &lt; file | od -c</code></pre>
<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>
<pre class="&lt;!---sh--&gt;"><code> ./try.sh</code></pre>
<h2 id="judges-remarks">Judges’ remarks:</h2>
<p>By changing the compile line you can make this program do anything you
want. This is a very efficient way to transfer source, though it
+4 -4
View File
@@ -1,6 +1,6 @@
## To build:
```sh
```<!---sh-->
make all
```
@@ -10,7 +10,7 @@ To compile on a 16 bit machine, change 300000 to 30000.
## To use:
```sh
```<!---sh-->
./heckbert col < file
```
@@ -19,7 +19,7 @@ where col is the number of columns to fold at and file is the file to fold.
## Try:
```sh
```<!---sh-->
./try.sh
```
@@ -28,7 +28,7 @@ where col is the number of columns to fold at and file is the file to fold.
Folding at the wrong length may be equivalent to a "Spindle or Mutilate" operation. For example:
```sh
```<!---sh-->
./heckbert 40 < heckbert.c > ph.c ; make ph ; ./ph 20 < heckbert.c > bar.c ; make bar
```
+4 -4
View File
@@ -141,17 +141,17 @@ 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> all</span></code></pre></div>
<pre class="&lt;!---sh--&gt;"><code> make all</code></pre>
<p>On System V systems, we had to compile with <code>-Dindex=strchr</code>.
To compile on a 16 bit machine, change 300000 to 30000.</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">./heckbert</span> col <span class="op">&lt;</span> file</span></code></pre></div>
<pre class="&lt;!---sh--&gt;"><code> ./heckbert col &lt; file</code></pre>
<p>where col is the number of columns to fold at and file is the file to fold.</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>
<pre class="&lt;!---sh--&gt;"><code> ./try.sh</code></pre>
<h2 id="judges-remarks">Judges’ remarks:</h2>
<p>Folding at the wrong length may be equivalent to a “Spindle or Mutilate” operation. For example:</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">./heckbert</span> 40 <span class="op">&lt;</span> heckbert.c <span class="op">&gt;</span> ph.c <span class="kw">;</span> <span class="fu">make</span> ph <span class="kw">;</span> <span class="ex">./ph</span> 20 <span class="op">&lt;</span> heckbert.c <span class="op">&gt;</span> bar.c <span class="kw">;</span> <span class="fu">make</span> bar</span></code></pre></div>
<pre class="&lt;!---sh--&gt;"><code> ./heckbert 40 &lt; heckbert.c &gt; ph.c ; make ph ; ./ph 20 &lt; heckbert.c &gt; bar.c ; make bar</code></pre>
<p>Try not to
<a href="https://repository.library.brown.edu/studio/item/bdr:788264/PDF/">Fold, Spindle or Mutilate</a>
files. :-)</p>
+3 -3
View File
@@ -1,20 +1,20 @@
## To build:
```sh
```<!---sh-->
make all
```
## To use:
```sh
```<!---sh-->
./hines file.c
```
## Try:
```sh
```<!---sh-->
./try.sh
```
+3 -3
View File
@@ -141,11 +141,11 @@ Location: <a href="../../location.html#ZZ">ZZ</a> - <em>Unknown location</em></l
<!-- 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> all</span></code></pre></div>
<pre class="&lt;!---sh--&gt;"><code> make all</code></pre>
<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">./hines</span> file.c</span></code></pre></div>
<pre class="&lt;!---sh--&gt;"><code> ./hines file.c</code></pre>
<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>
<pre class="&lt;!---sh--&gt;"><code> ./try.sh</code></pre>
<h2 id="judges-remarks">Judges’ remarks:</h2>
<p>This program was designed to maximize the bother function for
structured programmers. This program takes <code>goto</code> statements to their
+6 -6
View File
@@ -1,13 +1,13 @@
## To build:
```sh
```<!---sh-->
make all
```
## To use:
```sh
```<!---sh-->
./korn
```
@@ -29,14 +29,14 @@ Several points are important to understand this program:
2. What is the value of the symbol `"have"`? (hint: the value is NOT 4
characters, or `'h'`, or a string) Consider the fact that:
```c
```<!---c-->
char *x;
```
defines a pointer to a `char` (i.e. an address), and that the `=` assigns
things of compatible types. Since:
```c
```<!---c-->
x = "have";
```
@@ -44,13 +44,13 @@ is legal C, what type of value is `"have"`?
3. Note that the following expressions yield the same value:
```c
```<!---c-->
x[3] *(x+3) *(3+x)
```
since addition is commutative. What can be said about this value?
```c
```<!---c-->
3[x]
```
+6 -6
View File
@@ -141,9 +141,9 @@ 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> all</span></code></pre></div>
<pre class="&lt;!---sh--&gt;"><code> make all</code></pre>
<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">./korn</span></span></code></pre></div>
<pre class="&lt;!---sh--&gt;"><code> ./korn</code></pre>
<h2 id="judges-remarks">Judges’ remarks:</h2>
<p>The Judges believe that this is the best one line entry ever received.
Compile on a UNIX system, or at least one using a C implementation that
@@ -158,17 +158,17 @@ section right now and see if you are one of the few people who can.</p>
<li><p>What is the value of the symbol <code>"have"</code>? (hint: the value is NOT 4
characters, or <code>'h'</code>, or a string) Consider the fact that:</p></li>
</ol>
<div class="sourceCode" id="cb3"><pre class="sourceCode c"><code class="sourceCode c"><span id="cb3-1"><a href="#cb3-1" aria-hidden="true" tabindex="-1"></a> <span class="dt">char</span> <span class="op">*</span>x<span class="op">;</span></span></code></pre></div>
<pre class="&lt;!---c--&gt;"><code> char *x;</code></pre>
<p>defines a pointer to a <code>char</code> (i.e. an address), and that the <code>=</code> assigns
things of compatible types. Since:</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> x <span class="op">=</span> <span class="st">&quot;have&quot;</span><span class="op">;</span></span></code></pre></div>
<pre class="&lt;!---c--&gt;"><code> x = &quot;have&quot;;</code></pre>
<p>is legal C, what type of value is <code>"have"</code>?</p>
<ol start="3" type="1">
<li>Note that the following expressions yield the same value:</li>
</ol>
<div class="sourceCode" id="cb5"><pre class="sourceCode c"><code class="sourceCode c"><span id="cb5-1"><a href="#cb5-1" aria-hidden="true" tabindex="-1"></a> x<span class="op">[</span><span class="dv">3</span><span class="op">]</span> <span class="op">*(</span>x<span class="op">+</span><span class="dv">3</span><span class="op">)</span> <span class="op">*(</span><span class="dv">3</span><span class="op">+</span>x<span class="op">)</span></span></code></pre></div>
<pre class="&lt;!---c--&gt;"><code> x[3] *(x+3) *(3+x)</code></pre>
<p>since addition is commutative. What can be said about this value?</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="dv">3</span><span class="op">[</span>x<span class="op">]</span></span></code></pre></div>
<pre class="&lt;!---c--&gt;"><code> 3[x]</code></pre>
<p><a href="https://news.slashdot.org/story/01/02/06/2030205/david-korn-tells-all">David
Korn</a>’s
<a href="https://en.wikipedia.org/wiki/KornShell">/bin/ksh</a> provides us with a greatly
+3 -3
View File
@@ -1,13 +1,13 @@
## To build:
```sh
```<!---sh-->
make all
```
## To use:
```sh
```<!---sh-->
./lievaart
# enter a level and start playing as described below
```
@@ -17,7 +17,7 @@
To see what it would have looked like without the size restrictions:
```sh
```<!---sh-->
./lievaart2
# enter a level and start playing as described below
```
+5 -5
View File
@@ -141,14 +141,14 @@ Location: <a href="../../location.html#NL">NL</a> - <em>Kingdom of the Netherlan
<!-- 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> all</span></code></pre></div>
<pre class="&lt;!---sh--&gt;"><code> make all</code></pre>
<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">./lievaart</span></span>
<span id="cb2-2"><a href="#cb2-2" aria-hidden="true" tabindex="-1"></a> <span class="co"># enter a level and start playing as described below</span></span></code></pre></div>
<pre class="&lt;!---sh--&gt;"><code> ./lievaart
# enter a level and start playing as described below</code></pre>
<h2 id="try">Try:</h2>
<p>To see what it would have looked like without the size restrictions:</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">./lievaart2</span></span>
<span id="cb3-2"><a href="#cb3-2" aria-hidden="true" tabindex="-1"></a> <span class="co"># enter a level and start playing as described below</span></span></code></pre></div>
<pre class="&lt;!---sh--&gt;"><code> ./lievaart2
# enter a level and start playing as described below</code></pre>
<h2 id="judges-remarks">Judges’ remarks:</h2>
<p>We believe that you too will be amazed at just how much power Mr. Lievaart
packed into 1024 bytes!</p>
+4 -4
View File
@@ -1,13 +1,13 @@
## To build:
```sh
```<!---sh-->
make all
```
## To use:
```sh
```<!---sh-->
./wall
# enter some numbers
@@ -18,14 +18,14 @@
## Try:
```sh
```<!---sh-->
./try.sh
```
You may of course run the commands manually and enter text as you wish. For
instance you might try one or both of:
```sh
```<!---sh-->
./wall | bc
./wall | cat
+10 -10
View File
@@ -141,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> all</span></code></pre></div>
<pre class="&lt;!---sh--&gt;"><code> make all</code></pre>
<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">./wall</span></span>
<span id="cb2-2"><a href="#cb2-2" aria-hidden="true" tabindex="-1"></a> <span class="co"># enter some numbers</span></span>
<span id="cb2-3"><a href="#cb2-3" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb2-4"><a href="#cb2-4" aria-hidden="true" tabindex="-1"></a> <span class="ex">./wall</span> <span class="kw">|</span> <span class="ex">some_command</span></span>
<span id="cb2-5"><a href="#cb2-5" aria-hidden="true" tabindex="-1"></a> <span class="co"># enter some strings or numbers, depending on command</span></span></code></pre></div>
<pre class="&lt;!---sh--&gt;"><code> ./wall
# enter some numbers
./wall | some_command
# enter some strings or numbers, depending on command</code></pre>
<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>
<pre class="&lt;!---sh--&gt;"><code> ./try.sh</code></pre>
<p>You may of course run the commands manually and enter text as you wish. For
instance you might try one or both of:</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">./wall</span> <span class="kw">|</span> <span class="fu">bc</span></span>
<span id="cb4-2"><a href="#cb4-2" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb4-3"><a href="#cb4-3" aria-hidden="true" tabindex="-1"></a> <span class="ex">./wall</span> <span class="kw">|</span> <span class="fu">cat</span></span></code></pre></div>
<pre class="&lt;!---sh--&gt;"><code> ./wall | bc
./wall | cat</code></pre>
<p>and enter some input like:</p>
<pre><code> x*x
2^x
+2 -2
View File
@@ -1,13 +1,13 @@
## To build:
```sh
```<!---sh-->
make all
```
## To use:
```sh
```<!---sh-->
./westley
```
+2 -2
View File
@@ -141,9 +141,9 @@ 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> all</span></code></pre></div>
<pre class="&lt;!---sh--&gt;"><code> make all</code></pre>
<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">./westley</span></span></code></pre></div>
<pre class="&lt;!---sh--&gt;"><code> ./westley</code></pre>
<h2 id="judges-remarks">Judges’ remarks:</h2>
<p><code>putchar()</code> must exist in the C library and not just as a macro.
If it fails to compile, bug your OS/compiler vendor.</p>
+3 -3
View File
@@ -1,6 +1,6 @@
## To build:
```sh
```<!---sh-->
make all
```
@@ -12,7 +12,7 @@ program. See the [Alternate code](#alternate-code) section below for details.
## Try:
```sh
```<!---sh-->
./applin
```
@@ -25,7 +25,7 @@ with this entry.
### Alternate build:
```sh
```<!---sh-->
make alt
```
+3 -3
View File
@@ -141,18 +141,18 @@ 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> all</span></code></pre></div>
<pre class="&lt;!---sh--&gt;"><code> make all</code></pre>
<p>A smaller version, originally called <code>zsmall.c</code> (and still exists as such, as
the source of the alt code), of <a href="applin.c">applin.c</a>, can be found in
<a href="applin.alt.c">applin.alt.c</a>. Your machine may have an easier time with this
program. See the <a href="#alternate-code">Alternate code</a> section below for details.</p>
<h2 id="try">Try:</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">./applin</span></span></code></pre></div>
<pre class="&lt;!---sh--&gt;"><code> ./applin</code></pre>
<h2 id="alternate-code">Alternate code:</h2>
<p>As noted above a smaller version can be used in case your <code>cpp</code> has a hard time
with this entry.</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>
<pre class="&lt;!---sh--&gt;"><code> make alt</code></pre>
<p>Use <code>applin.alt</code> as you would <code>applin</code> above.</p>
<h4 id="history-about-the-smaller-version">History about the smaller version:</h4>
<p>Way back in 1988 ..</p>
+3 -3
View File
@@ -1,6 +1,6 @@
## To build:
```sh
```<!---sh-->
make all
```
@@ -18,13 +18,13 @@ For more detailed information see [1988 dale bugs](../../bugs.html#1988_dale).
## Try:
```sh
```<!---sh-->
./try.sh
```
Observe that three of the commands in the script are:
```sh
```<!---sh-->
./dale these files are in this directory: *
./dale $(printf "the following files exist in this directory:\n%s\n" *)
./dale "$(printf "the following files exist in this directory:\n%s\n" *)"
+5 -5
View File
@@ -141,17 +141,17 @@ Location: <a href="../../location.html#AU">AU</a> - <em>Commonwealth of Australi
<!-- 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> all</span></code></pre></div>
<pre class="&lt;!---sh--&gt;"><code> make all</code></pre>
<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>
<p>For more detailed information see <a href="../../bugs.html#1988_dale">1988 dale bugs</a>.</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>
<pre class="&lt;!---sh--&gt;"><code> ./try.sh</code></pre>
<p>Observe that three of the commands in the script are:</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">./dale</span> these files are in this directory: <span class="pp">*</span></span>
<span id="cb4-2"><a href="#cb4-2" aria-hidden="true" tabindex="-1"></a> <span class="ex">./dale</span> <span class="va">$(</span><span class="bu">printf</span> <span class="st">&quot;the following files exist in this directory:\n%s\n&quot;</span> <span class="pp">*</span><span class="va">)</span></span>
<span id="cb4-3"><a href="#cb4-3" aria-hidden="true" tabindex="-1"></a> <span class="ex">./dale</span> <span class="st">&quot;</span><span class="va">$(</span><span class="bu">printf</span> <span class="st">&quot;the following files exist in this directory:\n%s\n&quot;</span> <span class="pp">*</span><span class="va">)</span><span class="st">&quot;</span></span></code></pre></div>
<pre class="&lt;!---sh--&gt;"><code> ./dale these files are in this directory: *
./dale $(printf &quot;the following files exist in this directory:\n%s\n&quot; *)
./dale &quot;$(printf &quot;the following files exist in this directory:\n%s\n&quot; *)&quot;</code></pre>
<p>As the script asks what do the last two do and why do they do it? Why do they
differ in format from the first command? Finally how can you get the more likely
desired behaviour?</p>
+5 -5
View File
@@ -1,6 +1,6 @@
## To build:
```sh
```<!---sh-->
make all
```
@@ -11,7 +11,7 @@ code](#alternate-code) below.
## To use:
```sh
```<!---sh-->
./isaak
```
@@ -21,7 +21,7 @@ code](#alternate-code) below.
The original version of this code is in [isaak.alt.c](isaak.alt.c).
The original entry starts with the line:
```c
```<!---c-->
main(){};
```
@@ -37,7 +37,7 @@ compile.
### Alternate build:
```sh
```<!---sh-->
make alt
```
@@ -64,7 +64,7 @@ due to the fact that BSD style systems have an `sprintf(3)` that returns a `char
*`. Due to the above problems, we placed the output of this program in the
file: isaak.encode. To read this file do.
```sh
```<!---sh-->
uudecode < isaak.encode
cat isaak.output
```
+6 -6
View File
@@ -141,16 +141,16 @@ Location: <a href="../../location.html#ZZ">ZZ</a> - <em>Unknown location</em></l
<!-- 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> all</span></code></pre></div>
<pre class="&lt;!---sh--&gt;"><code> make all</code></pre>
<p>There is an alternate version, the original, that can’t be compiled in modern
systems but can be if you have an old enough compiler. 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">./isaak</span></span></code></pre></div>
<pre class="&lt;!---sh--&gt;"><code> ./isaak</code></pre>
<h2 id="alternate-code">Alternate code:</h2>
<p>The original version of this code is in <a href="isaak.alt.c">isaak.alt.c</a>.
The original entry starts with the line:</p>
<div class="sourceCode" id="cb3"><pre class="sourceCode c"><code class="sourceCode c"><span id="cb3-1"><a href="#cb3-1" aria-hidden="true" tabindex="-1"></a> main<span class="op">(){};</span></span></code></pre></div>
<pre class="&lt;!---c--&gt;"><code> main(){};</code></pre>
<p>This works on some systems. Why? Note that <code>#include &lt;stdio.h&gt;</code> is given on
the last line. Why is this needed? Note the unusual calls to <code>sprintf(3)</code>.</p>
<p>This version also relied on being able to define <code>#define</code> to something else and
@@ -158,7 +158,7 @@ using that macro for <code>#define</code>.</p>
<p>This version will not likely work on modern systems if you can even get it to
compile.</p>
<h3 id="alternate-build">Alternate build:</h3>
<div class="sourceCode" id="cb4"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb4-1"><a href="#cb4-1" aria-hidden="true" tabindex="-1"></a> <span class="fu">make</span> alt</span></code></pre></div>
<pre class="&lt;!---sh--&gt;"><code> make alt</code></pre>
<p>Use <code>isaak.alt</code> as you would <code>isaak</code> above.</p>
<h2 id="judges-remarks">Judges’ remarks:</h2>
<p>The program relies heavily on ASCII. Don’t even think of running it on
@@ -173,8 +173,8 @@ from a single macro (e.g., <code>"O/**/O"</code> creates either <code>++</code>
<p>NOTE: Most System V machines were not be able to execute this program correctly
due to the fact that BSD style systems have an <code>sprintf(3)</code> that returns a <code>char *</code>. Due to the above problems, we placed the output of this program in the
file: isaak.encode. To read this file do.</p>
<div class="sourceCode" id="cb5"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb5-1"><a href="#cb5-1" aria-hidden="true" tabindex="-1"></a> <span class="ex">uudecode</span> <span class="op">&lt;</span> isaak.encode</span>
<span id="cb5-2"><a href="#cb5-2" aria-hidden="true" tabindex="-1"></a> <span class="fu">cat</span> isaak.output</span></code></pre></div>
<pre class="&lt;!---sh--&gt;"><code> uudecode &lt; isaak.encode
cat isaak.output</code></pre>
<p>Since this was fixed, this file is not strictly necessary. See the
<a href="isaak.alt.c">isaak.alt.c</a> for the original source.</p>
<p>FYI: We are likely to be more strict about portability in the future.</p>
+7 -7
View File
@@ -1,13 +1,13 @@
## To build:
```sh
```<!---sh-->
make
```
## To use:
```sh
```<!---sh-->
./litmaath some text
```
@@ -17,7 +17,7 @@ code](#alternate-code) section below.
## Try:
```sh
```<!---sh-->
./litmaath eschew obfuscation
```
@@ -31,7 +31,7 @@ a file.
### Alternate build:
```sh
```<!---sh-->
make alt
```
@@ -40,7 +40,7 @@ Use `litmaath.alt` as you would `litmaath` above.
### Alternate try:
```sh
```<!---sh-->
./litmaath.alt six was afraid of seven because seven eight nine
```
@@ -50,7 +50,7 @@ Use `litmaath.alt` as you would `litmaath` above.
Note the unusual structure:
```c
```<!---c-->
while (<condition>)
;
```
@@ -66,7 +66,7 @@ could make the body of the `while` loop an `fprintf` with interesting
variables like:
```c
```<!---c-->
fprintf(stderr,
"argv=%lo *argv=%lo **argv=%c argv[1]=%lo *argv[1]=%c argc=%d\n",
(long) argv, (long) *argv, *argv && **argv ? **argv : '@',
+11 -11
View File
@@ -141,26 +141,26 @@ Location: <a href="../../location.html#CH">CH</a> - <em>Swiss Confederation</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>
<pre class="&lt;!---sh--&gt;"><code> make</code></pre>
<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">./litmaath</span> some text</span></code></pre></div>
<pre class="&lt;!---sh--&gt;"><code> ./litmaath some text</code></pre>
<p>There is an alternate version provided. See the <a href="#alternate-code">Alternate
code</a> section below.</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">./litmaath</span> eschew obfuscation</span></code></pre></div>
<pre class="&lt;!---sh--&gt;"><code> ./litmaath eschew obfuscation</code></pre>
<h2 id="alternate-code">Alternate code:</h2>
<p>This alternate code, added to help understand the entry and for fun, is code
that we suggested at the time of the entry publication but which we never put in
a file.</p>
<h3 id="alternate-build">Alternate build:</h3>
<div class="sourceCode" id="cb4"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb4-1"><a href="#cb4-1" aria-hidden="true" tabindex="-1"></a> <span class="fu">make</span> alt</span></code></pre></div>
<pre class="&lt;!---sh--&gt;"><code> make alt</code></pre>
<p>Use <code>litmaath.alt</code> as you would <code>litmaath</code> above.</p>
<h3 id="alternate-try">Alternate try:</h3>
<div class="sourceCode" id="cb5"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb5-1"><a href="#cb5-1" aria-hidden="true" tabindex="-1"></a> <span class="ex">./litmaath.alt</span> six was afraid of seven because seven eight nine</span></code></pre></div>
<pre class="&lt;!---sh--&gt;"><code> ./litmaath.alt six was afraid of seven because seven eight nine</code></pre>
<h2 id="judges-remarks">Judges’ remarks:</h2>
<p>Note the unusual structure:</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="cf">while</span> <span class="op">(&lt;</span>condition<span class="op">&gt;)</span></span>
<span id="cb6-2"><a href="#cb6-2" aria-hidden="true" tabindex="-1"></a> <span class="op">;</span></span></code></pre></div>
<pre class="&lt;!---c--&gt;"><code> while (&lt;condition&gt;)
;</code></pre>
<p>Did you notice that the body is empty?</p>
<p>Furthermore, it’s interesting to note that only two variables are
used to achieve everything.</p>
@@ -168,10 +168,10 @@ used to achieve everything.</p>
two small strings as arguments, and follow the program closely. One
could make the body of the <code>while</code> loop an <code>fprintf</code> with interesting
variables like:</p>
<div class="sourceCode" id="cb7"><pre class="sourceCode c"><code class="sourceCode c"><span id="cb7-1"><a href="#cb7-1" aria-hidden="true" tabindex="-1"></a> fprintf<span class="op">(</span>stderr<span class="op">,</span></span>
<span id="cb7-2"><a href="#cb7-2" aria-hidden="true" tabindex="-1"></a> <span class="st">&quot;argv=</span><span class="sc">%lo</span><span class="st"> *argv=</span><span class="sc">%lo</span><span class="st"> **argv=</span><span class="sc">%c</span><span class="st"> argv[1]=</span><span class="sc">%lo</span><span class="st"> *argv[1]=</span><span class="sc">%c</span><span class="st"> argc=</span><span class="sc">%d\n</span><span class="st">&quot;</span><span class="op">,</span></span>
<span id="cb7-3"><a href="#cb7-3" aria-hidden="true" tabindex="-1"></a> <span class="op">(</span><span class="dt">long</span><span class="op">)</span> argv<span class="op">,</span> <span class="op">(</span><span class="dt">long</span><span class="op">)</span> <span class="op">*</span>argv<span class="op">,</span> <span class="op">*</span>argv <span class="op">&amp;&amp;</span> <span class="op">**</span>argv <span class="op">?</span> <span class="op">**</span>argv <span class="op">:</span> <span class="ch">&#39;@&#39;</span><span class="op">,</span></span>
<span id="cb7-4"><a href="#cb7-4" aria-hidden="true" tabindex="-1"></a> <span class="op">(</span><span class="dt">long</span><span class="op">)</span> argv<span class="op">[</span><span class="dv">1</span><span class="op">],</span> argv<span class="op">[</span><span class="dv">1</span><span class="op">]</span> <span class="op">&amp;&amp;</span> <span class="op">*</span>argv<span class="op">[</span><span class="dv">1</span><span class="op">]</span> <span class="op">?</span> <span class="op">*</span>argv<span class="op">[</span><span class="dv">1</span><span class="op">]</span> <span class="op">:</span> <span class="ch">&#39;@&#39;</span><span class="op">,</span> argc<span class="op">);</span></span></code></pre></div>
<pre class="&lt;!---c--&gt;"><code> fprintf(stderr,
&quot;argv=%lo *argv=%lo **argv=%c argv[1]=%lo *argv[1]=%c argc=%d\n&quot;,
(long) argv, (long) *argv, *argv &amp;&amp; **argv ? **argv : &#39;@&#39;,
(long) argv[1], argv[1] &amp;&amp; *argv[1] ? *argv[1] : &#39;@&#39;, argc);</code></pre>
<p>… which is what the <a href="#alternate-code">alternate code</a> is.</p>
<h2 id="authors-remarks">Author’s remarks:</h2>
<p>No remarks were provided by the author.</p>
+1 -1
View File
@@ -1,6 +1,6 @@
## To build:
```sh
```<!---sh-->
make all
```
+1 -1
View File
@@ -141,7 +141,7 @@ Location: <a href="../../location.html#ZZ">ZZ</a> - <em>Unknown location</em></l
<!-- 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> all</span></code></pre></div>
<pre class="&lt;!---sh--&gt;"><code> make all</code></pre>
<h2 id="judges-remarks">Judges’ remarks:</h2>
<p>Compile and run without parameters.</p>
<p>The program is smaller than even the ‘compressed’ form of its output,
+3 -3
View File
@@ -1,13 +1,13 @@
## To build:
```sh
```<!---sh-->
make all
```
## Try:
```sh
```<!---sh-->
./reddy
char *(*(fun[16])();
char *(*(*(*(*(*fun[32])))))();
@@ -15,7 +15,7 @@
What happens if you input, and what you do about it?
```c
```<!---c-->
char *(*(*(*(*(*fun[32])))))());
```
+5 -5
View File
@@ -141,13 +141,13 @@ Location: <a href="../../location.html#ZZ">ZZ</a> - <em>Unknown location</em></l
<!-- 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> all</span></code></pre></div>
<pre class="&lt;!---sh--&gt;"><code> make all</code></pre>
<h2 id="try">Try:</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">./reddy</span></span>
<span id="cb2-2"><a href="#cb2-2" aria-hidden="true" tabindex="-1"></a> <span class="ex">char</span> <span class="pp">*(*(</span>fun<span class="pp">[</span><span class="ss">16</span><span class="pp">])</span>(<span class="pp">)</span><span class="kw">;</span></span>
<span id="cb2-3"><a href="#cb2-3" aria-hidden="true" tabindex="-1"></a> <span class="ex">char</span> <span class="pp">*(*(*(*(*(*</span>fun<span class="pp">[</span><span class="ss">32</span><span class="pp">])))))</span><span class="er">(</span><span class="kw">);</span></span></code></pre></div>
<pre class="&lt;!---sh--&gt;"><code> ./reddy
char *(*(fun[16])();
char *(*(*(*(*(*fun[32])))))();</code></pre>
<p>What happens if you input, and what you do about it?</p>
<div class="sourceCode" id="cb3"><pre class="sourceCode c"><code class="sourceCode c"><span id="cb3-1"><a href="#cb3-1" aria-hidden="true" tabindex="-1"></a> <span class="dt">char</span> <span class="op">*(*(*(*(*(*</span>fun<span class="op">[</span><span class="dv">32</span><span class="op">])))))());</span></span></code></pre></div>
<pre class="&lt;!---c--&gt;"><code> char *(*(*(*(*(*fun[32])))))());</code></pre>
<h2 id="judges-remarks">Judges’ remarks:</h2>
<p>This is a somewhat restricted version of a useful program that has been
posted to Usenet. What is unusual is what it is able to do so much
+4 -4
View File
@@ -1,20 +1,20 @@
## To build:
```sh
```<!---sh-->
make all
```
## Try:
```sh
```<!---sh-->
./robison 80 10
./robison 40 16
```
The first and second parameters are optional. You might also try:
```sh
```<!---sh-->
./robison 80 2 # <--- can you find the bug?
./robison 80 -246
```
@@ -24,7 +24,7 @@ The first and second parameters are optional. You might also try:
The following might make an interesting benchmark:
```sh
```<!---sh-->
./robison 100
```
+6 -6
View File
@@ -141,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> all</span></code></pre></div>
<pre class="&lt;!---sh--&gt;"><code> make all</code></pre>
<h2 id="try">Try:</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">./robison</span> 80 10</span>
<span id="cb2-2"><a href="#cb2-2" aria-hidden="true" tabindex="-1"></a> <span class="ex">./robison</span> 40 16</span></code></pre></div>
<pre class="&lt;!---sh--&gt;"><code> ./robison 80 10
./robison 40 16</code></pre>
<p>The first and second parameters are optional. You might also 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">./robison</span> 80 2 <span class="co"># &lt;--- can you find the bug?</span></span>
<span id="cb3-2"><a href="#cb3-2" aria-hidden="true" tabindex="-1"></a> <span class="ex">./robison</span> 80 <span class="at">-246</span></span></code></pre></div>
<pre class="&lt;!---sh--&gt;"><code> ./robison 80 2 # &lt;--- can you find the bug?
./robison 80 -246</code></pre>
<h2 id="judges-remarks">Judges’ remarks:</h2>
<p>The following might make an interesting benchmark:</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">./robison</span> 100</span></code></pre></div>
<pre class="&lt;!---sh--&gt;"><code> ./robison 100</code></pre>
<p>[Amdahl 5890-300E with System V cc: 8.40 seconds]</p>
<p>We suggest that you C pre-process and perhaps C-beautify this program.
All is not what it may appear to be in this program. Why does a <code>whi1e</code>
+6 -6
View File
@@ -1,6 +1,6 @@
## To build:
```sh
```<!---sh-->
make clobber all
```
@@ -12,7 +12,7 @@ code](#alternate-code) section below.
## To use:
```sh
```<!---sh-->
./spinellis
```
@@ -21,7 +21,7 @@ EOF (typically ctrl-d).
Now run again:
```sh
```<!---sh-->
./spinellis
```
@@ -33,7 +33,7 @@ For clang or compilers that won't read from `/dev/tty`, we provide this version.
### Alternate build:
```sh
```<!---sh-->
make clobber alt
```
@@ -42,7 +42,7 @@ and follow the instructions.
### Alternate use:
```sh
```<!---sh-->
./spinellis.alt
```
@@ -51,7 +51,7 @@ EOF (typically ctrl-d).
Now run again:
```sh
```<!---sh-->
./spinellis.alt
```
+6 -6
View File
@@ -141,27 +141,27 @@ Location: <a href="../../location.html#GR">GR</a> - <em>Hellenic Republic</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> clobber all</span></code></pre></div>
<pre class="&lt;!---sh--&gt;"><code> make clobber all</code></pre>
<p>and follow the instructions this will give you.</p>
<p>If your compiler will not read from <code>/dev/tty</code> 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">./spinellis</span></span></code></pre></div>
<pre class="&lt;!---sh--&gt;"><code> ./spinellis</code></pre>
<p>Type in or copy paste some C code, perhaps from <a href="input.txt">input.txt</a>, and send
EOF (typically ctrl-d).</p>
<p>Now run again:</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">./spinellis</span></span></code></pre></div>
<pre class="&lt;!---sh--&gt;"><code> ./spinellis</code></pre>
<h2 id="alternate-code">Alternate code:</h2>
<p>For clang or compilers that won’t read from <code>/dev/tty</code>, we provide this version.</p>
<h3 id="alternate-build">Alternate build:</h3>
<div class="sourceCode" id="cb4"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb4-1"><a href="#cb4-1" aria-hidden="true" tabindex="-1"></a> <span class="fu">make</span> clobber alt</span></code></pre></div>
<pre class="&lt;!---sh--&gt;"><code> make clobber alt</code></pre>
<p>and follow the instructions.</p>
<h3 id="alternate-use">Alternate use:</h3>
<div class="sourceCode" id="cb5"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb5-1"><a href="#cb5-1" aria-hidden="true" tabindex="-1"></a> <span class="ex">./spinellis.alt</span></span></code></pre></div>
<pre class="&lt;!---sh--&gt;"><code> ./spinellis.alt</code></pre>
<p>Type in or copy paste some C code, perhaps from <a href="input.txt">input.txt</a>, and send
EOF (typically ctrl-d).</p>
<p>Now run again:</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">./spinellis.alt</span></span></code></pre></div>
<pre class="&lt;!---sh--&gt;"><code> ./spinellis.alt</code></pre>
<h2 id="judges-remarks">Judges’ remarks:</h2>
<p>We enjoyed this entry this year; however in the future programs must be able to
be compiled from within a Makefile without the need of human intervention.</p>
+8 -8
View File
@@ -1,6 +1,6 @@
## To build:
```sh
```<!---sh-->
make all
```
@@ -11,13 +11,13 @@ might wish to do so.
## Try:
```sh
```<!---sh-->
./westley
```
Also try:
```sh
```<!---sh-->
./try.sh
```
@@ -31,7 +31,7 @@ This version is the original which might not work as you expect nowadays.
### Alternate build:
```sh
```<!---sh-->
make alt
```
@@ -41,7 +41,7 @@ This version is the original which might not work as you expect nowadays.
To see if your compiler has the problem described in the Judges' remarks below,
try:
```sh
```<!---sh-->
./westley.alt
```
@@ -52,7 +52,7 @@ Does it show the same output as `westley`?
Your compiler must parse
```c
```<!---c-->
#define _ -a
-_
```
@@ -62,7 +62,7 @@ conforming ANSI C Preprocessors may object to this: for such
compilers, you can elide the non-standard token-pasting requirement
by changing the #define line to:
```c
```<!---c-->
#define _ F-->00||F-OO--;
```
@@ -71,7 +71,7 @@ code is the original.
You might enjoy looking at the output of:
```sh
```<!---sh-->
cc -E westley.alt.c
```
+9 -9
View File
@@ -141,37 +141,37 @@ 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> all</span></code></pre></div>
<pre class="&lt;!---sh--&gt;"><code> make all</code></pre>
<p>NOTE: this version is a fixed version for modern C compilers. See the <a href="#alternate-code">Alternate
code</a> section below for how to use the original and why one
might wish to do so.</p>
<h2 id="try">Try:</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">./westley</span></span></code></pre></div>
<pre class="&lt;!---sh--&gt;"><code> ./westley</code></pre>
<p>Also 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>
<pre class="&lt;!---sh--&gt;"><code> ./try.sh</code></pre>
<p>to show the code with followed by the result so you can truly see the magic.</p>
<h2 id="alternate-code">Alternate code:</h2>
<p>This version is the original which might not work as you expect nowadays.</p>
<h3 id="alternate-build">Alternate build:</h3>
<div class="sourceCode" id="cb4"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb4-1"><a href="#cb4-1" aria-hidden="true" tabindex="-1"></a> <span class="fu">make</span> alt</span></code></pre></div>
<pre class="&lt;!---sh--&gt;"><code> make alt</code></pre>
<h3 id="alternate-use">Alternate use:</h3>
<p>To see if your compiler has the problem described in the Judges’ remarks below,
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">./westley.alt</span></span></code></pre></div>
<pre class="&lt;!---sh--&gt;"><code> ./westley.alt</code></pre>
<p>Does it show the same output as <code>westley</code>?</p>
<h2 id="judges-remarks">Judges’ remarks:</h2>
<p>Your compiler must parse</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="pp">#define _ </span><span class="op">-</span><span class="pp">a</span></span>
<span id="cb6-2"><a href="#cb6-2" aria-hidden="true" tabindex="-1"></a> <span class="op">-</span>_</span></code></pre></div>
<pre class="&lt;!---c--&gt;"><code> #define _ -a
-_</code></pre>
<p>as <code>--a</code> and not <code>-(-a)</code> or some other tokenized form. Some strictly
conforming ANSI C Preprocessors may object to this: for such
compilers, you can elide the non-standard token-pasting requirement
by changing the #define line to:</p>
<div class="sourceCode" id="cb7"><pre class="sourceCode c"><code class="sourceCode c"><span id="cb7-1"><a href="#cb7-1" aria-hidden="true" tabindex="-1"></a> <span class="pp">#define _ F</span><span class="op">--&gt;</span><span class="bn">00</span><span class="op">||</span><span class="pp">F</span><span class="op">-</span><span class="pp">OO</span><span class="op">--;</span></span></code></pre></div>
<pre class="&lt;!---c--&gt;"><code> #define _ F--&gt;00||F-OO--;</code></pre>
<p>This is what the modified code in <a href="westley.c">westley.c</a> does whereas the alt
code is the original.</p>
<p>You might enjoy looking at the output of:</p>
<div class="sourceCode" id="cb8"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb8-1"><a href="#cb8-1" aria-hidden="true" tabindex="-1"></a> <span class="fu">cc</span> <span class="at">-E</span> westley.alt.c</span></code></pre></div>
<pre class="&lt;!---sh--&gt;"><code> cc -E westley.alt.c</code></pre>
<h2 id="authors-remarks">Author’s remarks:</h2>
<p>No remarks were provided by the author.</p>
<!--
+3 -3
View File
@@ -1,6 +1,6 @@
## To build:
```sh
```<!---sh-->
make all
```
@@ -18,14 +18,14 @@ For more detailed information see [1989 fubar bugs](../../bugs.html#1989_fubar).
## To use:
```sh
```<!---sh-->
./fubar <number>
```
## Try:
```sh
```<!---sh-->
./try.sh # run on 1 - 7
./fubar.sh 2 # run via script
+6 -6
View File
@@ -141,18 +141,18 @@ 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> all</span></code></pre></div>
<pre class="&lt;!---sh--&gt;"><code> make all</code></pre>
<h3 id="bugs-and-misfeatures">Bugs and (Mis)features:</h3>
<p>The current status of this entry is:</p>
<pre><code> STATUS: known bug - please help us fix</code></pre>
<p>For more detailed information see <a href="../../bugs.html#1989_fubar">1989 fubar 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">./fubar</span> <span class="op">&lt;</span>number<span class="op">&gt;</span></span></code></pre></div>
<pre class="&lt;!---sh--&gt;"><code> ./fubar &lt;number&gt;</code></pre>
<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 class="co"># run on 1 - 7</span></span>
<span id="cb4-2"><a href="#cb4-2" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb4-3"><a href="#cb4-3" aria-hidden="true" tabindex="-1"></a> <span class="ex">./fubar.sh</span> 2 <span class="co"># run via script</span></span>
<span id="cb4-4"><a href="#cb4-4" aria-hidden="true" tabindex="-1"></a> <span class="ex">./fubar</span> 2 <span class="co"># run directly</span></span></code></pre></div>
<pre class="&lt;!---sh--&gt;"><code> ./try.sh # run on 1 - 7
./fubar.sh 2 # run via script
./fubar 2 # run directly</code></pre>
<h2 id="judges-remarks">Judges’ remarks:</h2>
<p>Run this with a single digit argument (or wait a long time and risk an infinite
loop as described in the <a href="../../bugs.html#1989_fubar">1989 fubar bugs</a> file).</p>
+5 -5
View File
@@ -2,7 +2,7 @@
NOTE: this will run the program itself.
```sh
```<!---sh-->
make clobber all
```
@@ -12,7 +12,7 @@ See the [Alternate code](#alternate-code) section below for more details.
## To use:
```sh
```<!---sh-->
./jar.1
```
@@ -26,14 +26,14 @@ This alternate code, which prints something slightly different, is provided as w
NOTE: this will run the program itself.
```sh
```<!---sh-->
make clobber alt
```
### Alternate use:
```sh
```<!---sh-->
./jar.1.alt
```
@@ -43,7 +43,7 @@ NOTE: this will run the program itself.
On many systems the compiler will not allow you to send the object file to
`/dev/tty`. The author suggested:
```sh
```<!---sh-->
cc -c -o /dev/tty jar.1.c
```
+5 -5
View File
@@ -142,22 +142,22 @@ Location: <a href="../../location.html#SE">SE</a> - <em>Kingdom of Sweden</em> (
<h2 id="to-build">To build:</h2>
<p>NOTE: this will run the program itself.</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> clobber all</span></code></pre></div>
<pre class="&lt;!---sh--&gt;"><code> make clobber all</code></pre>
<p>There is an alternate version with a slight difference that you may wish to try.
See the <a href="#alternate-code">Alternate code</a> section below for more details.</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">./jar.1</span></span></code></pre></div>
<pre class="&lt;!---sh--&gt;"><code> ./jar.1</code></pre>
<h2 id="alternate-code">Alternate code:</h2>
<p>This alternate code, which prints something slightly different, is provided as well.</p>
<h3 id="alternate-build">Alternate build:</h3>
<p>NOTE: this will run the program itself.</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 alt</span></code></pre></div>
<pre class="&lt;!---sh--&gt;"><code> make clobber alt</code></pre>
<h3 id="alternate-use">Alternate use:</h3>
<div class="sourceCode" id="cb4"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb4-1"><a href="#cb4-1" aria-hidden="true" tabindex="-1"></a> <span class="ex">./jar.1.alt</span></span></code></pre></div>
<pre class="&lt;!---sh--&gt;"><code> ./jar.1.alt</code></pre>
<h2 id="judges-remarks">Judges’ remarks:</h2>
<p>On many systems the compiler will not allow you to send the object file to
<code>/dev/tty</code>. The author suggested:</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">cc</span> <span class="at">-c</span> <span class="at">-o</span> /dev/tty jar.1.c</span></code></pre></div>
<pre class="&lt;!---sh--&gt;"><code> cc -c -o /dev/tty jar.1.c</code></pre>
<p>As a last resort the <code>jar.1.sh</code> script provided simulates
writing the raw binary of the .o file to the terminal.</p>
<p>Abuse of the rules winning entry usually result in a change of the rules.
+4 -4
View File
@@ -1,13 +1,13 @@
## To build:
```sh
```<!---sh-->
make all
```
## To use:
```sh
```<!---sh-->
./jar.2
[enter some lisp]
@@ -19,7 +19,7 @@ NOTE: this entry will likely segfault on invalid input.
## Try:
```sh
```<!---sh-->
./try.sh
./try.sh chocolate_cake.lisp
@@ -65,7 +65,7 @@ lisp expressions (followed by CR), the program evaluates them and
prints out the return values. End execution by typing an end-of-file
character.
```lisp
```<!---lisp-->
(+ 2.5 3.1)
(defun fib (n)
(if (< n 2)
+28 -28
View File
@@ -147,19 +147,19 @@ 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> all</span></code></pre></div>
<pre class="&lt;!---sh--&gt;"><code> make all</code></pre>
<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">./jar.2</span></span>
<span id="cb2-2"><a href="#cb2-2" aria-hidden="true" tabindex="-1"></a> <span class="ex">[enter</span> some lisp]</span>
<span id="cb2-3"><a href="#cb2-3" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb2-4"><a href="#cb2-4" aria-hidden="true" tabindex="-1"></a> <span class="ex">./jar.2</span> <span class="op">&lt;</span> some_lisp_file</span></code></pre></div>
<pre class="&lt;!---sh--&gt;"><code> ./jar.2
[enter some lisp]
./jar.2 &lt; some_lisp_file</code></pre>
<p>NOTE: this entry will likely segfault on invalid input.</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>
<span id="cb3-2"><a href="#cb3-2" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb3-3"><a href="#cb3-3" aria-hidden="true" tabindex="-1"></a> <span class="ex">./try.sh</span> chocolate_cake.lisp</span>
<span id="cb3-4"><a href="#cb3-4" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb3-5"><a href="#cb3-5" aria-hidden="true" tabindex="-1"></a> <span class="ex">./try.sh</span> try.txt</span></code></pre></div>
<pre class="&lt;!---sh--&gt;"><code> ./try.sh
./try.sh chocolate_cake.lisp
./try.sh try.txt</code></pre>
<h2 id="judges-remarks">Judges’ remarks:</h2>
<p>This is the most useful program submitted this year. It is a
rather large subset of lisp. It has no error recovery, and
@@ -192,24 +192,24 @@ The program implements a conventional lisp listener, i.e. you type in
lisp expressions (followed by CR), the program evaluates them and
prints out the return values. End execution by typing an end-of-file
character.</p>
<div class="sourceCode" id="cb4"><pre class="sourceCode lisp"><code class="sourceCode commonlisp"><span id="cb4-1"><a href="#cb4-1" aria-hidden="true" tabindex="-1"></a> (<span class="op">+</span> <span class="fl">2.5</span> <span class="fl">3.1</span>)</span>
<span id="cb4-2"><a href="#cb4-2" aria-hidden="true" tabindex="-1"></a> (<span class="kw">defun</span><span class="fu"> fib </span>(n)</span>
<span id="cb4-3"><a href="#cb4-3" aria-hidden="true" tabindex="-1"></a> (<span class="kw">if</span> (<span class="op">&lt;</span> n <span class="dv">2</span>)</span>
<span id="cb4-4"><a href="#cb4-4" aria-hidden="true" tabindex="-1"></a> <span class="dv">1</span></span>
<span id="cb4-5"><a href="#cb4-5" aria-hidden="true" tabindex="-1"></a> (<span class="op">+</span> (fib (<span class="op">-</span> n <span class="dv">2</span>)) (fib (<span class="op">-</span> n <span class="dv">1</span>)))))</span>
<span id="cb4-6"><a href="#cb4-6" aria-hidden="true" tabindex="-1"></a> (fib <span class="dv">10</span>)</span>
<span id="cb4-7"><a href="#cb4-7" aria-hidden="true" tabindex="-1"></a> (<span class="kw">defun</span><span class="fu"> </span>! (x) (<span class="kw">if</span> (<span class="kw">equal</span> x <span class="dv">0</span>) <span class="dv">1</span> (<span class="op">*</span> x (! (<span class="op">-</span> x <span class="dv">1</span>)))))</span>
<span id="cb4-8"><a href="#cb4-8" aria-hidden="true" tabindex="-1"></a> (! <span class="dv">7</span>)</span>
<span id="cb4-9"><a href="#cb4-9" aria-hidden="true" tabindex="-1"></a> (<span class="kw">defun</span><span class="fu"> fn1 </span>(fn) (<span class="op">+</span> (fn <span class="dv">1</span> <span class="dv">2</span>) (fn <span class="dv">3</span> <span class="dv">4</span>)))</span>
<span id="cb4-10"><a href="#cb4-10" aria-hidden="true" tabindex="-1"></a> (<span class="kw">defun</span><span class="fu"> fn2 </span>(a b) (<span class="op">+</span> a b))</span>
<span id="cb4-11"><a href="#cb4-11" aria-hidden="true" tabindex="-1"></a> (fn1 (<span class="kw">function</span> <span class="op">+</span>))</span>
<span id="cb4-12"><a href="#cb4-12" aria-hidden="true" tabindex="-1"></a> (fn1 (<span class="kw">function</span> fn2))</span>
<span id="cb4-13"><a href="#cb4-13" aria-hidden="true" tabindex="-1"></a> (fn1 (<span class="kw">function</span> (<span class="kw">lambda</span> (z1 z2) (<span class="op">+</span> z1 z2))))</span>
<span id="cb4-14"><a href="#cb4-14" aria-hidden="true" tabindex="-1"></a> (<span class="kw">quote</span> a)</span>
<span id="cb4-15"><a href="#cb4-15" aria-hidden="true" tabindex="-1"></a> (<span class="kw">cons</span> (<span class="kw">quote</span> (a b)) (<span class="kw">quote</span> (c d e)))</span>
<span id="cb4-16"><a href="#cb4-16" aria-hidden="true" tabindex="-1"></a> (<span class="kw">cons</span> (<span class="kw">quote</span> (f)) ())</span>
<span id="cb4-17"><a href="#cb4-17" aria-hidden="true" tabindex="-1"></a> (<span class="kw">car</span> (<span class="kw">quote</span> (a b c)))</span>
<span id="cb4-18"><a href="#cb4-18" aria-hidden="true" tabindex="-1"></a> (<span class="kw">cdr</span> (<span class="kw">cdr</span> (<span class="kw">quote</span> (g h i))))</span></code></pre></div>
<pre class="&lt;!---lisp--&gt;"><code> (+ 2.5 3.1)
(defun fib (n)
(if (&lt; n 2)
1
(+ (fib (- n 2)) (fib (- n 1)))))
(fib 10)
(defun ! (x) (if (equal x 0) 1 (* x (! (- x 1)))))
(! 7)
(defun fn1 (fn) (+ (fn 1 2) (fn 3 4)))
(defun fn2 (a b) (+ a b))
(fn1 (function +))
(fn1 (function fn2))
(fn1 (function (lambda (z1 z2) (+ z1 z2))))
(quote a)
(cons (quote (a b)) (quote (c d e)))
(cons (quote (f)) ())
(car (quote (a b c)))
(cdr (cdr (quote (g h i))))</code></pre>
<p>Please do not leave any whitespace before the first parenthesis when
you type your input, or any other unnecessary whitespace. Please try to
avoid any undefined variables or functions, wrong number of arguments
+6 -6
View File
@@ -1,6 +1,6 @@
## To build:
```sh
```<!---sh-->
make all
```
@@ -11,7 +11,7 @@ To get this to compile with a modern CPP, we had to replace `#D` with `#define`.
Run the program this way:
```sh
```<!---sh-->
./ovdluhe < textfile
```
@@ -21,7 +21,7 @@ by chance or is killed.
## Try:
```sh
```<!---sh-->
./try.sh ; sleep 2 ; ./try.sh
```
@@ -34,7 +34,7 @@ it's a `#define` it's easy to set up.
### Alternate build:
```sh
```<!---sh-->
make P=9 clobber alt
```
@@ -46,14 +46,14 @@ program to fail and a negative value will cause a compilation error.
### Alternate use:
```sh
```<!---sh-->
./ovdluhe.alt
```
### Alternate try:
```sh
```<!---sh-->
./try.alt.sh
P=5 ./try.alt.sh
+8 -8
View File
@@ -141,30 +141,30 @@ Location: <a href="../../location.html#ZZ">ZZ</a> - <em>Unknown location</em></l
<!-- 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> all</span></code></pre></div>
<pre class="&lt;!---sh--&gt;"><code> make all</code></pre>
<p>To get this to compile with a modern CPP, we had to replace <code>#D</code> with <code>#define</code>.</p>
<h2 id="to-use">To use:</h2>
<p>Run the program this way:</p>
<div class="sourceCode" id="cb2"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb2-1"><a href="#cb2-1" aria-hidden="true" tabindex="-1"></a> <span class="ex">./ovdluhe</span> <span class="op">&lt;</span> textfile</span></code></pre></div>
<pre class="&lt;!---sh--&gt;"><code> ./ovdluhe &lt; textfile</code></pre>
<p>The program stops when it reaches the end of the template buffer
by chance or is killed.</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 class="kw">;</span> <span class="fu">sleep</span> 2 <span class="kw">;</span> <span class="ex">./try.sh</span></span></code></pre></div>
<pre class="&lt;!---sh--&gt;"><code> ./try.sh ; sleep 2 ; ./try.sh</code></pre>
<h2 id="alternate-code">Alternate code:</h2>
<p>The author suggested that one varies the definition of <code>P</code> from 2 through 10. As
it’s a <code>#define</code> it’s easy to set up.</p>
<h3 id="alternate-build">Alternate build:</h3>
<div class="sourceCode" id="cb4"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb4-1"><a href="#cb4-1" aria-hidden="true" tabindex="-1"></a> <span class="fu">make</span> P=9 clobber alt</span></code></pre></div>
<pre class="&lt;!---sh--&gt;"><code> make P=9 clobber alt</code></pre>
<p>You do not have to define <code>P</code> but if you do you can replace the value with
whatever you wish, as long as it’s a positive <code>int</code> (or evaluates to a positive
<code>int</code> like the default <code>(A&lt;&lt;AP)</code> does). Too high a value will likely cause the
program to fail and a negative value will cause a compilation error.</p>
<h3 id="alternate-use">Alternate use:</h3>
<div class="sourceCode" id="cb5"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb5-1"><a href="#cb5-1" aria-hidden="true" tabindex="-1"></a> <span class="ex">./ovdluhe.alt</span></span></code></pre></div>
<pre class="&lt;!---sh--&gt;"><code> ./ovdluhe.alt</code></pre>
<h3 id="alternate-try">Alternate try:</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">./try.alt.sh</span></span>
<span id="cb6-2"><a href="#cb6-2" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb6-3"><a href="#cb6-3" aria-hidden="true" tabindex="-1"></a> <span class="va">P</span><span class="op">=</span>5 <span class="ex">./try.alt.sh</span></span></code></pre></div>
<pre class="&lt;!---sh--&gt;"><code> ./try.alt.sh
P=5 ./try.alt.sh</code></pre>
<p>NOTE: if you specify too high a value for <code>P</code> the program might fail. If you
specify a value &lt; 0 it will fail to compile.</p>
<h2 id="judges-remarks">Judges’ remarks:</h2>
+4 -4
View File
@@ -1,6 +1,6 @@
## To build:
```sh
```<!---sh-->
make all
```
@@ -10,7 +10,7 @@ out. See [alternate code](#alternate-code) below for more details.
## Try:
```sh
```<!---sh-->
./paul
```
@@ -28,14 +28,14 @@ could easily be added.
### Alternate build:
```sh
```<!---sh-->
make alt
```
### Alternate use:
```sh
```<!---sh-->
./paul.alt
```
+4 -4
View File
@@ -141,11 +141,11 @@ Location: <a href="../../location.html#US">US</a> - <em>United States of America
<!-- START: this line starts content for HTML phase 21 by: bin/pandoc-wrapper.sh via bin/md2html.sh -->
<h2 id="to-build">To build:</h2>
<div class="sourceCode" id="cb1"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb1-1"><a href="#cb1-1" aria-hidden="true" tabindex="-1"></a> <span class="fu">make</span> all</span></code></pre></div>
<pre class="&lt;!---sh--&gt;"><code> make all</code></pre>
<p>There is an alternate version with a trace routine that the author had commented
out. See <a href="#alternate-code">alternate code</a> below for more details.</p>
<h2 id="try">Try:</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">./paul</span></span></code></pre></div>
<pre class="&lt;!---sh--&gt;"><code> ./paul</code></pre>
<h2 id="alternate-code">Alternate code:</h2>
<p>This version was described by the author like:</p>
<blockquote>
@@ -156,9 +156,9 @@ and forth as the program runs. A much better debugger or trace
could easily be added.</p>
</blockquote>
<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>
<pre class="&lt;!---sh--&gt;"><code> make alt</code></pre>
<h3 id="alternate-use">Alternate use:</h3>
<div class="sourceCode" id="cb4"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb4-1"><a href="#cb4-1" aria-hidden="true" tabindex="-1"></a> <span class="ex">./paul.alt</span></span></code></pre></div>
<pre class="&lt;!---sh--&gt;"><code> ./paul.alt</code></pre>
<h2 id="judges-remarks">Judges’ remarks:</h2>
<p>The author’s comments is a detailed program explanation and spoiler. If you
want a real challenge, don’t read any further and try to understand the program
+3 -3
View File
@@ -1,6 +1,6 @@
## To build:
```sh
```<!---sh-->
make all
```
@@ -18,7 +18,7 @@ For more detailed information see [1989 robison bugs](../../bugs.html#1989_robis
## To use:
```sh
```<!---sh-->
./robison
# enter valid expressions
```
@@ -26,7 +26,7 @@ For more detailed information see [1989 robison bugs](../../bugs.html#1989_robis
## Try:
```sh
```<!---sh-->
./robison
11x10
# enter other expressions
+10 -10
View File
@@ -141,22 +141,22 @@ Location: <a href="../../location.html#US">US</a> - <em>United States of America
<!-- START: this line starts content for HTML phase 21 by: bin/pandoc-wrapper.sh via bin/md2html.sh -->
<h2 id="to-build">To build:</h2>
<div class="sourceCode" id="cb1"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb1-1"><a href="#cb1-1" aria-hidden="true" tabindex="-1"></a> <span class="fu">make</span> all</span></code></pre></div>
<pre class="&lt;!---sh--&gt;"><code> make all</code></pre>
<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>
<p>For more detailed information see <a href="../../bugs.html#1989_robison">1989 robison 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">./robison</span></span>
<span id="cb3-2"><a href="#cb3-2" aria-hidden="true" tabindex="-1"></a> <span class="co"># enter valid expressions</span></span></code></pre></div>
<pre class="&lt;!---sh--&gt;"><code> ./robison
# enter valid expressions</code></pre>
<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">./robison</span></span>
<span id="cb4-2"><a href="#cb4-2" aria-hidden="true" tabindex="-1"></a> <span class="ex">11x10</span></span>
<span id="cb4-3"><a href="#cb4-3" aria-hidden="true" tabindex="-1"></a> <span class="co"># enter other expressions</span></span>
<span id="cb4-4"><a href="#cb4-4" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb4-5"><a href="#cb4-5" aria-hidden="true" tabindex="-1"></a> <span class="ex">./try.sh</span></span>
<span id="cb4-6"><a href="#cb4-6" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb4-7"><a href="#cb4-7" aria-hidden="true" tabindex="-1"></a> <span class="bu">echo</span> 100 / 100 <span class="kw">|</span> <span class="ex">./robison</span> <span class="co"># &lt;-- what happens here ?</span></span></code></pre></div>
<pre class="&lt;!---sh--&gt;"><code> ./robison
11x10
# enter other expressions
./try.sh
echo 100 / 100 | ./robison # &lt;-- what happens here ?</code></pre>
<p>NOTE: This program will very likely crash or break into tiny bits :-) if you
feed it numbers with non-binary digits. This, as you might notice if you try one
of the above commands, can happen with other input as well. If you wish to
+2 -2
View File
@@ -1,13 +1,13 @@
## To build:
```sh
```<!---sh-->
make all
```
## Try:
```sh
```<!---sh-->
./roemer
```
+2 -2
View File
@@ -141,9 +141,9 @@ Location: <a href="../../location.html#NL">NL</a> - <em>Kingdom of the Netherlan
<!-- 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> all</span></code></pre></div>
<pre class="&lt;!---sh--&gt;"><code> make all</code></pre>
<h2 id="try">Try:</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">./roemer</span></span></code></pre></div>
<pre class="&lt;!---sh--&gt;"><code> ./roemer</code></pre>
<h2 id="judges-remarks">Judges’ remarks:</h2>
<p>Do you know what this program does? If you do, look again, there is more here
than meets the PI.</p>
+5 -5
View File
@@ -1,20 +1,20 @@
## To build:
```sh
```<!---sh-->
make all
```
## To use:
```sh
```<!---sh-->
./tromp [drops_per_sec [cmd_string]]
```
## Try:
```sh
```<!---sh-->
./tromp 5
./tromp 10 "hkl jq"
@@ -53,7 +53,7 @@ the judges' additional remarks in the author's remarks, for more details.
### Alternate build:
```sh
```<!---sh-->
make alt
```
@@ -138,7 +138,7 @@ at the start and `-raw` at the end. This further reduces the size of
the program, but has the possible disadvantage that the program
can only by stopped by 'q' or by the `kill -9' command.
```c
```<!---c-->
long h[4];t(){h[3]-=h[3]/3000;setitimer(0,h,0);}c,d,l,v[]={(int)t,0,2},w,s,I,K
=0,i=276,j,k,q[276],Q[276],*n=q,*m,x=17,f[]={7,-13,-12,1,8,-11,-12,-1,9,-1,1,
12,3,-13,-12,-1,12,-1,11,1,15,-1,13,1,18,-1,1,2,0,-12,-1,11,1,-12,1,13,10,-12,
+25 -25
View File
@@ -141,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> all</span></code></pre></div>
<pre class="&lt;!---sh--&gt;"><code> make all</code></pre>
<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">./tromp</span> [drops_per_sec <span class="pp">[</span><span class="ss">cmd_string</span><span class="pp">]</span>]</span></code></pre></div>
<pre class="&lt;!---sh--&gt;"><code> ./tromp [drops_per_sec [cmd_string]]</code></pre>
<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">./tromp</span> 5</span>
<span id="cb3-2"><a href="#cb3-2" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb3-3"><a href="#cb3-3" aria-hidden="true" tabindex="-1"></a> <span class="ex">./tromp</span> 10 <span class="st">&quot;hkl jq&quot;</span></span></code></pre></div>
<pre class="&lt;!---sh--&gt;"><code> ./tromp 5
./tromp 10 &quot;hkl jq&quot;</code></pre>
<p>The second command, <code>./tromp 10 "hkl jq"</code>, will set up the keys kind of like
vim:</p>
<ul>
@@ -171,7 +171,7 @@ loser</a> :-)</p>
<p>The author provided an alternate version of the code with some improvements. See
the judges’ additional remarks in the author’s remarks, for more details.</p>
<h3 id="alternate-build">Alternate 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> alt</span></code></pre></div>
<pre class="&lt;!---sh--&gt;"><code> make alt</code></pre>
<h3 id="alternate-use">Alternate use:</h3>
<p>Use <code>tromp.alt</code> as you would <code>tromp</code> above.</p>
<p>NOTE: testing more than one user updating the high score file, one of the
@@ -231,25 +231,25 @@ temporary file.</p>
at the start and <code>-raw</code> at the end. This further reduces the size of
the program, but has the possible disadvantage that the program
can only by stopped by ‘q’ or by the `kill -9’ command.</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="dt">long</span> h<span class="op">[</span><span class="dv">4</span><span class="op">];</span>t<span class="op">(){</span>h<span class="op">[</span><span class="dv">3</span><span class="op">]-=</span>h<span class="op">[</span><span class="dv">3</span><span class="op">]/</span><span class="dv">3000</span><span class="op">;</span>setitimer<span class="op">(</span><span class="dv">0</span><span class="op">,</span>h<span class="op">,</span><span class="dv">0</span><span class="op">);}</span>c<span class="op">,</span>d<span class="op">,</span>l<span class="op">,</span>v<span class="op">[]={(</span><span class="dt">int</span><span class="op">)</span>t<span class="op">,</span><span class="dv">0</span><span class="op">,</span><span class="dv">2</span><span class="op">},</span>w<span class="op">,</span>s<span class="op">,</span>I<span class="op">,</span>K</span>
<span id="cb6-2"><a href="#cb6-2" aria-hidden="true" tabindex="-1"></a> <span class="op">=</span><span class="dv">0</span><span class="op">,</span>i<span class="op">=</span><span class="dv">276</span><span class="op">,</span>j<span class="op">,</span>k<span class="op">,</span>q<span class="op">[</span><span class="dv">276</span><span class="op">],</span>Q<span class="op">[</span><span class="dv">276</span><span class="op">],*</span>n<span class="op">=</span>q<span class="op">,*</span>m<span class="op">,</span>x<span class="op">=</span><span class="dv">17</span><span class="op">,</span>f<span class="op">[]={</span><span class="dv">7</span><span class="op">,-</span><span class="dv">13</span><span class="op">,-</span><span class="dv">12</span><span class="op">,</span><span class="dv">1</span><span class="op">,</span><span class="dv">8</span><span class="op">,-</span><span class="dv">11</span><span class="op">,-</span><span class="dv">12</span><span class="op">,-</span><span class="dv">1</span><span class="op">,</span><span class="dv">9</span><span class="op">,-</span><span class="dv">1</span><span class="op">,</span><span class="dv">1</span><span class="op">,</span></span>
<span id="cb6-3"><a href="#cb6-3" aria-hidden="true" tabindex="-1"></a> <span class="dv">12</span><span class="op">,</span><span class="dv">3</span><span class="op">,-</span><span class="dv">13</span><span class="op">,-</span><span class="dv">12</span><span class="op">,-</span><span class="dv">1</span><span class="op">,</span><span class="dv">12</span><span class="op">,-</span><span class="dv">1</span><span class="op">,</span><span class="dv">11</span><span class="op">,</span><span class="dv">1</span><span class="op">,</span><span class="dv">15</span><span class="op">,-</span><span class="dv">1</span><span class="op">,</span><span class="dv">13</span><span class="op">,</span><span class="dv">1</span><span class="op">,</span><span class="dv">18</span><span class="op">,-</span><span class="dv">1</span><span class="op">,</span><span class="dv">1</span><span class="op">,</span><span class="dv">2</span><span class="op">,</span><span class="dv">0</span><span class="op">,-</span><span class="dv">12</span><span class="op">,-</span><span class="dv">1</span><span class="op">,</span><span class="dv">11</span><span class="op">,</span><span class="dv">1</span><span class="op">,-</span><span class="dv">12</span><span class="op">,</span><span class="dv">1</span><span class="op">,</span><span class="dv">13</span><span class="op">,</span><span class="dv">10</span><span class="op">,-</span><span class="dv">12</span><span class="op">,</span></span>
<span id="cb6-4"><a href="#cb6-4" aria-hidden="true" tabindex="-1"></a> <span class="dv">1</span><span class="op">,</span><span class="dv">12</span><span class="op">,</span><span class="dv">11</span><span class="op">,-</span><span class="dv">12</span><span class="op">,-</span><span class="dv">1</span><span class="op">,</span><span class="dv">1</span><span class="op">,</span><span class="dv">2</span><span class="op">,-</span><span class="dv">12</span><span class="op">,-</span><span class="dv">1</span><span class="op">,</span><span class="dv">12</span><span class="op">,</span><span class="dv">13</span><span class="op">,-</span><span class="dv">12</span><span class="op">,</span><span class="dv">12</span><span class="op">,</span><span class="dv">13</span><span class="op">,</span><span class="dv">14</span><span class="op">,-</span><span class="dv">11</span><span class="op">,-</span><span class="dv">1</span><span class="op">,</span><span class="dv">1</span><span class="op">,</span><span class="dv">4</span><span class="op">,-</span><span class="dv">13</span><span class="op">,-</span><span class="dv">12</span><span class="op">,</span><span class="dv">12</span><span class="op">,</span><span class="dv">16</span><span class="op">,-</span><span class="dv">11</span><span class="op">,-</span><span class="dv">12</span><span class="op">,</span></span>
<span id="cb6-5"><a href="#cb6-5" aria-hidden="true" tabindex="-1"></a> <span class="dv">12</span><span class="op">,</span><span class="dv">17</span><span class="op">,-</span><span class="dv">13</span><span class="op">,</span><span class="dv">1</span><span class="op">,-</span><span class="dv">1</span><span class="op">,</span><span class="dv">5</span><span class="op">,-</span><span class="dv">12</span><span class="op">,</span><span class="dv">12</span><span class="op">,</span><span class="dv">11</span><span class="op">,</span><span class="dv">6</span><span class="op">,-</span><span class="dv">12</span><span class="op">,</span><span class="dv">12</span><span class="op">,</span><span class="dv">24</span><span class="op">};</span>u<span class="op">(){</span><span class="cf">for</span><span class="op">(</span>i<span class="op">=</span><span class="dv">11</span><span class="op">;++</span>i<span class="op">&lt;</span><span class="dv">264</span><span class="op">;)</span><span class="cf">if</span><span class="op">((</span>k<span class="op">=</span>q<span class="op">[</span>i<span class="op">])-</span>Q<span class="op">[</span>i<span class="op">]</span></span>
<span id="cb6-6"><a href="#cb6-6" aria-hidden="true" tabindex="-1"></a> <span class="op">){</span>Q<span class="op">[</span>i<span class="op">]=</span>k<span class="op">;</span><span class="cf">if</span><span class="op">(</span>i<span class="op">-++</span>I<span class="op">||</span>i<span class="op">%</span><span class="dv">12</span><span class="op">&lt;</span><span class="dv">1</span><span class="op">)</span>printf<span class="op">(</span><span class="st">&quot;</span><span class="sc">\033</span><span class="st">[</span><span class="sc">%d</span><span class="st">;</span><span class="sc">%d</span><span class="st">H&quot;</span><span class="op">,(</span>I<span class="op">=</span>i<span class="op">)/</span><span class="dv">12</span><span class="op">,</span>i<span class="op">%</span><span class="dv">12</span><span class="op">*</span><span class="dv">2</span><span class="op">+</span><span class="dv">28</span><span class="op">);</span>printf<span class="op">(</span></span>
<span id="cb6-7"><a href="#cb6-7" aria-hidden="true" tabindex="-1"></a> <span class="st">&quot;</span><span class="sc">\033</span><span class="st">[</span><span class="sc">%d</span><span class="st">m &quot;</span><span class="op">+(</span>K<span class="op">-</span>k<span class="op">?</span><span class="dv">0</span><span class="op">:</span><span class="dv">5</span><span class="op">),</span>k<span class="op">);</span>K<span class="op">=</span>k<span class="op">;}</span>Q<span class="op">[</span><span class="dv">263</span><span class="op">]=</span>c<span class="op">=</span>getchar<span class="op">();}</span>G<span class="op">(</span>b<span class="op">){</span><span class="cf">for</span><span class="op">(</span>i<span class="op">=</span><span class="dv">4</span><span class="op">;</span>i<span class="op">--;)</span><span class="cf">if</span><span class="op">(</span>q<span class="op">[</span>i<span class="op">?</span>b<span class="op">+</span></span>
<span id="cb6-8"><a href="#cb6-8" aria-hidden="true" tabindex="-1"></a> n<span class="op">[</span>i<span class="op">]:</span>b<span class="op">])</span><span class="cf">return</span> <span class="dv">0</span><span class="op">;</span><span class="cf">return</span> <span class="dv">1</span><span class="op">;}</span>g<span class="op">(</span>b<span class="op">){</span><span class="cf">for</span><span class="op">(</span>i<span class="op">=</span><span class="dv">4</span><span class="op">;</span>i<span class="op">--;</span>q<span class="op">[</span>i<span class="op">?</span>x<span class="op">+</span>n<span class="op">[</span>i<span class="op">]:</span>x<span class="op">]=</span>b<span class="op">);}</span>main<span class="op">(</span>C<span class="op">,</span>V<span class="op">,</span>a<span class="op">)</span><span class="dt">char</span><span class="op">*</span></span>
<span id="cb6-9"><a href="#cb6-9" aria-hidden="true" tabindex="-1"></a> <span class="op">*</span>V<span class="op">,*</span>a<span class="op">;{</span>h<span class="op">[</span><span class="dv">3</span><span class="op">]=</span><span class="dv">1000000</span><span class="op">/(</span>l<span class="op">=</span>C<span class="op">&gt;</span><span class="dv">1</span><span class="op">?</span>atoi<span class="op">(</span>V<span class="op">[</span><span class="dv">1</span><span class="op">]):</span><span class="dv">2</span><span class="op">);</span><span class="cf">for</span><span class="op">(</span>a<span class="op">=</span>C<span class="op">&gt;</span><span class="dv">2</span><span class="op">?</span>V<span class="op">[</span><span class="dv">2</span><span class="op">]:</span><span class="st">&quot;jkl pq&quot;</span><span class="op">;</span>i<span class="op">;</span>i<span class="op">--)*</span>n<span class="op">++=</span>i<span class="op">&lt;</span></span>
<span id="cb6-10"><a href="#cb6-10" aria-hidden="true" tabindex="-1"></a> <span class="dv">25</span><span class="op">||</span>i<span class="op">%</span><span class="dv">12</span><span class="op">&lt;</span><span class="dv">2</span><span class="op">?</span><span class="dv">7</span><span class="op">:</span><span class="dv">0</span><span class="op">;</span>srand<span class="op">(</span>getpid<span class="op">());</span>system<span class="op">(</span><span class="st">&quot;stty cbreak -echo stop u&quot;</span><span class="op">);</span>sigvec<span class="op">(</span><span class="dv">14</span><span class="op">,</span>v<span class="op">,</span></span>
<span id="cb6-11"><a href="#cb6-11" aria-hidden="true" tabindex="-1"></a> <span class="dv">0</span><span class="op">);</span>t<span class="op">();</span>puts<span class="op">(</span><span class="st">&quot;</span><span class="sc">\033</span><span class="st">[H</span><span class="sc">\033</span><span class="st">[J&quot;</span><span class="op">);</span><span class="cf">for</span><span class="op">(</span>n<span class="op">=</span>f<span class="op">+</span>rand<span class="op">()%</span><span class="dv">7</span><span class="op">*</span><span class="dv">4</span><span class="op">;;</span>g<span class="op">(</span><span class="dv">7</span><span class="op">),</span>u<span class="op">(),</span>g<span class="op">(</span><span class="dv">0</span><span class="op">)){</span><span class="cf">if</span><span class="op">(</span>c<span class="op">&lt;</span><span class="dv">0</span><span class="op">){</span><span class="cf">if</span><span class="op">(</span>G<span class="op">(</span>x<span class="op">+</span></span>
<span id="cb6-12"><a href="#cb6-12" aria-hidden="true" tabindex="-1"></a> <span class="dv">12</span><span class="op">))</span>x<span class="op">+=</span><span class="dv">12</span><span class="op">;</span><span class="cf">else</span><span class="op">{</span>g<span class="op">(</span><span class="dv">7</span><span class="op">);++</span>w<span class="op">;</span><span class="cf">for</span><span class="op">(</span>j<span class="op">=</span><span class="dv">0</span><span class="op">;</span>j<span class="op">&lt;</span><span class="dv">252</span><span class="op">;</span>j<span class="op">=</span><span class="dv">12</span><span class="op">*(</span>j<span class="op">/</span><span class="dv">12</span><span class="op">+</span><span class="dv">1</span><span class="op">))</span><span class="cf">for</span><span class="op">(;</span>q<span class="op">[++</span>j<span class="op">];)</span><span class="cf">if</span><span class="op">(</span>j<span class="op">%</span><span class="dv">12</span><span class="op">==</span><span class="dv">10</span><span class="op">){</span></span>
<span id="cb6-13"><a href="#cb6-13" aria-hidden="true" tabindex="-1"></a> <span class="cf">for</span><span class="op">(;</span>j<span class="op">%</span><span class="dv">12</span><span class="op">;</span>q<span class="op">[</span>j<span class="op">--]=</span><span class="dv">0</span><span class="op">);</span>u<span class="op">();</span><span class="cf">for</span><span class="op">(;--</span>j<span class="op">;</span>q<span class="op">[</span>j<span class="op">+</span><span class="dv">12</span><span class="op">]=</span>q<span class="op">[</span>j<span class="op">]);</span>u<span class="op">();}</span>n<span class="op">=</span>f<span class="op">+</span>rand<span class="op">()%</span><span class="dv">7</span><span class="op">*</span><span class="dv">4</span><span class="op">;</span>G<span class="op">(</span>x<span class="op">=</span><span class="dv">17</span><span class="op">)||(</span>c</span>
<span id="cb6-14"><a href="#cb6-14" aria-hidden="true" tabindex="-1"></a> <span class="op">=</span>a<span class="op">[</span><span class="dv">5</span><span class="op">]);}}</span><span class="cf">if</span><span class="op">(</span>c<span class="op">==*</span>a<span class="op">)</span>G<span class="op">(--</span>x<span class="op">)||++</span>x<span class="op">;</span><span class="cf">if</span><span class="op">(</span>c<span class="op">==</span>a<span class="op">[</span><span class="dv">1</span><span class="op">])</span>n<span class="op">=</span>f<span class="op">+</span><span class="dv">4</span><span class="op">**(</span>m<span class="op">=</span>n<span class="op">),</span>G<span class="op">(</span>x<span class="op">)||(</span>n<span class="op">=</span>m<span class="op">);</span><span class="cf">if</span><span class="op">(</span>c<span class="op">==</span>a<span class="op">[</span><span class="dv">2</span><span class="op">])</span>G</span>
<span id="cb6-15"><a href="#cb6-15" aria-hidden="true" tabindex="-1"></a> <span class="op">(++</span>x<span class="op">)||--</span>x<span class="op">;</span><span class="cf">if</span><span class="op">(</span>c<span class="op">==</span>a<span class="op">[</span><span class="dv">3</span><span class="op">])</span><span class="cf">for</span><span class="op">(;</span>G<span class="op">(</span>x<span class="op">+</span><span class="dv">12</span><span class="op">);++</span>w<span class="op">)</span>x<span class="op">+=</span><span class="dv">12</span><span class="op">;</span><span class="cf">if</span><span class="op">(</span>c<span class="op">==</span>a<span class="op">[</span><span class="dv">4</span><span class="op">]||</span>c<span class="op">==</span>a<span class="op">[</span><span class="dv">5</span><span class="op">]){</span>s<span class="op">=</span>sigblock<span class="op">(</span></span>
<span id="cb6-16"><a href="#cb6-16" aria-hidden="true" tabindex="-1"></a> <span class="dv">8192</span><span class="op">);</span>printf<span class="op">(</span><span class="st">&quot;</span><span class="sc">\033</span><span class="st">[H</span><span class="sc">\033</span><span class="st">[J</span><span class="sc">\033</span><span class="st">[0m</span><span class="sc">%d\n</span><span class="st">&quot;</span><span class="op">,</span>w<span class="op">);</span><span class="cf">if</span><span class="op">(</span>c<span class="op">==</span>a<span class="op">[</span><span class="dv">5</span><span class="op">])</span><span class="cf">break</span><span class="op">;</span><span class="cf">for</span><span class="op">(</span>j<span class="op">=</span><span class="dv">264</span><span class="op">;</span>j<span class="op">--;</span>Q<span class="op">[</span>j<span class="op">]=</span></span>
<span id="cb6-17"><a href="#cb6-17" aria-hidden="true" tabindex="-1"></a> <span class="dv">0</span><span class="op">);</span><span class="cf">while</span><span class="op">(</span>getchar<span class="op">()-</span>a<span class="op">[</span><span class="dv">4</span><span class="op">]);</span>puts<span class="op">(</span><span class="st">&quot;</span><span class="sc">\033</span><span class="st">[H</span><span class="sc">\033</span><span class="st">[J</span><span class="sc">\033</span><span class="st">[7m&quot;</span><span class="op">);</span>sigsetmask<span class="op">(</span>s<span class="op">);}}</span>d<span class="op">=</span>popen<span class="op">(</span></span>
<span id="cb6-18"><a href="#cb6-18" aria-hidden="true" tabindex="-1"></a> <span class="st">&quot;stty -cbreak echo stop </span><span class="sc">\023</span><span class="st">;sort -mnr -o HI - HI;cat HI&quot;</span><span class="op">,</span><span class="st">&quot;w&quot;</span><span class="op">);</span>fprintf<span class="op">(</span>d<span class="op">,</span></span>
<span id="cb6-19"><a href="#cb6-19" aria-hidden="true" tabindex="-1"></a> <span class="st">&quot;</span><span class="sc">%4d</span><span class="st"> from level </span><span class="sc">%1d</span><span class="st"> by </span><span class="sc">%s\n</span><span class="st">&quot;</span><span class="op">,</span>w<span class="op">,</span>l<span class="op">,</span>getlogin<span class="op">());</span>pclose<span class="op">(</span>d<span class="op">);}</span></span></code></pre></div>
<pre class="&lt;!---c--&gt;"><code> long h[4];t(){h[3]-=h[3]/3000;setitimer(0,h,0);}c,d,l,v[]={(int)t,0,2},w,s,I,K
=0,i=276,j,k,q[276],Q[276],*n=q,*m,x=17,f[]={7,-13,-12,1,8,-11,-12,-1,9,-1,1,
12,3,-13,-12,-1,12,-1,11,1,15,-1,13,1,18,-1,1,2,0,-12,-1,11,1,-12,1,13,10,-12,
1,12,11,-12,-1,1,2,-12,-1,12,13,-12,12,13,14,-11,-1,1,4,-13,-12,12,16,-11,-12,
12,17,-13,1,-1,5,-12,12,11,6,-12,12,24};u(){for(i=11;++i&lt;264;)if((k=q[i])-Q[i]
){Q[i]=k;if(i-++I||i%12&lt;1)printf(&quot;\033[%d;%dH&quot;,(I=i)/12,i%12*2+28);printf(
&quot;\033[%dm &quot;+(K-k?0:5),k);K=k;}Q[263]=c=getchar();}G(b){for(i=4;i--;)if(q[i?b+
n[i]:b])return 0;return 1;}g(b){for(i=4;i--;q[i?x+n[i]:x]=b);}main(C,V,a)char*
*V,*a;{h[3]=1000000/(l=C&gt;1?atoi(V[1]):2);for(a=C&gt;2?V[2]:&quot;jkl pq&quot;;i;i--)*n++=i&lt;
25||i%12&lt;2?7:0;srand(getpid());system(&quot;stty cbreak -echo stop u&quot;);sigvec(14,v,
0);t();puts(&quot;\033[H\033[J&quot;);for(n=f+rand()%7*4;;g(7),u(),g(0)){if(c&lt;0){if(G(x+
12))x+=12;else{g(7);++w;for(j=0;j&lt;252;j=12*(j/12+1))for(;q[++j];)if(j%12==10){
for(;j%12;q[j--]=0);u();for(;--j;q[j+12]=q[j]);u();}n=f+rand()%7*4;G(x=17)||(c
=a[5]);}}if(c==*a)G(--x)||++x;if(c==a[1])n=f+4**(m=n),G(x)||(n=m);if(c==a[2])G
(++x)||--x;if(c==a[3])for(;G(x+12);++w)x+=12;if(c==a[4]||c==a[5]){s=sigblock(
8192);printf(&quot;\033[H\033[J\033[0m%d\n&quot;,w);if(c==a[5])break;for(j=264;j--;Q[j]=
0);while(getchar()-a[4]);puts(&quot;\033[H\033[J\033[7m&quot;);sigsetmask(s);}}d=popen(
&quot;stty -cbreak echo stop \023;sort -mnr -o HI - HI;cat HI&quot;,&quot;w&quot;);fprintf(d,
&quot;%4d from level %1d by %s\n&quot;,w,l,getlogin());pclose(d);}</code></pre>
<p>NOTE: the alternate version was fixed for modern systems in 2023.</p>
<!--
+2 -2
View File
@@ -1,13 +1,13 @@
## To build:
```sh
```<!---sh-->
make all
```
## Try:
```sh
```<!---sh-->
./try.sh
```
+2 -2
View File
@@ -141,9 +141,9 @@ Location: <a href="../../location.html#ZZ">ZZ</a> - <em>Unknown location</em></l
<!-- 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> all</span></code></pre></div>
<pre class="&lt;!---sh--&gt;"><code> make all</code></pre>
<h2 id="try">Try:</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">./try.sh</span></span></code></pre></div>
<pre class="&lt;!---sh--&gt;"><code> ./try.sh</code></pre>
<h2 id="judges-remarks">Judges’ remarks:</h2>
<p>This program computes all proper subsets of the set of
arguments passed to it. Each subset is printed with one
+11 -11
View File
@@ -1,6 +1,6 @@
## To build:
```sh
```<!---sh-->
make all
```
@@ -20,26 +20,26 @@ For more detailed information see [1989 westley bugs](../../bugs.html#1989_westl
Try compiling and running the 4 resulting programs like:
```sh
```<!---sh-->
./compile.sh
```
If you need to specify an alternate compiler path, say because your default
compiler is clang (or in the case of macOS gcc is clang) you can do so like:
```sh
```<!---sh-->
CC=/opt/local/bin/gcc-mp-12 ./compile.sh
```
If you wish to delay the script or remove the delay you can do so like:
```sh
```<!---sh-->
DELAY=2 ./compile.sh
```
Finally try:
```sh
```<!---sh-->
./westley
# input some lines of text, sending EOF (usually ctrl-d) to end
@@ -70,7 +70,7 @@ different algorithm for each version (hereafter referred to as
When compiling these versions, one needs to define `trgpune`
in the compile line (which the Makefile now has). Example:
```sh
```<!---sh-->
cc -Dtrgpune=putchar ver3.c -o ver3
```
@@ -109,13 +109,13 @@ function `vs()` to define in the ROT13 version. But a function
called `vs()` turns into a function called `if()` in the original,
so it can't be done. Therefore, I do:
```c
```<!---c-->
expr1 && expr2 && (expr3=etc);
```
which is the same as:
```c
```<!---c-->
if (expr1 && expr2) expr3=etc;
```
@@ -124,7 +124,7 @@ expressions if they aren't in an assignment or conditional
statement. This might warrant a warning, since other compilers
may do this. I found MANY compilers botched:
```c
```<!---c-->
expr1 && (expr2,expr3);
```
@@ -146,7 +146,7 @@ such statements to make it more portable.
Normally (!), a reversible C program is done thus:
```c
```<!---c-->
/**/ forward code /*/ edoc drawkcab /**/
```
@@ -154,7 +154,7 @@ If your compiler nests comments, it will get this wrong.
However, I have made some bits of the code palindromic,
(or different, but reversible) so it is more like:
```c
```<!---c-->
/**/forward/*//**/ palindromic /**//*/drawkcab/**/
```
+14 -14
View File
@@ -141,24 +141,24 @@ 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> all</span></code></pre></div>
<pre class="&lt;!---sh--&gt;"><code> make all</code></pre>
<h3 id="bugs-and-misfeatures">Bugs and (Mis)features:</h3>
<p>The current status of this entry is:</p>
<pre><code> STATUS: known bug - please help us fix</code></pre>
<p>For more detailed information see <a href="../../bugs.html#1989_westley">1989 westley bugs</a>.</p>
<h2 id="try">Try:</h2>
<p>Try compiling and running the 4 resulting programs like:</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">./compile.sh</span></span></code></pre></div>
<pre class="&lt;!---sh--&gt;"><code> ./compile.sh</code></pre>
<p>If you need to specify an alternate compiler path, say because your default
compiler is clang (or in the case of macOS gcc is clang) you can do so like:</p>
<div class="sourceCode" id="cb4"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb4-1"><a href="#cb4-1" aria-hidden="true" tabindex="-1"></a> <span class="va">CC</span><span class="op">=</span>/opt/local/bin/gcc-mp-12 <span class="ex">./compile.sh</span></span></code></pre></div>
<pre class="&lt;!---sh--&gt;"><code> CC=/opt/local/bin/gcc-mp-12 ./compile.sh</code></pre>
<p>If you wish to delay the script or remove the delay you can do so like:</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="va">DELAY</span><span class="op">=</span>2 <span class="ex">./compile.sh</span></span></code></pre></div>
<pre class="&lt;!---sh--&gt;"><code> DELAY=2 ./compile.sh</code></pre>
<p>Finally try:</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">./westley</span></span>
<span id="cb6-2"><a href="#cb6-2" aria-hidden="true" tabindex="-1"></a> <span class="co"># input some lines of text, sending EOF (usually ctrl-d) to end</span></span>
<span id="cb6-3"><a href="#cb6-3" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb6-4"><a href="#cb6-4" aria-hidden="true" tabindex="-1"></a> <span class="ex">./try.sh</span> <span class="co"># demo of some input</span></span></code></pre></div>
<pre class="&lt;!---sh--&gt;"><code> ./westley
# input some lines of text, sending EOF (usually ctrl-d) to end
./try.sh # demo of some input</code></pre>
<h2 id="judges-remarks">Judges’ remarks:</h2>
<p>There is a secret way to get ONE of the versions to print out
“<code>Hello, world!\n</code>”. Can you find how to do it?</p>
@@ -175,7 +175,7 @@ different algorithm for each version (hereafter referred to as
(ROT13 and reversed)).</p>
<p>When compiling these versions, one needs to define <code>trgpune</code>
in the compile line (which the Makefile now has). Example:</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">cc</span> <span class="at">-Dtrgpune</span><span class="op">=</span>putchar ver3.c <span class="at">-o</span> ver3</span></code></pre></div>
<pre class="&lt;!---sh--&gt;"><code> cc -Dtrgpune=putchar ver3.c -o ver3</code></pre>
<p><code>trgpune</code> is the ROT13 of <code>getchar()</code>, so <code>getchar()</code> and <code>putchar()</code>
are exchanged in the ROT13 counterpart. It is easy to see that
this is unavoidable. I must have a <code>#define</code> for a library
@@ -207,14 +207,14 @@ first argument (argc) must be at least one).</p>
function <code>vs()</code> to define in the ROT13 version. But a function
called <code>vs()</code> turns into a function called <code>if()</code> in the original,
so it can’t be done. Therefore, I do:</p>
<div class="sourceCode" id="cb8"><pre class="sourceCode c"><code class="sourceCode c"><span id="cb8-1"><a href="#cb8-1" aria-hidden="true" tabindex="-1"></a> expr1 <span class="op">&amp;&amp;</span> expr2 <span class="op">&amp;&amp;</span> <span class="op">(</span>expr3<span class="op">=</span>etc<span class="op">);</span></span></code></pre></div>
<pre class="&lt;!---c--&gt;"><code> expr1 &amp;&amp; expr2 &amp;&amp; (expr3=etc);</code></pre>
<p>which is the same as:</p>
<div class="sourceCode" id="cb9"><pre class="sourceCode c"><code class="sourceCode c"><span id="cb9-1"><a href="#cb9-1" aria-hidden="true" tabindex="-1"></a> <span class="cf">if</span> <span class="op">(</span>expr1 <span class="op">&amp;&amp;</span> expr2<span class="op">)</span> expr3<span class="op">=</span>etc<span class="op">;</span></span></code></pre></div>
<pre class="&lt;!---c--&gt;"><code> if (expr1 &amp;&amp; expr2) expr3=etc;</code></pre>
<p>A/UX on the Macintosh doesn’t get this right; it evaluates ALL
expressions if they aren’t in an assignment or conditional
statement. This might warrant a warning, since other compilers
may do this. I found MANY compilers botched:</p>
<div class="sourceCode" id="cb10"><pre class="sourceCode c"><code class="sourceCode c"><span id="cb10-1"><a href="#cb10-1" aria-hidden="true" tabindex="-1"></a> expr1 <span class="op">&amp;&amp;</span> <span class="op">(</span>expr2<span class="op">,</span>expr3<span class="op">);</span></span></code></pre></div>
<pre class="&lt;!---c--&gt;"><code> expr1 &amp;&amp; (expr2,expr3);</code></pre>
<p><code>expr2</code> was OFTEN evaluated even if <code>expr1</code> was false. I removed
such statements to make it more portable.</p>
<h3 id="variable-names-worth-noting">Variable names worth noting</h3>
@@ -224,11 +224,11 @@ such statements to make it more portable.</p>
<p><code>tang</code> and <code>gnat</code> are both ROT13 and palindrome pairs!</p>
<p>–</p>
<p>Normally (!), a reversible C program is done thus:</p>
<div class="sourceCode" id="cb11"><pre class="sourceCode c"><code class="sourceCode c"><span id="cb11-1"><a href="#cb11-1" aria-hidden="true" tabindex="-1"></a> <span class="co">/**/</span> forward code <span class="co">/*/ edoc drawkcab /**/</span></span></code></pre></div>
<pre class="&lt;!---c--&gt;"><code> /**/ forward code /*/ edoc drawkcab /**/</code></pre>
<p>If your compiler nests comments, it will get this wrong.
However, I have made some bits of the code palindromic,
(or different, but reversible) so it is more like:</p>
<div class="sourceCode" id="cb12"><pre class="sourceCode c"><code class="sourceCode c"><span id="cb12-1"><a href="#cb12-1" aria-hidden="true" tabindex="-1"></a> <span class="co">/**/</span>forward<span class="co">/*//**/</span> palindromic <span class="co">/**//*/drawkcab/**/</span></span></code></pre></div>
<pre class="&lt;!---c--&gt;"><code> /**/forward/*//**/ palindromic /**//*/drawkcab/**/</code></pre>
<p>The code can therefore be interlaced. There are eight
such palindromic bits. You can find them within the
<code>/*//**/ /**//*/</code> pairs.</p>
+4 -4
View File
@@ -1,6 +1,6 @@
## To build:
```sh
```<!---sh-->
make all
```
@@ -21,7 +21,7 @@ For more detailed information see [1990 baruch bugs](../../bugs.html#1990_baruch
## To use:
```sh
```<!---sh-->
echo 4 | ./baruch
echo 7 | ./baruch
```
@@ -29,7 +29,7 @@ For more detailed information see [1990 baruch bugs](../../bugs.html#1990_baruch
## Try:
```sh
```<!---sh-->
./try.sh
```
@@ -47,7 +47,7 @@ question. YMMV.
### Alternate build:
```sh
```<!---sh-->
make alt
```
+5 -5
View File
@@ -144,7 +144,7 @@ Location: <a href="../../location.html#IL">IL</a> - <em>State of Israel</em> (<e
<!-- START: this line starts content for HTML phase 21 by: bin/pandoc-wrapper.sh via bin/md2html.sh -->
<h2 id="to-build">To build:</h2>
<div class="sourceCode" id="cb1"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb1-1"><a href="#cb1-1" aria-hidden="true" tabindex="-1"></a> <span class="fu">make</span> all</span></code></pre></div>
<pre class="&lt;!---sh--&gt;"><code> make all</code></pre>
<p>There is an alternate version for those using Turbo-C or MSC. See <a href="#alternate-code">alternate
code</a> below for details.</p>
<h3 id="bugs-and-misfeatures">Bugs and (Mis)features:</h3>
@@ -152,10 +152,10 @@ code</a> below for details.</p>
<pre><code> STATUS: INABIAF - please **DO NOT** fix</code></pre>
<p>For more detailed information see <a href="../../bugs.html#1990_baruch">1990 baruch bugs</a>.</p>
<h2 id="to-use">To use:</h2>
<div class="sourceCode" id="cb3"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb3-1"><a href="#cb3-1" aria-hidden="true" tabindex="-1"></a> <span class="bu">echo</span> 4 <span class="kw">|</span> <span class="ex">./baruch</span></span>
<span id="cb3-2"><a href="#cb3-2" aria-hidden="true" tabindex="-1"></a> <span class="bu">echo</span> 7 <span class="kw">|</span> <span class="ex">./baruch</span></span></code></pre></div>
<pre class="&lt;!---sh--&gt;"><code> echo 4 | ./baruch
echo 7 | ./baruch</code></pre>
<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>
<pre class="&lt;!---sh--&gt;"><code> ./try.sh</code></pre>
<h2 id="alternate-code">Alternate code:</h2>
<p>This alternate code is for the <a href="https://en.wikipedia.org/wiki/0">very few</a>
<a href="https://en.wikipedia.org/wiki/Microsoft_Windows">users</a>
@@ -165,7 +165,7 @@ the <code>" #Q"</code> string was not changed as that showed worse looking outpu
of improved output though admittedly we have no way to test the compilers in
question. YMMV.</p>
<h3 id="alternate-build">Alternate 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> alt</span></code></pre></div>
<pre class="&lt;!---sh--&gt;"><code> make alt</code></pre>
<h3 id="alternate-use">Alternate use:</h3>
<p>Use <code>baruch.alt</code> as you would <code>baruch</code>.</p>
<h2 id="judges-remarks">Judges’ remarks:</h2>
+3 -3
View File
@@ -1,20 +1,20 @@
## To build:
```sh
```<!---sh-->
make all
```
## To use:
```sh
```<!---sh-->
./cmills [starting_cash]
```
## Try:
```sh
```<!---sh-->
./cmills 5000
```
+3 -3
View File
@@ -141,11 +141,11 @@ Location: <a href="../../location.html#US">US</a> - <em>United States of America
<!-- START: this line starts content for HTML phase 21 by: bin/pandoc-wrapper.sh via bin/md2html.sh -->
<h2 id="to-build">To build:</h2>
<div class="sourceCode" id="cb1"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb1-1"><a href="#cb1-1" aria-hidden="true" tabindex="-1"></a> <span class="fu">make</span> all</span></code></pre></div>
<pre class="&lt;!---sh--&gt;"><code> make all</code></pre>
<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">./cmills</span> <span class="pp">[</span><span class="ss">starting_cash</span><span class="pp">]</span></span></code></pre></div>
<pre class="&lt;!---sh--&gt;"><code> ./cmills [starting_cash]</code></pre>
<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">./cmills</span> 5000</span></code></pre></div>
<pre class="&lt;!---sh--&gt;"><code> ./cmills 5000</code></pre>
<h2 id="judges-remarks">Judges’ remarks:</h2>
<p>The Makefile uses several <code>-D</code> defines. The following is is a list of the macros
that may be changed:</p>
+3 -3
View File
@@ -1,13 +1,13 @@
## To build:
```sh
```<!---sh-->
make all
```
## To use:
```sh
```<!---sh-->
./dds
```
@@ -16,7 +16,7 @@
Give the following lines as input:
```basic
```<!---basic-->
OLD LANDER.BAS
RUN
```
+3 -3
View File
@@ -141,12 +141,12 @@ Location: <a href="../../location.html#GR">GR</a> - <em>Hellenic Republic</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> all</span></code></pre></div>
<pre class="&lt;!---sh--&gt;"><code> make all</code></pre>
<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">./dds</span></span></code></pre></div>
<pre class="&lt;!---sh--&gt;"><code> ./dds</code></pre>
<h2 id="try">Try:</h2>
<p>Give the following lines as input:</p>
<pre class="basic"><code> OLD LANDER.BAS
<pre class="&lt;!---basic--&gt;"><code> OLD LANDER.BAS
RUN</code></pre>
<p>NOTE: this entry is probably one of the only times CAPS LOCK might be worth
having (though still not useful enough to enable :-) ) as all input has to be
+6 -6
View File
@@ -1,20 +1,20 @@
## To build:
```sh
```<!---sh-->
make all
```
## To use:
```sh
```<!---sh-->
echo foo bar | ./dg
```
## Try:
```sh
```<!---sh-->
./try.sh
```
@@ -24,13 +24,13 @@
Some C preprocessors got confused about single quotes in certain cases.
In particular, the following source line:
```c
```<!---c-->
b12(ase(bco(acp(bi(acp(bcp(acp(bpl(aqu(bqu(A))))))))))))))))))))))))))))))
```
sometimes has to be changed to:
```c
```<!---c-->
b12(ase(bco(acp(bi(acp(bcp(acp(bpl('A'))))))))))))))))))))))))))))
```
@@ -56,7 +56,7 @@ As for the rot13 algorithm, it relies on `index(3)` to find if the
character is in the set `A-Za-z`. `l[]` is an array that gets filled
with:
```c
```<!---c-->
"nopqrstuvwxyzzzzabcdefghijklmmmmNOPQRSTUVWXYZZZZABCDEFGHIJKLMMMM"
```
+6 -6
View File
@@ -141,17 +141,17 @@ Location: <a href="../../location.html#ZZ">ZZ</a> - <em>Unknown location</em></l
<!-- 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> all</span></code></pre></div>
<pre class="&lt;!---sh--&gt;"><code> make all</code></pre>
<h2 id="to-use">To use:</h2>
<div class="sourceCode" id="cb2"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb2-1"><a href="#cb2-1" aria-hidden="true" tabindex="-1"></a> <span class="bu">echo</span> foo bar <span class="kw">|</span> <span class="ex">./dg</span></span></code></pre></div>
<pre class="&lt;!---sh--&gt;"><code> echo foo bar | ./dg</code></pre>
<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>
<pre class="&lt;!---sh--&gt;"><code> ./try.sh</code></pre>
<h2 id="judges-remarks">Judges’ remarks:</h2>
<p>Some C preprocessors got confused about single quotes in certain cases.
In particular, the following source line:</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> b12<span class="op">(</span>ase<span class="op">(</span>bco<span class="op">(</span>acp<span class="op">(</span>bi<span class="op">(</span>acp<span class="op">(</span>bcp<span class="op">(</span>acp<span class="op">(</span>bpl<span class="op">(</span>aqu<span class="op">(</span>bqu<span class="op">(</span>A<span class="op">))))))))))))))))))))))))))))))</span></span></code></pre></div>
<pre class="&lt;!---c--&gt;"><code> b12(ase(bco(acp(bi(acp(bcp(acp(bpl(aqu(bqu(A))))))))))))))))))))))))))))))</code></pre>
<p>sometimes has to be changed to:</p>
<div class="sourceCode" id="cb5"><pre class="sourceCode c"><code class="sourceCode c"><span id="cb5-1"><a href="#cb5-1" aria-hidden="true" tabindex="-1"></a> b12<span class="op">(</span>ase<span class="op">(</span>bco<span class="op">(</span>acp<span class="op">(</span>bi<span class="op">(</span>acp<span class="op">(</span>bcp<span class="op">(</span>acp<span class="op">(</span>bpl<span class="op">(</span><span class="ch">&#39;A&#39;</span><span class="op">))))))))))))))))))))))))))))</span></span></code></pre></div>
<pre class="&lt;!---c--&gt;"><code> b12(ase(bco(acp(bi(acp(bcp(acp(bpl(&#39;A&#39;))))))))))))))))))))))))))))</code></pre>
<p>particularly if the C preprocessor botches single quotes in cpp expansions,
which we have done for the wider audience.</p>
<h2 id="authors-remarks">Author’s remarks:</h2>
@@ -167,7 +167,7 @@ source. The <code>axx()</code> <code>#define</code>s do the same, but add tokens
<p>As for the rot13 algorithm, it relies on <code>index(3)</code> to find if the
character is in the set <code>A-Za-z</code>. <code>l[]</code> is an array that gets filled
with:</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="st">&quot;nopqrstuvwxyzzzzabcdefghijklmmmmNOPQRSTUVWXYZZZZABCDEFGHIJKLMMMM&quot;</span></span></code></pre></div>
<pre class="&lt;!---c--&gt;"><code> &quot;nopqrstuvwxyzzzzabcdefghijklmmmmNOPQRSTUVWXYZZZZABCDEFGHIJKLMMMM&quot;</code></pre>
<p>If <code>index(3)</code> says the char is in the alphabet, then XOR the offset
with <code>16</code> to translate, and output, otherwise pass it unchanged.</p>
<!--
+6 -6
View File
@@ -1,6 +1,6 @@
## To build:
```sh
```<!---sh-->
make all
```
@@ -9,7 +9,7 @@
To test the official C entry, one might try:
```sh
```<!---sh-->
echo "Quartz glyph jocks vend, fix, BMW." | compress | ./btoa | ./jaw
```
@@ -19,7 +19,7 @@ sentence.
#### Also try:
```sh
```<!---sh-->
./try.sh
```
@@ -39,14 +39,14 @@ it to 1530 bytes) which implements the complete shark utility. The script,
The sender must have `compress` and `btoa`. To send, try:
```sh
```<!---sh-->
./shark.sh jaw.* README.md > receive
```
The resulting file, `receive`, unpacks the input files
even if the receiver lacks `uncompress` and `btoa`:
```sh
```<!---sh-->
mkdir -p test
cd test
sh ../receive
@@ -168,7 +168,7 @@ Construct `sharkmail`, to auto-split `sharkives` into mailable segments and mail
them. Here's a simple one, which could be extended to enable auto-reassembly
with one shell cmd at the far end.
```sh
```<!---sh-->
#!/bin/sh
m=$1; shift
shark $* | split -800 - /tmp/shark$$
+20 -20
View File
@@ -147,14 +147,14 @@ Location: <a href="../../location.html#ZZ">ZZ</a> - <em>Unknown location</em></l
<!-- 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> all</span></code></pre></div>
<pre class="&lt;!---sh--&gt;"><code> make all</code></pre>
<h2 id="try">Try:</h2>
<p>To test the official C entry, one might try:</p>
<div class="sourceCode" id="cb2"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb2-1"><a href="#cb2-1" aria-hidden="true" tabindex="-1"></a> <span class="bu">echo</span> <span class="st">&quot;Quartz glyph jocks vend, fix, BMW.&quot;</span> <span class="kw">|</span> <span class="ex">compress</span> <span class="kw">|</span> <span class="ex">./btoa</span> <span class="kw">|</span> <span class="ex">./jaw</span></span></code></pre></div>
<pre class="&lt;!---sh--&gt;"><code> echo &quot;Quartz glyph jocks vend, fix, BMW.&quot; | compress | ./btoa | ./jaw</code></pre>
<p>which should apply the identity transformation to a minimal holoalphabetic
sentence.</p>
<h4 id="also-try">Also try:</h4>
<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>
<pre class="&lt;!---sh--&gt;"><code> ./try.sh</code></pre>
<h2 id="judges-remarks">Judges’ remarks:</h2>
<p>The program, in its base form, implements two useful utilities:</p>
<ul>
@@ -165,14 +165,14 @@ sentence.</p>
it to 1530 bytes) which implements the complete shark utility. The script,
<a href="shark.sh">shark.sh</a>, contains a <code>jaw.c</code> embedded within it!</p>
<p>The sender must have <code>compress</code> and <code>btoa</code>. To send, try:</p>
<div class="sourceCode" id="cb4"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb4-1"><a href="#cb4-1" aria-hidden="true" tabindex="-1"></a> <span class="ex">./shark.sh</span> jaw.<span class="pp">*</span> README.md <span class="op">&gt;</span> receive</span></code></pre></div>
<pre class="&lt;!---sh--&gt;"><code> ./shark.sh jaw.* README.md &gt; receive</code></pre>
<p>The resulting file, <code>receive</code>, unpacks the input files
even if the receiver lacks <code>uncompress</code> and <code>btoa</code>:</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">mkdir</span> <span class="at">-p</span> test</span>
<span id="cb5-2"><a href="#cb5-2" aria-hidden="true" tabindex="-1"></a> <span class="bu">cd</span> test</span>
<span id="cb5-3"><a href="#cb5-3" aria-hidden="true" tabindex="-1"></a> <span class="fu">sh</span> ../receive</span>
<span id="cb5-4"><a href="#cb5-4" aria-hidden="true" tabindex="-1"></a> <span class="fu">cmp</span> ../jaw.c jaw.c</span>
<span id="cb5-5"><a href="#cb5-5" aria-hidden="true" tabindex="-1"></a> <span class="fu">cmp</span> ../README.md README.md</span></code></pre></div>
<pre class="&lt;!---sh--&gt;"><code> mkdir -p test
cd test
sh ../receive
cmp ../jaw.c jaw.c
cmp ../README.md README.md</code></pre>
<p>NOTE: a limitation is that the script should be in the parent directory of the
directory it is run from.</p>
<h2 id="authors-remarks">Authors’ remarks:</h2>
@@ -262,17 +262,17 @@ left, and source-to-source transformations galore.</p></li>
<p>Construct <code>sharkmail</code>, to auto-split <code>sharkives</code> into mailable segments and mail
them. Here’s a simple one, which could be extended to enable auto-reassembly
with one shell cmd at the far end.</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="co">#!/bin/sh</span></span>
<span id="cb6-2"><a href="#cb6-2" aria-hidden="true" tabindex="-1"></a> <span class="va">m</span><span class="op">=</span><span class="va">$1</span><span class="kw">;</span> <span class="bu">shift</span></span>
<span id="cb6-3"><a href="#cb6-3" aria-hidden="true" tabindex="-1"></a> <span class="ex">shark</span> <span class="va">$*</span> <span class="kw">|</span> <span class="fu">split</span> <span class="at">-800</span> <span class="at">-</span> /tmp/shark<span class="va">$$</span></span>
<span id="cb6-4"><a href="#cb6-4" aria-hidden="true" tabindex="-1"></a> <span class="va">n</span><span class="op">=</span><span class="kw">`</span><span class="fu">ls</span> /tmp/shark<span class="va">$$</span><span class="pp">*</span> <span class="kw">|</span> <span class="fu">wc</span> <span class="at">-l</span> <span class="kw">|</span> <span class="fu">sed</span> <span class="st">&#39;s/ *//&#39;</span><span class="kw">`</span></span>
<span id="cb6-5"><a href="#cb6-5" aria-hidden="true" tabindex="-1"></a> <span class="va">p</span><span class="op">=</span>0</span>
<span id="cb6-6"><a href="#cb6-6" aria-hidden="true" tabindex="-1"></a> <span class="cf">for</span> f <span class="kw">in</span> <span class="kw">`</span><span class="fu">ls</span> /tmp/shark<span class="va">$$</span><span class="pp">*</span><span class="kw">`</span></span>
<span id="cb6-7"><a href="#cb6-7" aria-hidden="true" tabindex="-1"></a> <span class="cf">do</span></span>
<span id="cb6-8"><a href="#cb6-8" aria-hidden="true" tabindex="-1"></a> <span class="va">p</span><span class="op">=</span><span class="kw">`</span><span class="fu">expr</span> <span class="va">$p</span> + 1<span class="kw">`</span></span>
<span id="cb6-9"><a href="#cb6-9" aria-hidden="true" tabindex="-1"></a> <span class="ex">mail</span> <span class="at">-s</span> <span class="st">&quot;bundle (</span><span class="va">$p</span><span class="st"> of </span><span class="va">$n</span><span class="st">) from &#39;</span><span class="kw">`</span><span class="fu">whoami</span><span class="kw">`</span><span class="st">&#39;&quot;</span> <span class="va">$m</span> <span class="op">&lt;</span> <span class="va">$f</span></span>
<span id="cb6-10"><a href="#cb6-10" aria-hidden="true" tabindex="-1"></a> <span class="cf">done</span></span>
<span id="cb6-11"><a href="#cb6-11" aria-hidden="true" tabindex="-1"></a> <span class="fu">rm</span> /tmp/shark<span class="va">$$</span><span class="pp">*</span></span></code></pre></div>
<pre class="&lt;!---sh--&gt;"><code> #!/bin/sh
m=$1; shift
shark $* | split -800 - /tmp/shark$$
n=`ls /tmp/shark$$* | wc -l | sed &#39;s/ *//&#39;`
p=0
for f in `ls /tmp/shark$$*`
do
p=`expr $p + 1`
mail -s &quot;bundle ($p of $n) from &#39;`whoami`&#39;&quot; $m &lt; $f
done
rm /tmp/shark$$*</code></pre>
<h3 id="shark-history">Shark history:</h3>
<ul>
<li><p>May 1987: Karl Fox introduces 1023-byte <code>zcat.c</code> to USENET.
Loaded 100 of 700 files, more files were not shown because too many files have changed in this diff. Show more