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
@@ -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
|
||||
|
||||
@@ -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="<!---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</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"><</span>number<span class="op">></span></span></code></pre></div>
|
||||
<pre class="<!---sh-->"><code> ./fubar <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 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="<!---sh-->"><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>
|
||||
|
||||
@@ -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
|
||||
```
|
||||
|
||||
|
||||
@@ -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="<!---sh-->"><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="<!---sh-->"><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="<!---sh-->"><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="<!---sh-->"><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="<!---sh-->"><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.
|
||||
|
||||
@@ -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
@@ -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="<!---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">./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"><</span> some_lisp_file</span></code></pre></div>
|
||||
<pre class="<!---sh-->"><code> ./jar.2
|
||||
[enter some lisp]
|
||||
|
||||
./jar.2 < 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="<!---sh-->"><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"><</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="<!---lisp-->"><code> (+ 2.5 3.1)
|
||||
(defun fib (n)
|
||||
(if (< 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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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="<!---sh-->"><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"><</span> textfile</span></code></pre></div>
|
||||
<pre class="<!---sh-->"><code> ./ovdluhe < 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="<!---sh-->"><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="<!---sh-->"><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<<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="<!---sh-->"><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="<!---sh-->"><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 < 0 it will fail to compile.</p>
|
||||
<h2 id="judges-remarks">Judges’ remarks:</h2>
|
||||
|
||||
+4
-4
@@ -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
|
||||
```
|
||||
|
||||
|
||||
@@ -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="<!---sh-->"><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="<!---sh-->"><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="<!---sh-->"><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="<!---sh-->"><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
|
||||
|
||||
@@ -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
@@ -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="<!---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#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="<!---sh-->"><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"># <-- what happens here ?</span></span></code></pre></div>
|
||||
<pre class="<!---sh-->"><code> ./robison
|
||||
11x10
|
||||
# enter other expressions
|
||||
|
||||
./try.sh
|
||||
|
||||
echo 100 / 100 | ./robison # <-- 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
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
## To build:
|
||||
|
||||
```sh
|
||||
```<!---sh-->
|
||||
make all
|
||||
```
|
||||
|
||||
|
||||
## Try:
|
||||
|
||||
```sh
|
||||
```<!---sh-->
|
||||
./roemer
|
||||
```
|
||||
|
||||
|
||||
@@ -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="<!---sh-->"><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="<!---sh-->"><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>
|
||||
|
||||
@@ -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
@@ -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>
|
||||
<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="<!---sh-->"><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">"hkl jq"</span></span></code></pre></div>
|
||||
<pre class="<!---sh-->"><code> ./tromp 5
|
||||
|
||||
./tromp 10 "hkl jq"</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="<!---sh-->"><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"><</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"><</span><span class="dv">1</span><span class="op">)</span>printf<span class="op">(</span><span class="st">"</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"</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">"</span><span class="sc">\033</span><span class="st">[</span><span class="sc">%d</span><span class="st">m "</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">></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">></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">"jkl pq"</span><span class="op">;</span>i<span class="op">;</span>i<span class="op">--)*</span>n<span class="op">++=</span>i<span class="op"><</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"><</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">"stty cbreak -echo stop u"</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">"</span><span class="sc">\033</span><span class="st">[H</span><span class="sc">\033</span><span class="st">[J"</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"><</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"><</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">"</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">"</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">"</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"</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">"stty -cbreak echo stop </span><span class="sc">\023</span><span class="st">;sort -mnr -o HI - HI;cat HI"</span><span class="op">,</span><span class="st">"w"</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">"</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">"</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="<!---c-->"><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<264;)if((k=q[i])-Q[i]
|
||||
){Q[i]=k;if(i-++I||i%12<1)printf("\033[%d;%dH",(I=i)/12,i%12*2+28);printf(
|
||||
"\033[%dm "+(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>1?atoi(V[1]):2);for(a=C>2?V[2]:"jkl pq";i;i--)*n++=i<
|
||||
25||i%12<2?7:0;srand(getpid());system("stty cbreak -echo stop u");sigvec(14,v,
|
||||
0);t();puts("\033[H\033[J");for(n=f+rand()%7*4;;g(7),u(),g(0)){if(c<0){if(G(x+
|
||||
12))x+=12;else{g(7);++w;for(j=0;j<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("\033[H\033[J\033[0m%d\n",w);if(c==a[5])break;for(j=264;j--;Q[j]=
|
||||
0);while(getchar()-a[4]);puts("\033[H\033[J\033[7m");sigsetmask(s);}}d=popen(
|
||||
"stty -cbreak echo stop \023;sort -mnr -o HI - HI;cat HI","w");fprintf(d,
|
||||
"%4d from level %1d by %s\n",w,l,getlogin());pclose(d);}</code></pre>
|
||||
<p>NOTE: the alternate version was fixed for modern systems in 2023.</p>
|
||||
<!--
|
||||
|
||||
|
||||
+2
-2
@@ -1,13 +1,13 @@
|
||||
## To build:
|
||||
|
||||
```sh
|
||||
```<!---sh-->
|
||||
make all
|
||||
```
|
||||
|
||||
|
||||
## Try:
|
||||
|
||||
```sh
|
||||
```<!---sh-->
|
||||
./try.sh
|
||||
```
|
||||
|
||||
|
||||
@@ -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="<!---sh-->"><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="<!---sh-->"><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
@@ -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
@@ -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="<!---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</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="<!---sh-->"><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="<!---sh-->"><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="<!---sh-->"><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="<!---sh-->"><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="<!---sh-->"><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">&&</span> expr2 <span class="op">&&</span> <span class="op">(</span>expr3<span class="op">=</span>etc<span class="op">);</span></span></code></pre></div>
|
||||
<pre class="<!---c-->"><code> expr1 && expr2 && (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">&&</span> expr2<span class="op">)</span> expr3<span class="op">=</span>etc<span class="op">;</span></span></code></pre></div>
|
||||
<pre class="<!---c-->"><code> if (expr1 && 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">&&</span> <span class="op">(</span>expr2<span class="op">,</span>expr3<span class="op">);</span></span></code></pre></div>
|
||||
<pre class="<!---c-->"><code> expr1 && (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="<!---c-->"><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="<!---c-->"><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>
|
||||
|
||||
Reference in new issue
Block a user