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="<!---c-->"><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:
1 parent
3919df50fb
commit
b66c79254a
700 files changed
+7052
-7056
No files matched your search
+11
-11
@@ -1,6 +1,6 @@
|
||||
## To build:
|
||||
|
||||
```sh
|
||||
```<!---sh-->
|
||||
make all
|
||||
```
|
||||
|
||||
@@ -19,13 +19,13 @@ For more detailed information see [1992 adrian bugs](../../bugs.html#1992_adrian
|
||||
|
||||
## Try:
|
||||
|
||||
```sh
|
||||
```<!---sh-->
|
||||
./try.sh
|
||||
```
|
||||
|
||||
For the slow minded, try:
|
||||
|
||||
```sh
|
||||
```<!---sh-->
|
||||
./adsleep 32767
|
||||
```
|
||||
|
||||
@@ -134,7 +134,7 @@ character list.
|
||||
With the automaton specification in `filename`, invoke the program by
|
||||
typing
|
||||
|
||||
```sh
|
||||
```<!---sh-->
|
||||
./adrian filename
|
||||
```
|
||||
|
||||
@@ -151,7 +151,7 @@ occurs if your automaton has more than 257 states.
|
||||
|
||||
Running:
|
||||
|
||||
```sh
|
||||
```<!---sh-->
|
||||
./adrian from < your_mailbox
|
||||
```
|
||||
|
||||
@@ -169,7 +169,7 @@ the regular expression:
|
||||
|
||||
I suggest using `adrian.c` as input, and storing the output in `adwc.c`:
|
||||
|
||||
```sh
|
||||
```<!---sh-->
|
||||
./adrian < adrian.c > adwc.c
|
||||
```
|
||||
|
||||
@@ -181,13 +181,13 @@ in the input file.
|
||||
Another possibly interesting automaton can be created by slightly
|
||||
adjusting the `adrian.c` file. Change the first line to read
|
||||
|
||||
```c
|
||||
```<!---c-->
|
||||
/* . echo| . */
|
||||
```
|
||||
|
||||
and repeat the process above
|
||||
|
||||
```sh
|
||||
```<!---sh-->
|
||||
./adrian <adrian.c > adecho.c
|
||||
```
|
||||
|
||||
@@ -204,7 +204,7 @@ employed.
|
||||
Two other adjustments to the first line also yield useful results. By
|
||||
changing it to
|
||||
|
||||
```c
|
||||
```<!---c-->
|
||||
/* . head; . */
|
||||
```
|
||||
|
||||
@@ -221,7 +221,7 @@ specified (again this was changed to `__FILE__`).
|
||||
|
||||
By setting the first line to
|
||||
|
||||
```c
|
||||
```<!---c-->
|
||||
/* . basename . */
|
||||
```
|
||||
|
||||
@@ -240,7 +240,7 @@ The resulting base name is printed to stdout.
|
||||
|
||||
Lastly, by setting the first line to
|
||||
|
||||
```c
|
||||
```<!---c-->
|
||||
/* . sleep . */
|
||||
```
|
||||
|
||||
|
||||
+11
-11
@@ -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="<!---sh-->"><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
|
||||
STATUS: INABIAF - please **DO NOT** fix</code></pre>
|
||||
<p>For more detailed information see <a href="../../bugs.html#1992_adrian">1992 adrian 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="<!---sh-->"><code> ./try.sh</code></pre>
|
||||
<p>For the slow minded, 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">./adsleep</span> 32767</span></code></pre></div>
|
||||
<pre class="<!---sh-->"><code> ./adsleep 32767</code></pre>
|
||||
<h2 id="judges-remarks">Judges’ remarks:</h2>
|
||||
<p>Once you get past the obfuscation, you have an opportunity to learn
|
||||
about regular expressions and state machines.</p>
|
||||
@@ -214,7 +214,7 @@ character list.</p>
|
||||
[q5]</code></pre>
|
||||
<p>With the automaton specification in <code>filename</code>, invoke the program by
|
||||
typing</p>
|
||||
<div class="sourceCode" id="cb12"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb12-1"><a href="#cb12-1" aria-hidden="true" tabindex="-1"></a> <span class="ex">./adrian</span> filename</span></code></pre></div>
|
||||
<pre class="<!---sh-->"><code> ./adrian filename</code></pre>
|
||||
<p>It will read the file and print out all the lines which the automaton
|
||||
accepts. If the file cannot be opened, a system error message will
|
||||
be printed. If the input contains errors, then an error message along
|
||||
@@ -225,7 +225,7 @@ being processed is printed. Error <code>no_destination</code> occurs if you spec
|
||||
set of characters, but no destination state, and error <code>too_many_states</code>
|
||||
occurs if your automaton has more than 257 states.</p>
|
||||
<p>Running:</p>
|
||||
<div class="sourceCode" id="cb13"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb13-1"><a href="#cb13-1" aria-hidden="true" tabindex="-1"></a> <span class="ex">./adrian</span> from <span class="op"><</span> your_mailbox</span></code></pre></div>
|
||||
<pre class="<!---sh-->"><code> ./adrian from < your_mailbox</code></pre>
|
||||
<p>will perform a function similar to that of the unix <code>from</code> command.</p>
|
||||
<p>If no filename is specified on the command line, then <code>__FILE__</code> is used as the
|
||||
specification for the automaton. (Originally this was <code>"adgrep.c"</code> but the file
|
||||
@@ -234,23 +234,23 @@ changed to <code>__FILE__</code>.) In this case, the program will search for mat
|
||||
the regular expression:</p>
|
||||
<pre><code> ^.[^|C][^w[Q]*(Q|[w[]c).*|^.[C|]$</code></pre>
|
||||
<p>I suggest using <code>adrian.c</code> as input, and storing the output in <code>adwc.c</code>:</p>
|
||||
<div class="sourceCode" id="cb15"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb15-1"><a href="#cb15-1" aria-hidden="true" tabindex="-1"></a> <span class="ex">./adrian</span> <span class="op"><</span> adrian.c <span class="op">></span> adwc.c</span></code></pre></div>
|
||||
<pre class="<!---sh-->"><code> ./adrian < adrian.c > adwc.c</code></pre>
|
||||
<p>Compiling the new file, <code>adwc.c</code>, yields a clone of the unix <code>wc</code> command. It
|
||||
runs on one file, defaulting to <code>"adrian.c"</code> if no file is given (again, this
|
||||
was changed to be <code>__FILE__</code>) and displays the number of lines, words, and bytes
|
||||
in the input file.</p>
|
||||
<p>Another possibly interesting automaton can be created by slightly
|
||||
adjusting the <code>adrian.c</code> file. Change the first line to read</p>
|
||||
<div class="sourceCode" id="cb16"><pre class="sourceCode c"><code class="sourceCode c"><span id="cb16-1"><a href="#cb16-1" aria-hidden="true" tabindex="-1"></a> <span class="co">/* . echo| . */</span></span></code></pre></div>
|
||||
<pre class="<!---c-->"><code> /* . echo| . */</code></pre>
|
||||
<p>and repeat the process above</p>
|
||||
<div class="sourceCode" id="cb17"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb17-1"><a href="#cb17-1" aria-hidden="true" tabindex="-1"></a> <span class="ex">./adrian</span> <span class="op"><</span>adrian.c <span class="op">></span> adecho.c</span></code></pre></div>
|
||||
<pre class="<!---sh-->"><code> ./adrian <adrian.c > adecho.c</code></pre>
|
||||
<p>The new file now contains all lines which match</p>
|
||||
<pre><code> ^.[^5|m^]*[m^]([e=p,;]|[^e=+p,;].*)$</code></pre>
|
||||
<p>Compile and run. This is an <code>echo(1)</code> clone. Note the efficient algorithm
|
||||
employed.</p>
|
||||
<p>Two other adjustments to the first line also yield useful results. By
|
||||
changing it to</p>
|
||||
<div class="sourceCode" id="cb19"><pre class="sourceCode c"><code class="sourceCode c"><span id="cb19-1"><a href="#cb19-1" aria-hidden="true" tabindex="-1"></a> <span class="co">/* . head; . */</span></span></code></pre></div>
|
||||
<pre class="<!---c-->"><code> /* . head; . */</code></pre>
|
||||
<p>you can search for matches to</p>
|
||||
<pre><code> ^.[^W]*W..*$</code></pre>
|
||||
<p>By some freak happenstance, lines of <code>adrian.c</code> which match this regular
|
||||
@@ -258,7 +258,7 @@ expression form a unix <code>head(1)</code> command. It prints the first ten lin
|
||||
the file specified on the command line or <code>adrian.c</code> if no file is
|
||||
specified (again this was changed to <code>__FILE__</code>).</p>
|
||||
<p>By setting the first line to</p>
|
||||
<div class="sourceCode" id="cb21"><pre class="sourceCode c"><code class="sourceCode c"><span id="cb21-1"><a href="#cb21-1" aria-hidden="true" tabindex="-1"></a> <span class="co">/* . basename . */</span></span></code></pre></div>
|
||||
<pre class="<!---c-->"><code> /* . basename . */</code></pre>
|
||||
<p>a clone of the unix <code>basename(1)</code> command can be unearthed. The automaton will
|
||||
search for</p>
|
||||
<pre><code> ^.[^j]*jr.*$</code></pre>
|
||||
@@ -268,7 +268,7 @@ filename, and the second, an extension. All leading pathname components
|
||||
are removed from the filename, and the extension is removed if present.
|
||||
The resulting base name is printed to stdout.</p>
|
||||
<p>Lastly, by setting the first line to</p>
|
||||
<div class="sourceCode" id="cb23"><pre class="sourceCode c"><code class="sourceCode c"><span id="cb23-1"><a href="#cb23-1" aria-hidden="true" tabindex="-1"></a> <span class="co">/* . sleep . */</span></span></code></pre></div>
|
||||
<pre class="<!---c-->"><code> /* . sleep . */</code></pre>
|
||||
<p>you can search for</p>
|
||||
<pre><code> ^.[^(~][^s]*sl.*$</code></pre>
|
||||
<p>Filtering <code>adrian.c</code> through this search yields a clone of the <code>sleep(1)</code>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
## To build:
|
||||
|
||||
```sh
|
||||
```<!---sh-->
|
||||
make all
|
||||
```
|
||||
|
||||
@@ -21,14 +21,14 @@ For more detailed information see [1992 albert bugs](../../bugs.html#1992_albert
|
||||
|
||||
## To use:
|
||||
|
||||
```sh
|
||||
```<!---sh-->
|
||||
./albert number
|
||||
```
|
||||
|
||||
|
||||
## Try:
|
||||
|
||||
```sh
|
||||
```<!---sh-->
|
||||
./try.sh
|
||||
```
|
||||
|
||||
@@ -64,7 +64,7 @@ The [albert.alt.c](albert.c) file is the fixed file, whereas the
|
||||
|
||||
To compile this alternate version:
|
||||
|
||||
```sh
|
||||
```<!---sh-->
|
||||
make alt
|
||||
```
|
||||
|
||||
@@ -76,7 +76,7 @@ Use `albert.alt` as you would `albert` above.
|
||||
|
||||
### Alternate try:
|
||||
|
||||
```sh
|
||||
```<!---sh-->
|
||||
./try.alt.sh
|
||||
```
|
||||
|
||||
@@ -106,7 +106,7 @@ if you want to factor Fermat's 4th number. Then just run it.
|
||||
Or you may type `./albert <some-number>`
|
||||
A nice one is also (30 ones):
|
||||
|
||||
```sh
|
||||
```<!---sh-->
|
||||
./albert 111111111111111111111111111111
|
||||
```
|
||||
|
||||
@@ -114,7 +114,7 @@ Apart from the foregoing there are no special execution instructions.
|
||||
|
||||
To customize the program into a factorizer of a fixed number, use
|
||||
|
||||
```sh
|
||||
```<!---sh-->
|
||||
cc albert.c -o 4294967297
|
||||
```
|
||||
|
||||
|
||||
@@ -141,16 +141,16 @@ 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="<!---sh-->"><code> make all</code></pre>
|
||||
<p>An <a href="#alternate-code">alternate version</a> exists that fixes a bug.</p>
|
||||
<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#1992_albert">1992 albert 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">./albert</span> number</span></code></pre></div>
|
||||
<pre class="<!---sh-->"><code> ./albert number</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="<!---sh-->"><code> ./try.sh</code></pre>
|
||||
<h2 id="alternate-code">Alternate code:</h2>
|
||||
<p>An alternate version of this entry, <a href="albert.alt.c">albert.alt.c</a>, is provided.
|
||||
Leo Broukhis, before he was an IOCCC judge, sent the IOCCC
|
||||
@@ -173,11 +173,11 @@ judges this Email message:</p>
|
||||
<a href="albert.c">albert.c</a> is the file before applying Leo Broukhis’ fix.</p>
|
||||
<h3 id="alternate-build">Alternate build:</h3>
|
||||
<p>To compile this alternate version:</p>
|
||||
<div class="sourceCode" id="cb6"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb6-1"><a href="#cb6-1" aria-hidden="true" tabindex="-1"></a> <span class="fu">make</span> alt</span></code></pre></div>
|
||||
<pre class="<!---sh-->"><code> make alt</code></pre>
|
||||
<h3 id="alternate-use">Alternate use:</h3>
|
||||
<p>Use <code>albert.alt</code> as you would <code>albert</code> above.</p>
|
||||
<h3 id="alternate-try">Alternate 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">./try.alt.sh</span></span></code></pre></div>
|
||||
<pre class="<!---sh-->"><code> ./try.alt.sh</code></pre>
|
||||
<h2 id="judges-remarks">Judges’ remarks:</h2>
|
||||
<p>We were impressed with the speed at which it was able to factor
|
||||
arbitrarily large numbers consisting of factors that fit into
|
||||
@@ -194,10 +194,10 @@ multiplication, until the candidate factor no longer fits in a signed long.</p>
|
||||
if you want to factor Fermat’s 4th number. Then just run it.</p>
|
||||
<p>Or you may type <code>./albert <some-number></code>
|
||||
A nice one is also (30 ones):</p>
|
||||
<div class="sourceCode" id="cb8"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb8-1"><a href="#cb8-1" aria-hidden="true" tabindex="-1"></a> <span class="ex">./albert</span> 111111111111111111111111111111</span></code></pre></div>
|
||||
<pre class="<!---sh-->"><code> ./albert 111111111111111111111111111111</code></pre>
|
||||
<p>Apart from the foregoing there are no special execution instructions.</p>
|
||||
<p>To customize the program into a factorizer of a fixed number, use</p>
|
||||
<div class="sourceCode" id="cb9"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb9-1"><a href="#cb9-1" aria-hidden="true" tabindex="-1"></a> <span class="fu">cc</span> albert.c <span class="at">-o</span> 4294967297</span></code></pre></div>
|
||||
<pre class="<!---sh-->"><code> cc albert.c -o 4294967297</code></pre>
|
||||
<p>or some such.</p>
|
||||
<p>There are no data files used, and it is not possible to feed input
|
||||
via <code>stdin</code>.</p>
|
||||
|
||||
+3
-3
@@ -1,13 +1,13 @@
|
||||
## To build:
|
||||
|
||||
```sh
|
||||
```<!---sh-->
|
||||
make all
|
||||
```
|
||||
|
||||
|
||||
## To use:
|
||||
|
||||
```sh
|
||||
```<!---sh-->
|
||||
./ant Makefile
|
||||
|
||||
./ant Makefile rule
|
||||
@@ -18,7 +18,7 @@ where `Makefile` is a Makefile to use and `rule` is an optional rule to use.
|
||||
|
||||
## Try:
|
||||
|
||||
```sh
|
||||
```<!---sh-->
|
||||
./try.sh
|
||||
```
|
||||
|
||||
|
||||
+5
-5
@@ -141,14 +141,14 @@ Location: <a href="../../location.html#CA">CA</a> - <em>Canada</em></li>
|
||||
<!-- 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="<!---sh-->"><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">./ant</span> Makefile</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">./ant</span> Makefile rule</span></code></pre></div>
|
||||
<pre class="<!---sh-->"><code> ./ant Makefile
|
||||
|
||||
./ant Makefile rule</code></pre>
|
||||
<p>where <code>Makefile</code> is a Makefile to use and <code>rule</code> is an optional rule to use.</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="<!---sh-->"><code> ./try.sh</code></pre>
|
||||
<h2 id="judges-remarks">Judges’ remarks:</h2>
|
||||
<p>Like much of POSIX, obfuscation has its place. Your task is to
|
||||
figure out where.</p>
|
||||
|
||||
+11
-11
@@ -1,20 +1,20 @@
|
||||
## To build:
|
||||
|
||||
```sh
|
||||
```<!---sh-->
|
||||
make all
|
||||
```
|
||||
|
||||
|
||||
## To use:
|
||||
|
||||
```sh
|
||||
```<!---sh-->
|
||||
./buzzard.1 num num
|
||||
```
|
||||
|
||||
|
||||
## Try:
|
||||
|
||||
```sh
|
||||
```<!---sh-->
|
||||
./try.sh
|
||||
```
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
|
||||
To see good C Preprocessor buzzard.1, try:
|
||||
|
||||
```sh
|
||||
```<!---sh-->
|
||||
make babble.cppcb
|
||||
cat babble.cppcb
|
||||
```
|
||||
@@ -54,19 +54,19 @@ short strings.
|
||||
`buzzard.1` is a simple mathematical program. It expects two numeric
|
||||
arguments.
|
||||
|
||||
```sh
|
||||
```<!---sh-->
|
||||
./buzzard.1 0 <num>
|
||||
```
|
||||
|
||||
will print out the factorial of `<num>`.
|
||||
|
||||
```sh
|
||||
```<!---sh-->
|
||||
./buzzard.1 <num1> <num2>
|
||||
```
|
||||
|
||||
will print out the largest common factor of `num1` and `num2`.
|
||||
|
||||
```sh
|
||||
```<!---sh-->
|
||||
./buzzard.1 1 <num2>
|
||||
```
|
||||
|
||||
@@ -171,21 +171,21 @@ programs is the conditional (given that we have loops).
|
||||
Since all you can do in the given operation output set is
|
||||
assignment, we implement "conditional assignment":
|
||||
|
||||
```c
|
||||
```<!---c-->
|
||||
if (x) y = z;
|
||||
```
|
||||
|
||||
To implement this, we constrain `x` to be either 0 or 1, and
|
||||
simply compute:
|
||||
|
||||
```c
|
||||
```<!---c-->
|
||||
y = (z * x) + (y * (1-x));
|
||||
```
|
||||
|
||||
This is more obscured by factoring out common terms and restricting
|
||||
ourselves to two operand operations:
|
||||
|
||||
```c
|
||||
```<!---c-->
|
||||
temp = z; (temp == z)
|
||||
temp -= y; (temp == z-y)
|
||||
temp *= x; (temp == (z-y)*x)
|
||||
@@ -199,7 +199,7 @@ Next we imagine we have a [pc](https://en.wikipedia.org/wiki/Program_counter).
|
||||
we're not currently coming up on statement pc. To handle this, we simply make
|
||||
every operation conditional on the pc having the correct value:
|
||||
|
||||
```c
|
||||
```<!---c-->
|
||||
if (pc == some_constant) y = z;
|
||||
```
|
||||
|
||||
|
||||
+17
-17
@@ -141,15 +141,15 @@ 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="<!---sh-->"><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">./buzzard.1</span> num num</span></code></pre></div>
|
||||
<pre class="<!---sh-->"><code> ./buzzard.1 num num</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="<!---sh-->"><code> ./try.sh</code></pre>
|
||||
<h2 id="judges-remarks">Judges’ remarks:</h2>
|
||||
<p>To see good C Preprocessor buzzard.1, 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="fu">make</span> babble.cppcb</span>
|
||||
<span id="cb4-2"><a href="#cb4-2" aria-hidden="true" tabindex="-1"></a> <span class="fu">cat</span> babble.cppcb</span></code></pre></div>
|
||||
<pre class="<!---sh-->"><code> make babble.cppcb
|
||||
cat babble.cppcb</code></pre>
|
||||
<p>Notice how many statements it takes to do anything useful?</p>
|
||||
<h2 id="authors-remarks">Author’s remarks:</h2>
|
||||
<p>What you shouldn’t think about <code>buzzard.1</code>:</p>
|
||||
@@ -162,11 +162,11 @@ short strings.</p>
|
||||
<h3 id="what-it-does">What it does</h3>
|
||||
<p><code>buzzard.1</code> is a simple mathematical program. It expects two numeric
|
||||
arguments.</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">./buzzard.1</span> 0 <span class="op"><</span>num<span class="op">></span></span></code></pre></div>
|
||||
<pre class="<!---sh-->"><code> ./buzzard.1 0 <num></code></pre>
|
||||
<p>will print out the factorial of <code><num></code>.</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">./buzzard.1</span> <span class="op"><</span>num1<span class="op">></span> <span class="op"><</span>num2<span class="op">></span></span></code></pre></div>
|
||||
<pre class="<!---sh-->"><code> ./buzzard.1 <num1> <num2></code></pre>
|
||||
<p>will print out the largest common factor of <code>num1</code> and <code>num2</code>.</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">./buzzard.1</span> 1 <span class="op"><</span>num2<span class="op">></span></span></code></pre></div>
|
||||
<pre class="<!---sh-->"><code> ./buzzard.1 1 <num2></code></pre>
|
||||
<p>will print out a factor of <code>num2</code> if it’s composite, or else
|
||||
it will print a string informing you that <code>num2</code> is prime.</p>
|
||||
<p>If the first argument is less than 0, it prints out an
|
||||
@@ -244,23 +244,23 @@ BCD, so it can be output by the hexadecimal output statement.</p>
|
||||
programs is the conditional (given that we have loops).
|
||||
Since all you can do in the given operation output set is
|
||||
assignment, we implement “conditional assignment”:</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>x<span class="op">)</span> y <span class="op">=</span> z<span class="op">;</span></span></code></pre></div>
|
||||
<pre class="<!---c-->"><code> if (x) y = z;</code></pre>
|
||||
<p>To implement this, we constrain <code>x</code> to be either 0 or 1, and
|
||||
simply compute:</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> y <span class="op">=</span> <span class="op">(</span>z <span class="op">*</span> x<span class="op">)</span> <span class="op">+</span> <span class="op">(</span>y <span class="op">*</span> <span class="op">(</span><span class="dv">1</span><span class="op">-</span>x<span class="op">));</span></span></code></pre></div>
|
||||
<pre class="<!---c-->"><code> y = (z * x) + (y * (1-x));</code></pre>
|
||||
<p>This is more obscured by factoring out common terms and restricting
|
||||
ourselves to two operand operations:</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> temp <span class="op">=</span> z<span class="op">;</span> <span class="op">(</span>temp <span class="op">==</span> z<span class="op">)</span></span>
|
||||
<span id="cb11-2"><a href="#cb11-2" aria-hidden="true" tabindex="-1"></a> temp <span class="op">-=</span> y<span class="op">;</span> <span class="op">(</span>temp <span class="op">==</span> z<span class="op">-</span>y<span class="op">)</span></span>
|
||||
<span id="cb11-3"><a href="#cb11-3" aria-hidden="true" tabindex="-1"></a> temp <span class="op">*=</span> x<span class="op">;</span> <span class="op">(</span>temp <span class="op">==</span> <span class="op">(</span>z<span class="op">-</span>y<span class="op">)*</span>x<span class="op">)</span></span>
|
||||
<span id="cb11-4"><a href="#cb11-4" aria-hidden="true" tabindex="-1"></a> y <span class="op">+=</span> temp<span class="op">;</span> <span class="op">(</span>y <span class="op">==</span> <span class="op">(</span>z<span class="op">-</span>y<span class="op">)*</span>x <span class="op">+</span> y<span class="op">)</span></span>
|
||||
<span id="cb11-5"><a href="#cb11-5" aria-hidden="true" tabindex="-1"></a> <span class="op">(</span> <span class="op">==</span> z<span class="op">*</span>x <span class="op">-</span> y<span class="op">*</span>x <span class="op">+</span> y<span class="op">)</span></span>
|
||||
<span id="cb11-6"><a href="#cb11-6" aria-hidden="true" tabindex="-1"></a> <span class="op">(</span> <span class="op">==</span> z<span class="op">*</span>x <span class="op">+</span> y<span class="op">*(</span><span class="dv">1</span><span class="op">-</span>x<span class="op">))</span></span></code></pre></div>
|
||||
<pre class="<!---c-->"><code> temp = z; (temp == z)
|
||||
temp -= y; (temp == z-y)
|
||||
temp *= x; (temp == (z-y)*x)
|
||||
y += temp; (y == (z-y)*x + y)
|
||||
( == z*x - y*x + y)
|
||||
( == z*x + y*(1-x))</code></pre>
|
||||
<p>Next we imagine we have a <a href="https://en.wikipedia.org/wiki/Program_counter">pc</a>.
|
||||
“I’m supposed to execute statement pc next”, says our emulator. But suppose
|
||||
we’re not currently coming up on statement pc. To handle this, we simply make
|
||||
every operation conditional on the pc having the correct value:</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="cf">if</span> <span class="op">(</span>pc <span class="op">==</span> some_constant<span class="op">)</span> y <span class="op">=</span> z<span class="op">;</span></span></code></pre></div>
|
||||
<pre class="<!---c-->"><code> if (pc == some_constant) y = z;</code></pre>
|
||||
<p>To combine this with other operations, we simply multiply by our
|
||||
(<code>pc == some_constant</code>) flag right after the above <code>temp *= x</code>.</p>
|
||||
<p>To evaluate <code>pc == some_constant</code> requires one more trick. We assume that
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
## To build:
|
||||
|
||||
```sh
|
||||
```<!---sh-->
|
||||
make all
|
||||
```
|
||||
|
||||
@@ -13,13 +13,13 @@ code](#alternate-code) below for details.
|
||||
First, you must make sure that `first` is made first (even though `make all`
|
||||
should make first first :-) ):
|
||||
|
||||
```sh
|
||||
```<!---sh-->
|
||||
make first
|
||||
```
|
||||
|
||||
Second:
|
||||
|
||||
```sh
|
||||
```<!---sh-->
|
||||
# get help:
|
||||
echo help | cat third help.th - | ./first
|
||||
|
||||
@@ -29,7 +29,7 @@ Second:
|
||||
|
||||
Third:
|
||||
|
||||
```sh
|
||||
```<!---sh-->
|
||||
cat third help.th - | ./first
|
||||
```
|
||||
|
||||
@@ -50,7 +50,7 @@ Fourth:
|
||||
|
||||
## Try:
|
||||
|
||||
```sh
|
||||
```<!---sh-->
|
||||
./try.sh
|
||||
```
|
||||
|
||||
@@ -63,7 +63,7 @@ fix that the author notes in their remarks.
|
||||
|
||||
### Alternate build:
|
||||
|
||||
```sh
|
||||
```<!---sh-->
|
||||
make alt
|
||||
```
|
||||
|
||||
@@ -75,7 +75,7 @@ Use `buzzard.2.alt` as you would `buzzard.2` above.
|
||||
|
||||
### Alternate try:
|
||||
|
||||
```sh
|
||||
```<!---sh-->
|
||||
./try.alt.sh
|
||||
```
|
||||
|
||||
@@ -125,7 +125,7 @@ Do not expect to be able to do anything interesting with `first`.
|
||||
To do something interesting, you need to feed `first` the file
|
||||
[third](third) first. In unix, you can do
|
||||
|
||||
```sh
|
||||
```<!---sh-->
|
||||
cat third help.th - | ./first
|
||||
```
|
||||
|
||||
@@ -226,7 +226,7 @@ When you get the `Ok.` message from `third`, try out some sample
|
||||
you in a normal way. It only prints `'Ok.'` after you define a word).
|
||||
|
||||
|
||||
```sh
|
||||
```<!---sh-->
|
||||
2 3 + . cr
|
||||
```
|
||||
|
||||
|
||||
+13
-13
@@ -141,37 +141,37 @@ 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="<!---sh-->"><code> make all</code></pre>
|
||||
<p>There is an alternate version of this program. See <a href="#alternate-code">Alternate
|
||||
code</a> below for details.</p>
|
||||
<h2 id="to-use">To use:</h2>
|
||||
<p>First, you must make sure that <code>first</code> is made first (even though <code>make all</code>
|
||||
should make first first :-) ):</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="fu">make</span> first</span></code></pre></div>
|
||||
<pre class="<!---sh-->"><code> make first</code></pre>
|
||||
<p>Second:</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="co"># get help:</span></span>
|
||||
<span id="cb3-2"><a href="#cb3-2" aria-hidden="true" tabindex="-1"></a> <span class="bu">echo</span> help <span class="kw">|</span> <span class="fu">cat</span> third help.th <span class="at">-</span> <span class="kw">|</span> <span class="ex">./first</span></span>
|
||||
<span id="cb3-3"><a href="#cb3-3" aria-hidden="true" tabindex="-1"></a></span>
|
||||
<span id="cb3-4"><a href="#cb3-4" aria-hidden="true" tabindex="-1"></a> <span class="co"># try out a demo:</span></span>
|
||||
<span id="cb3-5"><a href="#cb3-5" aria-hidden="true" tabindex="-1"></a> <span class="fu">cat</span> third demo5.th <span class="kw">|</span> <span class="ex">./first</span></span></code></pre></div>
|
||||
<pre class="<!---sh-->"><code> # get help:
|
||||
echo help | cat third help.th - | ./first
|
||||
|
||||
# try out a demo:
|
||||
cat third demo5.th | ./first</code></pre>
|
||||
<p>Third:</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">cat</span> third help.th <span class="at">-</span> <span class="kw">|</span> <span class="ex">./first</span></span></code></pre></div>
|
||||
<pre class="<!---sh-->"><code> cat third help.th - | ./first</code></pre>
|
||||
<p>NOTE: Wait until ‘Ok’ is printed and the type:</p>
|
||||
<pre><code> 2 3 + . cr</code></pre>
|
||||
<p>Yes you should really type the 2 letters: <code>cr</code>.</p>
|
||||
<p>Fourth:</p>
|
||||
<pre><code> Sorry, this is third!</code></pre>
|
||||
<h2 id="try">Try:</h2>
|
||||
<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">./try.sh</span></span></code></pre></div>
|
||||
<pre class="<!---sh-->"><code> ./try.sh</code></pre>
|
||||
<h2 id="alternate-code">Alternate code:</h2>
|
||||
<p>This alternate version, <a href="buzzard.2.alt.c">buzzard.2.alt.c</a>, does not contain a
|
||||
fix that the author notes in their remarks.</p>
|
||||
<h3 id="alternate-build">Alternate build:</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="fu">make</span> alt</span></code></pre></div>
|
||||
<pre class="<!---sh-->"><code> make alt</code></pre>
|
||||
<h3 id="alternate-use">Alternate use:</h3>
|
||||
<p>Use <code>buzzard.2.alt</code> as you would <code>buzzard.2</code> above.</p>
|
||||
<h3 id="alternate-try">Alternate 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">./try.alt.sh</span></span></code></pre></div>
|
||||
<pre class="<!---sh-->"><code> ./try.alt.sh</code></pre>
|
||||
<h2 id="judges-remarks">Judges’ remarks:</h2>
|
||||
<p>Have fun!</p>
|
||||
<h2 id="authors-remarks">Author’s remarks:</h2>
|
||||
@@ -204,7 +204,7 @@ included, but it only works on ASCII systems.</p>
|
||||
<p>Do not expect to be able to do anything interesting with <code>first</code>.</p>
|
||||
<p>To do something interesting, you need to feed <code>first</code> the file
|
||||
<a href="third">third</a> first. In unix, you can do</p>
|
||||
<div class="sourceCode" id="cb10"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb10-1"><a href="#cb10-1" aria-hidden="true" tabindex="-1"></a> <span class="fu">cat</span> third help.th <span class="at">-</span> <span class="kw">|</span> <span class="ex">./first</span></span></code></pre></div>
|
||||
<pre class="<!---sh-->"><code> cat third help.th - | ./first</code></pre>
|
||||
<p>to do this. Hopefully most operating systems will provide a way to do this. It
|
||||
may take some time for this to complete (I seem to remember it taking several
|
||||
minutes on an 8086 PC); <code>THIRD</code> will prompt you when it is finished. The file
|
||||
@@ -283,7 +283,7 @@ take a significant amount of time in THIRD.</p>
|
||||
<a href="https://en.wikipedia.org/wiki/Forth_(programming_language)">FORTH</a> code
|
||||
(<code>first</code> has no way of knowing if keyboard input is waiting, so it can’t actually prompt
|
||||
you in a normal way. It only prints <code>'Ok.'</code> after you define a word).</p>
|
||||
<div class="sourceCode" id="cb11"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb11-1"><a href="#cb11-1" aria-hidden="true" tabindex="-1"></a> <span class="ex">2</span> 3 + . cr</span></code></pre></div>
|
||||
<pre class="<!---sh-->"><code> 2 3 + . cr</code></pre>
|
||||
<p>(which adds 2 and 3, and print the result and a newline.)</p>
|
||||
<p>THIRD responds:</p>
|
||||
<pre><code> 5</code></pre>
|
||||
|
||||
+7
-7
@@ -1,6 +1,6 @@
|
||||
## To build:
|
||||
|
||||
```sh
|
||||
```<!---sh-->
|
||||
make all
|
||||
```
|
||||
|
||||
@@ -21,14 +21,14 @@ For more detailed information see [1992 gson bugs](../../bugs.html#1992_gson).
|
||||
|
||||
## To use:
|
||||
|
||||
```sh
|
||||
```<!---sh-->
|
||||
./ag word word2 word3 < /path/to/dictionary
|
||||
```
|
||||
|
||||
|
||||
## Try:
|
||||
|
||||
```sh
|
||||
```<!---sh-->
|
||||
./try.sh
|
||||
```
|
||||
|
||||
@@ -45,7 +45,7 @@ following locations though the last one is more ironic:
|
||||
|
||||
Then using the proper dictionary file it does:
|
||||
|
||||
```sh
|
||||
```<!---sh-->
|
||||
./ag free software foundation < /usr/share/dict/words
|
||||
./ag obfuscated c contest < /usr/share/dict/words
|
||||
./ag unix international < /usr/share/dict/words
|
||||
@@ -73,7 +73,7 @@ weren't allowed to print!
|
||||
The author provided an obfuscated script that can be used to construct
|
||||
dictionaries which has been put in as [mkdict.sh](mkdict.sh). To use try:
|
||||
|
||||
```sh
|
||||
```<!---sh-->
|
||||
cat README.md | ./mkdict.sh > words
|
||||
```
|
||||
|
||||
@@ -103,7 +103,7 @@ have one already, you can make your own dictionary by concatenating a few
|
||||
hundred of your favourite Usenet articles and piping them through the following
|
||||
obfuscated shell script:
|
||||
|
||||
```sh
|
||||
```<!---sh-->
|
||||
#!/bin/sh
|
||||
z=a-z];tr [A-Z\] \[$z|sed s/[\^$z[\^$z*/_/g|tr _ \\012|grep ..|sort -u
|
||||
```
|
||||
@@ -258,7 +258,7 @@ those bits that should remain zero. For example, the following
|
||||
program prints all those 16-bit integers that contain zeroes in all
|
||||
even bit positions:
|
||||
|
||||
```c
|
||||
```<!---c-->
|
||||
main(){int i=0,s=0xAAAA;do{printf("%04x\t",i);}while(i=((i|~s)+1)&s);}
|
||||
```
|
||||
|
||||
|
||||
+14
-14
@@ -141,7 +141,7 @@ Location: <a href="../../location.html#FI">FI</a> - <em>Republic of Finland </em
|
||||
<!-- START: this line starts content for HTML phase 21 by: bin/pandoc-wrapper.sh via bin/md2html.sh -->
|
||||
|
||||
<h2 id="to-build">To build:</h2>
|
||||
<div class="sourceCode" id="cb1"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb1-1"><a href="#cb1-1" aria-hidden="true" tabindex="-1"></a> <span class="fu">make</span> all</span></code></pre></div>
|
||||
<pre class="<!---sh-->"><code> make all</code></pre>
|
||||
<p>NOTE: we DISABLE the optimiser because having it enabled causes some invocations
|
||||
to crash in some systems.</p>
|
||||
<h3 id="bugs-and-misfeatures">Bugs and (Mis)features:</h3>
|
||||
@@ -149,9 +149,9 @@ to crash in some systems.</p>
|
||||
<pre><code> STATUS: uses gets() - change to fgets() if possible</code></pre>
|
||||
<p>For more detailed information see <a href="../../bugs.html#1992_gson">1992 gson 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">./ag</span> word word2 word3 <span class="op"><</span> /path/to/dictionary</span></code></pre></div>
|
||||
<pre class="<!---sh-->"><code> ./ag word word2 word3 < /path/to/dictionary</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="<!---sh-->"><code> ./try.sh</code></pre>
|
||||
<p>This script will determine (or try and determine) where your system dictionary
|
||||
is located and assuming that it can find one it’ll use that. It checks the
|
||||
following locations though the last one is more ironic:</p>
|
||||
@@ -160,13 +160,13 @@ following locations though the last one is more ironic:</p>
|
||||
/usr/ucblib/dict/words
|
||||
/dev/null # <-- for machines with nothing to say</code></pre>
|
||||
<p>Then using the proper dictionary file it does:</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">./ag</span> free software foundation <span class="op"><</span> /usr/share/dict/words</span>
|
||||
<span id="cb6-2"><a href="#cb6-2" aria-hidden="true" tabindex="-1"></a> <span class="ex">./ag</span> obfuscated c contest <span class="op"><</span> /usr/share/dict/words</span>
|
||||
<span id="cb6-3"><a href="#cb6-3" aria-hidden="true" tabindex="-1"></a> <span class="ex">./ag</span> unix international <span class="op"><</span> /usr/share/dict/words</span>
|
||||
<span id="cb6-4"><a href="#cb6-4" aria-hidden="true" tabindex="-1"></a> <span class="ex">./ag</span> george bush <span class="op"><</span> /usr/share/dict/words</span>
|
||||
<span id="cb6-5"><a href="#cb6-5" aria-hidden="true" tabindex="-1"></a> <span class="ex">./ag</span> bill clinton <span class="op"><</span> /usr/share/dict/words</span>
|
||||
<span id="cb6-6"><a href="#cb6-6" aria-hidden="true" tabindex="-1"></a> <span class="ex">./ag</span> ross perot <span class="op"><</span> /usr/share/dict/words</span>
|
||||
<span id="cb6-7"><a href="#cb6-7" aria-hidden="true" tabindex="-1"></a> <span class="ex">./ag</span> paul e tsongas <span class="op"><</span> /usr/share/dict/words</span></code></pre></div>
|
||||
<pre class="<!---sh-->"><code> ./ag free software foundation < /usr/share/dict/words
|
||||
./ag obfuscated c contest < /usr/share/dict/words
|
||||
./ag unix international < /usr/share/dict/words
|
||||
./ag george bush < /usr/share/dict/words
|
||||
./ag bill clinton < /usr/share/dict/words
|
||||
./ag ross perot < /usr/share/dict/words
|
||||
./ag paul e tsongas < /usr/share/dict/words</code></pre>
|
||||
<p>where <code>/usr/share/dict/words</code> is the dictionary file.</p>
|
||||
<p>Then it uses the <a href="mkdict.sh">mkdict.sh</a> script to create a dictionary file out
|
||||
of the files <a href="README.md">README.md</a>, <a href="try.sh">try.sh</a> (itself) and
|
||||
@@ -179,7 +179,7 @@ names listed above. Run this program to find the anagrams they
|
||||
weren’t allowed to print!</p>
|
||||
<p>The author provided an obfuscated script that can be used to construct
|
||||
dictionaries which has been put in as <a href="mkdict.sh">mkdict.sh</a>. To use try:</p>
|
||||
<div class="sourceCode" id="cb7"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb7-1"><a href="#cb7-1" aria-hidden="true" tabindex="-1"></a> <span class="fu">cat</span> README.md <span class="kw">|</span> <span class="ex">./mkdict.sh</span> <span class="op">></span> words</span></code></pre></div>
|
||||
<pre class="<!---sh-->"><code> cat README.md | ./mkdict.sh > words</code></pre>
|
||||
<p>Then try using the program as shown above with the file <code>words</code>.</p>
|
||||
<h2 id="authors-remarks">Author’s remarks:</h2>
|
||||
<p>The name of the game:</p>
|
||||
@@ -195,8 +195,8 @@ natural language of your choice, one word on each line. If your machine doesn’
|
||||
have one already, you can make your own dictionary by concatenating a few
|
||||
hundred of your favourite Usenet articles and piping them through the following
|
||||
obfuscated shell script:</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="co">#!/bin/sh</span></span>
|
||||
<span id="cb8-2"><a href="#cb8-2" aria-hidden="true" tabindex="-1"></a> <span class="va">z</span><span class="op">=</span>a-z]<span class="kw">;</span><span class="fu">tr</span> [A-Z<span class="dt">\]</span> <span class="dt">\[</span><span class="va">$z</span><span class="kw">|</span><span class="fu">sed</span> s/[<span class="dt">\^</span><span class="va">$z</span>[<span class="dt">\^</span><span class="va">$z</span><span class="pp">*</span>/_/g<span class="kw">|</span><span class="fu">tr</span> _ <span class="dt">\\</span>012<span class="kw">|</span><span class="fu">grep</span> ..<span class="kw">|</span><span class="fu">sort</span> <span class="at">-u</span></span></code></pre></div>
|
||||
<pre class="<!---sh-->"><code> #!/bin/sh
|
||||
z=a-z];tr [A-Z\] \[$z|sed s/[\^$z[\^$z*/_/g|tr _ \\012|grep ..|sort -u</code></pre>
|
||||
<p>Using articles from alt.folklore.computers is likely to make
|
||||
a more professional-looking dictionary than rec.arts.erotica.</p>
|
||||
<p>AG must be run with the dictionary file as standard input.</p>
|
||||
@@ -323,7 +323,7 @@ the carries generated in incrementing <code>i</code> propagate straight across
|
||||
those bits that should remain zero. For example, the following
|
||||
program prints all those 16-bit integers that contain zeroes in all
|
||||
even bit positions:</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> main<span class="op">(){</span><span class="dt">int</span> i<span class="op">=</span><span class="dv">0</span><span class="op">,</span>s<span class="op">=</span><span class="bn">0xAAAA</span><span class="op">;</span><span class="cf">do</span><span class="op">{</span>printf<span class="op">(</span><span class="st">"</span><span class="sc">%04x\t</span><span class="st">"</span><span class="op">,</span>i<span class="op">);}</span><span class="cf">while</span><span class="op">(</span>i<span class="op">=((</span>i<span class="op">|~</span>s<span class="op">)+</span><span class="dv">1</span><span class="op">)&</span>s<span class="op">);}</span></span></code></pre></div>
|
||||
<pre class="<!---c-->"><code> main(){int i=0,s=0xAAAA;do{printf("%04x\t",i);}while(i=((i|~s)+1)&s);}</code></pre>
|
||||
<p>AG uses a similar method but works in the opposite direction, finding
|
||||
the next lower value with zeroes in given bit positions by propagating
|
||||
borrows across those bits. Some additional adjustments are made
|
||||
|
||||
+4
-4
@@ -1,13 +1,13 @@
|
||||
## To build:
|
||||
|
||||
```sh
|
||||
```<!---sh-->
|
||||
make all
|
||||
```
|
||||
|
||||
|
||||
## To use:
|
||||
|
||||
```sh
|
||||
```<!---sh-->
|
||||
# text mode
|
||||
./imc -text
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
|
||||
To see a number of options and configurations:
|
||||
|
||||
```sh
|
||||
```<!---sh-->
|
||||
./try.sh
|
||||
```
|
||||
|
||||
@@ -164,7 +164,7 @@ standard error to indicate its progress (one dot per pixel line).
|
||||
|
||||
Here are a couple of good pictures to draw:
|
||||
|
||||
```sh
|
||||
```<!---sh-->
|
||||
./imc -s 512,512 -f 600000 -l 512 -m 16 -c.00805,.74274 > screen1.ras
|
||||
./imc -s512,512 -j-.523,-.535 > screen2.ras
|
||||
```
|
||||
|
||||
+8
-8
@@ -141,15 +141,15 @@ 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="<!---sh-->"><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="co"># text mode</span></span>
|
||||
<span id="cb2-2"><a href="#cb2-2" aria-hidden="true" tabindex="-1"></a> <span class="ex">./imc</span> <span class="at">-text</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">./imc</span></span></code></pre></div>
|
||||
<pre class="<!---sh-->"><code> # text mode
|
||||
./imc -text
|
||||
|
||||
./imc</code></pre>
|
||||
<h2 id="try">Try:</h2>
|
||||
<p>To see a number of options and configurations:</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="<!---sh-->"><code> ./try.sh</code></pre>
|
||||
<h2 id="judges-remarks">Judges’ remarks:</h2>
|
||||
<p>The program is more interesting to run on workstations that can make use of a
|
||||
Sun raster file. Others can make use of the -text flag for character oriented
|
||||
@@ -263,8 +263,8 @@ bits (e.g. 8).</p>
|
||||
standard error to indicate its progress (one dot per pixel line).</p>
|
||||
<h3 id="example-pictures-to-try">Example pictures to try</h3>
|
||||
<p>Here are a couple of good pictures to draw:</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">./imc</span> <span class="at">-s</span> 512,512 <span class="at">-f</span> 600000 <span class="at">-l</span> 512 <span class="at">-m</span> 16 <span class="at">-c.00805,.74274</span> <span class="op">></span> screen1.ras</span>
|
||||
<span id="cb5-2"><a href="#cb5-2" aria-hidden="true" tabindex="-1"></a> <span class="ex">./imc</span> <span class="at">-s512,512</span> <span class="at">-j-.523,-.535</span> <span class="op">></span> screen2.ras</span></code></pre></div>
|
||||
<pre class="<!---sh-->"><code> ./imc -s 512,512 -f 600000 -l 512 -m 16 -c.00805,.74274 > screen1.ras
|
||||
./imc -s512,512 -j-.523,-.535 > screen2.ras</code></pre>
|
||||
<!--
|
||||
|
||||
Copyright © 1984-2024 by Landon Curt Noll. All Rights Reserved.
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
If your machine support the X Window System, Version 11:
|
||||
|
||||
```sh
|
||||
```<!---sh-->
|
||||
make alt
|
||||
```
|
||||
|
||||
@@ -24,7 +24,7 @@ For more detailed information see [1992 kivinen bugs](../../bugs.html#1992_kivin
|
||||
|
||||
## To use:
|
||||
|
||||
```sh
|
||||
```<!---sh-->
|
||||
./kivinen.alt
|
||||
|
||||
./kivinen.alt a
|
||||
@@ -41,7 +41,7 @@ Also try changing the speed that the game moves. For instance if you wish to
|
||||
change the `usleep(3)` value to `30000` from `20000`, try:
|
||||
|
||||
|
||||
```sh
|
||||
```<!---sh-->
|
||||
make clobber SLEEP=30000 alt # make it slower
|
||||
|
||||
make clobber SLEEP=10000 alt # make it faster
|
||||
@@ -59,7 +59,7 @@ code.
|
||||
|
||||
### Original build:
|
||||
|
||||
```sh
|
||||
```<!---sh-->
|
||||
make all
|
||||
```
|
||||
|
||||
|
||||
+10
-10
@@ -142,7 +142,7 @@ Location: <a href="../../location.html#FI">FI</a> - <em>Republic of Finland </em
|
||||
|
||||
<h2 id="to-build">To build:</h2>
|
||||
<p>If your machine support the X Window System, Version 11:</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> alt</span></code></pre></div>
|
||||
<pre class="<!---sh-->"><code> make alt</code></pre>
|
||||
<p>We recommend that you try the alt version first so you can get a better idea of
|
||||
what this looked like back in 1992. See <a href="#original-code">original code</a> for the
|
||||
original should you wish to see what we mean.</p>
|
||||
@@ -151,25 +151,25 @@ original should you wish to see what we mean.</p>
|
||||
<pre><code> STATUS: known bug - please help us fix</code></pre>
|
||||
<p>For more detailed information see <a href="../../bugs.html#1992_kivinen">1992 kivinen 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">./kivinen.alt</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">./kivinen.alt</span> a</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">./kivinen.alt</span> a b</span></code></pre></div>
|
||||
<pre class="<!---sh-->"><code> ./kivinen.alt
|
||||
|
||||
./kivinen.alt a
|
||||
|
||||
./kivinen.alt a b</code></pre>
|
||||
<p>See also the author’s remarks for other variations.</p>
|
||||
<h2 id="try">Try:</h2>
|
||||
<p>Also try changing the speed that the game moves. For instance if you wish to
|
||||
change the <code>usleep(3)</code> value to <code>30000</code> from <code>20000</code>, 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="fu">make</span> clobber SLEEP=30000 alt <span class="co"># make it slower</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="fu">make</span> clobber SLEEP=10000 alt <span class="co"># make it faster</span></span></code></pre></div>
|
||||
<pre class="<!---sh-->"><code> make clobber SLEEP=30000 alt # make it slower
|
||||
|
||||
make clobber SLEEP=10000 alt # make it faster</code></pre>
|
||||
<p>Then use the same syntax as above and described by the author.</p>
|
||||
<h2 id="original-code">Original code:</h2>
|
||||
<p>As noted above, the alt version is recommended because the code goes too fast in
|
||||
modern systems. If you wish to see the original you may do so with the original
|
||||
code.</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="<!---sh-->"><code> make all</code></pre>
|
||||
<h3 id="original-use">Original use:</h3>
|
||||
<p>Use <code>kivinen</code> as you would <code>kivinen.alt</code>.</p>
|
||||
<h2 id="judges-remarks">Judges’ remarks:</h2>
|
||||
|
||||
+2
-2
@@ -1,6 +1,6 @@
|
||||
## To build:
|
||||
|
||||
```sh
|
||||
```<!---sh-->
|
||||
make all
|
||||
```
|
||||
|
||||
@@ -18,7 +18,7 @@ For more detailed information see [1992 lush bugs](../../bugs.html#1992_lush).
|
||||
|
||||
## To use:
|
||||
|
||||
```sh
|
||||
```<!---sh-->
|
||||
./lush.sh
|
||||
```
|
||||
|
||||
|
||||
@@ -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="<!---sh-->"><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: doesn't work with some compilers - please provide alternative code or fix for more compilers</code></pre>
|
||||
<p>For more detailed information see <a href="../../bugs.html#1992_lush">1992 lush 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">./lush.sh</span></span></code></pre></div>
|
||||
<pre class="<!---sh-->"><code> ./lush.sh</code></pre>
|
||||
<h2 id="judges-remarks">Judges’ remarks:</h2>
|
||||
<p>The program uses error messages issued by the C Preprocessor to
|
||||
generate its message to the world. One program’s error is another
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
## To build:
|
||||
|
||||
```sh
|
||||
```<!---sh-->
|
||||
make all
|
||||
```
|
||||
|
||||
|
||||
## To use:
|
||||
|
||||
```sh
|
||||
```<!---sh-->
|
||||
./marangon
|
||||
```
|
||||
|
||||
|
||||
@@ -141,9 +141,9 @@ Location: <a href="../../location.html#IT">IT</a> - <em>Italian 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="<!---sh-->"><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">./marangon</span></span></code></pre></div>
|
||||
<pre class="<!---sh-->"><code> ./marangon</code></pre>
|
||||
<h2 id="judges-remarks">Judges’ remarks:</h2>
|
||||
<p>The object is to refill the table with 5’s, by incrementing or decrementing
|
||||
numbers as needed. It is the side effects that get you into trouble. If you
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
## To build:
|
||||
|
||||
```sh
|
||||
```<!---sh-->
|
||||
make all
|
||||
```
|
||||
|
||||
|
||||
## To use:
|
||||
|
||||
```sh
|
||||
```<!---sh-->
|
||||
./nathan
|
||||
# enter some text
|
||||
```
|
||||
@@ -17,7 +17,7 @@
|
||||
|
||||
To see some other fun uses:
|
||||
|
||||
```sh
|
||||
```<!---sh-->
|
||||
./try.sh
|
||||
```
|
||||
|
||||
@@ -58,7 +58,7 @@ distribute some winning entries outside of the US.
|
||||
Nathan Sidwell stated that he was willing to distribute the winning source. To
|
||||
read HIS instructions of how to obtain his winning program one was able to run:
|
||||
|
||||
```sh
|
||||
```<!---sh-->
|
||||
make nathan
|
||||
./nathan
|
||||
```
|
||||
|
||||
@@ -141,13 +141,13 @@ 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="<!---sh-->"><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">./nathan</span></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="<!---sh-->"><code> ./nathan
|
||||
# enter some text</code></pre>
|
||||
<h2 id="try">Try:</h2>
|
||||
<p>To see some other fun uses:</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="<!---sh-->"><code> ./try.sh</code></pre>
|
||||
<h2 id="judges-remarks">Judges’ remarks:</h2>
|
||||
<h3 id="warning">WARNING:</h3>
|
||||
<p>The judges make no claim as to the strength or security
|
||||
@@ -173,8 +173,8 @@ fall under this restricted category, the judges originally were not able to
|
||||
distribute some winning entries outside of the US.</p>
|
||||
<p>Nathan Sidwell stated that he was willing to distribute the winning source. To
|
||||
read HIS instructions of how to obtain his winning program one was able to run:</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> nathan</span>
|
||||
<span id="cb4-2"><a href="#cb4-2" aria-hidden="true" tabindex="-1"></a> <span class="ex">./nathan</span></span></code></pre></div>
|
||||
<pre class="<!---sh-->"><code> make nathan
|
||||
./nathan</code></pre>
|
||||
<p>to learn how to get a copy of the code.</p>
|
||||
<p>See the 1992/nathan.c file in the
|
||||
<a href="../../archive/historic/archive-1992.tar.bz2">archive/historic/archive-1992.tar.bz2</a>
|
||||
|
||||
+4
-4
@@ -1,6 +1,6 @@
|
||||
## To build:
|
||||
|
||||
```sh
|
||||
```<!---sh-->
|
||||
make all
|
||||
```
|
||||
|
||||
@@ -18,7 +18,7 @@ For more detailed information see [1992 vern bugs](../../bugs.html#1992_vern).
|
||||
|
||||
## To use:
|
||||
|
||||
```sh
|
||||
```<!---sh-->
|
||||
./vern 3 # <-- default is 2
|
||||
```
|
||||
|
||||
@@ -42,7 +42,7 @@ suggested above. :-)
|
||||
|
||||
For a real quick game try:
|
||||
|
||||
```sh
|
||||
```<!---sh-->
|
||||
./vern
|
||||
|
||||
65 55
|
||||
@@ -124,7 +124,7 @@ wouldn't pass the character limit. A nice side effect is that the
|
||||
initial source is gloriously difficult to peruse. In particular, the Makefile
|
||||
does:
|
||||
|
||||
```sh
|
||||
```<!---sh-->
|
||||
sed <vern.c 's/{ /(/g;s/} /)/g;s/; /#define /' | \
|
||||
sed 's/} /=/g;s/{ /i/g' >vern.tmp.c
|
||||
```
|
||||
|
||||
@@ -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="<!---sh-->"><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#1992_vern">1992 vern 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">./vern</span> 3 <span class="co"># <-- default is 2</span></span></code></pre></div>
|
||||
<pre class="<!---sh-->"><code> ./vern 3 # <-- default is 2</code></pre>
|
||||
<h2 id="try">Try:</h2>
|
||||
<p>You might start off by giving the following input:</p>
|
||||
<pre><code> 63 43
|
||||
@@ -158,10 +158,10 @@ Location: <a href="../../location.html#US">US</a> - <em>United States of America
|
||||
<p>The judges assume no responsibility for the obfuscated opening
|
||||
suggested above. :-)</p>
|
||||
<p>For a real quick game 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">./vern</span></span>
|
||||
<span id="cb5-2"><a href="#cb5-2" aria-hidden="true" tabindex="-1"></a></span>
|
||||
<span id="cb5-3"><a href="#cb5-3" aria-hidden="true" tabindex="-1"></a> <span class="ex">65</span> 55</span>
|
||||
<span id="cb5-4"><a href="#cb5-4" aria-hidden="true" tabindex="-1"></a> <span class="ex">66</span> 46</span></code></pre></div>
|
||||
<pre class="<!---sh-->"><code> ./vern
|
||||
|
||||
65 55
|
||||
66 46</code></pre>
|
||||
<p>NOTE: Move values must be restricted to the range 00 to 77.</p>
|
||||
<p>NOTE: Because some mailers have problems with the original winning source,
|
||||
a slightly modified version with shorter lines has been provided.</p>
|
||||
@@ -225,8 +225,8 @@ at build time into much-needed text. Without this hack the program
|
||||
wouldn’t pass the character limit. A nice side effect is that the
|
||||
initial source is gloriously difficult to peruse. In particular, the Makefile
|
||||
does:</p>
|
||||
<div class="sourceCode" id="cb6"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb6-1"><a href="#cb6-1" aria-hidden="true" tabindex="-1"></a> <span class="fu">sed</span> <span class="op"><</span>vern.c <span class="st">'s/{ /(/g;s/} /)/g;s/; /#define /'</span> <span class="kw">|</span> <span class="dt">\</span></span>
|
||||
<span id="cb6-2"><a href="#cb6-2" aria-hidden="true" tabindex="-1"></a> <span class="fu">sed</span> <span class="st">'s/} /=/g;s/{ /i/g'</span> <span class="op">></span>vern.tmp.c</span></code></pre></div>
|
||||
<pre class="<!---sh-->"><code> sed <vern.c 's/{ /(/g;s/} /)/g;s/; /#define /' | \
|
||||
sed 's/} /=/g;s/{ /i/g' >vern.tmp.c</code></pre>
|
||||
<p>and compiles <code>vern.tmp.c</code>.</p>
|
||||
<p>Second, the rather ho-hum step has been taking of naming each variable
|
||||
with a one or two letter identifier to render it meaningless (and save
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
## To build:
|
||||
|
||||
```sh
|
||||
```<!---sh-->
|
||||
make all
|
||||
```
|
||||
|
||||
@@ -22,7 +22,7 @@ For more detailed information see [1992 westley bugs](../../bugs.html#1992_westl
|
||||
If lost:
|
||||
|
||||
|
||||
```sh
|
||||
```<!---sh-->
|
||||
./whereami.sh lat long
|
||||
```
|
||||
|
||||
@@ -36,7 +36,7 @@ should just use the `westley` and `westley.alt` programs directly.
|
||||
|
||||
## Try:
|
||||
|
||||
```sh
|
||||
```<!---sh-->
|
||||
./try.sh
|
||||
```
|
||||
|
||||
@@ -48,14 +48,14 @@ The author provided a version for the US which we added. To build:
|
||||
|
||||
### Alternate build:
|
||||
|
||||
```sh
|
||||
```<!---sh-->
|
||||
make alt
|
||||
```
|
||||
|
||||
|
||||
### Alternate use:
|
||||
|
||||
```sh
|
||||
```<!---sh-->
|
||||
./whereami.alt.sh lat long
|
||||
```
|
||||
|
||||
@@ -67,7 +67,7 @@ NOTE: this alternative version also needs a terminal with at least 80 columns.
|
||||
The [try.sh](try.sh) script uses both the original entry and the alternate code
|
||||
so one can try the same script for both:
|
||||
|
||||
```sh
|
||||
```<!---sh-->
|
||||
./try.sh
|
||||
```
|
||||
|
||||
@@ -76,7 +76,7 @@ so one can try the same script for both:
|
||||
|
||||
To find the approximate place where this entry was judged, type:
|
||||
|
||||
```sh
|
||||
```<!---sh-->
|
||||
./whereami 37 -122 # NOTE: - means west of meridian
|
||||
|
||||
# or if you don't have curses installed:
|
||||
@@ -164,7 +164,7 @@ is reasonably accurate.
|
||||
|
||||
For a domestic (US) version with higher resolution, try:
|
||||
|
||||
```c
|
||||
```<!---c-->
|
||||
main(l,a,n,d)char**a;{for(d=atoi(a[1])/2*80-atoi(a[2])-2043;
|
||||
n="bnaBCOCXdBBHGYdAP[A M E R I C A].AqandkmavX|ELC}BOCd"
|
||||
[l++-3];)for(;n-->64;)putchar(!d+++33^l&1);}
|
||||
@@ -173,7 +173,7 @@ For a domestic (US) version with higher resolution, try:
|
||||
The code will test the 80-column wrap and document itself if it is
|
||||
joined together as one 160-character line and listed. You should see:
|
||||
|
||||
```c
|
||||
```<!---c-->
|
||||
main(l,a,n,d)...
|
||||
[A M E R I C A]...
|
||||
```
|
||||
|
||||
+15
-15
@@ -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="<!---sh-->"><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
|
||||
@@ -149,31 +149,31 @@ Location: <a href="../../location.html#US">US</a> - <em>United States of America
|
||||
<p>For more detailed information see <a href="../../bugs.html#1992_westley">1992 westley bugs</a>.</p>
|
||||
<h2 id="to-use">To use:</h2>
|
||||
<p>If lost:</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">./whereami.sh</span> lat long</span></code></pre></div>
|
||||
<pre class="<!---sh-->"><code> ./whereami.sh lat long</code></pre>
|
||||
<p>Where <code>lat</code> and <code>long</code> correspond to your latitude and longitude.</p>
|
||||
<p>NOTE: you <strong>MUST</strong> have a terminal that is at least 80 columns for this to show
|
||||
properly. The <code>whereami</code> and <code>whereami.alt</code> code checks this but it is not
|
||||
prohibitive if it cannot be compiled and linked (it uses curses); instead one
|
||||
should just use the <code>westley</code> and <code>westley.alt</code> programs directly.</p>
|
||||
<h2 id="try">Try:</h2>
|
||||
<div class="sourceCode" id="cb4"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb4-1"><a href="#cb4-1" aria-hidden="true" tabindex="-1"></a> <span class="ex">./try.sh</span></span></code></pre></div>
|
||||
<pre class="<!---sh-->"><code> ./try.sh</code></pre>
|
||||
<h2 id="alternate-code">Alternate code:</h2>
|
||||
<p>The author provided a version for the US which we added. To build:</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="<!---sh-->"><code> make alt</code></pre>
|
||||
<h3 id="alternate-use">Alternate 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">./whereami.alt.sh</span> lat long</span></code></pre></div>
|
||||
<pre class="<!---sh-->"><code> ./whereami.alt.sh lat long</code></pre>
|
||||
<p>NOTE: this alternative version also needs a terminal with at least 80 columns.</p>
|
||||
<h3 id="alternate-try">Alternate try:</h3>
|
||||
<p>The <a href="try.sh">try.sh</a> script uses both the original entry and the alternate code
|
||||
so one can try the same script for both:</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">./try.sh</span></span></code></pre></div>
|
||||
<pre class="<!---sh-->"><code> ./try.sh</code></pre>
|
||||
<h2 id="judges-remarks">Judges’ remarks:</h2>
|
||||
<p>To find the approximate place where this entry was judged, type:</p>
|
||||
<div class="sourceCode" id="cb8"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb8-1"><a href="#cb8-1" aria-hidden="true" tabindex="-1"></a> <span class="ex">./whereami</span> 37 <span class="at">-122</span> <span class="co"># </span><span class="al">NOTE</span><span class="co">: - means west of meridian</span></span>
|
||||
<span id="cb8-2"><a href="#cb8-2" aria-hidden="true" tabindex="-1"></a></span>
|
||||
<span id="cb8-3"><a href="#cb8-3" aria-hidden="true" tabindex="-1"></a> <span class="co"># or if you don't have curses installed:</span></span>
|
||||
<span id="cb8-4"><a href="#cb8-4" aria-hidden="true" tabindex="-1"></a> <span class="ex">./westley</span> 37 <span class="at">-122</span> <span class="co"># </span><span class="al">NOTE</span><span class="co">: - means west of meridian</span></span></code></pre></div>
|
||||
<pre class="<!---sh-->"><code> ./whereami 37 -122 # NOTE: - means west of meridian
|
||||
|
||||
# or if you don't have curses installed:
|
||||
./westley 37 -122 # NOTE: - means west of meridian</code></pre>
|
||||
<h2 id="authors-remarks">Author’s remarks:</h2>
|
||||
<p>Run the program with your latitude & longitude as integer
|
||||
arguments; it will produce a map made up of <code>'!'</code> with the given
|
||||
@@ -243,13 +243,13 @@ is reasonably accurate.</p>
|
||||
<li>Tokyo 36 140</li>
|
||||
</ul>
|
||||
<p>For a domestic (US) version with higher resolution, try:</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> main<span class="op">(</span>l<span class="op">,</span>a<span class="op">,</span>n<span class="op">,</span>d<span class="op">)</span><span class="dt">char</span><span class="op">**</span>a<span class="op">;{</span><span class="cf">for</span><span class="op">(</span>d<span class="op">=</span>atoi<span class="op">(</span>a<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">80</span><span class="op">-</span>atoi<span class="op">(</span>a<span class="op">[</span><span class="dv">2</span><span class="op">])-</span><span class="dv">2043</span><span class="op">;</span></span>
|
||||
<span id="cb9-2"><a href="#cb9-2" aria-hidden="true" tabindex="-1"></a> n<span class="op">=</span><span class="st">"bnaBCOCXdBBHGYdAP[A M E R I C A].AqandkmavX|ELC}BOCd"</span></span>
|
||||
<span id="cb9-3"><a href="#cb9-3" aria-hidden="true" tabindex="-1"></a> <span class="op">[</span>l<span class="op">++-</span><span class="dv">3</span><span class="op">];)</span><span class="cf">for</span><span class="op">(;</span>n<span class="op">--></span><span class="dv">64</span><span class="op">;)</span>putchar<span class="op">(!</span>d<span class="op">+++</span><span class="dv">33</span><span class="op">^</span>l<span class="op">&</span><span class="dv">1</span><span class="op">);}</span></span></code></pre></div>
|
||||
<pre class="<!---c-->"><code> main(l,a,n,d)char**a;{for(d=atoi(a[1])/2*80-atoi(a[2])-2043;
|
||||
n="bnaBCOCXdBBHGYdAP[A M E R I C A].AqandkmavX|ELC}BOCd"
|
||||
[l++-3];)for(;n-->64;)putchar(!d+++33^l&1);}</code></pre>
|
||||
<p>The code will test the 80-column wrap and document itself if it is
|
||||
joined together as one 160-character line and listed. You should see:</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> main<span class="op">(</span>l<span class="op">,</span>a<span class="op">,</span>n<span class="op">,</span>d<span class="op">)...</span></span>
|
||||
<span id="cb10-2"><a href="#cb10-2" aria-hidden="true" tabindex="-1"></a> <span class="op">[</span>A M E R I C A<span class="op">]...</span></span></code></pre></div>
|
||||
<pre class="<!---c-->"><code> main(l,a,n,d)...
|
||||
[A M E R I C A]...</code></pre>
|
||||
<p>…going down the left edge if your terminal auto-wraps at 80 characters.</p>
|
||||
<!--
|
||||
|
||||
|
||||
Reference in new issue
Block a user