force use of pandoc version >= 3.1.12.2
The `bin/pandoc-wrapper.sh` tool will verify that the ssytem has a recent enough version of `pandoc(1)`. We explain why we insist on `pandoc(1)`. version >= 3.1.12.2 in comments where the $PANDOC_MIN_VERSION is set. Added `--wrap=preserve` as a default argument to `pandoc(1)`. While this change will impact every HTML file generated, we believe this will improve the ability of someone to look at the generated HTML and correlate with the original markdown. Changed `bin/pandoc-wrapper.sh` VERSION from "1.4.2 2024-03-17" to "1.4.3 2024-03-18". Performed `make www` to achieve all of the above and to generate HTML using the new `--wrap=preserve` `pandoc(1)` mode.
This commit is contained in:
1 parent
9eb7a54e9f
commit
b0b212acb1
402 files changed
+37061
-55132
No files matched your search
+42
-64
@@ -129,9 +129,9 @@
|
||||
|
||||
<h2 id="author"><a name="author"></a>Author:</h2>
|
||||
<ul>
|
||||
<li>Name: <a href="../../authors.html#Glyn_Anderson">Glyn
|
||||
Anderson</a><br> Location: <a href="../../location.html#ZZ">ZZ</a> -
|
||||
<em>Unknown location</em> <br><br></li>
|
||||
<li>Name: <a href="../../authors.html#Glyn_Anderson">Glyn Anderson</a><br>
|
||||
Location: <a href="../../location.html#ZZ">ZZ</a> - <em>Unknown location</em>
|
||||
<br><br></li>
|
||||
</ul>
|
||||
|
||||
<!-- END: next line ends content generated by: bin/output-index-author.sh -->
|
||||
@@ -153,15 +153,13 @@ signal your distress to passing ships.</p>
|
||||
very cleverly obscured without the use of a single <code>#define</code>!
|
||||
Reformatting this program by hand :-) is the easiest way to understand
|
||||
what is going on.</p>
|
||||
<h3 id="note-about-defines-not-being-used">Note about
|
||||
<code>#define</code>s not being used:</h3>
|
||||
<p>In 2023 due to annoying warnings triggered at different times,
|
||||
sometimes interspersed with the output of the program (this happens in
|
||||
macOS), many entries were changed to use <code>fgets(3)</code> instead.
|
||||
However to make the entries more like the original we redefined
|
||||
<code>gets</code> to use <code>fgets</code>. Unfortunately it’s not
|
||||
possible to do it through <code>-Dfoo</code> compiler options so there
|
||||
is a <code>#define</code> in the code now.</p>
|
||||
<h3 id="note-about-defines-not-being-used">Note about <code>#define</code>s not being used:</h3>
|
||||
<p>In 2023 due to annoying warnings triggered at different times, sometimes
|
||||
interspersed with the output of the program (this happens in macOS), many
|
||||
entries were changed to use <code>fgets(3)</code> instead. However to make the entries more
|
||||
like the original we redefined <code>gets</code> to use <code>fgets</code>. Unfortunately it’s not
|
||||
possible to do it through <code>-Dfoo</code> compiler options so there is a <code>#define</code> in
|
||||
the code now.</p>
|
||||
<h2 id="authors-remarks">Author’s remarks:</h2>
|
||||
<p>This program is a simple filter that translates ASCII text into
|
||||
semaphore code. It reads from standard input and converts all
|
||||
@@ -184,74 +182,54 @@ input “Hello, world!”, the output will be:</p>
|
||||
][ <>][ ][] [][]
|
||||
</code></pre>
|
||||
<p>The program is obfuscated without the use of the preprocessor or any
|
||||
special compilation parameters. In fact, the program doesn’t even bother
|
||||
using any keywords, save the single <code>char</code> at the beginning.
|
||||
special compilation parameters. In fact, the program doesn’t even
|
||||
bother using any keywords, save the single <code>char</code> at the beginning.
|
||||
This program was crafted using only operator precedence rules,
|
||||
short-circuit evaluation and recursion. Each function contains a single,
|
||||
non-empty statement. (I did have to add a couple of empty statements to
|
||||
format the code properly.) There is a single string constant which
|
||||
encodes the flag positions and other data needed for drawing the
|
||||
semaphore codes.</p>
|
||||
<p>The preprocessor will provide no help in de-obfuscating this code,
|
||||
and a C beautifier won’t get you very far either. You just have to
|
||||
crunch through it.</p>
|
||||
<p>An ANSI C compiler will generate several warnings when it compiles
|
||||
this program, as none of the functions declare their return type, nor do
|
||||
they return anything. This was necessary to keep the program free of
|
||||
keywords. It’s valid in K&R C, and compiles in ANSI C. There are
|
||||
also warnings about conversion from <code>int</code> to
|
||||
<code>char</code> and the resulting loss of data. Again, if it’s OK with
|
||||
K&R, it’s OK with me.</p>
|
||||
<p>This program is a great teaching tool for learning the semaphore
|
||||
code; and if you don’t have any flags handy you can just use two copies
|
||||
of the source file.</p>
|
||||
<h2 id="copyright-and-cc-by-sa-4.0-license">Copyright and CC BY-SA 4.0
|
||||
License:</h2>
|
||||
<p>This file is Copyright (c) 2023 by Landon Curt Noll. All Rights
|
||||
Reserved. You are free to share and adapt this file under the terms of
|
||||
this license:</p>
|
||||
short-circuit evaluation and recursion. Each function contains a
|
||||
single, non-empty statement. (I did have to add a couple of empty
|
||||
statements to format the code properly.) There is a single string
|
||||
constant which encodes the flag positions and other data needed for
|
||||
drawing the semaphore codes.</p>
|
||||
<p>The preprocessor will provide no help in de-obfuscating this code, and a
|
||||
C beautifier won’t get you very far either. You just have to crunch
|
||||
through it.</p>
|
||||
<p>An ANSI C compiler will generate several warnings when it compiles this
|
||||
program, as none of the functions declare their return type, nor do they
|
||||
return anything. This was necessary to keep the program free of
|
||||
keywords. It’s valid in K&R C, and compiles in ANSI C. There are also
|
||||
warnings about conversion from <code>int</code> to <code>char</code> and the resulting loss of
|
||||
data. Again, if it’s OK with K&R, it’s OK with me.</p>
|
||||
<p>This program is a great teaching tool for learning the semaphore code;
|
||||
and if you don’t have any flags handy you can just use two copies of the
|
||||
source file.</p>
|
||||
<h2 id="copyright-and-cc-by-sa-4.0-license">Copyright and CC BY-SA 4.0 License:</h2>
|
||||
<p>This file is Copyright (c) 2023 by Landon Curt Noll. All Rights Reserved.
|
||||
You are free to share and adapt this file under the terms of this license:</p>
|
||||
<pre><code>Creative Commons Attribution-ShareAlike 4.0 International (CC BY-SA 4.0)</code></pre>
|
||||
<p>For more information, see:
|
||||
https://creativecommons.org/licenses/by-sa/4.0/</p>
|
||||
<p>For more information, see: https://creativecommons.org/licenses/by-sa/4.0/</p>
|
||||
|
||||
<!-- END: this line ends content for HTML phase 21 by: bin/pandoc-wrapper.sh via bin/md2html.sh -->
|
||||
<!-- START: this line starts content for HTML phase 22 by: bin/output-index-inventory.sh via bin/md2html.sh -->
|
||||
|
||||
<!-- START: this line starts content generated by: bin/output-index-inventory.sh -->
|
||||
|
||||
<h1 id="inventory-for-2000anderson"><a name="inventory"></a>Inventory
|
||||
for 2000/anderson</h1>
|
||||
<h1 id="inventory-for-2000anderson"><a name="inventory"></a>Inventory for 2000/anderson</h1>
|
||||
<p><a href="#top">Jump to top</a></p>
|
||||
<h2 id="primary-files">Primary files</h2>
|
||||
<ul>
|
||||
<li><a
|
||||
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2000/anderson/anderson.c">anderson.c</a>
|
||||
- entry source</li>
|
||||
<li><a
|
||||
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2000/anderson/Makefile">Makefile</a>
|
||||
- entry Makefile</li>
|
||||
<li><a
|
||||
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2000/anderson/anderson.orig.c">anderson.orig.c</a>
|
||||
- original source</li>
|
||||
<li><a
|
||||
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2000/anderson/try.sh">try.sh</a>
|
||||
- how to run</li>
|
||||
<li><a href="2000_anderson.tar.bz2">2000_anderson.tar.bz2</a> - download
|
||||
entry source</li>
|
||||
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2000/anderson/anderson.c">anderson.c</a> - entry source</li>
|
||||
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2000/anderson/Makefile">Makefile</a> - entry Makefile</li>
|
||||
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2000/anderson/anderson.orig.c">anderson.orig.c</a> - original source</li>
|
||||
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2000/anderson/try.sh">try.sh</a> - how to run</li>
|
||||
<li><a href="2000_anderson.tar.bz2">2000_anderson.tar.bz2</a> - download entry source</li>
|
||||
</ul>
|
||||
<h2 id="secondary-files">Secondary files</h2>
|
||||
<ul>
|
||||
<li><a href="index.html">index.html</a> - entry home page</li>
|
||||
<li><a
|
||||
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2000/anderson/.entry.json">.entry.json</a>
|
||||
- description of entry in JSON</li>
|
||||
<li><a
|
||||
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2000/anderson/.gitignore">.gitignore</a>
|
||||
- list of files that should not be committed under git</li>
|
||||
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2000/anderson/.entry.json">.entry.json</a> - description of entry in JSON</li>
|
||||
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2000/anderson/.gitignore">.gitignore</a> - list of files that should not be committed under git</li>
|
||||
<li><a href=".path">.path</a> - directory path from top directory</li>
|
||||
<li><a
|
||||
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2000/anderson/README.md">README.md</a>
|
||||
- markdown source for index.html</li>
|
||||
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2000/anderson/README.md">README.md</a> - markdown source for index.html</li>
|
||||
</ul>
|
||||
|
||||
<!-- END: next line ends content generated by: bin/output-index-inventory.sh -->
|
||||
|
||||
+27
-46
@@ -129,9 +129,9 @@
|
||||
|
||||
<h2 id="author"><a name="author"></a>Author:</h2>
|
||||
<ul>
|
||||
<li>Name: <a href="../../authors.html#Fabrice_Bellard">Fabrice
|
||||
Bellard</a><br> Location: <a href="../../location.html#FR">FR</a> -
|
||||
<em>French Republic</em> (<em>France</em>) <br><br></li>
|
||||
<li>Name: <a href="../../authors.html#Fabrice_Bellard">Fabrice Bellard</a><br>
|
||||
Location: <a href="../../location.html#FR">FR</a> - <em>French Republic</em> (<em>France</em>)
|
||||
<br><br></li>
|
||||
</ul>
|
||||
|
||||
<!-- END: next line ends content generated by: bin/output-index-author.sh -->
|
||||
@@ -144,65 +144,46 @@ Bellard</a><br> Location: <a href="../../location.html#FR">FR</a> -
|
||||
<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">./bellard</span></span></code></pre></div>
|
||||
<h2 id="judges-remarks">Judges’ remarks:</h2>
|
||||
<p>This code is a nice compact example of a Modular Fast Fourier
|
||||
Transform. While its output is very specific, the internal FFT has a
|
||||
wide variety of uses.</p>
|
||||
<p>Can you modify this code to produce primes such as
|
||||
<code>23523*2^70000-1</code>, <code>48594^65536+1</code> or
|
||||
<code>6917!-1</code>?</p>
|
||||
<p>NOTE: as bigger primes are found as time goes by this program no
|
||||
longer prints the biggest prime once noted by the author below.</p>
|
||||
<p>This code is a nice compact example of a Modular Fast Fourier Transform. While
|
||||
its output is very specific, the internal FFT has a wide variety of uses.</p>
|
||||
<p>Can you modify this code to produce primes such as <code>23523*2^70000-1</code>,
|
||||
<code>48594^65536+1</code> or <code>6917!-1</code>?</p>
|
||||
<p>NOTE: as bigger primes are found as time goes by this program no longer prints
|
||||
the biggest prime once noted by the author below.</p>
|
||||
<h2 id="authors-comments">Author’s comments:</h2>
|
||||
<p>This program prints the biggest known prime number
|
||||
(<code>2^6972593-1</code>) in base 10. It requires a few minutes. It
|
||||
uses a Modular Fast Fourier Transform to compute this number in a
|
||||
reasonable amount of time (the usual method would take ages !).</p>
|
||||
<p>The program uses >= 64 bit <code>long long</code> type. It should
|
||||
run on any system with a gcc compiler.</p>
|
||||
<h2 id="copyright-and-cc-by-sa-4.0-license">Copyright and CC BY-SA 4.0
|
||||
License:</h2>
|
||||
<p>This file is Copyright (c) 2023 by Landon Curt Noll. All Rights
|
||||
Reserved. You are free to share and adapt this file under the terms of
|
||||
this license:</p>
|
||||
<p>This program prints the biggest known prime number (<code>2^6972593-1</code>)
|
||||
in base 10. It requires a few minutes. It uses a Modular Fast
|
||||
Fourier Transform to compute this number in a reasonable amount
|
||||
of time (the usual method would take ages !).</p>
|
||||
<p>The program uses >= 64 bit <code>long long</code> type. It should run on any
|
||||
system with a gcc compiler.</p>
|
||||
<h2 id="copyright-and-cc-by-sa-4.0-license">Copyright and CC BY-SA 4.0 License:</h2>
|
||||
<p>This file is Copyright (c) 2023 by Landon Curt Noll. All Rights Reserved.
|
||||
You are free to share and adapt this file under the terms of this license:</p>
|
||||
<pre><code>Creative Commons Attribution-ShareAlike 4.0 International (CC BY-SA 4.0)</code></pre>
|
||||
<p>For more information, see:
|
||||
https://creativecommons.org/licenses/by-sa/4.0/</p>
|
||||
<p>For more information, see: https://creativecommons.org/licenses/by-sa/4.0/</p>
|
||||
|
||||
<!-- END: this line ends content for HTML phase 21 by: bin/pandoc-wrapper.sh via bin/md2html.sh -->
|
||||
<!-- START: this line starts content for HTML phase 22 by: bin/output-index-inventory.sh via bin/md2html.sh -->
|
||||
|
||||
<!-- START: this line starts content generated by: bin/output-index-inventory.sh -->
|
||||
|
||||
<h1 id="inventory-for-2000bellard"><a name="inventory"></a>Inventory for
|
||||
2000/bellard</h1>
|
||||
<h1 id="inventory-for-2000bellard"><a name="inventory"></a>Inventory for 2000/bellard</h1>
|
||||
<p><a href="#top">Jump to top</a></p>
|
||||
<h2 id="primary-files">Primary files</h2>
|
||||
<ul>
|
||||
<li><a
|
||||
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2000/bellard/bellard.c">bellard.c</a>
|
||||
- entry source</li>
|
||||
<li><a
|
||||
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2000/bellard/Makefile">Makefile</a>
|
||||
- entry Makefile</li>
|
||||
<li><a
|
||||
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2000/bellard/bellard.orig.c">bellard.orig.c</a>
|
||||
- original source</li>
|
||||
<li><a href="2000_bellard.tar.bz2">2000_bellard.tar.bz2</a> - download
|
||||
entry source</li>
|
||||
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2000/bellard/bellard.c">bellard.c</a> - entry source</li>
|
||||
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2000/bellard/Makefile">Makefile</a> - entry Makefile</li>
|
||||
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2000/bellard/bellard.orig.c">bellard.orig.c</a> - original source</li>
|
||||
<li><a href="2000_bellard.tar.bz2">2000_bellard.tar.bz2</a> - download entry source</li>
|
||||
</ul>
|
||||
<h2 id="secondary-files">Secondary files</h2>
|
||||
<ul>
|
||||
<li><a href="index.html">index.html</a> - entry home page</li>
|
||||
<li><a
|
||||
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2000/bellard/.entry.json">.entry.json</a>
|
||||
- description of entry in JSON</li>
|
||||
<li><a
|
||||
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2000/bellard/.gitignore">.gitignore</a>
|
||||
- list of files that should not be committed under git</li>
|
||||
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2000/bellard/.entry.json">.entry.json</a> - description of entry in JSON</li>
|
||||
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2000/bellard/.gitignore">.gitignore</a> - list of files that should not be committed under git</li>
|
||||
<li><a href=".path">.path</a> - directory path from top directory</li>
|
||||
<li><a
|
||||
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2000/bellard/README.md">README.md</a>
|
||||
- markdown source for index.html</li>
|
||||
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2000/bellard/README.md">README.md</a> - markdown source for index.html</li>
|
||||
</ul>
|
||||
|
||||
<!-- END: next line ends content generated by: bin/output-index-inventory.sh -->
|
||||
|
||||
+219
-263
@@ -130,8 +130,8 @@
|
||||
<h2 id="author"><a name="author"></a>Author:</h2>
|
||||
<ul>
|
||||
<li>Name: <a href="../../authors.html#Bernd_Meyer">Bernd Meyer</a><br>
|
||||
Location: <a href="../../location.html#AU">AU</a> - <em>Commonwealth of
|
||||
Australia</em> (<em>Australia</em>) <br><br></li>
|
||||
Location: <a href="../../location.html#AU">AU</a> - <em>Commonwealth of Australia</em> (<em>Australia</em>)
|
||||
<br><br></li>
|
||||
</ul>
|
||||
|
||||
<!-- END: next line ends content generated by: bin/output-index-author.sh -->
|
||||
@@ -146,278 +146,253 @@ Australia</em> (<em>Australia</em>) <br><br></li>
|
||||
<h2 id="try">Try:</h2>
|
||||
<p>In a video window (white text on black background):</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>
|
||||
<p>The script will suggest you compare the output of the program with
|
||||
images, prompting you to press any key to continue so that you may do
|
||||
so.</p>
|
||||
<p>The script will suggest you compare the output of the program with images,
|
||||
prompting you to press any key to continue so that you may do so.</p>
|
||||
<h2 id="judges-remarks">Judges’ remarks:</h2>
|
||||
<p>Don’t even think of supplying different compression factors (the
|
||||
dashed argument) for compression and decompression! You’ve been
|
||||
warned.</p>
|
||||
dashed argument) for compression and decompression! You’ve been warned.</p>
|
||||
<p>The author recommended on linux/x86, glibc 2.0, libc4/5:</p>
|
||||
<pre class="make"><code>bmeyer: bmeyer.c
|
||||
CC -DY="__setfpucw(0x127f)" -O6 $? -o $@ -lm</code></pre>
|
||||
<p>However many compilers use <code>-O3</code> as the maximum level for
|
||||
<code>-O</code> optimization.</p>
|
||||
<p>However many compilers use <code>-O3</code> as the maximum level for <code>-O</code> optimization.</p>
|
||||
<p>And on linux/x86, glibc 2.1:</p>
|
||||
<pre class="make"><code>bmeyer: bmeyer.c
|
||||
gcc -DY='int x=0x127f; __asm__ ("fldcw %0" : : "m" (*&x))' $? -o $@ -lm</code></pre>
|
||||
<p>Compile with the maximum possible optimization on your system. If
|
||||
your system has 80-bit internal representation of floating point values
|
||||
(x86, some Motorola processors) and you want the compressed format to be
|
||||
portable across platforms, you need to set your FPU to use 64 bit mode.
|
||||
Read the author’s remarks below for more details.</p>
|
||||
<p>If you cannot work out how to get into 64 bit mode, you can try using
|
||||
<code>-ffloat-store</code> if you compile with GCC (this may have a
|
||||
performance penalty). The resulting binary will have a good chance to
|
||||
produce portable files, but due to the resulting double-rounding (first
|
||||
internally set to 80 bit, then to 64 bit on writing the value to
|
||||
memory), there is a small but very real chance any given file produced
|
||||
might not be portable.</p>
|
||||
<p>The <a href="Makefile">Makefile</a> defaults to <code>-O3</code> and
|
||||
no <code>asm()</code> call.</p>
|
||||
<p>Compile with the maximum possible optimization on your system.
|
||||
If your system has 80-bit internal representation of floating
|
||||
point values (x86, some Motorola processors) and you want the
|
||||
compressed format to be portable across platforms, you need
|
||||
to set your FPU to use 64 bit mode. Read the author’s remarks
|
||||
below for more details.</p>
|
||||
<p>If you cannot work out how to get into 64 bit mode, you can
|
||||
try using <code>-ffloat-store</code> if you compile with GCC (this may have
|
||||
a performance penalty). The resulting binary will have a good
|
||||
chance to produce portable files, but due to the resulting
|
||||
double-rounding (first internally set to 80 bit, then to 64 bit
|
||||
on writing the value to memory), there is a small but very real
|
||||
chance any given file produced might not be portable.</p>
|
||||
<p>The <a href="Makefile">Makefile</a> defaults to <code>-O3</code> and no <code>asm()</code> call.</p>
|
||||
<h2 id="authors-remarks">Author’s remarks:</h2>
|
||||
<p>This program is called <code>GLICBAWLS</code></p>
|
||||
<h4 id="function">Function</h4>
|
||||
<p><code>GLICBAWLS</code> stands for “Grey Level Image Compression By
|
||||
Adaptive Weighted Least Squares”.</p>
|
||||
<p><code>GLICBAWLS</code> stands for “Grey Level Image Compression By Adaptive Weighted Least
|
||||
Squares”.</p>
|
||||
<p>And that’s exactly what this program does — feed it a .PGM file
|
||||
(either raw [i.e. P5] or ASCII [i.e. P2]) on stdin, and it will output a
|
||||
compressed version to stdout. Feed it a compressed file on stdin, and it
|
||||
will decompress it to stdout — as either raw or ASCII .PGM, depending on
|
||||
what format it was compressed from. For example:</p>
|
||||
(either raw [i.e. P5] or ASCII [i.e. P2]) on stdin, and it will
|
||||
output a compressed version to stdout. Feed it a compressed file
|
||||
on stdin, and it will decompress it to stdout — as either raw or
|
||||
ASCII .PGM, depending on what format it was compressed from. For
|
||||
example:</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">./glicbawls</span> <span class="op"><</span> michael.pgm <span class="op">></span> michael.glic</span></code></pre></div>
|
||||
<p>and then</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">./glicbawls</span> <span class="op"><</span> michael.glic <span class="op">></span> michael.decoded.pgm</span></code></pre></div>
|
||||
<p>As it turns out, <code>glicbawls</code> compresses greyscale images
|
||||
(or, more precisely, “natural” greyscale images) better than any other
|
||||
<p>As it turns out, <code>glicbawls</code> compresses greyscale images (or, more
|
||||
precisely, “natural” greyscale images) better than any other
|
||||
program I am aware of (with the exception of the not-yet-published
|
||||
program developed for my PhD thesis). Of course, this might take some
|
||||
time, so a progress indicator is provided. To make things more
|
||||
interesting, instead of a boring bar or percentage display, an ASCII
|
||||
rendition of the image being compressed/decompressed is output to
|
||||
<code>stderr</code> (assuming white text on black background). If you
|
||||
program developed for my PhD thesis). Of course, this might take
|
||||
some time, so a progress indicator is provided. To make things
|
||||
more interesting, instead of a boring bar or percentage display,
|
||||
an ASCII rendition of the image being compressed/decompressed is
|
||||
output to <code>stderr</code> (assuming white text on black background). If you
|
||||
have trouble recognizing the image, try squinting at it ;-).</p>
|
||||
<p>If you still have trouble, simply use a terminal or xterm with more
|
||||
than 80 columns, and tell <code>glicbawls</code> about it by giving the
|
||||
<p>If you still have trouble, simply use a terminal or xterm with
|
||||
more than 80 columns, and tell <code>glicbawls</code> about it by giving the
|
||||
number of columns as an argument. For example</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">./glicbawls</span> 260 <span class="op"><</span>lavabus.pgm <span class="op">></span>lavabus.glic</span></code></pre></div>
|
||||
<p>will allow <code>glicbawls</code> to use up to 260 columns, which
|
||||
makes things much more recognizable.</p>
|
||||
<p>Still running out of space? Need to compress those images just a tad
|
||||
more? And maybe you can handle some loss due to the compression? If so,
|
||||
you can use <code>glicbawls</code>’ “near lossless” compression mode. In
|
||||
that mode, the decoded pixel values are allowed to differ from the
|
||||
originals, but there is an upper limit on the magnitude of the
|
||||
difference. For example, if a maximum error of 2 is allowed, an original
|
||||
pixel value of 37 could be decoded as 35, 36, 37, 38 or 39. In order to
|
||||
use this mode, simply give the maximum allowed error as an argument,
|
||||
with a dash (<code>-</code>) before it. For example:</p>
|
||||
<p>will allow <code>glicbawls</code> to use up to 260 columns, which makes things
|
||||
much more recognizable.</p>
|
||||
<p>Still running out of space? Need to compress those images just a
|
||||
tad more? And maybe you can handle some loss due to the
|
||||
compression? If so, you can use <code>glicbawls</code>’ “near lossless”
|
||||
compression mode. In that mode, the decoded pixel values are
|
||||
allowed to differ from the originals, but there is an upper limit
|
||||
on the magnitude of the difference. For example, if a maximum
|
||||
error of 2 is allowed, an original pixel value of 37 could be
|
||||
decoded as 35, 36, 37, 38 or 39. In order to use this mode, simply
|
||||
give the maximum allowed error as an argument, with a dash (<code>-</code>)
|
||||
before it. For example:</p>
|
||||
<div class="sourceCode" id="cb9"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb9-1"><a href="#cb9-1" aria-hidden="true" tabindex="-1"></a><span class="ex">./glicbawls</span> <span class="at">-2</span> <span class="op"><</span> graph.pgm <span class="op">></span> graph.2.glic</span></code></pre></div>
|
||||
<p>will compress in a way that allows decompression with a maximum error
|
||||
of two. You can combine both types of arguments, i.e.:</p>
|
||||
<div class="sourceCode" id="cb10"><pre
|
||||
class="sourceCode sh"><code class="sourceCode bash"><span id="cb10-1"><a href="#cb10-1" aria-hidden="true" tabindex="-1"></a><span class="ex">./glicbawls</span> <span class="at">-3</span> 180 <span class="op"><</span> graph.pgm <span class="op">></span>graph.3.glic</span></code></pre></div>
|
||||
<p>will compress with a maximum error of 3, using a 180 column terminal
|
||||
for the progress display, and:</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">./glicbawls</span> <span class="at">-3</span> 180 <span class="op"><</span> graph.3.glic <span class="op">></span> graph.3maxerr.pgm</span></code></pre></div>
|
||||
<p>will compress in a way that allows decompression with a maximum
|
||||
error of two. You can combine both types of arguments, i.e.:</p>
|
||||
<div class="sourceCode" id="cb10"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb10-1"><a href="#cb10-1" aria-hidden="true" tabindex="-1"></a><span class="ex">./glicbawls</span> <span class="at">-3</span> 180 <span class="op"><</span> graph.pgm <span class="op">></span>graph.3.glic</span></code></pre></div>
|
||||
<p>will compress with a maximum error of 3, using a 180 column
|
||||
terminal for the progress display, and:</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">./glicbawls</span> <span class="at">-3</span> 180 <span class="op"><</span> graph.3.glic <span class="op">></span> graph.3maxerr.pgm</span></code></pre></div>
|
||||
<p>will decompress the result on such a terminal.</p>
|
||||
<p>But wait, there is more — you can also feed <code>glicbawls</code>
|
||||
.PPM files (i.e. colour images), raw or ASCII, your choice.
|
||||
<code>glicbawls</code> will compress and decompress them just fine.
|
||||
However, it only does “reasonably well” on them; It beats PNG easily,
|
||||
but there are certainly programs out there that can compress colour
|
||||
images considerably better. And don’t even <em>think</em> about using it
|
||||
for so-called “artistic” images (i.e. anything that wasn’t scanned from
|
||||
a photo or camera)….</p>
|
||||
<p>But wait, there is more — you can also feed <code>glicbawls</code> .PPM files
|
||||
(i.e. colour images), raw or ASCII, your choice. <code>glicbawls</code> will
|
||||
compress and decompress them just fine. However, it only does
|
||||
“reasonably well” on them; It beats PNG easily, but there are
|
||||
certainly programs out there that can compress colour images
|
||||
considerably better. And don’t even <em>think</em> about using it for
|
||||
so-called “artistic” images (i.e. anything that wasn’t scanned
|
||||
from a photo or camera)….</p>
|
||||
<h3 id="warning">WARNING</h3>
|
||||
<p><code>glicball</code> is rather CPU and FPU intensive. Don’t run it
|
||||
on anything slow. Things start to be usable around 300+MHz, with 600+
|
||||
being highly desirable.</p>
|
||||
<p><code>glicball</code> is rather CPU and FPU intensive. Don’t run it on anything slow.
|
||||
Things start to be usable around 300+MHz, with 600+ being highly desirable.</p>
|
||||
<h3 id="compile-instructions">Compile Instructions</h3>
|
||||
<p>Unlike most compression program, <code>glicbawls</code> makes heavy
|
||||
use of floating point maths — and not all FPUs are created equal. Most
|
||||
importantly, the x86 and 68k FPUs use 80 bit floating point formats
|
||||
internally, while most other processors use IEEE 64 bit formats by
|
||||
default. If not taken care of, this means that a <code>glicbawls</code>
|
||||
file compressed on one CPU cannot generally be decompressed on
|
||||
another.</p>
|
||||
<p>Fortunately, just about all current FPUs can be put into IEEE 64 bit
|
||||
mode (or at least something close enough for <code>glicbawls</code>).
|
||||
Unfortunately, there is no standard way of doing so. For this reason,
|
||||
the build file contains <em>three</em> compile lines; one for machines
|
||||
that already use 64 bit mode by default (most RISC processors), one for
|
||||
linux/x86 machines using libc4, libc5 or glibc2.0, and one for linux/x86
|
||||
machines using glibc2.1 (glibc2.1 no longer exports the
|
||||
<code>__setfpucw()</code> function, necessitating the use of gcc inline
|
||||
assembly. *Grumble*).</p>
|
||||
<p>So, if you are building on a machine that does not, by default, use
|
||||
IEEE 64 bit floating point doubles, you’ll have to define <code>Y</code>
|
||||
to be a command that switches it into that mode. If you fail to do so,
|
||||
your <code>glicbawls</code> executable will still be able to decompress
|
||||
its own compressed files, but you may be unable to exchange files with
|
||||
<p>Unlike most compression program, <code>glicbawls</code> makes heavy use of
|
||||
floating point maths — and not all FPUs are created equal. Most
|
||||
importantly, the x86 and 68k FPUs use 80 bit floating point
|
||||
formats internally, while most other processors use IEEE 64 bit
|
||||
formats by default. If not taken care of, this means that a
|
||||
<code>glicbawls</code> file compressed on one CPU cannot generally be
|
||||
decompressed on another.</p>
|
||||
<p>Fortunately, just about all current FPUs can be put into IEEE 64
|
||||
bit mode (or at least something close enough for
|
||||
<code>glicbawls</code>). Unfortunately, there is no standard way of doing
|
||||
so. For this reason, the build file contains <em>three</em> compile
|
||||
lines; one for machines that already use 64 bit mode by default
|
||||
(most RISC processors), one for linux/x86 machines using libc4,
|
||||
libc5 or glibc2.0, and one for linux/x86 machines using glibc2.1
|
||||
(glibc2.1 no longer exports the <code>__setfpucw()</code> function, necessitating
|
||||
the use of gcc inline assembly. *Grumble*).</p>
|
||||
<p>So, if you are building on a machine that does not, by default,
|
||||
use IEEE 64 bit floating point doubles, you’ll have to define <code>Y</code> to
|
||||
be a command that switches it into that mode. If you fail to do
|
||||
so, your <code>glicbawls</code> executable will still be able to decompress its
|
||||
own compressed files, but you may be unable to exchange files with
|
||||
<code>glicbawls</code> on other machines.</p>
|
||||
<h3 id="obfuscation">Obfuscation</h3>
|
||||
<p>Most of the obfuscation of this program was driven by the desperate
|
||||
struggle to fit all of <code>glicbawls</code>’ features into code that
|
||||
fits the IOCCC’s size limits. All identifiers’ names are
|
||||
single-character, which was only possible by ruthless exploitation of
|
||||
scope. There is a function <code>M()</code> that handles nearly all
|
||||
input from <code>stdin</code>, handles all output to
|
||||
<code>stdout</code>, and also recursively calculates one of the
|
||||
mathematical expressions needed for error modelling. There is a function
|
||||
that calculates <code>(A^(-1)*b)*x</code> with <code>A</code> being a
|
||||
matrix and <code>b</code> and <code>x</code> being vectors, and does so
|
||||
in a very efficient way — but one would be hard pressed to find it.
|
||||
There is an arithmetic coder that is even less recognizable. A lot of
|
||||
loop variables don’t get initialized, but instead the code is arranged
|
||||
in such a way that they just happen to have the right value when control
|
||||
flow reaches the loops. Lots of functions use the same two global
|
||||
scratch variables. Variables change their meaning all the time, and the
|
||||
differences between compressing and decompressing are handled in rather
|
||||
subtle ways all over the program. The string that holds the ASCII values
|
||||
for displaying the progress image doubles as a description on how to
|
||||
find a pixel’s causal neighbours. And then there are a few
|
||||
<code>#define</code>s that really are just in there to save a few
|
||||
characters, but as an added “benefit” make the source ever more
|
||||
unreadable.</p>
|
||||
<p>In short — running it through the preprocessor and the pretty-printer
|
||||
will give you something that looks slightly less like line noise and
|
||||
slightly more like a C program, but unless you are a true wizard, it is
|
||||
unlikely to gain you any insights into what is actually going on….<a
|
||||
href="#fn1" class="footnote-ref" id="fnref1"
|
||||
role="doc-noteref"><sup>1</sup></a></p>
|
||||
<p>Most of the obfuscation of this program was driven by the
|
||||
desperate struggle to fit all of <code>glicbawls</code>’ features into code
|
||||
that fits the IOCCC’s size limits. All identifiers’ names are
|
||||
single-character, which was only possible by ruthless exploitation
|
||||
of scope. There is a function <code>M()</code> that handles nearly all input
|
||||
from <code>stdin</code>, handles all output to <code>stdout</code>, and also recursively
|
||||
calculates one of the mathematical expressions needed for error
|
||||
modelling. There is a function that calculates <code>(A^(-1)*b)*x</code> with <code>A</code>
|
||||
being a matrix and <code>b</code> and <code>x</code> being vectors, and does so in a very
|
||||
efficient way — but one would be hard pressed to find it. There
|
||||
is an arithmetic coder that is even less recognizable. A lot of
|
||||
loop variables don’t get initialized, but instead the code is
|
||||
arranged in such a way that they just happen to have the right
|
||||
value when control flow reaches the loops. Lots of functions use
|
||||
the same two global scratch variables. Variables change their
|
||||
meaning all the time, and the differences between compressing and
|
||||
decompressing are handled in rather subtle ways all over the
|
||||
program. The string that holds the ASCII values for displaying the
|
||||
progress image doubles as a description on how to find a pixel’s
|
||||
causal neighbours. And then there are a few <code>#define</code>s that really
|
||||
are just in there to save a few characters, but as an added
|
||||
“benefit” make the source ever more unreadable.</p>
|
||||
<p>In short — running it through the preprocessor and the
|
||||
pretty-printer will give you something that looks slightly less
|
||||
like line noise and slightly more like a C program, but unless you
|
||||
are a true wizard, it is unlikely to gain you any insights into
|
||||
what is actually going on….<a href="#fn1" class="footnote-ref" id="fnref1" role="doc-noteref"><sup>1</sup></a></p>
|
||||
<h3 id="bugs-assumptions-and-todo">Bugs, Assumptions and TODO</h3>
|
||||
<p><code>glicbawls</code> assumes that characters are 8 bit wide, and
|
||||
that the character set used is ASCII. If one of these isn’t true, all
|
||||
hell will break loose.</p>
|
||||
<p>The .PGM headers are not checked very thoroughly —
|
||||
<code>glicbawls</code> will happily try to encode lots of files that it
|
||||
shouldn’t touch. The old adage of “garbage in, garbage out” holds in
|
||||
that case. Furthermore, even if <code>glicbawls</code> detects an
|
||||
incorrect input, it fails to provide a meaningful error message, and
|
||||
instead simply aborts.</p>
|
||||
<p>When decompressing a near-lossless encoded image, the maximum allowed
|
||||
error is required as a command line parameter. This should really be
|
||||
saved in the compressed file!</p>
|
||||
<p><code>glicbawls</code> relies on the decimal representation of all
|
||||
integers having less than 255 digits. While ANSI C does not guarantee
|
||||
this, it seems rather unlikely that anyone in the foreseeable future
|
||||
would use images with <code>10^255</code> rows, columns or different
|
||||
levels of grey. Also, it is assumed that any integer used can be cast to
|
||||
a <code>double</code> and back without loss of precision. This limits
|
||||
the number of rows, columns and grey levels to 9 quintillion, which
|
||||
should also be sufficient for the next few years.</p>
|
||||
<p>There is a theoretical chance that you might get a division by zero
|
||||
error. You have a MUCH better chance of getting hit by lightning the
|
||||
very second you realize that you just won a few million in a lottery.
|
||||
But if it happens to you, don’t say I didn’t warn you! Instead, go out
|
||||
and buy a lightning rod and a lottery ticket ;-)</p>
|
||||
<p>At one point, a pointer to <code>int</code> is used as the target of
|
||||
a <code>"%1[#]"</code> conversion in a <code>scanf(3)</code>, which
|
||||
makes gcc rather unhappy, but shouldn’t really cause anyone any trouble.
|
||||
The same goes for a couple of assignments which are used as truth
|
||||
values.</p>
|
||||
<p><code>glicbawls</code> assumes that characters are 8 bit wide, and that the
|
||||
character set used is ASCII. If one of these isn’t true, all hell
|
||||
will break loose.</p>
|
||||
<p>The .PGM headers are not checked very thoroughly — <code>glicbawls</code>
|
||||
will happily try to encode lots of files that it shouldn’t
|
||||
touch. The old adage of “garbage in, garbage out” holds in that
|
||||
case. Furthermore, even if <code>glicbawls</code> detects an incorrect input,
|
||||
it fails to provide a meaningful error message, and instead
|
||||
simply aborts.</p>
|
||||
<p>When decompressing a near-lossless encoded image, the maximum
|
||||
allowed error is required as a command line parameter. This should
|
||||
really be saved in the compressed file!</p>
|
||||
<p><code>glicbawls</code> relies on the decimal representation of all integers
|
||||
having less than 255 digits. While ANSI C does not guarantee this,
|
||||
it seems rather unlikely that anyone in the foreseeable future
|
||||
would use images with <code>10^255</code> rows, columns or different levels of
|
||||
grey. Also, it is assumed that any integer used can be cast to a
|
||||
<code>double</code> and back without loss of precision. This limits the number
|
||||
of rows, columns and grey levels to 9 quintillion, which should
|
||||
also be sufficient for the next few years.</p>
|
||||
<p>There is a theoretical chance that you might get a division by
|
||||
zero error. You have a MUCH better chance of getting hit by
|
||||
lightning the very second you realize that you just won a few
|
||||
million in a lottery. But if it happens to you, don’t say I
|
||||
didn’t warn you! Instead, go out and buy a lightning rod and a
|
||||
lottery ticket ;-)</p>
|
||||
<p>At one point, a pointer to <code>int</code> is used as the target of a <code>"%1[#]"</code>
|
||||
conversion in a <code>scanf(3)</code>, which makes gcc rather unhappy, but
|
||||
shouldn’t really cause anyone any trouble. The same goes for a
|
||||
couple of assignments which are used as truth values.</p>
|
||||
<h3 id="algorithm">Algorithm</h3>
|
||||
<p>An exhaustive explanation of the algorithm used would go beyond the
|
||||
scope of an info file, and would also be quite difficult in pure ASCII,
|
||||
so the following is just a rough outline, and contains some
|
||||
compression-speak…</p>
|
||||
<p>The image is handled in <a
|
||||
href="https://en.wikipedia.org/wiki/Scan_line">scanline</a> ordering.
|
||||
For each pixel, an expected value is calculated by creating a least
|
||||
squares predictor of order 12 based on all of the previously
|
||||
encoded/decoded pixels. However, the contribution of each pixel is
|
||||
weighted according to its <a
|
||||
href="https://en.wikipedia.org/wiki/Taxicab_geometry">Manhattan-distance</a>
|
||||
from the current pixel, <code>D</code>. That weight used is
|
||||
<code>pow(0.8,D)</code>. <a href="#fn2" class="footnote-ref" id="fnref2"
|
||||
role="doc-noteref"><sup>2</sup></a> <a href="#fn3" class="footnote-ref"
|
||||
id="fnref3" role="doc-noteref"><sup>3</sup></a> <a href="#fn4"
|
||||
class="footnote-ref" id="fnref4" role="doc-noteref"><sup>4</sup></a></p>
|
||||
<p>In a similar way, the prediction <em>errors</em> for all previous
|
||||
pixels are combined — a weighted average (with weight
|
||||
<code>pow(0.7,D)</code>) of the squares of all previous prediction
|
||||
errors is taken, and the square root of the (appropriately scaled)
|
||||
result is called sigma.</p>
|
||||
<p>The predicted value and sigma are then used as the parameters of a <a
|
||||
href="https://en.wikipedia.org/wiki/Student%27s_t-distribution">Student
|
||||
or t-distribution</a> (which is similar to a <a
|
||||
href="https://en.wikipedia.org/wiki/Normal_distribution">normal
|
||||
distribution</a>, but has more weight in the tails), providing a <a
|
||||
href="https://en.wikipedia.org/wiki/Probability_distribution">probability
|
||||
distribution</a> for the current pixel.</p>
|
||||
<p>An exhaustive explanation of the algorithm used would go beyond
|
||||
the scope of an info file, and would also be quite difficult in
|
||||
pure ASCII, so the following is just a rough outline, and contains
|
||||
some compression-speak…</p>
|
||||
<p>The image is handled in <a href="https://en.wikipedia.org/wiki/Scan_line">scanline</a>
|
||||
ordering. For each pixel, an expected value is calculated by creating a least
|
||||
squares predictor of order 12 based on all of the previously encoded/decoded
|
||||
pixels. However, the contribution of each pixel is weighted according to its
|
||||
<a href="https://en.wikipedia.org/wiki/Taxicab_geometry">Manhattan-distance</a> from the
|
||||
current pixel, <code>D</code>. That weight used is <code>pow(0.8,D)</code>. <a href="#fn2" class="footnote-ref" id="fnref2" role="doc-noteref"><sup>2</sup></a> <a href="#fn3" class="footnote-ref" id="fnref3" role="doc-noteref"><sup>3</sup></a> <a href="#fn4" class="footnote-ref" id="fnref4" role="doc-noteref"><sup>4</sup></a></p>
|
||||
<p>In a similar way, the prediction <em>errors</em> for all previous pixels
|
||||
are combined — a weighted average (with weight <code>pow(0.7,D)</code>) of
|
||||
the squares of all previous prediction errors is taken, and the
|
||||
square root of the (appropriately scaled) result is called sigma.</p>
|
||||
<p>The predicted value and sigma are then used as the parameters of a <a href="https://en.wikipedia.org/wiki/Student%27s_t-distribution">Student or
|
||||
t-distribution</a> (which
|
||||
is similar to a <a href="https://en.wikipedia.org/wiki/Normal_distribution">normal
|
||||
distribution</a>, but has more
|
||||
weight in the tails), providing a <a href="https://en.wikipedia.org/wiki/Probability_distribution">probability
|
||||
distribution</a> for the
|
||||
current pixel.</p>
|
||||
<p>Next, the possible interval of values for the current pixel is
|
||||
halved, and through integration of the probability distribution, a
|
||||
probability is calculated for the pixel value being in the lower half.
|
||||
During encoding, the actual value is examined, and the result encoded
|
||||
using an arithmetic coder. During decoding, the arithmetic decoder
|
||||
provides the information which half the actual value is in. In both
|
||||
cases, the interval borders are adjusted accordingly, the arithmetic
|
||||
coder/decoder updated, and the interval halving repeated until the
|
||||
precise value has been en/decoded<a href="#fn5" class="footnote-ref"
|
||||
id="fnref5" role="doc-noteref"><sup>5</sup></a>.</p>
|
||||
probability is calculated for the pixel value being in the lower
|
||||
half. During encoding, the actual value is examined, and the
|
||||
result encoded using an arithmetic coder. During decoding, the
|
||||
arithmetic decoder provides the information which half the actual
|
||||
value is in. In both cases, the interval borders are adjusted
|
||||
accordingly, the arithmetic coder/decoder updated, and the
|
||||
interval halving repeated until the precise value has been
|
||||
en/decoded<a href="#fn5" class="footnote-ref" id="fnref5" role="doc-noteref"><sup>5</sup></a>.</p>
|
||||
<h3 id="photo-credit">Photo Credit:</h3>
|
||||
<p><a href="lavabus.pgm">Lavabus</a> was taken by the judge, Landon Curt
|
||||
Noll. <a href="michael.pgm">Michael</a> was provided by the author. <a
|
||||
href="lenna.glic">Lenna</a> is a 1972 Playboy centerfold (doesn’t show
|
||||
very much).</p>
|
||||
<p><a href="lavabus.pgm">Lavabus</a> was taken by the judge, Landon Curt Noll.
|
||||
<a href="michael.pgm">Michael</a> was provided by the author. <a href="lenna.glic">Lenna</a> is a
|
||||
1972 Playboy centerfold (doesn’t show very much).</p>
|
||||
<ul>
|
||||
<li><p><a href="michael.pgm">michael.pgm</a></p>
|
||||
<p>The author’s Godchild and nephew.</p></li>
|
||||
<li><p><a href="lavabus.pgm">lavabus.pgm</a></p>
|
||||
<p>A bus that was trapped by lava from <a
|
||||
href="https://en.wikipedia.org/wiki/Kīlauea">Kilauea volcano</a> in
|
||||
Hawaii, US. Nobody was in the bus at the time, BTW. Photo date:
|
||||
1981.</p></li>
|
||||
<p>A bus that was trapped by lava from <a href="https://en.wikipedia.org/wiki/Kīlauea">Kilauea
|
||||
volcano</a> in Hawaii, US. Nobody was
|
||||
in the bus at the time, BTW. Photo date: 1981.</p></li>
|
||||
<li><p><a href="lenna.glic">lenna.glic</a></p>
|
||||
<p>A November 1972 Playboy centerfold was scanned in long ago and has
|
||||
been used for image compression research since then. Playboy originally
|
||||
threatened to prosecute unauthorized use, but eventually granted that,
|
||||
having been in use for image compression testing for so long, it was now
|
||||
a useful benchmark. (Note: This picture doesn’t show very
|
||||
much.)</p></li>
|
||||
<p>A November 1972 Playboy centerfold was scanned in long ago and has been used
|
||||
for image compression research since then. Playboy originally threatened to
|
||||
prosecute unauthorized use, but eventually granted that, having been in use
|
||||
for image compression testing for so long, it was now a useful benchmark.
|
||||
(Note: This picture doesn’t show very much.)</p></li>
|
||||
</ul>
|
||||
<h2 id="copyright-and-cc-by-sa-4.0-license">Copyright and CC BY-SA 4.0
|
||||
License:</h2>
|
||||
<p>This file is Copyright (c) 2023 by Landon Curt Noll. All Rights
|
||||
Reserved. You are free to share and adapt this file under the terms of
|
||||
this license:</p>
|
||||
<h2 id="copyright-and-cc-by-sa-4.0-license">Copyright and CC BY-SA 4.0 License:</h2>
|
||||
<p>This file is Copyright (c) 2023 by Landon Curt Noll. All Rights Reserved.
|
||||
You are free to share and adapt this file under the terms of this license:</p>
|
||||
<pre><code>Creative Commons Attribution-ShareAlike 4.0 International (CC BY-SA 4.0)</code></pre>
|
||||
<p>For more information, see:
|
||||
https://creativecommons.org/licenses/by-sa/4.0/</p>
|
||||
<section id="footnotes" class="footnotes footnotes-end-of-document"
|
||||
role="doc-endnotes">
|
||||
<p>For more information, see: https://creativecommons.org/licenses/by-sa/4.0/</p>
|
||||
<section id="footnotes" class="footnotes footnotes-end-of-document" role="doc-endnotes">
|
||||
<hr />
|
||||
<ol>
|
||||
<li id="fn1"><p>Yes, this could be seen as a challenge….<a
|
||||
href="#fnref1" class="footnote-back" role="doc-backlink">↩︎</a></p></li>
|
||||
<li id="fn2"><p>Actually, the weight is <code>pow(0.8,D)/s</code>, where
|
||||
<code>s</code> is the sigma used for encoding/decoding the particular
|
||||
previous pixel. Dividing by <code>s</code> is a rather arbitrary action
|
||||
justified only by the improvement in results. Mathematically, I can only
|
||||
justify dividing by <code>s^2</code>, or not dividing at all….<a
|
||||
href="#fnref2" class="footnote-back" role="doc-backlink">↩︎</a></p></li>
|
||||
<li id="fn3"><p>Obviously, these least squares predictors are not
|
||||
calculated from scratch for each pixel. Some clever reuse of earlier
|
||||
<li id="fn1"><p>Yes, this could be seen as a challenge….<a href="#fnref1" class="footnote-back" role="doc-backlink">↩︎</a></p></li>
|
||||
<li id="fn2"><p>Actually, the weight is <code>pow(0.8,D)/s</code>, where <code>s</code> is the sigma
|
||||
used for encoding/decoding the particular previous pixel. Dividing
|
||||
by <code>s</code> is a rather arbitrary action justified only by the
|
||||
improvement in results. Mathematically, I can only justify
|
||||
dividing by <code>s^2</code>, or not dividing at all….<a href="#fnref2" class="footnote-back" role="doc-backlink">↩︎</a></p></li>
|
||||
<li id="fn3"><p>Obviously, these least squares predictors are not calculated
|
||||
from scratch for each pixel. Some clever reuse of earlier
|
||||
results allows <code>O(1)</code> calculation, rather than the
|
||||
<code>O(previous_rows*columns)</code> this description would suggest.<a
|
||||
href="#fnref3" class="footnote-back" role="doc-backlink">↩︎</a></p></li>
|
||||
<li id="fn4"><p>As anyone who has ever tried local least squares knows
|
||||
from bitter experience, there is a lot of numerical instability
|
||||
<code>O(previous_rows*columns)</code> this description would suggest.<a href="#fnref3" class="footnote-back" role="doc-backlink">↩︎</a></p></li>
|
||||
<li id="fn4"><p>As anyone who has ever tried local least squares knows from
|
||||
bitter experience, there is a lot of numerical instability
|
||||
associated with them. So <code>glicbawls</code> adds a bias towards an
|
||||
averaging predictor to the equation system the least squares predictor
|
||||
is calculated from. The weight that is given to this bias is constantly
|
||||
adjusted throughout coding/decoding, thus justifying the ‘a’ in
|
||||
<code>glicbawls</code>.<a href="#fnref4" class="footnote-back"
|
||||
role="doc-backlink">↩︎</a></p></li>
|
||||
averaging predictor to the equation system the least squares
|
||||
predictor is calculated from. The weight that is given to
|
||||
this bias is constantly adjusted throughout coding/decoding,
|
||||
thus justifying the ‘a’ in <code>glicbawls</code>.<a href="#fnref4" class="footnote-back" role="doc-backlink">↩︎</a></p></li>
|
||||
<li id="fn5"><p>In the case of near-lossless coding, the interval is not
|
||||
necessarily <em>halved</em>, but rather split at a convenient point (the
|
||||
split points are chosen in such a way as to minimise the expected number
|
||||
of bits needed for coding). Also, the iteration ends as soon as the
|
||||
interval is small enough to guarantee decoding within the requested
|
||||
maximum error.<a href="#fnref5" class="footnote-back"
|
||||
role="doc-backlink">↩︎</a></p></li>
|
||||
necessarily <em>halved</em>, but rather split at a convenient point
|
||||
(the split points are chosen in such a way as to minimise the
|
||||
expected number of bits needed for coding). Also, the
|
||||
iteration ends as soon as the interval is small enough to
|
||||
guarantee decoding within the requested maximum error.<a href="#fnref5" class="footnote-back" role="doc-backlink">↩︎</a></p></li>
|
||||
</ol>
|
||||
</section>
|
||||
|
||||
@@ -426,45 +401,26 @@ role="doc-backlink">↩︎</a></p></li>
|
||||
|
||||
<!-- START: this line starts content generated by: bin/output-index-inventory.sh -->
|
||||
|
||||
<h1 id="inventory-for-2000bmeyer"><a name="inventory"></a>Inventory for
|
||||
2000/bmeyer</h1>
|
||||
<h1 id="inventory-for-2000bmeyer"><a name="inventory"></a>Inventory for 2000/bmeyer</h1>
|
||||
<p><a href="#top">Jump to top</a></p>
|
||||
<h2 id="primary-files">Primary files</h2>
|
||||
<ul>
|
||||
<li><a
|
||||
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2000/bmeyer/bmeyer.c">bmeyer.c</a>
|
||||
- entry source</li>
|
||||
<li><a
|
||||
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2000/bmeyer/Makefile">Makefile</a>
|
||||
- entry Makefile</li>
|
||||
<li><a
|
||||
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2000/bmeyer/bmeyer.orig.c">bmeyer.orig.c</a>
|
||||
- original source</li>
|
||||
<li><a href="lavabus.pgm">lavabus.pgm</a> - Kilauea volcano bus trapped
|
||||
in lava</li>
|
||||
<li><a href="michael.pgm">michael.pgm</a> - author’s Godchild and
|
||||
Nephew</li>
|
||||
<li><a
|
||||
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2000/bmeyer/try.sh">try.sh</a>
|
||||
- how to run</li>
|
||||
<li><a href="lenna.glic">lenna.glic</a> - P10 scan of 1972 Playboy
|
||||
centerfold</li>
|
||||
<li><a href="2000_bmeyer.tar.bz2">2000_bmeyer.tar.bz2</a> - download
|
||||
entry source</li>
|
||||
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2000/bmeyer/bmeyer.c">bmeyer.c</a> - entry source</li>
|
||||
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2000/bmeyer/Makefile">Makefile</a> - entry Makefile</li>
|
||||
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2000/bmeyer/bmeyer.orig.c">bmeyer.orig.c</a> - original source</li>
|
||||
<li><a href="lavabus.pgm">lavabus.pgm</a> - Kilauea volcano bus trapped in lava</li>
|
||||
<li><a href="michael.pgm">michael.pgm</a> - author’s Godchild and Nephew</li>
|
||||
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2000/bmeyer/try.sh">try.sh</a> - how to run</li>
|
||||
<li><a href="lenna.glic">lenna.glic</a> - P10 scan of 1972 Playboy centerfold</li>
|
||||
<li><a href="2000_bmeyer.tar.bz2">2000_bmeyer.tar.bz2</a> - download entry source</li>
|
||||
</ul>
|
||||
<h2 id="secondary-files">Secondary files</h2>
|
||||
<ul>
|
||||
<li><a href="index.html">index.html</a> - entry home page</li>
|
||||
<li><a
|
||||
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2000/bmeyer/.entry.json">.entry.json</a>
|
||||
- description of entry in JSON</li>
|
||||
<li><a
|
||||
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2000/bmeyer/.gitignore">.gitignore</a>
|
||||
- list of files that should not be committed under git</li>
|
||||
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2000/bmeyer/.entry.json">.entry.json</a> - description of entry in JSON</li>
|
||||
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2000/bmeyer/.gitignore">.gitignore</a> - list of files that should not be committed under git</li>
|
||||
<li><a href=".path">.path</a> - directory path from top directory</li>
|
||||
<li><a
|
||||
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2000/bmeyer/README.md">README.md</a>
|
||||
- markdown source for index.html</li>
|
||||
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2000/bmeyer/README.md">README.md</a> - markdown source for index.html</li>
|
||||
</ul>
|
||||
|
||||
<!-- END: next line ends content generated by: bin/output-index-inventory.sh -->
|
||||
|
||||
+36
-55
@@ -130,11 +130,11 @@
|
||||
<h2 id="authors"><a name="author"></a>Authors:</h2>
|
||||
<ul>
|
||||
<li>Name: <a href="../../authors.html#Lord_Zarbon">Lord Zarbon</a><br>
|
||||
Location: <a href="../../location.html#ZZ">ZZ</a> - <em>Unknown
|
||||
location</em> <br><br></li>
|
||||
<li>Name: <a href="../../authors.html#Moxen_N_Briddlebane">Moxen N.
|
||||
Briddlebane</a><br> Location: <a href="../../location.html#ZZ">ZZ</a> -
|
||||
<em>Unknown location</em> <br><br></li>
|
||||
Location: <a href="../../location.html#ZZ">ZZ</a> - <em>Unknown location</em>
|
||||
<br><br></li>
|
||||
<li>Name: <a href="../../authors.html#Moxen_N_Briddlebane">Moxen N. Briddlebane</a><br>
|
||||
Location: <a href="../../location.html#ZZ">ZZ</a> - <em>Unknown location</em>
|
||||
<br><br></li>
|
||||
</ul>
|
||||
|
||||
<!-- END: next line ends content generated by: bin/output-index-author.sh -->
|
||||
@@ -147,8 +147,8 @@ Briddlebane</a><br> Location: <a href="../../location.html#ZZ">ZZ</a> -
|
||||
<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">./briddlebane</span></span></code></pre></div>
|
||||
<h2 id="try">Try:</h2>
|
||||
<p>For some fun every time you log in try running this from your
|
||||
<code>.bashrc</code> or equivalent file!</p>
|
||||
<p>For some fun every time you log in try running this from your <code>.bashrc</code> or
|
||||
equivalent file!</p>
|
||||
<p>You might also like to try:</p>
|
||||
<div class="sourceCode" id="cb3"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb3-1"><a href="#cb3-1" aria-hidden="true" tabindex="-1"></a><span class="ex">./try.sh</span></span>
|
||||
<span id="cb3-2"><a href="#cb3-2" aria-hidden="true" tabindex="-1"></a></span>
|
||||
@@ -161,69 +161,50 @@ evening of Dec 22, 2000).</p>
|
||||
<p>Can you find out how it stores the insult strings? Can you then take
|
||||
an insult and figure out when it will be uttered?</p>
|
||||
<h2 id="authors-remarks">Author’s remarks:</h2>
|
||||
<p>This program was broadcast from deep within the Zarbonic Cluster and
|
||||
received at 9:03pm on March 21st, 2000 by Moxen N. Briddlebane. The
|
||||
original author, as designated by other components of the transmission,
|
||||
refers to himself simply as “Lord Zarbon”, though offers no information
|
||||
in relation to the significance of that post. The sole purpose of this
|
||||
program appears to be to degrade and humiliate the people of this planet
|
||||
by calling them names. It takes no input, it only produces a single line
|
||||
of slanderous output.</p>
|
||||
<p>The program appears to be rather confused, internally. It is unclear
|
||||
whether or not “Lord Zarbon” truly understands the mechanics of
|
||||
programming. What is particularly disturbing is the curious method of
|
||||
insult-encoding employed by this program. Furthermore, it is ambiguous
|
||||
how said data is arranged and why it is necessary to resort to
|
||||
trigonometric functions to handle it. One of the real mysteries involves
|
||||
the numbers <code>114</code> and <code>2</code>, which are, according to
|
||||
Lord Zarbon, very deliberate.</p>
|
||||
<h2 id="copyright-and-cc-by-sa-4.0-license">Copyright and CC BY-SA 4.0
|
||||
License:</h2>
|
||||
<p>This file is Copyright (c) 2023 by Landon Curt Noll. All Rights
|
||||
Reserved. You are free to share and adapt this file under the terms of
|
||||
this license:</p>
|
||||
<p>This program was broadcast from deep within the Zarbonic Cluster
|
||||
and received at 9:03pm on March 21st, 2000 by Moxen N. Briddlebane.
|
||||
The original author, as designated by other components of the
|
||||
transmission, refers to himself simply as “Lord Zarbon”, though
|
||||
offers no information in relation to the significance of that
|
||||
post. The sole purpose of this program appears to be to degrade
|
||||
and humiliate the people of this planet by calling them names.
|
||||
It takes no input, it only produces a single line of slanderous output.</p>
|
||||
<p>The program appears to be rather confused, internally. It is
|
||||
unclear whether or not “Lord Zarbon” truly understands the
|
||||
mechanics of programming. What is particularly disturbing is
|
||||
the curious method of insult-encoding employed by this program.
|
||||
Furthermore, it is ambiguous how said data is arranged and why
|
||||
it is necessary to resort to trigonometric functions to handle
|
||||
it. One of the real mysteries involves the numbers <code>114</code> and
|
||||
<code>2</code>, which are, according to Lord Zarbon, very deliberate.</p>
|
||||
<h2 id="copyright-and-cc-by-sa-4.0-license">Copyright and CC BY-SA 4.0 License:</h2>
|
||||
<p>This file is Copyright (c) 2023 by Landon Curt Noll. All Rights Reserved.
|
||||
You are free to share and adapt this file under the terms of this license:</p>
|
||||
<pre><code>Creative Commons Attribution-ShareAlike 4.0 International (CC BY-SA 4.0)</code></pre>
|
||||
<p>For more information, see:
|
||||
https://creativecommons.org/licenses/by-sa/4.0/</p>
|
||||
<p>For more information, see: https://creativecommons.org/licenses/by-sa/4.0/</p>
|
||||
|
||||
<!-- END: this line ends content for HTML phase 21 by: bin/pandoc-wrapper.sh via bin/md2html.sh -->
|
||||
<!-- START: this line starts content for HTML phase 22 by: bin/output-index-inventory.sh via bin/md2html.sh -->
|
||||
|
||||
<!-- START: this line starts content generated by: bin/output-index-inventory.sh -->
|
||||
|
||||
<h1 id="inventory-for-2000briddlebane"><a name="inventory"></a>Inventory
|
||||
for 2000/briddlebane</h1>
|
||||
<h1 id="inventory-for-2000briddlebane"><a name="inventory"></a>Inventory for 2000/briddlebane</h1>
|
||||
<p><a href="#top">Jump to top</a></p>
|
||||
<h2 id="primary-files">Primary files</h2>
|
||||
<ul>
|
||||
<li><a
|
||||
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2000/briddlebane/briddlebane.c">briddlebane.c</a>
|
||||
- entry source</li>
|
||||
<li><a
|
||||
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2000/briddlebane/Makefile">Makefile</a>
|
||||
- entry Makefile</li>
|
||||
<li><a
|
||||
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2000/briddlebane/briddlebane.orig.c">briddlebane.orig.c</a>
|
||||
- original source</li>
|
||||
<li><a
|
||||
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2000/briddlebane/try.sh">try.sh</a>
|
||||
- how to run</li>
|
||||
<li><a href="2000_briddlebane.tar.bz2">2000_briddlebane.tar.bz2</a> -
|
||||
download entry source</li>
|
||||
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2000/briddlebane/briddlebane.c">briddlebane.c</a> - entry source</li>
|
||||
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2000/briddlebane/Makefile">Makefile</a> - entry Makefile</li>
|
||||
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2000/briddlebane/briddlebane.orig.c">briddlebane.orig.c</a> - original source</li>
|
||||
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2000/briddlebane/try.sh">try.sh</a> - how to run</li>
|
||||
<li><a href="2000_briddlebane.tar.bz2">2000_briddlebane.tar.bz2</a> - download entry source</li>
|
||||
</ul>
|
||||
<h2 id="secondary-files">Secondary files</h2>
|
||||
<ul>
|
||||
<li><a href="index.html">index.html</a> - entry home page</li>
|
||||
<li><a
|
||||
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2000/briddlebane/.entry.json">.entry.json</a>
|
||||
- description of entry in JSON</li>
|
||||
<li><a
|
||||
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2000/briddlebane/.gitignore">.gitignore</a>
|
||||
- list of files that should not be committed under git</li>
|
||||
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2000/briddlebane/.entry.json">.entry.json</a> - description of entry in JSON</li>
|
||||
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2000/briddlebane/.gitignore">.gitignore</a> - list of files that should not be committed under git</li>
|
||||
<li><a href=".path">.path</a> - directory path from top directory</li>
|
||||
<li><a
|
||||
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2000/briddlebane/README.md">README.md</a>
|
||||
- markdown source for index.html</li>
|
||||
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2000/briddlebane/README.md">README.md</a> - markdown source for index.html</li>
|
||||
</ul>
|
||||
|
||||
<!-- END: next line ends content generated by: bin/output-index-inventory.sh -->
|
||||
|
||||
+26
-48
@@ -130,8 +130,8 @@
|
||||
<h2 id="author"><a name="author"></a>Author:</h2>
|
||||
<ul>
|
||||
<li>Name: <a href="../../authors.html#Don_Yang">Don Yang</a><br>
|
||||
Location: <a href="../../location.html#US">US</a> - <em>United States of
|
||||
America</em> (<em>United States</em>) <br><br></li>
|
||||
Location: <a href="../../location.html#US">US</a> - <em>United States of America</em> (<em>United States</em>)
|
||||
<br><br></li>
|
||||
</ul>
|
||||
|
||||
<!-- END: next line ends content generated by: bin/output-index-author.sh -->
|
||||
@@ -147,8 +147,8 @@ America</em> (<em>United States</em>) <br><br></li>
|
||||
<div class="sourceCode" id="cb3"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb3-1"><a href="#cb3-1" aria-hidden="true" tabindex="-1"></a><span class="ex">./try.sh</span></span></code></pre></div>
|
||||
<h2 id="judges-remarks">Judges’ remarks:</h2>
|
||||
<p>A beautiful combination of solving several different problems, but
|
||||
mostly, the single most impressive layout we’ve ever seen. Many programs
|
||||
have <em>one</em> interesting layout; this one has four.</p>
|
||||
mostly, the single most impressive layout we’ve ever seen. Many
|
||||
programs have <em>one</em> interesting layout; this one has four.</p>
|
||||
<p>It may be informative to run the code through a “beautifier”, to
|
||||
study it, but the layout itself is where most of the interest lies.</p>
|
||||
<h2 id="authors-remarks">Author’s remarks:</h2>
|
||||
@@ -159,69 +159,47 @@ them with cool layout!</p>
|
||||
<p>For your enjoyment:</p>
|
||||
<ol type="1">
|
||||
<li>Compile <a href="dhyang.c">dhyang.c</a>.</li>
|
||||
<li>Run <code>./dhyang</code> and redirect output to another
|
||||
<code>.c</code> file.</li>
|
||||
<li>Run <code>./dhyang</code> and redirect output to another <code>.c</code> file.</li>
|
||||
<li>Compile that file.</li>
|
||||
<li>Repeat steps 2 and 3 until eventually the output cycles.</li>
|
||||
</ol>
|
||||
<p>To interpret the output: the <a href="dhyang.c.c">dhyang.c</a> is an
|
||||
image of Saitou Hajime, which eventually generates three sources files
|
||||
that are images of “aku soku zan” (sin swift slay), Saitou’s motto
|
||||
;)</p>
|
||||
<p>To interpret the output: the <a href="dhyang.c.c">dhyang.c</a> is an image of Saitou
|
||||
Hajime, which eventually generates three sources files that are images of “aku
|
||||
soku zan” (sin swift slay), Saitou’s motto ;)</p>
|
||||
<p>For best viewing, set tab spaces to 8 characters, and set your
|
||||
terminal fonts to as close to square as possible. I hate to do this but
|
||||
you know, size…</p>
|
||||
<p><a href="dhyang.c">dhyang.c</a> and all its output compiles with gcc
|
||||
if your OS uses ASCII character set. No file is included and all
|
||||
functions assume default <code>int</code> return type (a source of
|
||||
compile warnings).</p>
|
||||
<h2 id="copyright-and-cc-by-sa-4.0-license">Copyright and CC BY-SA 4.0
|
||||
License:</h2>
|
||||
<p>This file is Copyright (c) 2023 by Landon Curt Noll. All Rights
|
||||
Reserved. You are free to share and adapt this file under the terms of
|
||||
this license:</p>
|
||||
terminal fonts to as close to square as possible. I hate to do this
|
||||
but you know, size…</p>
|
||||
<p><a href="dhyang.c">dhyang.c</a> and all its output compiles with gcc if your OS uses ASCII
|
||||
character set. No file is included and all functions assume default <code>int</code> return
|
||||
type (a source of compile warnings).</p>
|
||||
<h2 id="copyright-and-cc-by-sa-4.0-license">Copyright and CC BY-SA 4.0 License:</h2>
|
||||
<p>This file is Copyright (c) 2023 by Landon Curt Noll. All Rights Reserved.
|
||||
You are free to share and adapt this file under the terms of this license:</p>
|
||||
<pre><code>Creative Commons Attribution-ShareAlike 4.0 International (CC BY-SA 4.0)</code></pre>
|
||||
<p>For more information, see:
|
||||
https://creativecommons.org/licenses/by-sa/4.0/</p>
|
||||
<p>For more information, see: https://creativecommons.org/licenses/by-sa/4.0/</p>
|
||||
|
||||
<!-- END: this line ends content for HTML phase 21 by: bin/pandoc-wrapper.sh via bin/md2html.sh -->
|
||||
<!-- START: this line starts content for HTML phase 22 by: bin/output-index-inventory.sh via bin/md2html.sh -->
|
||||
|
||||
<!-- START: this line starts content generated by: bin/output-index-inventory.sh -->
|
||||
|
||||
<h1 id="inventory-for-2000dhyang"><a name="inventory"></a>Inventory for
|
||||
2000/dhyang</h1>
|
||||
<h1 id="inventory-for-2000dhyang"><a name="inventory"></a>Inventory for 2000/dhyang</h1>
|
||||
<p><a href="#top">Jump to top</a></p>
|
||||
<h2 id="primary-files">Primary files</h2>
|
||||
<ul>
|
||||
<li><a
|
||||
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2000/dhyang/dhyang.c">dhyang.c</a>
|
||||
- entry source</li>
|
||||
<li><a
|
||||
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2000/dhyang/Makefile">Makefile</a>
|
||||
- entry Makefile</li>
|
||||
<li><a
|
||||
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2000/dhyang/dhyang.orig.c">dhyang.orig.c</a>
|
||||
- original source</li>
|
||||
<li><a
|
||||
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2000/dhyang/try.sh">try.sh</a>
|
||||
- how to run</li>
|
||||
<li><a href="2000_dhyang.tar.bz2">2000_dhyang.tar.bz2</a> - download
|
||||
entry source</li>
|
||||
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2000/dhyang/dhyang.c">dhyang.c</a> - entry source</li>
|
||||
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2000/dhyang/Makefile">Makefile</a> - entry Makefile</li>
|
||||
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2000/dhyang/dhyang.orig.c">dhyang.orig.c</a> - original source</li>
|
||||
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2000/dhyang/try.sh">try.sh</a> - how to run</li>
|
||||
<li><a href="2000_dhyang.tar.bz2">2000_dhyang.tar.bz2</a> - download entry source</li>
|
||||
</ul>
|
||||
<h2 id="secondary-files">Secondary files</h2>
|
||||
<ul>
|
||||
<li><a href="index.html">index.html</a> - entry home page</li>
|
||||
<li><a
|
||||
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2000/dhyang/.entry.json">.entry.json</a>
|
||||
- description of entry in JSON</li>
|
||||
<li><a
|
||||
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2000/dhyang/.gitignore">.gitignore</a>
|
||||
- list of files that should not be committed under git</li>
|
||||
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2000/dhyang/.entry.json">.entry.json</a> - description of entry in JSON</li>
|
||||
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2000/dhyang/.gitignore">.gitignore</a> - list of files that should not be committed under git</li>
|
||||
<li><a href=".path">.path</a> - directory path from top directory</li>
|
||||
<li><a
|
||||
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2000/dhyang/README.md">README.md</a>
|
||||
- markdown source for index.html</li>
|
||||
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2000/dhyang/README.md">README.md</a> - markdown source for index.html</li>
|
||||
</ul>
|
||||
|
||||
<!-- END: next line ends content generated by: bin/output-index-inventory.sh -->
|
||||
|
||||
+106
-143
@@ -129,9 +129,9 @@
|
||||
|
||||
<h2 id="author"><a name="author"></a>Author:</h2>
|
||||
<ul>
|
||||
<li>Name: <a href="../../authors.html#J_David_Lowe">J. David
|
||||
Lowe</a><br> Location: <a href="../../location.html#US">US</a> -
|
||||
<em>United States of America</em> (<em>United States</em>) <br><br></li>
|
||||
<li>Name: <a href="../../authors.html#J_David_Lowe">J. David Lowe</a><br>
|
||||
Location: <a href="../../location.html#US">US</a> - <em>United States of America</em> (<em>United States</em>)
|
||||
<br><br></li>
|
||||
</ul>
|
||||
|
||||
<!-- END: next line ends content generated by: bin/output-index-author.sh -->
|
||||
@@ -148,8 +148,7 @@ Lowe</a><br> Location: <a href="../../location.html#US">US</a> -
|
||||
<p>The current status of this entry is:</p>
|
||||
<pre><code>STATUS: doesn't work with some platforms - please help us fix
|
||||
STATUS: known bug - please help us fix</code></pre>
|
||||
<p>For more detailed information see <a
|
||||
href="../../bugs.html#2000_dlowe">2000 dlowe bugs</a>.</p>
|
||||
<p>For more detailed information see <a href="../../bugs.html#2000_dlowe">2000 dlowe bugs</a>.</p>
|
||||
<h2 id="to-use">To use:</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">./dlowe</span> [file ...]</span></code></pre></div>
|
||||
<h2 id="try">Try:</h2>
|
||||
@@ -159,27 +158,23 @@ href="../../bugs.html#2000_dlowe">2000 dlowe bugs</a>.</p>
|
||||
the use of embedded language interpreters. The judges considered
|
||||
disqualifying this entry because of the use of perl, but on the other
|
||||
hand it qualifies as the Worst Abuse of the Rules. As a previous author,
|
||||
<a href="../../authors.html#J_David_Lowe">David Lowe</a> continues to
|
||||
inflict the highest quality “poot” on the Judges.</p>
|
||||
<p>The program also contains an undocumented command for Chad and Chongo
|
||||
(Landon). The judges’ remarks contain a clue to the hidden command
|
||||
:-).</p>
|
||||
<a href="../../authors.html#J_David_Lowe">David Lowe</a> continues to inflict the highest quality “poot” on the
|
||||
Judges.</p>
|
||||
<p>The program also contains an undocumented command for Chad and Chongo (Landon).
|
||||
The judges’ remarks contain a clue to the hidden command :-).</p>
|
||||
<ul>
|
||||
<li>The IOCCC uses an anonymous judging process which keeps the identity
|
||||
of the submitters hidden until all winning entries have been
|
||||
selected.</li>
|
||||
of the submitters hidden until all winning entries have been selected.</li>
|
||||
</ul>
|
||||
<h2 id="authors-remarks">Author’s remarks:</h2>
|
||||
<h3 id="usage">Usage</h3>
|
||||
<pre><code>./dlowe [file ...]</code></pre>
|
||||
<h3 id="synopsis">Synopsis</h3>
|
||||
<p>This is a <a
|
||||
href="https://en.wikipedia.org/wiki/Reverse_Polish_notation">Reverse
|
||||
Polish calculator</a>, loosely based on the <code>dc(1)</code> unix
|
||||
calculator.</p>
|
||||
<p>This is a <a href="https://en.wikipedia.org/wiki/Reverse_Polish_notation">Reverse Polish
|
||||
calculator</a>, loosely
|
||||
based on the <code>dc(1)</code> unix calculator.</p>
|
||||
<h1 id="syntax">Syntax</h1>
|
||||
<p>This program understands the following <code>dc(1)</code>
|
||||
commands:</p>
|
||||
<p>This program understands the following <code>dc(1)</code> commands:</p>
|
||||
<pre><code>p prints the top stack value without altering the stack.
|
||||
P prints the top stack value, removing it from the stack, and
|
||||
doesn't print a trailing newline.
|
||||
@@ -200,14 +195,13 @@ r reverses the order of the top two stack values.</code></pre>
|
||||
% Pops 2 values and pushes the remainder of the division that
|
||||
/ would do.</code></pre>
|
||||
<p>The precision and range are double, like it or not, except that the
|
||||
modulus operator actually returns <code>(p1 - (p2 * (p1 / p2)))</code>,
|
||||
but with the innermost division calculated at integer precision. This is
|
||||
usually what you expect
|
||||
(e.g. <code>echo "12 8 % p" | ./dlowe == 4</code>)</p>
|
||||
<p>Commands are read from <code>stdin</code> or from a list of files
|
||||
named on the command line. Unlike <code>dc(1)</code>, multiple commands
|
||||
on the same line must be space separated. Commands are only executed
|
||||
when a newline or EOF is encountered.</p>
|
||||
modulus operator actually returns <code>(p1 - (p2 * (p1 / p2)))</code>, but with
|
||||
the innermost division calculated at integer precision. This is
|
||||
usually what you expect (e.g. <code>echo "12 8 % p" | ./dlowe == 4</code>)</p>
|
||||
<p>Commands are read from <code>stdin</code> or from a list of files named on
|
||||
the command line. Unlike <code>dc(1)</code>, multiple commands on the same line
|
||||
must be space separated. Commands are only executed when a newline
|
||||
or EOF is encountered.</p>
|
||||
<h3 id="diagnostics">Diagnostics:</h3>
|
||||
<pre><code>"stack empty" Not enough on the stack for the requested command
|
||||
"divide by zero" Attempt to divide by zero
|
||||
@@ -218,8 +212,7 @@ Floating point exception (core dumped) (or something to that effect)
|
||||
This bug appears to be fixed in perl5.6.0
|
||||
</code></pre>
|
||||
<h3 id="examples">Examples:</h3>
|
||||
<div class="sourceCode" id="cb10"><pre
|
||||
class="sourceCode sh"><code class="sourceCode bash"><span id="cb10-1"><a href="#cb10-1" aria-hidden="true" tabindex="-1"></a><span class="ex">$</span> echo <span class="st">'12 13 14 15 16 + + + + f'</span> <span class="kw">|</span> <span class="ex">./dlowe</span></span>
|
||||
<div class="sourceCode" id="cb10"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb10-1"><a href="#cb10-1" aria-hidden="true" tabindex="-1"></a><span class="ex">$</span> echo <span class="st">'12 13 14 15 16 + + + + f'</span> <span class="kw">|</span> <span class="ex">./dlowe</span></span>
|
||||
<span id="cb10-2"><a href="#cb10-2" aria-hidden="true" tabindex="-1"></a><span class="ex">70</span></span>
|
||||
<span id="cb10-3"><a href="#cb10-3" aria-hidden="true" tabindex="-1"></a><span class="ex">$</span> echo <span class="st">'12 13 14 15 16 17 + - * / p'</span> <span class="kw">|</span> <span class="ex">./dlowe</span></span>
|
||||
<span id="cb10-4"><a href="#cb10-4" aria-hidden="true" tabindex="-1"></a><span class="ex">-0.0515873015873016</span></span>
|
||||
@@ -234,174 +227,144 @@ class="sourceCode sh"><code class="sourceCode bash"><span id="cb10-1"><a href="#
|
||||
<span id="cb10-13"><a href="#cb10-13" aria-hidden="true" tabindex="-1"></a><span class="ex">$</span> echo <span class="st">'7 P 6 d P P 8 p'</span> <span class="kw">|</span> <span class="ex">./dlowe</span> <span class="kw">|</span> <span class="fu">tr</span> 876 tpo</span>
|
||||
<span id="cb10-14"><a href="#cb10-14" aria-hidden="true" tabindex="-1"></a><span class="ex">poot</span></span></code></pre></div>
|
||||
<h3 id="code-concept">Code Concept:</h3>
|
||||
<p>We all know that Perl and other VHLLs (very high level languages) are
|
||||
particularly well-suited for (among other things) string handling, I/O,
|
||||
and powerful built-in data types, and (relatively) poorly suited for
|
||||
number crunching and other processor-intensive tasks - areas where C is
|
||||
strongest. This program takes this knowledge to its extreme conclusion,
|
||||
using each language for its strengths. Thus, it uses Perl to read and
|
||||
parse input, for output, and for the easy-to-use list primitive, and
|
||||
uses C for mathematical operations. Since the rules of this contest
|
||||
state that the program must be generated by an ANSI C compiler, of
|
||||
course, the outer Perl layer is wrapped with a thin layer of C.</p>
|
||||
<p>We all know that Perl and other VHLLs (very high level languages)
|
||||
are particularly well-suited for (among other things) string
|
||||
handling, I/O, and powerful built-in data types, and (relatively)
|
||||
poorly suited for number crunching and other processor-intensive
|
||||
tasks - areas where C is strongest. This program takes this
|
||||
knowledge to its extreme conclusion, using each language for its
|
||||
strengths. Thus, it uses Perl to read and parse input, for output,
|
||||
and for the easy-to-use list primitive, and uses C for mathematical
|
||||
operations. Since the rules of this contest state that the program
|
||||
must be generated by an ANSI C compiler, of course, the outer Perl
|
||||
layer is wrapped with a thin layer of C.</p>
|
||||
<p>In case that wasn’t clear, in a nutshell: this program is C, calling
|
||||
embedded Perl (contained in a C string), which in turn calls back to C,
|
||||
which performs math on Perl data types and calls Perl functions for
|
||||
embedded Perl (contained in a C string), which in turn calls back to
|
||||
C, which performs math on Perl data types and calls Perl functions for
|
||||
error reporting.</p>
|
||||
<h3 id="requirements">Requirements:</h3>
|
||||
<p>Unfortunately, Perl is an evolving beast - that includes the
|
||||
embedding API and the XS API. The code was developed under
|
||||
<code>Perl 5.005_03</code>, successfully tested against
|
||||
<code>Perl 5.6.0</code>, <code>Perl 5.005_02</code> and
|
||||
<code>Perl 5.004_04</code>, and according to the version delta
|
||||
documentation, should work as-is with <code>Perl 5.002</code> and later
|
||||
(which has been around since February 1996). To clarify - it’s not the
|
||||
Perl code itself that may be non-portable, it’s the C code for embedding
|
||||
Perl and for calling C from Perl.</p>
|
||||
<code>Perl 5.005_03</code>, successfully tested against <code>Perl 5.6.0</code>, <code>Perl 5.005_02</code>
|
||||
and <code>Perl 5.004_04</code>, and according to the version delta documentation,
|
||||
should work as-is with <code>Perl 5.002</code> and later (which has been around
|
||||
since February 1996). To clarify - it’s not the Perl code itself
|
||||
that may be non-portable, it’s the C code for embedding Perl and for
|
||||
calling C from Perl.</p>
|
||||
<p>It is also important that Perl be installed cleanly and correctly.
|
||||
You may have problems linking if, for example, you have multiple
|
||||
overlapping versions of Perl installed (which might not be a problem for
|
||||
scripts, but causes problems with embedding the interpreter). More
|
||||
commonly, you may get non-fatal warnings from the linker, caused by
|
||||
slight mis-configurations of Perl on your system.</p>
|
||||
<p>Some compilers also complain that “third argument of
|
||||
<code>main()</code> is deprecated” or something to that effect. But in
|
||||
Perl prior to <code>5.6.0</code>, the header file “proto.h” actually had
|
||||
a prototype for <code>main()</code>, so applications which embed Perl
|
||||
must use the three argument form of <code>main()</code>.</p>
|
||||
overlapping versions of Perl installed (which might not be a problem
|
||||
for scripts, but causes problems with embedding the interpreter).
|
||||
More commonly, you may get non-fatal warnings from the linker, caused
|
||||
by slight mis-configurations of Perl on your system.</p>
|
||||
<p>Some compilers also complain that “third argument of <code>main()</code> is
|
||||
deprecated” or something to that effect. But in Perl prior to
|
||||
<code>5.6.0</code>, the header file “proto.h” actually had a prototype for <code>main()</code>, so
|
||||
applications which embed Perl must use the three argument form of <code>main()</code>.</p>
|
||||
<h3 id="aside-history">Aside: history…</h3>
|
||||
<p>Larry Wall wrote the original Perl in 1986-87, the same two
|
||||
successive years he won the IOCCC. I hope this program helps you to
|
||||
realize that this was no fluke - that Perl and Obfuscation are as
|
||||
inseparable as, say, camels and humps.</p>
|
||||
<p>Larry Wall wrote the original Perl in 1986-87, the same two successive
|
||||
years he won the IOCCC. I hope this program helps you to realize that
|
||||
this was no fluke - that Perl and Obfuscation are as inseparable as,
|
||||
say, camels and humps.</p>
|
||||
<h3 id="obfuscated">Obfuscated?</h3>
|
||||
<ul>
|
||||
<li><p>Reverse Polish notation is pretty strange, in and of
|
||||
itself.</p></li>
|
||||
<li><p>Reverse Polish notation is pretty strange, in and of itself.</p></li>
|
||||
<li><p>The layout of the program is three roughly symmetrical “stacks”
|
||||
of code. This layout is quite sensitive in places - my C indenter
|
||||
actually breaks the code by inserting spaces in certain places.</p></li>
|
||||
<li><p>Anyone who has ever programmed in Perl can attest to the fact
|
||||
that it is particularly well-suited to obfuscation; thus, the Perl is
|
||||
<li><p>Anyone who has ever programmed in Perl can attest to the fact that
|
||||
it is particularly well-suited to obfuscation; thus, the Perl is
|
||||
obfuscated. (Here’s my favorite legal Perl from this program:
|
||||
<code>_:$_=<>;</code> - but <code>$SS[$#SS]-=$SS[$#SS-1]</code>
|
||||
isn’t bad, either).</p></li>
|
||||
<code>_:$_=<>;</code> - but <code>$SS[$#SS]-=$SS[$#SS-1]</code> isn’t bad, either).</p></li>
|
||||
<li><p>I’ve eschewed traditional branch and loop structures such as
|
||||
<code>if</code> and <code>for</code>, in favor of their oft-neglected
|
||||
cousins, <code>goto</code> and <code>?:</code>, in both the Perl and C
|
||||
code.</p></li>
|
||||
<code>if</code> and <code>for</code>, in favor of their oft-neglected cousins, <code>goto</code>
|
||||
and <code>?:</code>, in both the Perl and C code.</p></li>
|
||||
<li><p>I’ve used some highly magical Perl incantations, such as symbolic
|
||||
references, the <code>goto &NAME</code> syntax,
|
||||
<code>AUTOLOAD</code> for exception handling, and abuse of the default
|
||||
scalar (<code>$_</code>).</p></li>
|
||||
references, the <code>goto &NAME</code> syntax, <code>AUTOLOAD</code> for exception handling,
|
||||
and abuse of the default scalar (<code>$_</code>).</p></li>
|
||||
<li><p>I’ve also deliberately used Perl syntax that is very much unlike
|
||||
C syntax: the <code>&NAME</code> rather than <code>NAME()</code>
|
||||
function calling syntax, leaving off parentheses wherever possible,
|
||||
using <code>print()</code> instead of <code>printf()</code>, and using
|
||||
the English style logic operators <code>and</code> and <code>or</code>
|
||||
rather than <code>&&</code> and <code>||</code>, for
|
||||
example.</p></li>
|
||||
C syntax: the <code>&NAME</code> rather than <code>NAME()</code> function calling syntax,
|
||||
leaving off parentheses wherever possible, using <code>print()</code> instead
|
||||
of <code>printf()</code>, and using the English style logic operators <code>and</code> and
|
||||
<code>or</code> rather than <code>&&</code> and <code>||</code>, for example.</p></li>
|
||||
<li><p>The fact that all the Perl code is in double-quotes doesn’t lend
|
||||
any readability to the regular expressions and quoted strings
|
||||
therein.</p></li>
|
||||
<li><p>The points and ways in which C and Perl connect are
|
||||
<em>really</em> obscure. They’re also incredibly poorly documented, as
|
||||
they’re primarily used in machine-generated code. However, there’s a
|
||||
wealth of example code on <a href="https://www.cpan.org">CPAN
|
||||
(www.cpan.org)</a>.</p></li>
|
||||
<li><p>The Perl API functions are almost all macros, so you will
|
||||
probably find that preprocessor expansion will only make things worse.
|
||||
They also have helpful, verbose names like <code>SvNV</code>,
|
||||
<code>SvIV</code>, and <code>newSVpv</code>. I couldn’t have done better
|
||||
myself!</p></li>
|
||||
<li><p>The points and ways in which C and Perl connect are <em>really</em>
|
||||
obscure. They’re also incredibly poorly documented, as they’re
|
||||
primarily used in machine-generated code. However, there’s a
|
||||
wealth of example code on <a href="https://www.cpan.org">CPAN (www.cpan.org)</a>.</p></li>
|
||||
<li><p>The Perl API functions are almost all macros, so you will probably
|
||||
find that preprocessor expansion will only make things worse. They
|
||||
also have helpful, verbose names like <code>SvNV</code>, <code>SvIV</code>, and <code>newSVpv</code>. I
|
||||
couldn’t have done better myself!</p></li>
|
||||
<li><p>Figuring out how the mathematical C functions get called is a bit
|
||||
tricky. Note the lack of explicit switching based on command
|
||||
input.</p></li>
|
||||
<li><p>Because of the “interesting” way that commands are interpreted,
|
||||
all of the commands have synonyms. For example, if you find it easier to
|
||||
remember, <code>=</code> is synonymous with <code>d</code>. This also
|
||||
makes it possible to write (even more) obfuscated reverse Polish
|
||||
commands (I figure this explanation moves the synonyms from ‘bug’ to
|
||||
all of the commands have synonyms. For example, if you find it
|
||||
easier to remember, <code>=</code> is synonymous with <code>d</code>. This also makes it
|
||||
possible to write (even more) obfuscated reverse Polish commands
|
||||
(I figure this explanation moves the synonyms from ‘bug’ to
|
||||
‘feature’!)</p></li>
|
||||
</ul>
|
||||
<p>. The first IOCCC entry with an “easter egg”?…</p>
|
||||
<h3 id="aside-on-unobfuscated-perl">Aside: on unobfuscated Perl</h3>
|
||||
<p>My original intent was to write obfuscated C and crystal-clear Perl,
|
||||
to highlight my bending of the rules. Unfortunately, Perl really doesn’t
|
||||
lend itself to crystal-clear code…</p>
|
||||
to highlight my bending of the rules. Unfortunately, Perl really
|
||||
doesn’t lend itself to crystal-clear code…</p>
|
||||
<h3 id="bending-the-rules">Bending the rules?</h3>
|
||||
<p>Well, the rules never state that you can’t embed another programming
|
||||
language, but on the other hand, knowing Perl probably isn’t high on the
|
||||
list of qualifications for judges… Oh dear, I guess your C beautifier
|
||||
won’t help too much, either ;)</p>
|
||||
language, but on the other hand, knowing Perl probably isn’t high on
|
||||
the list of qualifications for judges… Oh dear, I guess your C
|
||||
beautifier won’t help too much, either ;)</p>
|
||||
<p>If you don’t change the rules, it’ll be embedded Ada next year!</p>
|
||||
<h3 id="auto-defend">Auto defend</h3>
|
||||
<p>A. Isn’t this the obfuscated C contest? What’s this Perl
|
||||
<code>$#_&&$_</code>?</p>
|
||||
<p>D. Hey, this program <em>is</em> 100% C, and does not exec an
|
||||
external Perl interpreter. It simply links against the Perl language
|
||||
library. The “Perl code” is just a C string constant.</p>
|
||||
<p>A. Isn’t this the obfuscated C contest? What’s this Perl <code>$#_&&$_</code>?</p>
|
||||
<p>D. Hey, this program <em>is</em> 100% C, and does not exec an external Perl
|
||||
interpreter. It simply links against the Perl language library.
|
||||
The “Perl code” is just a C string constant.</p>
|
||||
<p>A. Perl isn’t portable enough, or ubiquitous enough.</p>
|
||||
<p>D. I’d argue that it is more portable than X. According to the Perl
|
||||
folks, it runs on the following platforms: Acorn, AIX, Amiga, AS/400,
|
||||
BeOS, Concurrent, Debian, DEC OSF/1, Digital UNIX, EPOC, FreeBSD,
|
||||
Guardian, HP-UX, IRIX, LinuxPPC, LynxOS, MacOS, MachTen, Minix, MPE/iX,
|
||||
MS-DOS, MVS, NetBSD, Netware, NextStep, OpenBSD, OpenLinux, ODT,
|
||||
OpenVMS, OS/2, OS390, OSR, PowerMAX, Psion, QNX, Redhat, Reliant UNIX,
|
||||
RISCOS, SCO, SGI, SINIX, Slackware, Solaris, Sun, SuSE, Tandem, Tru64,
|
||||
UNIX, U/WIN, Unixware, VMS, Win31, Win32, Windows 3.1, and Windows
|
||||
95/98/NT/2K. Granted, embeddable Perl isn’t quite so portable, but
|
||||
still…</p>
|
||||
<p>Also, Perl 5 is bundled with the following OS distributions: AIX
|
||||
4.3.3+, FreeBSD 3.0+, IRIX 6.4+, every Linux distribution, NetBSD,
|
||||
OpenBSD, and DEC Tru64 5.0+, again according to the Perl people.</p>
|
||||
<h2 id="copyright-and-cc-by-sa-4.0-license">Copyright and CC BY-SA 4.0
|
||||
License:</h2>
|
||||
<p>This file is Copyright (c) 2023 by Landon Curt Noll. All Rights
|
||||
Reserved. You are free to share and adapt this file under the terms of
|
||||
this license:</p>
|
||||
MS-DOS, MVS, NetBSD, Netware, NextStep, OpenBSD, OpenLinux, ODT, OpenVMS,
|
||||
OS/2, OS390, OSR, PowerMAX, Psion, QNX, Redhat, Reliant UNIX, RISCOS,
|
||||
SCO, SGI, SINIX, Slackware, Solaris, Sun, SuSE, Tandem, Tru64, UNIX,
|
||||
U/WIN, Unixware, VMS, Win31, Win32, Windows 3.1, and Windows 95/98/NT/2K.
|
||||
Granted, embeddable Perl isn’t quite so portable, but still…</p>
|
||||
<p>Also, Perl 5 is bundled with the following OS distributions: AIX 4.3.3+,
|
||||
FreeBSD 3.0+, IRIX 6.4+, every Linux distribution, NetBSD, OpenBSD, and
|
||||
DEC Tru64 5.0+, again according to the Perl people.</p>
|
||||
<h2 id="copyright-and-cc-by-sa-4.0-license">Copyright and CC BY-SA 4.0 License:</h2>
|
||||
<p>This file is Copyright (c) 2023 by Landon Curt Noll. All Rights Reserved.
|
||||
You are free to share and adapt this file under the terms of this license:</p>
|
||||
<pre><code>Creative Commons Attribution-ShareAlike 4.0 International (CC BY-SA 4.0)</code></pre>
|
||||
<p>For more information, see:
|
||||
https://creativecommons.org/licenses/by-sa/4.0/</p>
|
||||
<p>For more information, see: https://creativecommons.org/licenses/by-sa/4.0/</p>
|
||||
|
||||
<!-- END: this line ends content for HTML phase 21 by: bin/pandoc-wrapper.sh via bin/md2html.sh -->
|
||||
<!-- START: this line starts content for HTML phase 22 by: bin/output-index-inventory.sh via bin/md2html.sh -->
|
||||
|
||||
<!-- START: this line starts content generated by: bin/output-index-inventory.sh -->
|
||||
|
||||
<h1 id="inventory-for-2000dlowe"><a name="inventory"></a>Inventory for
|
||||
2000/dlowe</h1>
|
||||
<h1 id="inventory-for-2000dlowe"><a name="inventory"></a>Inventory for 2000/dlowe</h1>
|
||||
<p><a href="#top">Jump to top</a></p>
|
||||
<h2 id="primary-files">Primary files</h2>
|
||||
<ul>
|
||||
<li><a
|
||||
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2000/dlowe/dlowe.c">dlowe.c</a>
|
||||
- entry source</li>
|
||||
<li><a
|
||||
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2000/dlowe/Makefile">Makefile</a>
|
||||
- entry Makefile</li>
|
||||
<li><a
|
||||
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2000/dlowe/dlowe.orig.c">dlowe.orig.c</a>
|
||||
- original source</li>
|
||||
<li><a
|
||||
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2000/dlowe/try.sh">try.sh</a>
|
||||
- how to run</li>
|
||||
<li><a href="2000_dlowe.tar.bz2">2000_dlowe.tar.bz2</a> - download entry
|
||||
source</li>
|
||||
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2000/dlowe/dlowe.c">dlowe.c</a> - entry source</li>
|
||||
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2000/dlowe/Makefile">Makefile</a> - entry Makefile</li>
|
||||
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2000/dlowe/dlowe.orig.c">dlowe.orig.c</a> - original source</li>
|
||||
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2000/dlowe/try.sh">try.sh</a> - how to run</li>
|
||||
<li><a href="2000_dlowe.tar.bz2">2000_dlowe.tar.bz2</a> - download entry source</li>
|
||||
</ul>
|
||||
<h2 id="secondary-files">Secondary files</h2>
|
||||
<ul>
|
||||
<li><a href="index.html">index.html</a> - entry home page</li>
|
||||
<li><a
|
||||
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2000/dlowe/.entry.json">.entry.json</a>
|
||||
- description of entry in JSON</li>
|
||||
<li><a
|
||||
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2000/dlowe/.gitignore">.gitignore</a>
|
||||
- list of files that should not be committed under git</li>
|
||||
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2000/dlowe/.entry.json">.entry.json</a> - description of entry in JSON</li>
|
||||
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2000/dlowe/.gitignore">.gitignore</a> - list of files that should not be committed under git</li>
|
||||
<li><a href=".path">.path</a> - directory path from top directory</li>
|
||||
<li><a
|
||||
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2000/dlowe/README.md">README.md</a>
|
||||
- markdown source for index.html</li>
|
||||
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2000/dlowe/README.md">README.md</a> - markdown source for index.html</li>
|
||||
</ul>
|
||||
|
||||
<!-- END: next line ends content generated by: bin/output-index-inventory.sh -->
|
||||
|
||||
+59
-85
@@ -123,17 +123,14 @@
|
||||
<!-- END: this line ends content from: inc/before-content.default.html -->
|
||||
<!-- START: this line starts content for HTML phase 21 by: bin/pandoc-wrapper.sh via bin/md2html.sh -->
|
||||
|
||||
<h1 id="fifteenth-international-obfuscated-c-code-contest">Fifteenth
|
||||
International Obfuscated C Code Contest</h1>
|
||||
<h1 id="fifteenth-international-obfuscated-c-code-contest">Fifteenth International Obfuscated C Code Contest</h1>
|
||||
<h2 id="standard-ioccc-stuff">Standard IOCCC stuff</h2>
|
||||
<p>View the <code>index.html</code> web page for the given winning entry
|
||||
for information on how on how to compile it and how to run the winning
|
||||
program. Look at the winning source and try to figure how it does what
|
||||
it does! You may then wish to look at the Author’s remarks for even more
|
||||
details.</p>
|
||||
<p>Use <code>make</code> to compile entries. It is possible that on
|
||||
non-Unix / non-Linux systems the Makefile needs to be changed. See the
|
||||
Makefile for details.</p>
|
||||
<p>View the <code>index.html</code> web page for the given winning entry for information on how
|
||||
on how to compile it and how to run the winning program.
|
||||
Look at the winning source and try to figure how it does what it does!
|
||||
You may then wish to look at the Author’s remarks for even more details.</p>
|
||||
<p>Use <code>make</code> to compile entries. It is possible that on non-Unix / non-Linux
|
||||
systems the Makefile needs to be changed. See the Makefile for details.</p>
|
||||
<p>Read over the Makefile for compile/build issues. Your system may
|
||||
require certain changes (add or remove a library, add or remove a
|
||||
<code>#define</code>).</p>
|
||||
@@ -141,107 +138,84 @@ require certain changes (add or remove a library, add or remove a
|
||||
yours is lacking, you may need to compile using gcc instead of your
|
||||
local compiler.</p>
|
||||
<h2 id="new-judge">New Judge</h2>
|
||||
<p>The judges were unable to contact Jeremy Horn for judging the 2000
|
||||
contest.</p>
|
||||
<p>As a result, <a href="http://www.sfik.com/">Simon Cooper</a> joined
|
||||
our team. Simon is well known for being a co-author of the 2nd edition
|
||||
of the Building Internet Firewalls book.</p>
|
||||
<h2 id="remarks-on-some-of-the-entries">Remarks on some of the
|
||||
entries</h2>
|
||||
<p>The judges were unable to contact Jeremy Horn for judging the 2000 contest.</p>
|
||||
<p>As a result, <a href="http://www.sfik.com/">Simon Cooper</a> joined our team. Simon is
|
||||
well known for being a co-author of the 2nd edition of the Building Internet
|
||||
Firewalls book.</p>
|
||||
<h2 id="remarks-on-some-of-the-entries">Remarks on some of the entries</h2>
|
||||
<p>There were some outstanding entries that did not win. Unfortunately
|
||||
some very good entries lost because they:</p>
|
||||
<ul>
|
||||
<li>depended too much on non-portable side effects in expressions;</li>
|
||||
<li>depended too much on a particular byte order;</li>
|
||||
<li>required the use of a special script, data file or pseudo-machine
|
||||
language that was not supplied with the entry.</li>
|
||||
<li>required the use of a special script, data file or pseudo-machine language
|
||||
that was not supplied with the entry.</li>
|
||||
</ul>
|
||||
<p>We hope the authors of some of those entries will fix and re-submit
|
||||
them for the next IOCCC.</p>
|
||||
<p>We believe you will be impressed with this year’s winning entries.
|
||||
The <a href="jarijyrki/index.html">Best of Show</a> is a fine example of
|
||||
compact obfuscation. But don’t ignore the shorter entries. The <a
|
||||
href="natori/index.html">Best Small Program</a>, <a
|
||||
href="briddlebane/README.m">Best Abuse of User</a> and <a
|
||||
href="tomx/index.html">Most Complete Program</a> are well worth studying
|
||||
in detail.</p>
|
||||
<p>The <a href="dlowe/index.html">Worst Abuse of the Rules</a> is
|
||||
technically allowed by the rules. We gave it an award this year, but
|
||||
don’t assume you can get away with using it next time … :-)</p>
|
||||
<p>Speaking of time, be sure to check out the <a
|
||||
href="rince/index.html">Astronomically Obfuscated</a> and the <a
|
||||
href="schneiderwent/index.html">Most Timely Output</a> entries.</p>
|
||||
<p>We believe you will be impressed with this year’s winning entries. The <a href="jarijyrki/index.html">Best of
|
||||
Show</a> is a fine example of compact obfuscation. But don’t
|
||||
ignore the shorter entries. The <a href="natori/index.html">Best Small Program</a>, <a href="briddlebane/README.m">Best
|
||||
Abuse of User</a> and <a href="tomx/index.html">Most Complete Program</a>
|
||||
are well worth studying in detail.</p>
|
||||
<p>The <a href="dlowe/index.html">Worst Abuse of the Rules</a> is technically allowed by the
|
||||
rules. We gave it an award this year, but don’t assume you can get away with
|
||||
using it next time … :-)</p>
|
||||
<p>Speaking of time, be sure to check out the <a href="rince/index.html">Astronomically
|
||||
Obfuscated</a> and the <a href="schneiderwent/index.html">Most Timely
|
||||
Output</a> entries.</p>
|
||||
<h2 id="there-was-no-1999-contest">There was no 1999 contest</h2>
|
||||
<p>So what happened to 1999? Landon Curt Noll was scheduled to take a
|
||||
vacation from the IOCCC this year. The remaining judges were unable to
|
||||
contact Jeremy Horn, so the IOCCC stalled.</p>
|
||||
<p>But thanks to Landon’s returning early from his IOCCC vacation
|
||||
(Landon will take a full IOCCC vacation during some other year), Simon
|
||||
Cooper joining the IOCCC judging team as well as the hard work of Peter
|
||||
Seebach and Leonid A. Broukhis the judging was completed in Dec
|
||||
2000.</p>
|
||||
vacation from the IOCCC this year. The remaining judges were
|
||||
unable to contact Jeremy Horn, so the IOCCC stalled.</p>
|
||||
<p>But thanks to Landon’s returning early from his IOCCC vacation (Landon
|
||||
will take a full IOCCC vacation during some other year), Simon Cooper
|
||||
joining the IOCCC judging team as well as the hard work of Peter Seebach
|
||||
and Leonid A. Broukhis the judging was completed in Dec 2000.</p>
|
||||
<p>It was decided that the 15th contest would be the year 2000 contest
|
||||
(the year the judging completed) rather than year 1999 (the initial
|
||||
scheduled start of the contest). That is why there is no 1999
|
||||
contest.</p>
|
||||
<p><strong>NOTE</strong>: The above has been mentioned in an Amici
|
||||
Curiae for the DeCSS case. See <a
|
||||
href="https://web.archive.org/web/20231021211330/http://cryptome.org/mpaa-v-2600-bac.htm">BRIEF
|
||||
OF AMICI CURIAE N SUPPORT OF APPELLANTS AND REVERSAL ..</a>.</p>
|
||||
scheduled start of the contest). That is why there is no 1999 contest.</p>
|
||||
<p><strong>NOTE</strong>: The above has been mentioned in an Amici Curiae for the
|
||||
DeCSS case. See <a href="https://web.archive.org/web/20231021211330/http://cryptome.org/mpaa-v-2600-bac.htm">BRIEF OF AMICI CURIAE N SUPPORT OF APPELLANTS AND
|
||||
REVERSAL ..</a>.</p>
|
||||
<h2 id="final-comments">Final Comments</h2>
|
||||
<p>Please send us comments and suggestions what we have expressed above.
|
||||
Also include anything else that you would like to see in future
|
||||
contests. Send such email to:</p>
|
||||
Also include anything else that you would like to see in future contests.
|
||||
Send such email to:</p>
|
||||
<pre><code>questions@ioccc.org</code></pre>
|
||||
<p><strong>IMPORTANT NOTE</strong>: The email addresses found above are
|
||||
for historical purposes only, and should not be used today. See <a
|
||||
href="../contact.html">contact.html</a> for up to date contact details
|
||||
as well as details on how to provide fixes to any of the entries. See
|
||||
also <a href="../faq.html">the IOCCC FAQ</a> for addition information on
|
||||
the IOCCC.</p>
|
||||
<p><strong>IMPORTANT NOTE</strong>: The email addresses found above are for historical
|
||||
purposes only, and should not be used today. See
|
||||
<a href="../contact.html">contact.html</a> for up to date contact details
|
||||
as well as details on how to provide fixes to any of the entries.
|
||||
See also <a href="../faq.html">the IOCCC FAQ</a> for addition information on the IOCCC.</p>
|
||||
<h1 id="copyright-and-license">Copyright and License</h1>
|
||||
<p>Copyright (c) 2000,2023, Landon Curt Noll, Peter Seebach and Leonid
|
||||
A. Broukhis. All Rights Reserved. This work is licensed under a <a
|
||||
href="https://creativecommons.org/licenses/by-sa/4.0/">Creative Commons
|
||||
CC BY-SA 4.0 DEED Attribution-ShareAlike 4.0 International</a> license.
|
||||
If you do use this work in some form, the <a href="../judges.html">IOCCC
|
||||
judges</a> would appreciate (but does not require) if you were to <a
|
||||
href="../contact.html">send us a note about your use</a>.</p>
|
||||
<p>Copyright (c) 2000,2023, Landon Curt Noll, Peter Seebach and Leonid A. Broukhis. All Rights Reserved.
|
||||
This work is licensed under a <a href="https://creativecommons.org/licenses/by-sa/4.0/">Creative Commons CC BY-SA 4.0 DEED Attribution-ShareAlike
|
||||
4.0 International</a> license.
|
||||
If you do use this work in some form, the <a href="../judges.html">IOCCC judges</a> would appreciate
|
||||
(but does not require) if you were to <a href="../contact.html">send us a note about your use</a>.</p>
|
||||
|
||||
<!-- END: this line ends content for HTML phase 21 by: bin/pandoc-wrapper.sh via bin/md2html.sh -->
|
||||
<!-- START: this line starts content for HTML phase 22 by: bin/output-year-index.sh via bin/md2html.sh -->
|
||||
|
||||
<!-- START: this line starts content generated by: bin/output-year-index.sh -->
|
||||
|
||||
<h1
|
||||
id="winning-entries-of-2000---the-15th-ioccc"><a name=inventory></a><a name=2000></a>Winning
|
||||
Entries of 2000 - The 15th IOCCC</h1>
|
||||
<p><strong>Download IOCCC</strong> <a
|
||||
href="2000/ioccc.2000.tar.bz2">2000 entry source</a></p>
|
||||
<h1 id="winning-entries-of-2000---the-15th-ioccc"><a name=inventory></a><a name=2000></a>Winning Entries of 2000 - The 15th IOCCC</h1>
|
||||
<p><strong>Download IOCCC</strong> <a href="2000/ioccc.2000.tar.bz2">2000 entry source</a></p>
|
||||
<ul>
|
||||
<li><a href="anderson/index.html">2000/anderson</a> - Best Use of
|
||||
Flags</li>
|
||||
<li><a href="bellard/index.html">2000/bellard</a> - Most Specific
|
||||
Output</li>
|
||||
<li><a href="anderson/index.html">2000/anderson</a> - Best Use of Flags</li>
|
||||
<li><a href="bellard/index.html">2000/bellard</a> - Most Specific Output</li>
|
||||
<li><a href="bmeyer/index.html">2000/bmeyer</a> - Best Utility</li>
|
||||
<li><a href="briddlebane/index.html">2000/briddlebane</a> - Best Abuse
|
||||
of User</li>
|
||||
<li><a href="briddlebane/index.html">2000/briddlebane</a> - Best Abuse of User</li>
|
||||
<li><a href="dhyang/index.html">2000/dhyang</a> - Best Layout</li>
|
||||
<li><a href="dlowe/index.html">2000/dlowe</a> - Worst Abuse of the
|
||||
Rules</li>
|
||||
<li><a href="jarijyrki/index.html">2000/jarijyrki</a> - Best of
|
||||
Show</li>
|
||||
<li><a href="natori/index.html">2000/natori</a> - Best Small
|
||||
Program</li>
|
||||
<li><a href="primenum/index.html">2000/primenum</a> - Best Abuse of
|
||||
CPP</li>
|
||||
<li><a href="rince/index.html">2000/rince</a> - Astronomically
|
||||
Obfuscated</li>
|
||||
<li><a href="dlowe/index.html">2000/dlowe</a> - Worst Abuse of the Rules</li>
|
||||
<li><a href="jarijyrki/index.html">2000/jarijyrki</a> - Best of Show</li>
|
||||
<li><a href="natori/index.html">2000/natori</a> - Best Small Program</li>
|
||||
<li><a href="primenum/index.html">2000/primenum</a> - Best Abuse of CPP</li>
|
||||
<li><a href="rince/index.html">2000/rince</a> - Astronomically Obfuscated</li>
|
||||
<li><a href="robison/index.html">2000/robison</a> - Best game</li>
|
||||
<li><a href="schneiderwent/index.html">2000/schneiderwent</a> - Most
|
||||
Timely Output</li>
|
||||
<li><a href="thadgavin/index.html">2000/thadgavin</a> - Most Portable
|
||||
Output</li>
|
||||
<li><a href="schneiderwent/index.html">2000/schneiderwent</a> - Most Timely Output</li>
|
||||
<li><a href="thadgavin/index.html">2000/thadgavin</a> - Most Portable Output</li>
|
||||
<li><a href="tomx/index.html">2000/tomx</a> - Most Complete Program</li>
|
||||
</ul>
|
||||
<p> <strong>Jump to:</strong> <a href="#">top</a></p>
|
||||
|
||||
+163
-215
@@ -130,11 +130,11 @@
|
||||
<h2 id="authors"><a name="author"></a>Authors:</h2>
|
||||
<ul>
|
||||
<li>Name: <a href="../../authors.html#Jari_Arkko">Jari Arkko</a><br>
|
||||
Location: <a href="../../location.html#SE">SE</a> - <em>Kingdom of
|
||||
Sweden</em> (<em>Sweden</em>) <br><br></li>
|
||||
<li>Name: <a href="../../authors.html#Jyrki_Holopainen">Jyrki
|
||||
Holopainen</a><br> Location: <a href="../../location.html#FI">FI</a> -
|
||||
<em>Republic of Finland </em> (<em>Finland</em>) <br><br></li>
|
||||
Location: <a href="../../location.html#SE">SE</a> - <em>Kingdom of Sweden</em> (<em>Sweden</em>)
|
||||
<br><br></li>
|
||||
<li>Name: <a href="../../authors.html#Jyrki_Holopainen">Jyrki Holopainen</a><br>
|
||||
Location: <a href="../../location.html#FI">FI</a> - <em>Republic of Finland </em> (<em>Finland</em>)
|
||||
<br><br></li>
|
||||
</ul>
|
||||
|
||||
<!-- END: next line ends content generated by: bin/output-index-author.sh -->
|
||||
@@ -144,12 +144,10 @@ Holopainen</a><br> Location: <a href="../../location.html#FI">FI</a> -
|
||||
|
||||
<h2 id="to-build">To build:</h2>
|
||||
<div class="sourceCode" id="cb1"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb1-1"><a href="#cb1-1" aria-hidden="true" tabindex="-1"></a><span class="fu">make</span></span></code></pre></div>
|
||||
<p>You will need X11 header files and libraries installed to build this
|
||||
program.</p>
|
||||
<p>You will need X11 header files and libraries installed to build this program.</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">./jarijyrki</span> <span class="op"><</span> infile.info <span class="op">></span> outfile.info</span></code></pre></div>
|
||||
<p>You will need a system capable of displaying the results of X Window
|
||||
programs.</p>
|
||||
<p>You will need a system capable of displaying the results of X Window programs.</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">./jarijyrki</span> <span class="op"><</span> finance.sheet <span class="op">></span> myedits.info</span></code></pre></div>
|
||||
<p>Then click on cell <code>C3</code> and type in the following:</p>
|
||||
@@ -160,23 +158,21 @@ programs.</p>
|
||||
<p>Now try running:</p>
|
||||
<pre><code>./jarijyrki < myedits.info</code></pre>
|
||||
<p>And observe that it matches what you had in the previous run!</p>
|
||||
<p>NOTE: changing the dimension parameters (see the authors’ remarks)
|
||||
renders existing spreadsheet files unusable.</p>
|
||||
<p>NOTE: changing the dimension parameters (see the authors’ remarks) renders
|
||||
existing spreadsheet files unusable.</p>
|
||||
<h2 id="judges-remarks">Judges’ remarks:</h2>
|
||||
<p>This entry is one of those that makes you wonder why some commercial
|
||||
software needs tens to hundreds of <strike>megabytes</strike>gigabytes
|
||||
to install! This entry does not simply do the basics, it includes
|
||||
graphing features. All this program needs now is a <a
|
||||
href="../../1998/banks/index.html">1998/banks</a> flight simulator!</p>
|
||||
<p>This entry is one of those that makes you wonder why some commercial software
|
||||
needs tens to hundreds of <strike>megabytes</strike>gigabytes to install! This
|
||||
entry does not simply do the basics, it includes graphing features. All this
|
||||
program needs now is a <a href="../../1998/banks/index.html">1998/banks</a> flight simulator!</p>
|
||||
<h2 id="authors-remarks">Author’s remarks:</h2>
|
||||
<h3 id="overview">1. OVERVIEW</h3>
|
||||
<p>This program is an X-Windows based spreadsheet program. The main
|
||||
functions it supports are:</p>
|
||||
<p>This program is an X-Windows based spreadsheet program. The main functions it
|
||||
supports are:</p>
|
||||
<ul>
|
||||
<li>Text cells</li>
|
||||
<li>Numeric cells</li>
|
||||
<li>Arithmetic operations: <code>+</code> <code>-</code> <code>*</code>
|
||||
<code>/</code></li>
|
||||
<li>Arithmetic operations: <code>+</code> <code>-</code> <code>*</code> <code>/</code></li>
|
||||
<li>Pie charts</li>
|
||||
<li>Histograms</li>
|
||||
<li>Cell editing</li>
|
||||
@@ -199,9 +195,8 @@ functions it supports are:</p>
|
||||
<h5 id="movement">Movement</h5>
|
||||
<p>Click the mouse or use the arrow keys.</p>
|
||||
<h5 id="editing">Editing</h5>
|
||||
<p>The currently selected cell is always in the edit state. Press any
|
||||
key to add a character at the end of the formula; press backspace to
|
||||
delete the last one.</p>
|
||||
<p>The currently selected cell is always in the edit state. Press any key to add a
|
||||
character at the end of the formula; press backspace to delete the last one.</p>
|
||||
<h5 id="formulas">Formulas</h5>
|
||||
<pre><code>123.45
|
||||
A1 A2 +
|
||||
@@ -214,116 +209,95 @@ D1 D2 /</code></pre>
|
||||
<h5 id="histograms">Histograms</h5>
|
||||
<pre><code>A1 A2 A3 ...</code></pre>
|
||||
<p>Finish the formula with <code>!</code> to create the histogram.</p>
|
||||
<h4 id="starting-and-loading-spreadsheets">2.2. Starting and Loading
|
||||
Spreadsheets</h4>
|
||||
<p>To start the spreadsheet program with an existing spreadsheet, for
|
||||
instance <a href="finance.sheet">finance.sheet</a>, use the following
|
||||
<h4 id="starting-and-loading-spreadsheets">2.2. Starting and Loading Spreadsheets</h4>
|
||||
<p>To start the spreadsheet program with an existing
|
||||
spreadsheet, for instance <a href="finance.sheet">finance.sheet</a>, use the following
|
||||
command line:</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">./jarijyrki</span> <span class="op"><</span> finance.sheet</span></code></pre></div>
|
||||
<p>The file <a href="finance.sheet">finance.sheet</a> has been provided
|
||||
as an example. This file contains a set of financial numbers and two
|
||||
graphical entities - a pie chart and a histogram - based on them. We
|
||||
recommend starting the use of the program from this file, as a way to
|
||||
study and learn the formula language supported by the program.</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">./jarijyrki</span> <span class="op"><</span> finance.sheet</span></code></pre></div>
|
||||
<p>The file <a href="finance.sheet">finance.sheet</a> has been provided as an example. This
|
||||
file contains a set of financial numbers and two graphical entities - a pie
|
||||
chart and a histogram - based on them. We recommend starting the use of the
|
||||
program from this file, as a way to study and learn the formula language
|
||||
supported by the program.</p>
|
||||
<p>To start the program with an empty sheet, use</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">./jarijyrki</span> <span class="op"><</span> /dev/null</span></code></pre></div>
|
||||
<p>Alternatively, <code>/dev/zero</code> could be used but that may not
|
||||
exist on all systems.</p>
|
||||
<h4 id="exiting-and-saving-spreadsheets">2.3. Exiting and Saving
|
||||
Spreadsheets</h4>
|
||||
<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">./jarijyrki</span> <span class="op"><</span> /dev/null</span></code></pre></div>
|
||||
<p>Alternatively, <code>/dev/zero</code> could be used but that may not exist on all systems.</p>
|
||||
<h4 id="exiting-and-saving-spreadsheets">2.3. Exiting and Saving Spreadsheets</h4>
|
||||
<p>Normally the user obviously wants to edit the spreadsheet. After the
|
||||
spreadsheet program finishes, it outputs the edited spreadsheet to the
|
||||
standard output. Hence, when the spreadsheet window has come up, you’ve
|
||||
made your changes, and you press the ESC key the program finishes. To
|
||||
save the results in a file, the following typical command line would be
|
||||
used:</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">./jarijyrki</span> <span class="op"><</span> finance.sheet <span class="op">></span> myedits.info</span></code></pre></div>
|
||||
spreadsheet program finishes, it outputs the edited spreadsheet to the standard
|
||||
output. Hence, when the spreadsheet window has come up, you’ve made your
|
||||
changes, and you press the ESC key the program finishes. To save the results in
|
||||
a file, the following typical command line would be used:</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">./jarijyrki</span> <span class="op"><</span> finance.sheet <span class="op">></span> myedits.info</span></code></pre></div>
|
||||
<h4 id="visual-overview">2.4. Visual Overview</h4>
|
||||
<p>On top of the window the Formula Area shows the formula (or text) of
|
||||
the currently selected cell. The program starts with <code>A1</code> as
|
||||
being the current cell. Below the Formula Area is the Column Letters
|
||||
Area: <code>A</code>, <code>B</code>, and so on. Correspondingly, on the
|
||||
left side of the window is the Row Numbers Area: <code>1</code>,
|
||||
<code>2</code>, and so on. The rest of the window is dedicated to the
|
||||
actual spreadsheet cells.</p>
|
||||
<p>The example spreadsheet, <a href="finance.sheet">finance.sheet</a>,
|
||||
provided with this program contains two sets of numbers in the visible
|
||||
area of the spreadsheet. The top set of numbers forms the
|
||||
product-by-product turnover breakdown of an imaginary company. Below it
|
||||
is the yearly development of the company profits. On the top right
|
||||
corner is a pie chart showing the turnover breakdown in graphical form,
|
||||
and on the bottom right corner is a histogram showing the yearly
|
||||
development. If you scroll the window you can see additional data from
|
||||
the spreadsheet.</p>
|
||||
<p>On top of the window the Formula Area shows the formula (or text) of the
|
||||
currently selected cell. The program starts with <code>A1</code> as being the current cell.
|
||||
Below the Formula Area is the Column Letters Area: <code>A</code>, <code>B</code>, and so on.
|
||||
Correspondingly, on the left side of the window is the Row Numbers Area: <code>1</code>, <code>2</code>,
|
||||
and so on. The rest of the window is dedicated to the actual spreadsheet cells.</p>
|
||||
<p>The example spreadsheet, <a href="finance.sheet">finance.sheet</a>, provided with this
|
||||
program contains two sets of numbers in the visible area of the spreadsheet. The
|
||||
top set of numbers forms the product-by-product turnover breakdown of an
|
||||
imaginary company. Below it is the yearly development of the company profits. On
|
||||
the top right corner is a pie chart showing the turnover breakdown in graphical
|
||||
form, and on the bottom right corner is a histogram showing the yearly
|
||||
development. If you scroll the window you can see additional data from the
|
||||
spreadsheet.</p>
|
||||
<h4 id="movement-and-scrolling">2.5. Movement and Scrolling</h4>
|
||||
<p>Use arrow keys to move left, right, up, and down among the cells. You
|
||||
may also click the mouse on a cell to cause it to be activated as the
|
||||
current one.</p>
|
||||
<p>Note that it is not possible to move around the formula; the formula
|
||||
can only be edited from its end by adding or removing characters.</p>
|
||||
<p>Going beyond the borders of the window results in scrolling the
|
||||
current view. It is not possible to go up from the first row or left
|
||||
from the first column; but it is possible to wrap back to start from the
|
||||
last row and last column.</p>
|
||||
<p>Use arrow keys to move left, right, up, and down among the cells. You may also
|
||||
click the mouse on a cell to cause it to be activated as the current one.</p>
|
||||
<p>Note that it is not possible to move around the formula; the formula can only be
|
||||
edited from its end by adding or removing characters.</p>
|
||||
<p>Going beyond the borders of the window results in scrolling the current view. It
|
||||
is not possible to go up from the first row or left from the first column; but it is
|
||||
possible to wrap back to start from the last row and last column.</p>
|
||||
<h4 id="formulas-1">2.6. Formulas</h4>
|
||||
<p>The spreadsheet formulas operate on a stack. Operands of an operation
|
||||
(e.g. plus) are first pushed to the stack and then the operation is
|
||||
performed. If a formula on a cell produces <em>exactly</em> one result
|
||||
then that is shown in the cell. Otherwise, the formula is interpreted as
|
||||
a string and shown as it is.</p>
|
||||
<p>The spreadsheet formulas operate on a stack. Operands of an operation (e.g.
|
||||
plus) are first pushed to the stack and then the operation is performed. If a
|
||||
formula on a cell produces <em>exactly</em> one result then that is shown in the cell.
|
||||
Otherwise, the formula is interpreted as a string and shown as it is.</p>
|
||||
<p>An example of a simple formula, simply specifying a number is</p>
|
||||
<pre><code>123.50</code></pre>
|
||||
<p>Another simple formula refers to a cell:</p>
|
||||
<pre><code>A1</code></pre>
|
||||
<p>This particular example formula referred to the first cell of the
|
||||
first row in the spreadsheet. Arithmetic operations require both
|
||||
arguments:</p>
|
||||
<p>This particular example formula referred to the first cell of the first row in
|
||||
the spreadsheet. Arithmetic operations require both arguments:</p>
|
||||
<pre><code>A1 A2 +
|
||||
B1 B2 *
|
||||
C1 C2 -
|
||||
D1 D2 /</code></pre>
|
||||
<p>More complex formulae can be constructed by combining these simple
|
||||
ones:</p>
|
||||
<p>More complex formulae can be constructed by combining these simple ones:</p>
|
||||
<pre><code>A1 A2 + 2 *</code></pre>
|
||||
<p>This example calculates the sum of the cells <code>A1</code> and
|
||||
<code>A2</code>, and then multiplies the result by two.</p>
|
||||
<p>The currently selected cell is always in a state where it can be
|
||||
edited. Press any key to add a character at the end of the formula;
|
||||
press backspace to delete the last character. Any resulting
|
||||
recalculations are immediately visible. (Note how much nicer this
|
||||
feature is as you get used to it, compared to the behaviour of certain
|
||||
commercial spreadsheet programs.)</p>
|
||||
<p>This example calculates the sum of the cells <code>A1</code> and <code>A2</code>, and then multiplies
|
||||
the result by two.</p>
|
||||
<p>The currently selected cell is always in a state where it can be edited. Press
|
||||
any key to add a character at the end of the formula; press backspace to delete
|
||||
the last character. Any resulting recalculations are immediately visible. (Note
|
||||
how much nicer this feature is as you get used to it, compared to the behaviour
|
||||
of certain commercial spreadsheet programs.)</p>
|
||||
<h4 id="graphical-formulas">2.7. Graphical Formulas</h4>
|
||||
<p>The program supports two types of graphical representations of the
|
||||
data in the cells: pie charts and histograms. The pie chart can consist
|
||||
of any number of slices, and is constructed by putting the pie amounts
|
||||
in stack and using the <code>@</code> operator. The program
|
||||
automatically computes the relative size of the slices.</p>
|
||||
<p>The program supports two types of graphical representations of the data in the
|
||||
cells: pie charts and histograms. The pie chart can consist of any number of
|
||||
slices, and is constructed by putting the pie amounts in stack and using the <code>@</code>
|
||||
operator. The program automatically computes the relative size of the slices.</p>
|
||||
<pre><code>A1 A2 A3 A4 @</code></pre>
|
||||
<p>This example would draw a pie chart of four cells, <code>A1</code> to
|
||||
<code>A4</code>. The pie formula is shown above the pie for
|
||||
reference.</p>
|
||||
<p>The histograms are drawn in a similar manner, by using the
|
||||
<code>!</code> operator:</p>
|
||||
<p>This example would draw a pie chart of four cells, <code>A1</code> to <code>A4</code>.
|
||||
The pie formula is shown above the pie for reference.</p>
|
||||
<p>The histograms are drawn in a similar manner, by using the <code>!</code> operator:</p>
|
||||
<pre><code>A1 A2 A3 A3 !</code></pre>
|
||||
<h4 id="errors-in-formulas">2.8. Errors in Formulas</h4>
|
||||
<p>The program detects recursive reference attempts, references cells
|
||||
not containing a numerical value, attempts to define formulas with zero,
|
||||
two, or more results remaining on the stack, and syntax errors of
|
||||
formulas. Note that typically as the user types in a formula, it toggles
|
||||
between valid and invalid forms dynamically as all single character
|
||||
changes are immediately taken in account. This is not dangerous, just
|
||||
complete the formula and view the results.</p>
|
||||
<p>Errors are signalled by showing the formula on a cell instead of the
|
||||
numerical value supposedly returned by it.</p>
|
||||
<p>The program detects recursive reference attempts, references cells not
|
||||
containing a numerical value, attempts to define formulas with zero, two, or
|
||||
more results remaining on the stack, and syntax errors of formulas. Note that
|
||||
typically as the user types in a formula, it toggles between valid and invalid
|
||||
forms dynamically as all single character changes are immediately taken in
|
||||
account. This is not dangerous, just complete the formula and view the results.</p>
|
||||
<p>Errors are signalled by showing the formula on a cell instead of the numerical
|
||||
value supposedly returned by it.</p>
|
||||
<p>Division by zero results in an IEEE Inf number.</p>
|
||||
<h4 id="compilation-parameters-and-configuration">2.9. Compilation
|
||||
Parameters and Configuration</h4>
|
||||
<p>This section explains the meaning and rationale for the compile time
|
||||
parameters:</p>
|
||||
<h4 id="compilation-parameters-and-configuration">2.9. Compilation Parameters and Configuration</h4>
|
||||
<p>This section explains the meaning and rationale for the
|
||||
compile time parameters:</p>
|
||||
<hr />
|
||||
<pre><code>-DC=XK_Up
|
||||
-DL=XK_Down
|
||||
@@ -331,145 +305,119 @@ parameters:</p>
|
||||
-DV=XK_Right
|
||||
-DR=XK_Escape
|
||||
-D_=XK_BackSpace</code></pre>
|
||||
<p>These definitions can be used to change the user interface of the
|
||||
program with respect to special keys. The first four define the movement
|
||||
operations and the latter two define the program termination and
|
||||
character deletion keys. Typical modifications to these parameters
|
||||
include changing character deletion to the key the user is most familiar
|
||||
with, which could also be <code>XK_Delete</code>. <code>XK_Escape</code>
|
||||
might be better in some cases as one of the function keys. Likewise for
|
||||
the arrow keys.</p>
|
||||
<p>These definitions can be used to change the user interface of the program with
|
||||
respect to special keys. The first four define the movement operations and
|
||||
the latter two define the program termination and character deletion keys.
|
||||
Typical modifications to these parameters include changing character deletion to
|
||||
the key the user is most familiar with, which could also be <code>XK_Delete</code>.
|
||||
<code>XK_Escape</code> might be better in some cases as one of the function keys. Likewise
|
||||
for the arrow keys.</p>
|
||||
<pre><code>-DU=40</code></pre>
|
||||
<p>This parameter defines the maximum dimensions of the stored and
|
||||
handled spreadsheet (but see section 4.4 for a warning about changing
|
||||
this without thinking about the consequences!).</p>
|
||||
<p>This parameter defines the maximum dimensions of the stored and handled
|
||||
spreadsheet (but see section 4.4 for a warning about changing this without
|
||||
thinking about the consequences!).</p>
|
||||
<pre><code>-DT=98</code></pre>
|
||||
<p>This parameter defines the maximum length of a formula in one cell.
|
||||
Note the warning in section 4.4.</p>
|
||||
<p>This parameter defines the maximum length of a formula in one cell. Note the
|
||||
warning in section 4.4.</p>
|
||||
<pre><code>-Dz="(T+1)*U*U"</code></pre>
|
||||
<p>Defines the number of bytes in a spreadsheet file. The number is
|
||||
automatically adjusted when the spreadsheet size parameters are changed.
|
||||
Note the warning in section 4.4.</p>
|
||||
<p>Defines the number of bytes in a spreadsheet file. The number is automatically
|
||||
adjusted when the spreadsheet size parameters are changed. Note the warning in
|
||||
section 4.4.</p>
|
||||
<pre><code>-DQ=80
|
||||
-DS=20</code></pre>
|
||||
<p>These two parameters define the visual dimensions of a cell. Changing
|
||||
these may be necessary on your system if the default font sizes differ
|
||||
from those in the systems we’ve tested the program with. <code>S</code>
|
||||
also defines the size of the left (<code>x1</code>) and top margins
|
||||
(<code>x2</code>).</p>
|
||||
<p>These two parameters define the visual dimensions of a cell. Changing these may
|
||||
be necessary on your system if the default font sizes differ from those in the
|
||||
systems we’ve tested the program with. <code>S</code> also defines the size of the left
|
||||
(<code>x1</code>) and top margins (<code>x2</code>).</p>
|
||||
<pre><code>-DN=10</code></pre>
|
||||
<p>This is the x-indentation of text inside a cell. Changing this may be
|
||||
necessary to suit other font sizes and different X environments.</p>
|
||||
<p>This is the x-indentation of text inside a cell. Changing this may be necessary
|
||||
to suit other font sizes and different X environments.</p>
|
||||
<pre><code>-DB=5</code></pre>
|
||||
<p>This is the y-indentation of text inside a cell. Changing this may be
|
||||
necessary to suit other font sizes and different X environments.</p>
|
||||
<p>This is the y-indentation of text inside a cell. Changing this may be necessary
|
||||
to suit other font sizes and different X environments.</p>
|
||||
<pre><code>-DG=23</code></pre>
|
||||
<p>This parameter is the number of cell rows visible at one time.</p>
|
||||
<pre><code>-Dp=7</code></pre>
|
||||
<p>This parameter is one smaller than the number of cells columns
|
||||
visible at one time.</p>
|
||||
<p>This parameter is one smaller than the number of cells columns visible at one
|
||||
time.</p>
|
||||
<pre><code>-DM="((p+1)*Q)+S"
|
||||
-DH="(G*S)+S+S"</code></pre>
|
||||
<p>These parameters are the window x and y sizes of the spreadsheet
|
||||
program window. With these definitions, they are automatically
|
||||
reflecting the at-one-time-visible cell row/column amounts. Hence, we
|
||||
recommend changing the <code>G</code> and <code>p</code> parameters if
|
||||
you want to change the window size in normal cases. Experimentation with
|
||||
<code>M</code> and <code>H</code> can be used to get other types of
|
||||
effect such as adding a margin also at the bottom of the window.</p>
|
||||
<p>These parameters are the window x and y sizes of the spreadsheet program window.
|
||||
With these definitions, they are automatically reflecting the
|
||||
at-one-time-visible cell row/column amounts. Hence, we recommend changing the
|
||||
<code>G</code> and <code>p</code> parameters if you want to change the window size in normal cases.
|
||||
Experimentation with <code>M</code> and <code>H</code> can be used to get other types of effect such
|
||||
as adding a margin also at the bottom of the window.</p>
|
||||
<h3 id="implementation">3. IMPLEMENTATION</h3>
|
||||
<p>It’s better to just read the code. But note the use of stack in the
|
||||
implementation of <code>@</code> and <code>!</code> operators, and note
|
||||
the use of <code>*#i</code> in one of the macros (can you see why?).
|
||||
Extreme compression has been the key in writing this program. With
|
||||
compression comes the use of ASCII code numbers instead of character
|
||||
constants and so on. (This particular obfuscation is not really a
|
||||
desirable one as it is not completely portable. But it certainly was a
|
||||
necessary one.)</p>
|
||||
implementation of <code>@</code> and <code>!</code> operators, and note the use of <code>*#i</code> in one of the
|
||||
macros (can you see why?). Extreme compression has been the key in writing this
|
||||
program. With compression comes the use of ASCII code numbers instead of
|
||||
character constants and so on. (This particular obfuscation is not really a
|
||||
desirable one as it is not completely portable. But it certainly was a necessary
|
||||
one.)</p>
|
||||
<p>What does <code>i(=)</code> do or does it do anything? Why?</p>
|
||||
<h3 id="warnings-and-caveats">4. WARNINGS AND CAVEATS</h3>
|
||||
<h4 id="x11-paths-in-compilation">4.1. X11 Paths in Compilation</h4>
|
||||
<p>The given Makefile may have to be edited to insert correct library
|
||||
and include file path names.</p>
|
||||
<p>The given Makefile may have to be edited to insert correct library and include
|
||||
file path names.</p>
|
||||
<h4 id="font-sizes">4.2. Font Sizes</h4>
|
||||
<p>We’ve tested the program with a limited amount of X servers. It is
|
||||
possible that other systems use default font sizes or other parameters
|
||||
that cause the visual looks to be different or perhaps even unusable; if
|
||||
this happens, changing compile-time parameters explained in section 2.8
|
||||
might help.</p>
|
||||
<p>We’ve tested the program with a limited amount of X servers. It is possible that
|
||||
other systems use default font sizes or other parameters that cause the visual
|
||||
looks to be different or perhaps even unusable; if this happens, changing
|
||||
compile-time parameters explained in section 2.8 might help.</p>
|
||||
<h4 id="screen-sizes">4.3. Screen Sizes</h4>
|
||||
<p>The size of the window as it comes up - a parameter as defined in
|
||||
compile-time - has been set suitable for a small laptop screen. Larger
|
||||
screens may benefit from setting these parameters higher. Smaller
|
||||
screens require changing the parameters so that all of the window
|
||||
becomes visible.</p>
|
||||
<h4 id="spreadsheet-dimension-changes">4.4. Spreadsheet Dimension
|
||||
Changes</h4>
|
||||
<p>The size of the read, manipulated, and stored spreadsheets is defined
|
||||
by a compile time parameter. However, changing this parameter is not
|
||||
entirely trivial. The following constraints apply:</p>
|
||||
<p>The size of the window as it comes up - a parameter as defined in compile-time -
|
||||
has been set suitable for a small laptop screen. Larger screens may benefit
|
||||
from setting these parameters higher. Smaller screens require changing the
|
||||
parameters so that all of the window becomes visible.</p>
|
||||
<h4 id="spreadsheet-dimension-changes">4.4. Spreadsheet Dimension Changes</h4>
|
||||
<p>The size of the read, manipulated, and stored spreadsheets is defined by a
|
||||
compile time parameter. However, changing this parameter is not entirely
|
||||
trivial. The following constraints apply:</p>
|
||||
<ul>
|
||||
<li><p>Horizontal (alphabet) dimension handling will always be A to Z
|
||||
regardless of the actual allocated memory area.</p></li>
|
||||
<li><p>Any change in the dimension parameter renders existing
|
||||
spreadsheet files unusable.</p></li>
|
||||
<li><p>Horizontal (alphabet) dimension handling will always be A to Z regardless of
|
||||
the actual allocated memory area.</p></li>
|
||||
<li><p>Any change in the dimension parameter renders existing spreadsheet files
|
||||
unusable.</p></li>
|
||||
</ul>
|
||||
<h4 id="ascii-reliance">4.5. ASCII Reliance</h4>
|
||||
<p>The software relies on running on ASCII-based code system. Why?
|
||||
Because <code>32</code> is shorter than <code>' '</code>.</p>
|
||||
<h4 id="command-line-single-character-defines">4.6. Command Line Single
|
||||
Character Defines</h4>
|
||||
<p>The use of single character (e.g. <code>G</code> or <code>p</code>)
|
||||
for a <code>-D</code> option might break certain systems, if those
|
||||
characters are used in the included X header files in certain kinds of
|
||||
places. If this happens, you may move the offending character to a new
|
||||
name by exchanging it on the command line and in the program with
|
||||
another character. Note that there are <em>no</em> free characters in
|
||||
the program currently.</p>
|
||||
<h2 id="copyright-and-cc-by-sa-4.0-license">Copyright and CC BY-SA 4.0
|
||||
License:</h2>
|
||||
<p>This file is Copyright (c) 2023 by Landon Curt Noll. All Rights
|
||||
Reserved. You are free to share and adapt this file under the terms of
|
||||
this license:</p>
|
||||
<p>The software relies on running on ASCII-based code system. Why? Because <code>32</code> is
|
||||
shorter than <code>' '</code>.</p>
|
||||
<h4 id="command-line-single-character-defines">4.6. Command Line Single Character Defines</h4>
|
||||
<p>The use of single character (e.g. <code>G</code> or <code>p</code>) for a <code>-D</code> option might break
|
||||
certain systems, if those characters are used in the included X header files in
|
||||
certain kinds of places. If this happens, you may move the offending character
|
||||
to a new name by exchanging it on the command line and in the program with
|
||||
another character. Note that there are <em>no</em> free characters in the program
|
||||
currently.</p>
|
||||
<h2 id="copyright-and-cc-by-sa-4.0-license">Copyright and CC BY-SA 4.0 License:</h2>
|
||||
<p>This file is Copyright (c) 2023 by Landon Curt Noll. All Rights Reserved.
|
||||
You are free to share and adapt this file under the terms of this license:</p>
|
||||
<pre><code>Creative Commons Attribution-ShareAlike 4.0 International (CC BY-SA 4.0)</code></pre>
|
||||
<p>For more information, see:
|
||||
https://creativecommons.org/licenses/by-sa/4.0/</p>
|
||||
<p>For more information, see: https://creativecommons.org/licenses/by-sa/4.0/</p>
|
||||
|
||||
<!-- END: this line ends content for HTML phase 21 by: bin/pandoc-wrapper.sh via bin/md2html.sh -->
|
||||
<!-- START: this line starts content for HTML phase 22 by: bin/output-index-inventory.sh via bin/md2html.sh -->
|
||||
|
||||
<!-- START: this line starts content generated by: bin/output-index-inventory.sh -->
|
||||
|
||||
<h1 id="inventory-for-2000jarijyrki"><a name="inventory"></a>Inventory
|
||||
for 2000/jarijyrki</h1>
|
||||
<h1 id="inventory-for-2000jarijyrki"><a name="inventory"></a>Inventory for 2000/jarijyrki</h1>
|
||||
<p><a href="#top">Jump to top</a></p>
|
||||
<h2 id="primary-files">Primary files</h2>
|
||||
<ul>
|
||||
<li><a
|
||||
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2000/jarijyrki/jarijyrki.c">jarijyrki.c</a>
|
||||
- entry source</li>
|
||||
<li><a
|
||||
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2000/jarijyrki/Makefile">Makefile</a>
|
||||
- entry Makefile</li>
|
||||
<li><a
|
||||
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2000/jarijyrki/jarijyrki.orig.c">jarijyrki.orig.c</a>
|
||||
- original source</li>
|
||||
<li><a href="2000_jarijyrki.tar.bz2">2000_jarijyrki.tar.bz2</a> -
|
||||
download entry source</li>
|
||||
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2000/jarijyrki/jarijyrki.c">jarijyrki.c</a> - entry source</li>
|
||||
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2000/jarijyrki/Makefile">Makefile</a> - entry Makefile</li>
|
||||
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2000/jarijyrki/jarijyrki.orig.c">jarijyrki.orig.c</a> - original source</li>
|
||||
<li><a href="2000_jarijyrki.tar.bz2">2000_jarijyrki.tar.bz2</a> - download entry source</li>
|
||||
</ul>
|
||||
<h2 id="secondary-files">Secondary files</h2>
|
||||
<ul>
|
||||
<li><a href="index.html">index.html</a> - entry home page</li>
|
||||
<li><a
|
||||
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2000/jarijyrki/.entry.json">.entry.json</a>
|
||||
- description of entry in JSON</li>
|
||||
<li><a
|
||||
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2000/jarijyrki/.gitignore">.gitignore</a>
|
||||
- list of files that should not be committed under git</li>
|
||||
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2000/jarijyrki/.entry.json">.entry.json</a> - description of entry in JSON</li>
|
||||
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2000/jarijyrki/.gitignore">.gitignore</a> - list of files that should not be committed under git</li>
|
||||
<li><a href=".path">.path</a> - directory path from top directory</li>
|
||||
<li><a
|
||||
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2000/jarijyrki/README.md">README.md</a>
|
||||
- markdown source for index.html</li>
|
||||
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2000/jarijyrki/README.md">README.md</a> - markdown source for index.html</li>
|
||||
<li><a href="finance.sheet">finance.sheet</a> - spreadsheet</li>
|
||||
</ul>
|
||||
|
||||
|
||||
+41
-67
@@ -141,109 +141,83 @@ Location: <a href="../../location.html#JP">JP</a> - <em>Japan</em>
|
||||
|
||||
<h2 id="to-build">To build:</h2>
|
||||
<div class="sourceCode" id="cb1"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb1-1"><a href="#cb1-1" aria-hidden="true" tabindex="-1"></a><span class="fu">make</span></span></code></pre></div>
|
||||
<p>An alt version exists for those in the southern hemisphere (or those
|
||||
who want to see what it would be in the southern hemisphere). See <a
|
||||
href="#alternate-code">alternate version</a> below.</p>
|
||||
<p>An alt version exists for those in the southern hemisphere (or those who want to
|
||||
see what it would be in the southern hemisphere). See <a href="#alternate-code">alternate
|
||||
version</a> below.</p>
|
||||
<h2 id="to-use">To use:</h2>
|
||||
<div class="sourceCode" id="cb2"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb2-1"><a href="#cb2-1" aria-hidden="true" tabindex="-1"></a><span class="ex">./natori</span></span></code></pre></div>
|
||||
<h2 id="try">Try:</h2>
|
||||
<div class="sourceCode" id="cb3"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb3-1"><a href="#cb3-1" aria-hidden="true" tabindex="-1"></a><span class="ex">./try.sh</span></span></code></pre></div>
|
||||
<p>Try running this on different days, say a few days apart (even better
|
||||
if the Moon phase changes), and each time run it several times in a row
|
||||
(or several times in a day).</p>
|
||||
<p>Also try modifying the code so that it will show another Moon phase
|
||||
based on input or else just by the code itself. Bonus points if you can
|
||||
make it show all.</p>
|
||||
<p>Try running this on different days, say a few days apart (even better if the
|
||||
Moon phase changes), and each time run it several times in a row (or several
|
||||
times in a day).</p>
|
||||
<p>Also try modifying the code so that it will show another Moon phase based on
|
||||
input or else just by the code itself. Bonus points if you can make it show all.</p>
|
||||
<p>NOTE: if it’s a Full Moon the script won’t look as nice.</p>
|
||||
<h2 id="alternate-code">Alternate code:</h2>
|
||||
<p>The author noted that those in the southern hemisphere might want to
|
||||
change <code>acos(l/2)</code> into <code>acos(-l/2)</code> which we have
|
||||
done in the alternate version.</p>
|
||||
<p>The author noted that those in the southern hemisphere might want to change
|
||||
<code>acos(l/2)</code> into <code>acos(-l/2)</code> which we have done in the alternate version.</p>
|
||||
<h3 id="alternate-build">Alternate build:</h3>
|
||||
<p>To run the alternate code that supports the southern hemisphere:</p>
|
||||
<div class="sourceCode" id="cb4"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb4-1"><a href="#cb4-1" aria-hidden="true" tabindex="-1"></a><span class="fu">make</span> alt</span></code></pre></div>
|
||||
<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">./natori.alt</span></span></code></pre></div>
|
||||
<p>Try running this on different days, say a few days apart, and each
|
||||
time run it several times in a row (or several times in a day).</p>
|
||||
<p>Try running this on different days, say a few days apart, and each time run it
|
||||
several times in a row (or several times in a day).</p>
|
||||
<p>What happens if you run it in the northern hemisphere? Are there any
|
||||
differences?</p>
|
||||
<p>Can you identify any Moon phases that result in the same output of
|
||||
both versions? Or are there any?</p>
|
||||
<p>Can you identify any Moon phases that result in the same output of both
|
||||
versions? Or are there any?</p>
|
||||
<h3 id="alternate-try">Alternate try:</h3>
|
||||
<div class="sourceCode" id="cb6"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb6-1"><a href="#cb6-1" aria-hidden="true" tabindex="-1"></a><span class="ex">./try.alt.sh</span></span></code></pre></div>
|
||||
<p>Like with <a href="try.sh">try.sh</a>, try using this multiple times
|
||||
in a row or throughout the day on different days (if different phases of
|
||||
the Moon you’ll see more of a difference, of course).</p>
|
||||
<p>Like with <a href="try.sh">try.sh</a>, try using this multiple times in a row or throughout
|
||||
the day on different days (if different phases of the Moon you’ll see more of a
|
||||
difference, of course).</p>
|
||||
<p>NOTE: if it’s a Full Moon the script won’t look as nice.</p>
|
||||
<h2 id="judges-remarks">Judges’ remarks:</h2>
|
||||
<p>Here is a nice compact program that changes with the phase of the
|
||||
Moon. Can you figure out how it does it?</p>
|
||||
<p>The ANSI-C committee, among their multiple misdeeds, broke perfectly
|
||||
fun C programs by making it intractable for them to declare their own
|
||||
non-traditional prototype for <code>main()</code>. We have had to uglify
|
||||
this program in order to prevent C compilers from failing to compile it
|
||||
due to (the now changed) unusual arg types of the <code>main()</code>
|
||||
function.</p>
|
||||
<p>Here is a nice compact program that changes with the phase of the Moon.
|
||||
Can you figure out how it does it?</p>
|
||||
<p>The ANSI-C committee, among their multiple misdeeds, broke perfectly fun C
|
||||
programs by making it intractable for them to declare their own non-traditional
|
||||
prototype for <code>main()</code>. We have had to uglify this program in order to prevent
|
||||
C compilers from failing to compile it due to (the now changed) unusual arg
|
||||
types of the <code>main()</code> function.</p>
|
||||
<h2 id="authors-remarks">Author’s remarks:</h2>
|
||||
<p>This program outputs a rough image of the moon in its current phase.
|
||||
The main obfuscation of this entry is its complicated double recursion
|
||||
(without any loop or conditional statement).</p>
|
||||
<p>People living in the southern hemisphere may want to change
|
||||
<code>acos(l/2)</code> into <code>acos(-l/2)</code>.</p>
|
||||
<h2 id="copyright-and-cc-by-sa-4.0-license">Copyright and CC BY-SA 4.0
|
||||
License:</h2>
|
||||
<p>This file is Copyright (c) 2023 by Landon Curt Noll. All Rights
|
||||
Reserved. You are free to share and adapt this file under the terms of
|
||||
this license:</p>
|
||||
<p>People living in the southern hemisphere may want to change <code>acos(l/2)</code>
|
||||
into <code>acos(-l/2)</code>.</p>
|
||||
<h2 id="copyright-and-cc-by-sa-4.0-license">Copyright and CC BY-SA 4.0 License:</h2>
|
||||
<p>This file is Copyright (c) 2023 by Landon Curt Noll. All Rights Reserved.
|
||||
You are free to share and adapt this file under the terms of this license:</p>
|
||||
<pre><code>Creative Commons Attribution-ShareAlike 4.0 International (CC BY-SA 4.0)</code></pre>
|
||||
<p>For more information, see:
|
||||
https://creativecommons.org/licenses/by-sa/4.0/</p>
|
||||
<p>For more information, see: https://creativecommons.org/licenses/by-sa/4.0/</p>
|
||||
|
||||
<!-- END: this line ends content for HTML phase 21 by: bin/pandoc-wrapper.sh via bin/md2html.sh -->
|
||||
<!-- START: this line starts content for HTML phase 22 by: bin/output-index-inventory.sh via bin/md2html.sh -->
|
||||
|
||||
<!-- START: this line starts content generated by: bin/output-index-inventory.sh -->
|
||||
|
||||
<h1 id="inventory-for-2000natori"><a name="inventory"></a>Inventory for
|
||||
2000/natori</h1>
|
||||
<h1 id="inventory-for-2000natori"><a name="inventory"></a>Inventory for 2000/natori</h1>
|
||||
<p><a href="#top">Jump to top</a></p>
|
||||
<h2 id="primary-files">Primary files</h2>
|
||||
<ul>
|
||||
<li><a
|
||||
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2000/natori/natori.c">natori.c</a>
|
||||
- entry source</li>
|
||||
<li><a
|
||||
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2000/natori/Makefile">Makefile</a>
|
||||
- entry Makefile</li>
|
||||
<li><a
|
||||
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2000/natori/natori.alt.c">natori.alt.c</a>
|
||||
- alternative source</li>
|
||||
<li><a
|
||||
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2000/natori/natori.orig.c">natori.orig.c</a>
|
||||
- original source</li>
|
||||
<li><a
|
||||
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2000/natori/try.alt.sh">try.alt.sh</a>
|
||||
- how to run alternative code</li>
|
||||
<li><a
|
||||
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2000/natori/try.sh">try.sh</a>
|
||||
- how to run</li>
|
||||
<li><a href="2000_natori.tar.bz2">2000_natori.tar.bz2</a> - download
|
||||
entry source</li>
|
||||
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2000/natori/natori.c">natori.c</a> - entry source</li>
|
||||
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2000/natori/Makefile">Makefile</a> - entry Makefile</li>
|
||||
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2000/natori/natori.alt.c">natori.alt.c</a> - alternative source</li>
|
||||
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2000/natori/natori.orig.c">natori.orig.c</a> - original source</li>
|
||||
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2000/natori/try.alt.sh">try.alt.sh</a> - how to run alternative code</li>
|
||||
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2000/natori/try.sh">try.sh</a> - how to run</li>
|
||||
<li><a href="2000_natori.tar.bz2">2000_natori.tar.bz2</a> - download entry source</li>
|
||||
</ul>
|
||||
<h2 id="secondary-files">Secondary files</h2>
|
||||
<ul>
|
||||
<li><a href="index.html">index.html</a> - entry home page</li>
|
||||
<li><a
|
||||
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2000/natori/.entry.json">.entry.json</a>
|
||||
- description of entry in JSON</li>
|
||||
<li><a
|
||||
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2000/natori/.gitignore">.gitignore</a>
|
||||
- list of files that should not be committed under git</li>
|
||||
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2000/natori/.entry.json">.entry.json</a> - description of entry in JSON</li>
|
||||
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2000/natori/.gitignore">.gitignore</a> - list of files that should not be committed under git</li>
|
||||
<li><a href=".path">.path</a> - directory path from top directory</li>
|
||||
<li><a
|
||||
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2000/natori/README.md">README.md</a>
|
||||
- markdown source for index.html</li>
|
||||
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2000/natori/README.md">README.md</a> - markdown source for index.html</li>
|
||||
</ul>
|
||||
|
||||
<!-- END: next line ends content generated by: bin/output-index-inventory.sh -->
|
||||
|
||||
+34
-59
@@ -129,9 +129,9 @@
|
||||
|
||||
<h2 id="author"><a name="author"></a>Author:</h2>
|
||||
<ul>
|
||||
<li>Name: <a href="../../authors.html#Raymond_Cheong">Raymond
|
||||
Cheong</a><br> Location: <a href="../../location.html#US">US</a> -
|
||||
<em>United States of America</em> (<em>United States</em>) <br><br></li>
|
||||
<li>Name: <a href="../../authors.html#Raymond_Cheong">Raymond Cheong</a><br>
|
||||
Location: <a href="../../location.html#US">US</a> - <em>United States of America</em> (<em>United States</em>)
|
||||
<br><br></li>
|
||||
</ul>
|
||||
|
||||
<!-- END: next line ends content generated by: bin/output-index-author.sh -->
|
||||
@@ -144,8 +144,7 @@ Cheong</a><br> Location: <a href="../../location.html#US">US</a> -
|
||||
<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#2000_primenum">2000 primenum bugs</a>.</p>
|
||||
<p>For more detailed information see <a href="../../bugs.html#2000_primenum">2000 primenum bugs</a>.</p>
|
||||
<h2 id="to-use">To use:</h2>
|
||||
<div class="sourceCode" id="cb3"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb3-1"><a href="#cb3-1" aria-hidden="true" tabindex="-1"></a><span class="bu">echo</span> n <span class="kw">|</span> <span class="ex">./primenum</span> n</span></code></pre></div>
|
||||
<p>NOTE: <code>n</code> is an integer.</p>
|
||||
@@ -155,8 +154,8 @@ href="../../bugs.html#2000_primenum">2000 primenum bugs</a>.</p>
|
||||
<p>Don’t read the author remarks until you’re ready for the spoiler.
|
||||
Just stop and read the program; it won’t take long. Once you’ve figured
|
||||
out what it does, run it. It may surprise you.</p>
|
||||
<p>This entry won, not because the obfuscation is impenetrable, but
|
||||
because it successfully fooled half of the judges, including me.</p>
|
||||
<p>This entry won, not because the obfuscation is impenetrable, but because
|
||||
it successfully fooled half of the judges, including me.</p>
|
||||
<h2 id="authors-remarks">Author’s remarks:</h2>
|
||||
<h3 id="description">Description</h3>
|
||||
<p>For 15 years, IOCCC entries have obfuscated programs using esoteric,
|
||||
@@ -165,23 +164,20 @@ that trend and obfuscates in the most “obvious” way possible: by
|
||||
painstakingly describing the algorithm in clear pseudocode. Even novice
|
||||
programmers will recognize that the program should find and print prime
|
||||
numbers up to a given number (as specified on the command line).</p>
|
||||
<p>But novice programmers especially know that mistakes are often made
|
||||
in translating pseudocode to real code, often resulting in programs with
|
||||
<p>But novice programmers especially know that mistakes are often made in
|
||||
translating pseudocode to real code, often resulting in programs with
|
||||
unexpected and confusing output. Clearly, the program contains several
|
||||
syntax “mistakes” (e.g. <code>LessThanOrEqualTo</code>) and blatant
|
||||
“errors” (e.g. <code>Zero</code>). This program clearly requires
|
||||
“debugging.”</p>
|
||||
<p>As a result of these “bugs”, the program does not calculate primes at
|
||||
all. Instead, the program reads input from <code>stdin</code> and
|
||||
returns garbled text on <code>stdout</code>. Fortunately, you can
|
||||
recover the original message simply by running the program a second
|
||||
time. Try:</p>
|
||||
syntax “mistakes” (e.g. <code>LessThanOrEqualTo</code>) and blatant “errors” (e.g.
|
||||
<code>Zero</code>). This program clearly requires “debugging.”</p>
|
||||
<p>As a result of these “bugs”, the program does not calculate primes at all.
|
||||
Instead, the program reads input from <code>stdin</code> and returns garbled text on
|
||||
<code>stdout</code>. Fortunately, you can recover the original message simply by
|
||||
running the program a second time. 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">./primenum</span> n <span class="op"><</span> textfile <span class="kw">|</span> <span class="ex">./primenum</span> n <span class="op">></span> textfile2</span>
|
||||
<span id="cb5-2"><a href="#cb5-2" aria-hidden="true" tabindex="-1"></a><span class="fu">diff</span> textfile textfile2</span></code></pre></div>
|
||||
<p>where n is the same number (modulo 64). So, the prime number
|
||||
generator is actually a simple text encoder/decoder! Of course, don’t
|
||||
forget that argument, otherwise the “bugs” in the program will cause it
|
||||
to crash!</p>
|
||||
<p>where n is the same number (modulo 64). So, the prime number generator
|
||||
is actually a simple text encoder/decoder! Of course, don’t forget that
|
||||
argument, otherwise the “bugs” in the program will cause it to crash!</p>
|
||||
<h3 id="features">Features</h3>
|
||||
<ul>
|
||||
<li><p>The program attempts to mislead the reader into thinking that it
|
||||
@@ -192,13 +188,11 @@ generates prime numbers. It does this by:</p>
|
||||
<li>using suggestive variable names; and</li>
|
||||
<li>using a suggestive program name.</li>
|
||||
</ul></li>
|
||||
<li><p>The program demonstrates a novel method of abusing the C
|
||||
preprocessor.</p></li>
|
||||
<li><p>Determining how the filter algorithm works is left as an exercise
|
||||
to the reader.</p></li>
|
||||
<li><p>The program demonstrates a novel method of abusing the C preprocessor.</p></li>
|
||||
<li><p>Determining how the filter algorithm works is left as an exercise to the
|
||||
reader.</p></li>
|
||||
<li><p>OK, so running it through the preprocessor strips away the prime
|
||||
number front. But ye be warned: “not a11 variab1es1es are identica1”
|
||||
:-)</p></li>
|
||||
number front. But ye be warned: “not a11 variab1es1es are identica1” :-)</p></li>
|
||||
<li><p>Other features include</p>
|
||||
<ul>
|
||||
<li>useless variables</li>
|
||||
@@ -209,53 +203,34 @@ number front. But ye be warned: “not a11 variab1es1es are identica1”
|
||||
<li><p>Try also
|
||||
<code>echo THIS MESSAGE IS IN ALL CAPS | ./primenum 32</code></p></li>
|
||||
</ul>
|
||||
<h2 id="copyright-and-cc-by-sa-4.0-license">Copyright and CC BY-SA 4.0
|
||||
License:</h2>
|
||||
<p>This file is Copyright (c) 2023 by Landon Curt Noll. All Rights
|
||||
Reserved. You are free to share and adapt this file under the terms of
|
||||
this license:</p>
|
||||
<h2 id="copyright-and-cc-by-sa-4.0-license">Copyright and CC BY-SA 4.0 License:</h2>
|
||||
<p>This file is Copyright (c) 2023 by Landon Curt Noll. All Rights Reserved.
|
||||
You are free to share and adapt this file under the terms of this license:</p>
|
||||
<pre><code>Creative Commons Attribution-ShareAlike 4.0 International (CC BY-SA 4.0)</code></pre>
|
||||
<p>For more information, see:
|
||||
https://creativecommons.org/licenses/by-sa/4.0/</p>
|
||||
<p>For more information, see: https://creativecommons.org/licenses/by-sa/4.0/</p>
|
||||
|
||||
<!-- END: this line ends content for HTML phase 21 by: bin/pandoc-wrapper.sh via bin/md2html.sh -->
|
||||
<!-- START: this line starts content for HTML phase 22 by: bin/output-index-inventory.sh via bin/md2html.sh -->
|
||||
|
||||
<!-- START: this line starts content generated by: bin/output-index-inventory.sh -->
|
||||
|
||||
<h1 id="inventory-for-2000primenum"><a name="inventory"></a>Inventory
|
||||
for 2000/primenum</h1>
|
||||
<h1 id="inventory-for-2000primenum"><a name="inventory"></a>Inventory for 2000/primenum</h1>
|
||||
<p><a href="#top">Jump to top</a></p>
|
||||
<h2 id="primary-files">Primary files</h2>
|
||||
<ul>
|
||||
<li><a
|
||||
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2000/primenum/primenum.c">primenum.c</a>
|
||||
- entry source</li>
|
||||
<li><a
|
||||
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2000/primenum/Makefile">Makefile</a>
|
||||
- entry Makefile</li>
|
||||
<li><a
|
||||
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2000/primenum/primenum.orig.c">primenum.orig.c</a>
|
||||
- original source</li>
|
||||
<li><a
|
||||
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2000/primenum/try.sh">try.sh</a>
|
||||
- how to run</li>
|
||||
<li><a href="2000_primenum.tar.bz2">2000_primenum.tar.bz2</a> - download
|
||||
entry source</li>
|
||||
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2000/primenum/primenum.c">primenum.c</a> - entry source</li>
|
||||
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2000/primenum/Makefile">Makefile</a> - entry Makefile</li>
|
||||
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2000/primenum/primenum.orig.c">primenum.orig.c</a> - original source</li>
|
||||
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2000/primenum/try.sh">try.sh</a> - how to run</li>
|
||||
<li><a href="2000_primenum.tar.bz2">2000_primenum.tar.bz2</a> - download entry source</li>
|
||||
</ul>
|
||||
<h2 id="secondary-files">Secondary files</h2>
|
||||
<ul>
|
||||
<li><a href="index.html">index.html</a> - entry home page</li>
|
||||
<li><a
|
||||
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2000/primenum/.entry.json">.entry.json</a>
|
||||
- description of entry in JSON</li>
|
||||
<li><a
|
||||
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2000/primenum/.gitignore">.gitignore</a>
|
||||
- list of files that should not be committed under git</li>
|
||||
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2000/primenum/.entry.json">.entry.json</a> - description of entry in JSON</li>
|
||||
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2000/primenum/.gitignore">.gitignore</a> - list of files that should not be committed under git</li>
|
||||
<li><a href=".path">.path</a> - directory path from top directory</li>
|
||||
<li><a
|
||||
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2000/primenum/README.md">README.md</a>
|
||||
- markdown source for index.html</li>
|
||||
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2000/primenum/README.md">README.md</a> - markdown source for index.html</li>
|
||||
</ul>
|
||||
|
||||
<!-- END: next line ends content generated by: bin/output-index-inventory.sh -->
|
||||
|
||||
+160
-221
@@ -129,10 +129,9 @@
|
||||
|
||||
<h2 id="author"><a name="author"></a>Author:</h2>
|
||||
<ul>
|
||||
<li>Name: <a href="../../authors.html#James_Bonfield">James
|
||||
Bonfield</a><br> Location: <a href="../../location.html#GB">GB</a> -
|
||||
<em>United Kingdom of Great Britain and Northern Ireland</em>
|
||||
(<em>United Kingdom</em>) <br><br></li>
|
||||
<li>Name: <a href="../../authors.html#James_Bonfield">James Bonfield</a><br>
|
||||
Location: <a href="../../location.html#GB">GB</a> - <em>United Kingdom of Great Britain and Northern Ireland</em> (<em>United Kingdom</em>)
|
||||
<br><br></li>
|
||||
</ul>
|
||||
|
||||
<!-- END: next line ends content generated by: bin/output-index-author.sh -->
|
||||
@@ -145,73 +144,64 @@ Bonfield</a><br> Location: <a href="../../location.html#GB">GB</a> -
|
||||
<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#2000_rince">2000 rince bugs</a>.</p>
|
||||
<p>For more detailed information see <a href="../../bugs.html#2000_rince">2000 rince 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">./rince</span> number number2</span></code></pre></div>
|
||||
<p>If <code>DISPLAY</code> is not set the program will very likely crash
|
||||
or do something different.</p>
|
||||
<p>If <code>DISPLAY</code> is not set the program will very likely crash or do something
|
||||
different.</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>
|
||||
<p>This will run the program several times with different parameters to
|
||||
show different types of things. See the author’s remarks for more
|
||||
details.</p>
|
||||
<p>This will run the program several times with different parameters to show
|
||||
different types of things. See the author’s remarks for more details.</p>
|
||||
<h2 id="judges-remarks">Judges’ remarks:</h2>
|
||||
<p>This program may have you going around in circles :-) Try running it
|
||||
first before reading the author’s remarks below.</p>
|
||||
<p>The judges verified the correctness of output for recent dates
|
||||
through visual observation.</p>
|
||||
<p>This program may have you going around in circles :-) Try running it first
|
||||
before reading the author’s remarks below.</p>
|
||||
<p>The judges verified the correctness of output for recent dates through visual
|
||||
observation.</p>
|
||||
<h2 id="authors-remarks">Author’s remarks:</h2>
|
||||
<h3 id="how-to-use-it">How to use it</h3>
|
||||
<p>The simplest way to run it is with no arguments. Just type:</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">./rince</span></span></code></pre></div>
|
||||
<p>You will need to have access to X windows, although it doesn’t
|
||||
require desperately high resolution and there are no known limitations
|
||||
on colour depth.</p>
|
||||
<p>The display will change slowly over time, although it may take 10
|
||||
minutes or more to be visible. For those that cannot wait that long the
|
||||
program has a built in time machine. Indeed the program knows the speed
|
||||
of light, which is used to ensure that we see the “live” pictures.
|
||||
Simply specify the fraction of a day to skip forward for each screen
|
||||
refresh. I suggest:</p>
|
||||
<p>You will need to have access to X windows, although it doesn’t require
|
||||
desperately high resolution and there are no known limitations on colour
|
||||
depth.</p>
|
||||
<p>The display will change slowly over time, although it may take 10 minutes
|
||||
or more to be visible. For those that cannot wait that long the program
|
||||
has a built in time machine. Indeed the program knows the speed of light,
|
||||
which is used to ensure that we see the “live” pictures. Simply specify
|
||||
the fraction of a day to skip forward for each screen refresh. I suggest:</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">./rince</span> 0.01</span></code></pre></div>
|
||||
<p>To display the output (still guessing?) for a given date, specify two
|
||||
arguments. The first argument is as before and the second argument is a
|
||||
Julian day number (given as a fractional component). E.g.:</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">./rince</span> 0 2441193.6</span>
|
||||
<span id="cb7-2"><a href="#cb7-2" aria-hidden="true" tabindex="-1"></a><span class="ex">./rince</span> 0.01 2441193.6</span></code></pre></div>
|
||||
<p>A Julian day is defined to be the number of days since January 1st in
|
||||
the year <code>-4712 (4713BC)</code>, starting at 12 noon GMT.<a
|
||||
href="#fn1" class="footnote-ref" id="fnref1"
|
||||
role="doc-noteref"><sup>1</sup></a><a href="#fn2" class="footnote-ref"
|
||||
id="fnref2" role="doc-noteref"><sup>2</sup></a> To aid conversion from
|
||||
our time (GMT) to Julian day there is a supplementary program named: <a
|
||||
href="dmy2jd.c">dmy2jd.c</a>. Run it with
|
||||
<code>day_float month year</code> as arguments. See below for an
|
||||
example.</p>
|
||||
<p>A Julian day is defined to be the number of days since January 1st in the year
|
||||
<code>-4712 (4713BC)</code>, starting at 12 noon GMT.<a href="#fn1" class="footnote-ref" id="fnref1" role="doc-noteref"><sup>1</sup></a><a href="#fn2" class="footnote-ref" id="fnref2" role="doc-noteref"><sup>2</sup></a> To aid conversion from our time
|
||||
(GMT) to Julian day there is a supplementary program named:
|
||||
<a href="dmy2jd.c">dmy2jd.c</a>. Run it with <code>day_float month year</code> as arguments. See below
|
||||
for an example.</p>
|
||||
<h3 id="what-it-does">What it does</h3>
|
||||
<p>This program plots the positions of the four <a
|
||||
href="https://en.wikipedia.org/wiki/Galilean_moons">Galilean moons</a>
|
||||
of <a href="https://en.wikipedia.org/wiki/Jupiter">Jupiter</a>, as seen
|
||||
from <a href="https://en.wikipedia.org/wiki/Earth">Earth</a>. It doesn’t
|
||||
correct for your location on Earth, but I assure you that the <a
|
||||
href="https://en.wikipedia.org/wiki/Parallax#Astronomy">parallax</a> is
|
||||
minimal!</p>
|
||||
<p>The moons are labelled with Roman numerals from <code>I</code> to
|
||||
<code>IV</code>, <code>I</code> being the closest to the planet and
|
||||
<code>IV</code> being the furthest. They are:</p>
|
||||
<p>This program plots the positions of the four <a href="https://en.wikipedia.org/wiki/Galilean_moons">Galilean
|
||||
moons</a> of
|
||||
<a href="https://en.wikipedia.org/wiki/Jupiter">Jupiter</a>, as seen from
|
||||
<a href="https://en.wikipedia.org/wiki/Earth">Earth</a>. It doesn’t correct for your
|
||||
location on Earth, but I assure you that the
|
||||
<a href="https://en.wikipedia.org/wiki/Parallax#Astronomy">parallax</a> is minimal!</p>
|
||||
<p>The moons are labelled with Roman numerals from <code>I</code> to <code>IV</code>, <code>I</code> being the
|
||||
closest to the planet and <code>IV</code> being the furthest. They are:</p>
|
||||
<pre><code>I Io
|
||||
II Europa
|
||||
III Ganymede
|
||||
IV Callisto</code></pre>
|
||||
<p>Amazingly, all it takes is a pair of binoculars to see the Galilean
|
||||
moons, so the results can be experimentally checked. (Note that at
|
||||
present, the best views of Jupiter are over the autumn/winter.)</p>
|
||||
<p>The positions of the moons should be correct for binoculars, but
|
||||
possibly not if you have a telescope or if you are in the southern
|
||||
hemisphere. In that case I suggest that to get the correct image you
|
||||
look at the screen from inside the monitor whilst standing on your head.
|
||||
In case of confusion, please consult the following chart (*):</p>
|
||||
<p>Amazingly, all it takes is a pair of binoculars to see the Galilean moons,
|
||||
so the results can be experimentally checked. (Note that at present, the
|
||||
best views of Jupiter are over the autumn/winter.)</p>
|
||||
<p>The positions of the moons should be correct for binoculars, but possibly
|
||||
not if you have a telescope or if you are in the southern hemisphere. In
|
||||
that case I suggest that to get the correct image you look at the screen
|
||||
from inside the monitor whilst standing on your head. In case of
|
||||
confusion, please consult the following chart (*):</p>
|
||||
<pre><code> N
|
||||
^
|
||||
|
|
||||
@@ -221,9 +211,8 @@ In case of confusion, please consult the following chart (*):</p>
|
||||
S</code></pre>
|
||||
<p>(*) Not to scale.</p>
|
||||
<h3 id="history">History</h3>
|
||||
<p>Galileo discovered the moons in January 1610. <a
|
||||
href="https://web.archive.org/web/20001204212000/http://www-isds.jpl.nasa.gov/cwo/cwo_54ga/html/cd/galileo.htm"
|
||||
class="uri">https://web.archive.org/web/20001204212000/http://www-isds.jpl.nasa.gov/cwo/cwo_54ga/html/cd/galileo.htm</a>
|
||||
<p>Galileo discovered the moons in January 1610.
|
||||
<a href="https://web.archive.org/web/20001204212000/http://www-isds.jpl.nasa.gov/cwo/cwo_54ga/html/cd/galileo.htm" class="uri">https://web.archive.org/web/20001204212000/http://www-isds.jpl.nasa.gov/cwo/cwo_54ga/html/cd/galileo.htm</a>
|
||||
states the following:</p>
|
||||
<pre><code>By early 1610, Galileo had further improved his telescope by
|
||||
double its power, so it now enlarged objects a thousand
|
||||
@@ -257,181 +246,149 @@ Jupiter. One argument against the sun-centered theory was, if
|
||||
the Earth orbited the sun, wouldn't the moon get left behind?
|
||||
Here he could see for himself that somehow, a planet could
|
||||
orbit the sun, and not leave a moon behind!</code></pre>
|
||||
<p>Thus we can plot Galileo’s discoveries using the following three
|
||||
plots:</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">./rince</span> 0 <span class="va">$(</span><span class="ex">./dmy2jd</span> 7.8 1 1610<span class="va">)</span></span>
|
||||
<p>Thus we can plot Galileo’s discoveries using the following three plots:</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">./rince</span> 0 <span class="va">$(</span><span class="ex">./dmy2jd</span> 7.8 1 1610<span class="va">)</span></span>
|
||||
<span id="cb11-2"><a href="#cb11-2" aria-hidden="true" tabindex="-1"></a><span class="ex">./rince</span> 0 <span class="va">$(</span><span class="ex">./dmy2jd</span> 8.8 1 1610<span class="va">)</span></span>
|
||||
<span id="cb11-3"><a href="#cb11-3" aria-hidden="true" tabindex="-1"></a><span class="ex">./rince</span> 0 <span class="va">$(</span><span class="ex">./dmy2jd</span> 10.8 1 1610<span class="va">)</span></span></code></pre></div>
|
||||
<p>However we can go one better by seeing what Galileo would have seen
|
||||
if it wasn’t cloudy on the 9th. Try:</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">./rince</span> 0 <span class="va">$(</span><span class="ex">./dmy2jd</span> 9.85 1 1610<span class="va">)</span></span></code></pre></div>
|
||||
<p>to see what he was missing out on. I wonder what he’d have made of
|
||||
that!</p>
|
||||
<p>However we can go one better by seeing what Galileo would have seen if it
|
||||
wasn’t cloudy on the 9th. Try:</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">./rince</span> 0 <span class="va">$(</span><span class="ex">./dmy2jd</span> 9.85 1 1610<span class="va">)</span></span></code></pre></div>
|
||||
<p>to see what he was missing out on. I wonder what he’d have made of that!</p>
|
||||
<p>Galileo discovered the fourth moon a few days later.</p>
|
||||
<p>I’ve tried typing these dates into two Java based Jovian moon
|
||||
plotters, but both I tried had problems dealing with dates earlier than
|
||||
1900. More professional software, such as the <a
|
||||
href="http://www.bmsoftware.com/skymappro9.htm">SkyMap</a> gets these
|
||||
values correct and this compares well with the above description and
|
||||
with this IOCCC entry.</p>
|
||||
<p>The year 4713BC was chosen by <a
|
||||
href="https://en.wikipedia.org/wiki/Joseph_Justus_Scaliger">Joseph
|
||||
Justus Scaliger</a> in the 16th Century, so clearly this program has a
|
||||
long history :-) A more complete description of the origins of Julian
|
||||
Days can be found at <a
|
||||
href="https://web.archive.org/web/20001206152200/http://aa.usno.navy.mil/AA/faq/docs/millennium.html"
|
||||
class="uri">https://web.archive.org/web/20001206152200/http://aa.usno.navy.mil/AA/faq/docs/millennium.html</a>.</p>
|
||||
<p>I’ve tried typing these dates into two Java based Jovian moon plotters,
|
||||
but both I tried had problems dealing with dates earlier than 1900. More
|
||||
professional software, such as the
|
||||
<a href="http://www.bmsoftware.com/skymappro9.htm">SkyMap</a> gets these values
|
||||
correct and this compares well with the above description and with this
|
||||
IOCCC entry.</p>
|
||||
<p>The year 4713BC was chosen by <a href="https://en.wikipedia.org/wiki/Joseph_Justus_Scaliger">Joseph Justus
|
||||
Scaliger</a> in the 16th
|
||||
Century, so clearly this program has a long history :-) A more complete
|
||||
description of the origins of Julian Days can be found at
|
||||
<a href="https://web.archive.org/web/20001206152200/http://aa.usno.navy.mil/AA/faq/docs/millennium.html" class="uri">https://web.archive.org/web/20001206152200/http://aa.usno.navy.mil/AA/faq/docs/millennium.html</a>.</p>
|
||||
<h3 id="assumptions">Assumptions</h3>
|
||||
<p>This program assumes:</p>
|
||||
<ol type="1">
|
||||
<li><p>The ASCII character set is used.</p></li>
|
||||
<li><p>That an enormous comet hasn’t changed the course of Jupiter (or
|
||||
Earth!).</p></li>
|
||||
<li><p>That the date has not been specified as the gap between the <a
|
||||
href="https://en.wikipedia.org/wiki/Julian_calendar">Julian</a> and <a
|
||||
href="https://en.wikipedia.org/wiki/Gregorian_calendar">Gregorian</a>
|
||||
calendar.</p></li>
|
||||
<li><p>That the <code>DISPLAY</code> environment variable is set and the
|
||||
X display can opened. If this is not the case the program will
|
||||
crash.</p></li>
|
||||
<li><p>That an enormous comet hasn’t changed the course of Jupiter (or Earth!).</p></li>
|
||||
<li><p>That the date has not been specified as the gap between the
|
||||
<a href="https://en.wikipedia.org/wiki/Julian_calendar">Julian</a> and
|
||||
<a href="https://en.wikipedia.org/wiki/Gregorian_calendar">Gregorian</a> calendar.</p></li>
|
||||
<li><p>That the <code>DISPLAY</code> environment variable is set and the X display can opened.
|
||||
If this is not the case the program will crash.</p></li>
|
||||
<li><p>There is a year 2000BC problem :-)</p>
|
||||
<p>More specifically, the plots for dates that far back are too
|
||||
inaccurate to be of realistic use. Comparisons against <a
|
||||
href="http://www.bmsoftware.com/skymappro9.htm">SkyMap Pro</a> show that
|
||||
there is a good similarity (but not much more) up to about
|
||||
500BC.</p></li>
|
||||
<li><p>The code definitely is not portable - it will produce incorrect
|
||||
results if run from the surface of <a
|
||||
href="https://science.nasa.gov/mars/">Mars</a>.</p></li>
|
||||
<p>More specifically, the plots for dates that far back are too inaccurate to
|
||||
be of realistic use. Comparisons against <a href="http://www.bmsoftware.com/skymappro9.htm">SkyMap
|
||||
Pro</a> show that there is a good
|
||||
similarity (but not much more) up to about 500BC.</p></li>
|
||||
<li><p>The code definitely is not portable - it will produce incorrect results if
|
||||
run from the surface of <a href="https://science.nasa.gov/mars/">Mars</a>.</p></li>
|
||||
</ol>
|
||||
<h3 id="obfuscations">Obfuscations</h3>
|
||||
<p>In addition to the normal obfuscations, I feel that the code contains
|
||||
some less common tricks. Taken through the standard rounds listed in the
|
||||
<a href="../../2000/guidelines.txt">guidelines</a>, the code attempts to
|
||||
pass these as follows:</p>
|
||||
<p>In addition to the normal obfuscations, I feel that the code contains some less
|
||||
common tricks. Taken through the standard rounds listed in the
|
||||
<a href="../../2000/guidelines.txt">guidelines</a>, the code attempts to pass these as follows:</p>
|
||||
<ol type="1">
|
||||
<li><p>Look at the original source</p>
|
||||
<p>With luck, pure casual inspection should not reveal much except that
|
||||
the program contains the X Windows logo (a big clue) and contains a
|
||||
date. This date may give a clue to a few people that this is an
|
||||
astronomical program.</p>
|
||||
<p>Unfortunately I was stretched for space which meant that the large
|
||||
string constant could not be split up using a “partA” “partB” method
|
||||
which clearly limits the code layout. However the space saved by using a
|
||||
single long string constant is more than outweighed by the ability to
|
||||
further obfuscate.</p></li>
|
||||
<p>With luck, pure casual inspection should not reveal much except
|
||||
that the program contains the X Windows logo (a big clue) and
|
||||
contains a date. This date may give a clue to a few people that
|
||||
this is an astronomical program.</p>
|
||||
<p>Unfortunately I was stretched for space which meant that the
|
||||
large string constant could not be split up using a “partA”
|
||||
“partB” method which clearly limits the code layout. However the
|
||||
space saved by using a single long string constant is more than
|
||||
outweighed by the ability to further obfuscate.</p></li>
|
||||
<li><p>convert ANSI trigraphs to ASCII</p>
|
||||
<p>These are not used.</p></li>
|
||||
<li><p>C pre-process the source ignoring <code>#include</code>
|
||||
lines</p></li>
|
||||
<li><p>C pre-process the source ignoring <code>#define</code> and
|
||||
<code>#include</code> lines</p>
|
||||
<li><p>C pre-process the source ignoring <code>#include</code> lines</p></li>
|
||||
<li><p>C pre-process the source ignoring <code>#define</code> and <code>#include</code> lines</p>
|
||||
<p>This does a good job of expanding out the code, but it does not
|
||||
clarify things greatly. The use of <code>#define</code>s has been
|
||||
restricted primarily to a space-saving mechanism.</p>
|
||||
<p>Additionally, the use of <code>typedef</code>s means that the types
|
||||
used are still obscured unless further replacement edits are
|
||||
made.</p></li>
|
||||
clarify things greatly. The use of <code>#define</code>s has been restricted
|
||||
primarily to a space-saving mechanism.</p>
|
||||
<p>Additionally, the use of <code>typedef</code>s means that the types used are
|
||||
still obscured unless further replacement edits are made.</p></li>
|
||||
<li><p>Run it through a C beautifier.</p>
|
||||
<p>GNU <code>indent(1)</code> seems to do a reasonable job, provided
|
||||
that the <code>#define</code>s are expanded first. This doesn’t lay the
|
||||
algorithm particularly bare though as most of the obfuscations are not
|
||||
<p>GNU <code>indent(1)</code> seems to do a reasonable job, provided that the
|
||||
<code>#define</code>s are expanded first. This doesn’t lay the algorithm
|
||||
particularly bare though as most of the obfuscations are not
|
||||
simple code layouts.</p></li>
|
||||
<li><p>Examine the algorithm.</p>
|
||||
<p>The algorithm operates on two levels. The main visible level is by
|
||||
taking a large string and breaking this down into a series of opcodes
|
||||
(which I have termed J-code). These are then executed.</p>
|
||||
<p>To get to the real method of how it works, you need to decode the
|
||||
opcode string (which deliberately contains as many <code>;</code>,
|
||||
<code>{</code> and <code>}</code> symbols as possible), which will give
|
||||
you a <a
|
||||
href="https://en.wikipedia.org/wiki/Reverse_Polish_notation">Reverse
|
||||
Polish notation</a> chunk of mathematics.</p>
|
||||
<p>Sensible people amongst you will simply refer to the referenced book
|
||||
:-)</p></li>
|
||||
<p>The algorithm operates on two levels. The main visible level is
|
||||
by taking a large string and breaking this down into a series of
|
||||
opcodes (which I have termed J-code). These are then executed.</p>
|
||||
<p>To get to the real method of how it works, you need to decode the opcode
|
||||
string (which deliberately contains as many <code>;</code>, <code>{</code> and <code>}</code> symbols as
|
||||
possible), which will give you a <a href="https://en.wikipedia.org/wiki/Reverse_Polish_notation">Reverse Polish
|
||||
notation</a> chunk of
|
||||
mathematics.</p>
|
||||
<p>Sensible people amongst you will simply refer to the referenced book :-)</p></li>
|
||||
<li><p>Lint it.</p>
|
||||
<p>I no longer have lint, although I do have access to Purify. I’m happy
|
||||
to say that purify does not detect any memory errors or memory
|
||||
leaks.</p>
|
||||
<p>I no longer have lint, although I do have access to Purify. I’m
|
||||
happy to say that purify does not detect any memory errors or
|
||||
memory leaks.</p>
|
||||
<p>See below for compilation warnings.</p></li>
|
||||
<li><p>Compile it.</p>
|
||||
<p>I’m sorry to say that there are several warnings issued by the
|
||||
compiler.</p>
|
||||
<p>Firstly, the return type for <code>X()</code> is not specified, so it
|
||||
defaults to <code>int</code>. Horror of all horrors - this function does
|
||||
not return an integer type (it doesn’t contain any specific
|
||||
<code>return</code>s). The return value from <code>X()</code> is not
|
||||
accessed. The same problem occurs in <code>main()</code> - it does not
|
||||
return. However <code>main()</code> never exits unless there is a
|
||||
serious error.</p>
|
||||
<p>The 6th argument of <code>XDrawText</code> (which should be
|
||||
<code>XTextItem</code>) is passed as a compatible structure, but without
|
||||
casting. This is to reduce code space. A more elegant solution is to
|
||||
remove the <code>struct {...} Z</code> completely and use
|
||||
<code>XTextItem f={i-127+r/3*2,r%3+r/3+1,0,E}</code> at the start of
|
||||
<code>XDrawText</code> block. Although this is accepted by several
|
||||
compilers, it is not strict ANSI due to the non-constant initialisers. A
|
||||
pity.</p>
|
||||
<p>Note that I make use of <code>usleep()</code>. This is a POSIX call
|
||||
(it is BSD), but it’s supported on many systems. It may be implemented
|
||||
using <code>select()</code> or <code>poll()</code> if required, or as a
|
||||
final solution you can change the <code>usleep(10000)</code> to
|
||||
<code>sleep(1)</code>. To compile on systems which do not have
|
||||
<code>usleep()</code>, but do have <code>select()</code>, the following
|
||||
may suffice as an additional compiler argument:</p>
|
||||
<p>Firstly, the return type for <code>X()</code> is not specified, so it defaults to <code>int</code>.
|
||||
Horror of all horrors - this function does not return an integer type (it
|
||||
doesn’t contain any specific <code>return</code>s). The return value from <code>X()</code> is not
|
||||
accessed. The same problem occurs in <code>main()</code> - it does not return. However
|
||||
<code>main()</code> never exits unless there is a serious error.</p>
|
||||
<p>The 6th argument of <code>XDrawText</code> (which should be <code>XTextItem</code>) is
|
||||
passed as a compatible structure, but without casting. This is
|
||||
to reduce code space. A more elegant solution is to remove the
|
||||
<code>struct {...} Z</code> completely and use <code>XTextItem f={i-127+r/3*2,r%3+r/3+1,0,E}</code> at the start of <code>XDrawText</code>
|
||||
block. Although this is accepted by several compilers, it is not
|
||||
strict ANSI due to the non-constant initialisers. A pity.</p>
|
||||
<p>Note that I make use of <code>usleep()</code>. This is a POSIX call (it is BSD), but it’s
|
||||
supported on many systems. It may be implemented using <code>select()</code> or <code>poll()</code> if
|
||||
required, or as a final solution you can change the <code>usleep(10000)</code> to
|
||||
<code>sleep(1)</code>. To compile on systems which do not have <code>usleep()</code>, but do have
|
||||
<code>select()</code>, the following may suffice as an additional compiler argument:</p>
|
||||
<pre><code>-Dusleep={time_t v[2]={0,10000};select(0,0,0,0,v);}</code></pre>
|
||||
<p><code>gcc</code> complains about “unreachable code at beginning of
|
||||
switch statement”, although removing some of this code will prevent the
|
||||
algorithm from working.</p>
|
||||
<p><code>gcc</code> also suggests that I should be using extra
|
||||
parenthesis, but I’m taking this as good comment :-)</p></li>
|
||||
<p><code>gcc</code> complains about “unreachable code at beginning of switch
|
||||
statement”, although removing some of this code will prevent
|
||||
the algorithm from working.</p>
|
||||
<p><code>gcc</code> also suggests that I should be using extra parenthesis, but
|
||||
I’m taking this as good comment :-)</p></li>
|
||||
</ol>
|
||||
<p>In addition to the above, the program has the following useful(?)
|
||||
obfuscations:</p>
|
||||
<ol type="1">
|
||||
<li><p>The algorithm requires many floating point numbers (about 50).
|
||||
These are encoded as ASCII.</p></li>
|
||||
<li><p>The J-code algorithm has opcodes designed to be space saving.
|
||||
They are all one byte, but many are also considered as whitespace by the
|
||||
rules. This algorithm forms part of the same string that the floating
|
||||
point constants are embedded within. What does the <code>;</code>
|
||||
command do in J-code?</p></li>
|
||||
<li><p>The algorithm requires many floating point numbers (about 50). These are
|
||||
encoded as ASCII.</p></li>
|
||||
<li><p>The J-code algorithm has opcodes designed to be space saving. They are all
|
||||
one byte, but many are also considered as whitespace by the rules. This
|
||||
algorithm forms part of the same string that the floating point constants are
|
||||
embedded within. What does the <code>;</code> command do in J-code?</p></li>
|
||||
<li><p>The J-code language is both stack based and variable based. This
|
||||
“uncleanliness” is not ideal from a computer science angle, but when has
|
||||
cleanliness been considered as good in IOCCC? :-)</p></li>
|
||||
<li><p>Association of unconnected data by implied function usage. E.g.
|
||||
use of <code>strlen()</code> and <code>sizeof()</code> simply to return
|
||||
useful numerical values, using irrelevant arguments.</p></li>
|
||||
<li><p>As we already have a dependency on ASCII this has been abused
|
||||
further. Specifically some integer constants are specified as ASCII and
|
||||
some ASCII constants are integers. This hides the true meaning for the
|
||||
values.</p></li>
|
||||
<li><p>Red herrings: there are a couple of pieces of code whose
|
||||
appearance is just there to mislead the infirm of mind. I’ve only tried
|
||||
to include such examples in places where at first glance the code
|
||||
appears to be executed.</p></li>
|
||||
<li><p>Association of unconnected data by implied function usage. E.g. use of
|
||||
<code>strlen()</code> and <code>sizeof()</code> simply to return useful numerical values, using
|
||||
irrelevant arguments.</p></li>
|
||||
<li><p>As we already have a dependency on ASCII this has been abused further.
|
||||
Specifically some integer constants are specified as ASCII and some ASCII
|
||||
constants are integers. This hides the true meaning for the values.</p></li>
|
||||
<li><p>Red herrings: there are a couple of pieces of code whose appearance is just
|
||||
there to mislead the infirm of mind. I’ve only tried to include such examples
|
||||
in places where at first glance the code appears to be executed.</p></li>
|
||||
</ol>
|
||||
<h3 id="references">References</h3>
|
||||
<h2 id="copyright-and-cc-by-sa-4.0-license">Copyright and CC BY-SA 4.0
|
||||
License:</h2>
|
||||
<p>This file is Copyright (c) 2023 by Landon Curt Noll. All Rights
|
||||
Reserved. You are free to share and adapt this file under the terms of
|
||||
this license:</p>
|
||||
<h2 id="copyright-and-cc-by-sa-4.0-license">Copyright and CC BY-SA 4.0 License:</h2>
|
||||
<p>This file is Copyright (c) 2023 by Landon Curt Noll. All Rights Reserved.
|
||||
You are free to share and adapt this file under the terms of this license:</p>
|
||||
<pre><code>Creative Commons Attribution-ShareAlike 4.0 International (CC BY-SA 4.0)</code></pre>
|
||||
<p>For more information, see:
|
||||
https://creativecommons.org/licenses/by-sa/4.0/</p>
|
||||
<section id="footnotes" class="footnotes footnotes-end-of-document"
|
||||
role="doc-endnotes">
|
||||
<p>For more information, see: https://creativecommons.org/licenses/by-sa/4.0/</p>
|
||||
<section id="footnotes" class="footnotes footnotes-end-of-document" role="doc-endnotes">
|
||||
<hr />
|
||||
<ol>
|
||||
<li id="fn1"><p>Astronomical algorithms (1st ed): page 59 Jean Meeus.
|
||||
Published by Willmann-Bell Inc.<a href="#fnref1" class="footnote-back"
|
||||
role="doc-backlink">↩︎</a></p></li>
|
||||
<li id="fn2"><p>Astronomical algorithms (1st ed): pages 285-299. Jean
|
||||
Meeus. Published by Willmann-Bell Inc.<a href="#fnref2"
|
||||
class="footnote-back" role="doc-backlink">↩︎</a></p></li>
|
||||
<li id="fn1"><p>Astronomical algorithms (1st ed): page 59
|
||||
Jean Meeus. Published by Willmann-Bell Inc.<a href="#fnref1" class="footnote-back" role="doc-backlink">↩︎</a></p></li>
|
||||
<li id="fn2"><p>Astronomical algorithms (1st ed): pages 285-299.
|
||||
Jean Meeus. Published by Willmann-Bell Inc.<a href="#fnref2" class="footnote-back" role="doc-backlink">↩︎</a></p></li>
|
||||
</ol>
|
||||
</section>
|
||||
|
||||
@@ -440,42 +397,24 @@ class="footnote-back" role="doc-backlink">↩︎</a></p></li>
|
||||
|
||||
<!-- START: this line starts content generated by: bin/output-index-inventory.sh -->
|
||||
|
||||
<h1 id="inventory-for-2000rince"><a name="inventory"></a>Inventory for
|
||||
2000/rince</h1>
|
||||
<h1 id="inventory-for-2000rince"><a name="inventory"></a>Inventory for 2000/rince</h1>
|
||||
<p><a href="#top">Jump to top</a></p>
|
||||
<h2 id="primary-files">Primary files</h2>
|
||||
<ul>
|
||||
<li><a
|
||||
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2000/rince/rince.c">rince.c</a>
|
||||
- entry source</li>
|
||||
<li><a
|
||||
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2000/rince/Makefile">Makefile</a>
|
||||
- entry Makefile</li>
|
||||
<li><a
|
||||
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2000/rince/rince.orig.c">rince.orig.c</a>
|
||||
- original source</li>
|
||||
<li><a
|
||||
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2000/rince/try.sh">try.sh</a>
|
||||
- how to run</li>
|
||||
<li><a
|
||||
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2000/rince/dmy2jd.c">dmy2jd.c</a>
|
||||
- supplementary program source</li>
|
||||
<li><a href="2000_rince.tar.bz2">2000_rince.tar.bz2</a> - download entry
|
||||
source</li>
|
||||
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2000/rince/rince.c">rince.c</a> - entry source</li>
|
||||
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2000/rince/Makefile">Makefile</a> - entry Makefile</li>
|
||||
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2000/rince/rince.orig.c">rince.orig.c</a> - original source</li>
|
||||
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2000/rince/try.sh">try.sh</a> - how to run</li>
|
||||
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2000/rince/dmy2jd.c">dmy2jd.c</a> - supplementary program source</li>
|
||||
<li><a href="2000_rince.tar.bz2">2000_rince.tar.bz2</a> - download entry source</li>
|
||||
</ul>
|
||||
<h2 id="secondary-files">Secondary files</h2>
|
||||
<ul>
|
||||
<li><a href="index.html">index.html</a> - entry home page</li>
|
||||
<li><a
|
||||
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2000/rince/.entry.json">.entry.json</a>
|
||||
- description of entry in JSON</li>
|
||||
<li><a
|
||||
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2000/rince/.gitignore">.gitignore</a>
|
||||
- list of files that should not be committed under git</li>
|
||||
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2000/rince/.entry.json">.entry.json</a> - description of entry in JSON</li>
|
||||
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2000/rince/.gitignore">.gitignore</a> - list of files that should not be committed under git</li>
|
||||
<li><a href=".path">.path</a> - directory path from top directory</li>
|
||||
<li><a
|
||||
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2000/rince/README.md">README.md</a>
|
||||
- markdown source for index.html</li>
|
||||
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2000/rince/README.md">README.md</a> - markdown source for index.html</li>
|
||||
</ul>
|
||||
|
||||
<!-- END: next line ends content generated by: bin/output-index-inventory.sh -->
|
||||
|
||||
+72
-99
@@ -129,9 +129,9 @@
|
||||
|
||||
<h2 id="author"><a name="author"></a>Author:</h2>
|
||||
<ul>
|
||||
<li>Name: <a href="../../authors.html#Arch_D_Robison">Arch D.
|
||||
Robison</a><br> Location: <a href="../../location.html#US">US</a> -
|
||||
<em>United States of America</em> (<em>United States</em>) <br><br></li>
|
||||
<li>Name: <a href="../../authors.html#Arch_D_Robison">Arch D. Robison</a><br>
|
||||
Location: <a href="../../location.html#US">US</a> - <em>United States of America</em> (<em>United States</em>)
|
||||
<br><br></li>
|
||||
</ul>
|
||||
|
||||
<!-- END: next line ends content generated by: bin/output-index-author.sh -->
|
||||
@@ -144,98 +144,88 @@ Robison</a><br> Location: <a href="../../location.html#US">US</a> -
|
||||
<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">./robison</span></span></code></pre></div>
|
||||
<h2 id="judges-remarks">Judges’ remarks:</h2>
|
||||
<p>The program plays almost always reasonably, but does not always
|
||||
detect illegal moves. Try “9 1” as your first move, then “13 2”. Also it
|
||||
tends to think for quite a while in the beginning of a game. It is also
|
||||
smart enough to give up by making a losing move at the end of a game
|
||||
when its position is hopeless.</p>
|
||||
<p>The program plays almost always reasonably, but does not always detect
|
||||
illegal moves. Try “9 1” as your first move, then “13 2”. Also it
|
||||
tends to think for quite a while in the beginning of a game. It is
|
||||
also smart enough to give up by making a losing move at the end of
|
||||
a game when its position is hopeless.</p>
|
||||
<p>Unfortunately, due to the contest rules, we’re unable to grant the
|
||||
author a patent he applied for. :-)</p>
|
||||
<h2 id="authors-remarks">Author’s remarks:</h2>
|
||||
<h3 id="title-of-invention">TITLE OF INVENTION</h3>
|
||||
<p>Highly Compressed Program for Playing Hygienic Checkers</p>
|
||||
<h3 id="field-of-invention">FIELD OF INVENTION</h3>
|
||||
<p>The present invention generally relates to <a
|
||||
href="https://en.wikipedia.org/wiki/Checkers">checkers</a>.</p>
|
||||
<p>The present invention generally relates to
|
||||
<a href="https://en.wikipedia.org/wiki/Checkers">checkers</a>.</p>
|
||||
<h3 id="background-of-the-invention">BACKGROUND OF THE INVENTION</h3>
|
||||
<p>Within the field of <a
|
||||
href="https://en.wikipedia.org/wiki/Checkers">Checkers</a>, the problem
|
||||
of finding a hygienic opponent is difficult, as good opponents are
|
||||
peculiar to the tavern habitat of cracker-barrels, pot-belly stoves,
|
||||
tobacco, and spittoons.</p>
|
||||
<h3 id="brief-summary-of-the-invention">BRIEF SUMMARY OF THE
|
||||
INVENTION</h3>
|
||||
<p>The present invention plays <a
|
||||
href="https://en.wikipedia.org/wiki/Checkers">Checkers</a> without
|
||||
spitting.</p>
|
||||
<h3 id="brief-description-of-several-views-of-the-invention">BRIEF
|
||||
DESCRIPTION OF SEVERAL VIEWS OF THE INVENTION</h3>
|
||||
<p>Within the field of <a href="https://en.wikipedia.org/wiki/Checkers">Checkers</a>, the
|
||||
problem of finding a hygienic opponent is difficult, as good opponents are
|
||||
peculiar to the tavern habitat of cracker-barrels, pot-belly stoves, tobacco,
|
||||
and spittoons.</p>
|
||||
<h3 id="brief-summary-of-the-invention">BRIEF SUMMARY OF THE INVENTION</h3>
|
||||
<p>The present invention plays <a href="https://en.wikipedia.org/wiki/Checkers">Checkers</a>
|
||||
without spitting.</p>
|
||||
<h3 id="brief-description-of-several-views-of-the-invention">BRIEF DESCRIPTION OF SEVERAL VIEWS OF THE INVENTION</h3>
|
||||
<p>FIG. 1 shows a numbering of positions.</p>
|
||||
<p>FIG. 2 shows a numbering of directions.</p>
|
||||
<p>FIG. 3 shows a sample board.</p>
|
||||
<p>FIG. 4 shows a method in accordance with the present invention.</p>
|
||||
<h3 id="detailed-description-of-the-invention">DETAILED DESCRIPTION OF
|
||||
THE INVENTION</h3>
|
||||
<p>Operator plays Black (<code>x</code>); the program plays White
|
||||
(<code>o</code>). Said Black goes first. On operator’s turn, said
|
||||
program requests a position and direction. FIG. 1 shows the numbering of
|
||||
the squares. FIG. 2 shows the numbering of directions. As per standard
|
||||
rules, if one or more jumps are possible, one of the jumps must be taken
|
||||
in preference to other moves. Said operator enters the numbers for the
|
||||
<h3 id="detailed-description-of-the-invention">DETAILED DESCRIPTION OF THE INVENTION</h3>
|
||||
<p>Operator plays Black (<code>x</code>); the program plays White (<code>o</code>). Said Black goes first.
|
||||
On operator’s turn, said program requests a position and direction. FIG. 1 shows
|
||||
the numbering of the squares. FIG. 2 shows the numbering of directions. As per
|
||||
standard rules, if one or more jumps are possible, one of the jumps must be
|
||||
taken in preference to other moves. Said operator enters the numbers for the
|
||||
position and direction. If after jumping over a piece, another jump is
|
||||
possible, and said piece did not become a king after said jump, standard
|
||||
rules require that another jump be taken. In said case, said program
|
||||
requests a direction only in which to continue jumping from the present
|
||||
position. Kings are denoted by upper case. FIG. 3 shows a sample board.
|
||||
There is a black king (<code>X</code>) on square 30 and a red king
|
||||
(<code>O</code>) on square 2. The numbers on the right are the numbers
|
||||
of the rightmost square in each row.</p>
|
||||
<p>A player loses if they cannot make a legal move. Said loss is
|
||||
trivially true if player loses all of his/her pieces. The present
|
||||
invention announces said loser.</p>
|
||||
<p>FIG. 4 shows a C program in accordance with the present invention.
|
||||
Control flow is straightforward: control enters routine
|
||||
<code>main()</code>, executes a plurality of statements, and exits via a
|
||||
<code>return</code> statement. FIG. 4 presumes that type
|
||||
<code>int</code> is <code>32 bits</code> and <code>short</code> is
|
||||
<code>16 bits</code>, which are essential to the preferred embodiment of
|
||||
the invention. FIG. 4 also presumes that the host computer uses ASCII
|
||||
encoding for characters. It should be obvious that practitioners skilled
|
||||
possible, and said piece did not become a king after said jump, standard rules
|
||||
require that another jump be taken. In said case, said program requests a
|
||||
direction only in which to continue jumping from the present position. Kings
|
||||
are denoted by upper case. FIG. 3 shows a sample board. There is a black king
|
||||
(<code>X</code>) on square 30 and a red king (<code>O</code>) on square 2. The numbers on the right are
|
||||
the numbers of the rightmost square in each row.</p>
|
||||
<p>A player loses if they cannot make a legal move. Said loss is trivially
|
||||
true if player loses all of his/her pieces. The present invention announces
|
||||
said loser.</p>
|
||||
<p>FIG. 4 shows a C program in accordance with the present invention. Control flow
|
||||
is straightforward: control enters routine <code>main()</code>, executes a plurality of
|
||||
statements, and exits via a <code>return</code> statement. FIG. 4 presumes that type <code>int</code>
|
||||
is <code>32 bits</code> and <code>short</code> is <code>16 bits</code>, which are essential to the preferred
|
||||
embodiment of the invention. FIG. 4 also presumes that the host computer uses
|
||||
ASCII encoding for characters. It should be obvious that practitioners skilled
|
||||
in the art of C programming can remove said limitations.</p>
|
||||
<p>The disclosure here describes a particular embodiment of the present
|
||||
invention, and other embodiments within the spirit of this disclosure
|
||||
are possible, as well as consumption of spirits while playing.</p>
|
||||
<p>The disclosure here describes a particular embodiment of the present invention,
|
||||
and other embodiments within the spirit of this disclosure are possible, as well
|
||||
as consumption of spirits while playing.</p>
|
||||
<h3 id="claims">CLAIMS</h3>
|
||||
<p>I claim, by letters patently absurd:</p>
|
||||
<ol type="1">
|
||||
<li><p>A method for playing checkers on a computer-based system, where
|
||||
said method’s source code fits into 1536 countable bytes of source code,
|
||||
<li><p>A method for playing checkers on a computer-based system, where said
|
||||
method’s source code fits into 1536 countable bytes of source code,
|
||||
where a byte is countable if</p>
|
||||
<ul>
|
||||
<li>it is not whitespace and</li>
|
||||
<li>it is not a ‘<code>{</code>’, ‘<code>}</code>’, or ‘<code>;</code>’
|
||||
immediately followed by whitespace.</li>
|
||||
<li>it is not a ‘<code>{</code>’, ‘<code>}</code>’, or ‘<code>;</code>’ immediately followed by whitespace.</li>
|
||||
</ul></li>
|
||||
<li><p>The method of claim 1, further comprising a method of alpha-beta
|
||||
pruning that exploits the zero-sum nature of the game to unify alpha and
|
||||
beta cuts.</p></li>
|
||||
<li><p>The method of claim 1, further comprising the step of formatting
|
||||
the source code with short lines, in order to impress the manager with
|
||||
<li><p>The method of claim 1, further comprising a method of alpha-beta pruning
|
||||
that exploits the zero-sum nature of the game to unify alpha
|
||||
and beta cuts.</p></li>
|
||||
<li><p>The method of claim 1, further comprising the step of formatting the
|
||||
source code with short lines, in order to impress the manager with
|
||||
high productivity, when measured in lines of code.</p></li>
|
||||
<li><p>The method of claim 3, further comprising the step for telling
|
||||
the skeptical manager that this is the well-known technique of “linear
|
||||
programming”.</p></li>
|
||||
<li><p>The method of claim 1, where <code>~-</code> and <code>-~</code>
|
||||
replace the obvious arithmetic operations.</p></li>
|
||||
<li><p>The method of claim 3, further comprising the step for telling the
|
||||
skeptical manager that this is the well-known technique of
|
||||
“linear programming”.</p></li>
|
||||
<li><p>The method of claim 1, where <code>~-</code> and <code>-~</code> replace the obvious arithmetic
|
||||
operations.</p></li>
|
||||
<li><p>The method of claim 1, further comprising a method where</p>
|
||||
<ul>
|
||||
<li>strings are encrypted in a manner suitable as C strings, and</li>
|
||||
<li>7-bit ASCII characters with uniform distribution are maximally
|
||||
packed subject to the restriction that each byte is not countable</li>
|
||||
<li>7-bit ASCII characters with uniform distribution are maximally packed
|
||||
subject to the restriction that each byte is not countable</li>
|
||||
</ul></li>
|
||||
<li><p>A method for a computer-based system that uses a single shared
|
||||
code sequence to either sum a plurality of bits in an N-bit word or
|
||||
reverses them, in lg(N) time, depending upon a parameter.</p></li>
|
||||
<li><p>A method for a computer-based system that uses a single shared code
|
||||
sequence to either sum a plurality of bits in an N-bit word or reverses
|
||||
them, in lg(N) time, depending upon a parameter.</p></li>
|
||||
</ol>
|
||||
<h3 id="drawings">DRAWINGS</h3>
|
||||
<h4 id="fig-1.">FIG 1.</h4>
|
||||
@@ -273,50 +263,33 @@ reverses them, in lg(N) time, depending upon a parameter.</p></li>
|
||||
x x O x 1</code></pre>
|
||||
<h4 id="fig.-4">FIG. 4</h4>
|
||||
<p>[See attached listing.]</p>
|
||||
<h2 id="copyright-and-cc-by-sa-4.0-license">Copyright and CC BY-SA 4.0
|
||||
License:</h2>
|
||||
<p>This file is Copyright (c) 2023 by Landon Curt Noll. All Rights
|
||||
Reserved. You are free to share and adapt this file under the terms of
|
||||
this license:</p>
|
||||
<h2 id="copyright-and-cc-by-sa-4.0-license">Copyright and CC BY-SA 4.0 License:</h2>
|
||||
<p>This file is Copyright (c) 2023 by Landon Curt Noll. All Rights Reserved.
|
||||
You are free to share and adapt this file under the terms of this license:</p>
|
||||
<pre><code>Creative Commons Attribution-ShareAlike 4.0 International (CC BY-SA 4.0)</code></pre>
|
||||
<p>For more information, see:
|
||||
https://creativecommons.org/licenses/by-sa/4.0/</p>
|
||||
<p>For more information, see: https://creativecommons.org/licenses/by-sa/4.0/</p>
|
||||
|
||||
<!-- END: this line ends content for HTML phase 21 by: bin/pandoc-wrapper.sh via bin/md2html.sh -->
|
||||
<!-- START: this line starts content for HTML phase 22 by: bin/output-index-inventory.sh via bin/md2html.sh -->
|
||||
|
||||
<!-- START: this line starts content generated by: bin/output-index-inventory.sh -->
|
||||
|
||||
<h1 id="inventory-for-2000robison"><a name="inventory"></a>Inventory for
|
||||
2000/robison</h1>
|
||||
<h1 id="inventory-for-2000robison"><a name="inventory"></a>Inventory for 2000/robison</h1>
|
||||
<p><a href="#top">Jump to top</a></p>
|
||||
<h2 id="primary-files">Primary files</h2>
|
||||
<ul>
|
||||
<li><a
|
||||
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2000/robison/robison.c">robison.c</a>
|
||||
- entry source</li>
|
||||
<li><a
|
||||
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2000/robison/Makefile">Makefile</a>
|
||||
- entry Makefile</li>
|
||||
<li><a
|
||||
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2000/robison/robison.orig.c">robison.orig.c</a>
|
||||
- original source</li>
|
||||
<li><a href="2000_robison.tar.bz2">2000_robison.tar.bz2</a> - download
|
||||
entry source</li>
|
||||
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2000/robison/robison.c">robison.c</a> - entry source</li>
|
||||
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2000/robison/Makefile">Makefile</a> - entry Makefile</li>
|
||||
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2000/robison/robison.orig.c">robison.orig.c</a> - original source</li>
|
||||
<li><a href="2000_robison.tar.bz2">2000_robison.tar.bz2</a> - download entry source</li>
|
||||
</ul>
|
||||
<h2 id="secondary-files">Secondary files</h2>
|
||||
<ul>
|
||||
<li><a href="index.html">index.html</a> - entry home page</li>
|
||||
<li><a
|
||||
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2000/robison/.entry.json">.entry.json</a>
|
||||
- description of entry in JSON</li>
|
||||
<li><a
|
||||
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2000/robison/.gitignore">.gitignore</a>
|
||||
- list of files that should not be committed under git</li>
|
||||
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2000/robison/.entry.json">.entry.json</a> - description of entry in JSON</li>
|
||||
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2000/robison/.gitignore">.gitignore</a> - list of files that should not be committed under git</li>
|
||||
<li><a href=".path">.path</a> - directory path from top directory</li>
|
||||
<li><a
|
||||
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2000/robison/README.md">README.md</a>
|
||||
- markdown source for index.html</li>
|
||||
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2000/robison/README.md">README.md</a> - markdown source for index.html</li>
|
||||
</ul>
|
||||
|
||||
<!-- END: next line ends content generated by: bin/output-index-inventory.sh -->
|
||||
|
||||
@@ -129,9 +129,8 @@
|
||||
|
||||
<h2 id="author"><a name="author"></a>Author:</h2>
|
||||
<ul>
|
||||
<li>Name: <a href="../../authors.html#Craig_Schneiderwent">Craig
|
||||
Schneiderwent</a><br> Location: <a href="../../location.html#US">US</a>
|
||||
- <em>United States of America</em> (<em>United States</em>)
|
||||
<li>Name: <a href="../../authors.html#Craig_Schneiderwent">Craig Schneiderwent</a><br>
|
||||
Location: <a href="../../location.html#US">US</a> - <em>United States of America</em> (<em>United States</em>)
|
||||
<br><br></li>
|
||||
</ul>
|
||||
|
||||
@@ -148,113 +147,88 @@ Schneiderwent</a><br> Location: <a href="../../location.html#US">US</a>
|
||||
<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">./schneiderwent</span> schneiderwent.data</span>
|
||||
<span id="cb3-2"><a href="#cb3-2" aria-hidden="true" tabindex="-1"></a><span class="ex">./schneiderwent</span></span></code></pre></div>
|
||||
<p>What’s the difference?</p>
|
||||
<p>If you have a long while to spare (and you’re bored enough that you
|
||||
could watch paint dry :-) ) you might also try:</p>
|
||||
<p>If you have a long while to spare (and you’re bored enough that you could watch
|
||||
paint dry :-) ) you might also try:</p>
|
||||
<div class="sourceCode" id="cb4"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb4-1"><a href="#cb4-1" aria-hidden="true" tabindex="-1"></a><span class="ex">./try.sh</span></span></code></pre></div>
|
||||
<p>Alternatively, you can check on it later on, to see all the entry
|
||||
does. Or if you wish to make it run faster, you can override how long it
|
||||
sleeps per iterations and how many iterations it runs. For instance to
|
||||
make it sleep only 30 seconds and run only twice:</p>
|
||||
<p>Alternatively, you can check on it later on, to see all the entry does. Or if
|
||||
you wish to make it run faster, you can override how long it sleeps per
|
||||
iterations and how many iterations it runs. For instance to make it sleep only
|
||||
30 seconds and run only twice:</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">SLEEP</span><span class="op">=</span>30 <span class="va">ITERATIONS</span><span class="op">=</span>2 <span class="ex">./try.sh</span></span></code></pre></div>
|
||||
<h2 id="judges-remarks">Judges’ remarks:</h2>
|
||||
<p>Very nice play by the rules and portable text obfuscation. This far
|
||||
surpasses old tricks like adding or subtracting 1 from every character
|
||||
in a C string.</p>
|
||||
<p>Very nice play by the rules and portable text obfuscation.
|
||||
This far surpasses old tricks like adding or subtracting 1
|
||||
from every character in a C string.</p>
|
||||
<p>Translating the messages into your language of preference while
|
||||
keeping the program portable between different encodings (Chinese,
|
||||
Japanese, Russian - anyone?) may be an entertaining task.</p>
|
||||
keeping the program portable between different encodings
|
||||
(Chinese, Japanese, Russian - anyone?) may be an entertaining task.</p>
|
||||
<h2 id="authors-remarks">Author’s remarks:</h2>
|
||||
<p>This entry displays the current time to the console, for example:</p>
|
||||
<blockquote>
|
||||
<p>it’s just after ten ’til 6 in the evening</p>
|
||||
</blockquote>
|
||||
<p>FWIW, none of the compilers with which this entry was tested issued
|
||||
any warnings or errors in compiling the source for this entry. No doubt
|
||||
lint will complain about the goto statements.</p>
|
||||
<p>The <a href="schneiderwent.data">schneiderwent.data</a> file consists
|
||||
of the values used by multiple table lookups. This is simply good
|
||||
program design, separating these values from the source code allows
|
||||
changing the behavior of the application without recompiling.</p>
|
||||
<p>Having learned COBOL at an early age, the <code>pthread</code>s of my
|
||||
thought processes tend to be translated into code in a verbose manner.
|
||||
Some of the <code>#define</code>s in this entry’s code are to mitigate
|
||||
this personal deficiency.</p>
|
||||
any warnings or errors in compiling the source for this entry. No
|
||||
doubt lint will complain about the goto statements.</p>
|
||||
<p>The <a href="schneiderwent.data">schneiderwent.data</a> file consists of the values used by
|
||||
multiple table lookups. This is simply good program design, separating these
|
||||
values from the source code allows changing the behavior of the application
|
||||
without recompiling.</p>
|
||||
<p>Having learned COBOL at an early age, the <code>pthread</code>s of my thought
|
||||
processes tend to be translated into code in a verbose manner. Some
|
||||
of the <code>#define</code>s in this entry’s code are to mitigate this personal
|
||||
deficiency.</p>
|
||||
<h3 id="obfuscation">Obfuscation</h3>
|
||||
<p>Obfuscation in this entry consists of:</p>
|
||||
<ul>
|
||||
<li><code>printf(3)</code>ing console messages stored as <a
|
||||
href="https://en.wikipedia.org/wiki/EBCDIC">EBCDIC</a> character values
|
||||
- this is not an attempt at encryption, but rather at cross platform
|
||||
compatibility.</li>
|
||||
<li><a href="https://en.wikipedia.org/wiki/ASCII">ASCII</a> character
|
||||
values are calculated from the EBCDIC in a particularly ugly abuse of
|
||||
the <code>?:</code> operator.</li>
|
||||
<li>Detection of whether to print the ASCII or EBCDIC values is done by
|
||||
taking the remainder of dividing the character <code>'J'</code> by
|
||||
<code>2</code> - the ASCII value of the character is even, the EBCDIC
|
||||
value is odd.</li>
|
||||
<li>The messages to be <code>printf(3)</code>ed are determined via
|
||||
multiple table lookups and bit-masked values.</li>
|
||||
<li>For minutes, the bit position turned on is multiplied by two to
|
||||
determine the message to be <code>printf(3)</code>ed.</li>
|
||||
<li><code>printf(3)</code>ing console messages stored as
|
||||
<a href="https://en.wikipedia.org/wiki/EBCDIC">EBCDIC</a> character values - this is not
|
||||
an attempt at encryption, but rather at cross platform compatibility.</li>
|
||||
<li><a href="https://en.wikipedia.org/wiki/ASCII">ASCII</a> character values are calculated
|
||||
from the EBCDIC in a particularly ugly abuse of the <code>?:</code> operator.</li>
|
||||
<li>Detection of whether to print the ASCII or EBCDIC values is done by taking the
|
||||
remainder of dividing the character <code>'J'</code> by <code>2</code> - the ASCII value of the
|
||||
character is even, the EBCDIC value is odd.</li>
|
||||
<li>The messages to be <code>printf(3)</code>ed are determined via multiple table lookups and
|
||||
bit-masked values.</li>
|
||||
<li>For minutes, the bit position turned on is multiplied by two to determine the
|
||||
message to be <code>printf(3)</code>ed.</li>
|
||||
<li>For hours, the straight bit position is used.</li>
|
||||
<li>This entry mostly eschews function calls for the often overlooked
|
||||
<code>setjmp(3)</code>/<code>longjmp(3)</code> combination.</li>
|
||||
<li>The trigraphs are not there as obfuscation nor are they there to
|
||||
annoy the judges - it’s just the easiest way to get around the absence
|
||||
of square brackets in a normal 3270 environment.</li>
|
||||
<li>The trigraphs are not there as obfuscation nor are they there to annoy the
|
||||
judges - it’s just the easiest way to get around the absence of square brackets
|
||||
in a normal 3270 environment.</li>
|
||||
</ul>
|
||||
<h2 id="copyright-and-cc-by-sa-4.0-license">Copyright and CC BY-SA 4.0
|
||||
License:</h2>
|
||||
<p>This file is Copyright (c) 2023 by Landon Curt Noll. All Rights
|
||||
Reserved. You are free to share and adapt this file under the terms of
|
||||
this license:</p>
|
||||
<h2 id="copyright-and-cc-by-sa-4.0-license">Copyright and CC BY-SA 4.0 License:</h2>
|
||||
<p>This file is Copyright (c) 2023 by Landon Curt Noll. All Rights Reserved.
|
||||
You are free to share and adapt this file under the terms of this license:</p>
|
||||
<pre><code>Creative Commons Attribution-ShareAlike 4.0 International (CC BY-SA 4.0)</code></pre>
|
||||
<p>For more information, see:
|
||||
https://creativecommons.org/licenses/by-sa/4.0/</p>
|
||||
<p>For more information, see: https://creativecommons.org/licenses/by-sa/4.0/</p>
|
||||
|
||||
<!-- END: this line ends content for HTML phase 21 by: bin/pandoc-wrapper.sh via bin/md2html.sh -->
|
||||
<!-- START: this line starts content for HTML phase 22 by: bin/output-index-inventory.sh via bin/md2html.sh -->
|
||||
|
||||
<!-- START: this line starts content generated by: bin/output-index-inventory.sh -->
|
||||
|
||||
<h1
|
||||
id="inventory-for-2000schneiderwent"><a name="inventory"></a>Inventory
|
||||
for 2000/schneiderwent</h1>
|
||||
<h1 id="inventory-for-2000schneiderwent"><a name="inventory"></a>Inventory for 2000/schneiderwent</h1>
|
||||
<p><a href="#top">Jump to top</a></p>
|
||||
<h2 id="primary-files">Primary files</h2>
|
||||
<ul>
|
||||
<li><a
|
||||
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2000/schneiderwent/schneiderwent.c">schneiderwent.c</a>
|
||||
- entry source</li>
|
||||
<li><a
|
||||
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2000/schneiderwent/Makefile">Makefile</a>
|
||||
- entry Makefile</li>
|
||||
<li><a
|
||||
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2000/schneiderwent/schneiderwent.orig.c">schneiderwent.orig.c</a>
|
||||
- original source</li>
|
||||
<li><a
|
||||
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2000/schneiderwent/try.sh">try.sh</a>
|
||||
- how to run</li>
|
||||
<li><a
|
||||
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2000/schneiderwent/schneiderwent.data">schneiderwent.data</a>
|
||||
- table lookups values</li>
|
||||
<li><a href="2000_schneiderwent.tar.bz2">2000_schneiderwent.tar.bz2</a>
|
||||
- download entry source</li>
|
||||
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2000/schneiderwent/schneiderwent.c">schneiderwent.c</a> - entry source</li>
|
||||
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2000/schneiderwent/Makefile">Makefile</a> - entry Makefile</li>
|
||||
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2000/schneiderwent/schneiderwent.orig.c">schneiderwent.orig.c</a> - original source</li>
|
||||
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2000/schneiderwent/try.sh">try.sh</a> - how to run</li>
|
||||
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2000/schneiderwent/schneiderwent.data">schneiderwent.data</a> - table lookups values</li>
|
||||
<li><a href="2000_schneiderwent.tar.bz2">2000_schneiderwent.tar.bz2</a> - download entry source</li>
|
||||
</ul>
|
||||
<h2 id="secondary-files">Secondary files</h2>
|
||||
<ul>
|
||||
<li><a href="index.html">index.html</a> - entry home page</li>
|
||||
<li><a
|
||||
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2000/schneiderwent/.entry.json">.entry.json</a>
|
||||
- description of entry in JSON</li>
|
||||
<li><a
|
||||
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2000/schneiderwent/.gitignore">.gitignore</a>
|
||||
- list of files that should not be committed under git</li>
|
||||
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2000/schneiderwent/.entry.json">.entry.json</a> - description of entry in JSON</li>
|
||||
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2000/schneiderwent/.gitignore">.gitignore</a> - list of files that should not be committed under git</li>
|
||||
<li><a href=".path">.path</a> - directory path from top directory</li>
|
||||
<li><a
|
||||
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2000/schneiderwent/README.md">README.md</a>
|
||||
- markdown source for index.html</li>
|
||||
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2000/schneiderwent/README.md">README.md</a> - markdown source for index.html</li>
|
||||
</ul>
|
||||
|
||||
<!-- END: next line ends content generated by: bin/output-index-inventory.sh -->
|
||||
|
||||
+54
-85
@@ -129,13 +129,12 @@
|
||||
|
||||
<h2 id="authors"><a name="author"></a>Authors:</h2>
|
||||
<ul>
|
||||
<li>Name: <a href="../../authors.html#Gavin_Buttimore">Gavin
|
||||
Buttimore</a><br> Location: <a href="../../location.html#ZZ">ZZ</a> -
|
||||
<em>Unknown location</em> <br><br></li>
|
||||
<li>Name: <a href="../../authors.html#Thaddaeus_Frogley">Thaddaeus
|
||||
Frogley</a><br> Location: <a href="../../location.html#GB">GB</a> -
|
||||
<em>United Kingdom of Great Britain and Northern Ireland</em>
|
||||
(<em>United Kingdom</em>) <br><br></li>
|
||||
<li>Name: <a href="../../authors.html#Gavin_Buttimore">Gavin Buttimore</a><br>
|
||||
Location: <a href="../../location.html#ZZ">ZZ</a> - <em>Unknown location</em>
|
||||
<br><br></li>
|
||||
<li>Name: <a href="../../authors.html#Thaddaeus_Frogley">Thaddaeus Frogley</a><br>
|
||||
Location: <a href="../../location.html#GB">GB</a> - <em>United Kingdom of Great Britain and Northern Ireland</em> (<em>United Kingdom</em>)
|
||||
<br><br></li>
|
||||
</ul>
|
||||
|
||||
<!-- END: next line ends content generated by: bin/output-index-author.sh -->
|
||||
@@ -145,49 +144,44 @@ Frogley</a><br> Location: <a href="../../location.html#GB">GB</a> -
|
||||
|
||||
<h2 id="to-build">To build:</h2>
|
||||
<div class="sourceCode" id="cb1"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb1-1"><a href="#cb1-1" aria-hidden="true" tabindex="-1"></a><span class="fu">make</span> alt</span></code></pre></div>
|
||||
<p>NOTE: if you don’t have curses or SDL1 installed both modes will fail
|
||||
to compile. In that case see the <a href="../../faq.html#SDL">FAQ 3.8 -
|
||||
How do I compile an IOCCC entry that requires SDL1 or SDL2?</a> and <a
|
||||
href="../../faq.html#curses">FAQ 3.9 - How do I compile an IOCCC entry
|
||||
that requires (n)curses?</a> for more information.</p>
|
||||
<p>We recommend that you use the alternate code so you can see what this
|
||||
entry looked like back in 2000 (with a configurable speed). See the <a
|
||||
href="#original-code">original code</a> section for the original
|
||||
entry.</p>
|
||||
<p>NOTE: if you don’t have curses or SDL1 installed both modes will fail to compile. In
|
||||
that case see the <a href="../../faq.html#SDL">FAQ 3.8 - How do I compile an IOCCC entry that requires SDL1
|
||||
or SDL2?</a> and <a href="../../faq.html#curses">FAQ 3.9 - How do I compile an IOCCC entry that
|
||||
requires (n)curses?</a> for more information.</p>
|
||||
<p>We recommend that you use the alternate code so you can see what this entry
|
||||
looked like back in 2000 (with a configurable speed). See the
|
||||
<a href="#original-code">original code</a> section for the original entry.</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">./thadgavin.alt</span></span></code></pre></div>
|
||||
<p>You can press ‘q’ at any time to exit.</p>
|
||||
<h2 id="try">Try:</h2>
|
||||
<p>If you have SDL1 installed:</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">./thadgavin_sdl</span></span></code></pre></div>
|
||||
<p>Whereas the curses version has an early exit the SDL version does
|
||||
not. You will have to kill it yourself.</p>
|
||||
<p>You might also wish to reconfigure the speed at which the programs
|
||||
run. The code calls <code>usleep(3)</code> with two default values, one
|
||||
for SDL and one for curses. The curses and SDL macros are defined in the
|
||||
Makefile in a way that makes it easy to redefine the values:
|
||||
<code>SLEEP</code> is how long the program sleeps (in microseconds)
|
||||
between output with curses and <code>SDL_SLEEP</code> is how long it
|
||||
sleeps (also in microseconds) for the SDL version.</p>
|
||||
<p>To change the SDL one to something like <code>15000</code> you can
|
||||
do:</p>
|
||||
<p>Whereas the curses version has an early exit the SDL version does not. You will
|
||||
have to kill it yourself.</p>
|
||||
<p>You might also wish to reconfigure the speed at which the programs run. The code
|
||||
calls <code>usleep(3)</code> with two default values, one for SDL and one for curses. The
|
||||
curses and SDL macros are defined in the Makefile in a way that makes it easy to
|
||||
redefine the values: <code>SLEEP</code> is how long the program sleeps (in microseconds)
|
||||
between output with curses and <code>SDL_SLEEP</code> is how long it sleeps (also in
|
||||
microseconds) for the SDL version.</p>
|
||||
<p>To change the SDL one to something like <code>15000</code> you can do:</p>
|
||||
<div class="sourceCode" id="cb4"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb4-1"><a href="#cb4-1" aria-hidden="true" tabindex="-1"></a><span class="fu">make</span> SDL_SLEEP=15000 clobber alt</span></code></pre></div>
|
||||
<p>and to change the curses one to <code>40</code>:</p>
|
||||
<div class="sourceCode" id="cb5"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb5-1"><a href="#cb5-1" aria-hidden="true" tabindex="-1"></a><span class="fu">make</span> SLEEP=40 clobber alt</span></code></pre></div>
|
||||
<p>Then use the program(s) in the same way.</p>
|
||||
<p>The different macros is because the curses version is already much
|
||||
slower and so it’s better to not tie the two values together. You may of
|
||||
course redefine both in the same command.</p>
|
||||
<p>The different macros is because the curses version is already much slower and so
|
||||
it’s better to not tie the two values together. You may of course redefine both
|
||||
in the same command.</p>
|
||||
<h2 id="original-code">Original code:</h2>
|
||||
<p>WARNING: if you are sensitive to rapid movement or if you want to see
|
||||
better what is going on then please use the alternate code as described
|
||||
above. If you wish to see the original entry see below.</p>
|
||||
<p>NOTE: in curses mode you might want to type <code>reset</code> after
|
||||
execution of this program if your terminal is messed up after exiting
|
||||
the program (send intr, typically ctrl-c) as the program does not call
|
||||
<code>endwin()</code>. Using <code>reset</code> will clear the screen.
|
||||
The alt code, as noted above, allows one to quit early so this is not a
|
||||
problem there.</p>
|
||||
<p>WARNING: if you are sensitive to rapid movement or if you want to see better
|
||||
what is going on then please use the alternate code as described above. If you
|
||||
wish to see the original entry see below.</p>
|
||||
<p>NOTE: in curses mode you might want to type <code>reset</code> after execution of this
|
||||
program if your terminal is messed up after exiting the program (send intr,
|
||||
typically ctrl-c) as the program does not call <code>endwin()</code>. Using <code>reset</code> will
|
||||
clear the screen. The alt code, as noted above, allows one to quit early so this
|
||||
is not a problem there.</p>
|
||||
<h3 id="original-build">Original build:</h3>
|
||||
<div class="sourceCode" id="cb6"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb6-1"><a href="#cb6-1" aria-hidden="true" tabindex="-1"></a><span class="fu">make</span> all</span></code></pre></div>
|
||||
<h3 id="original-use">Original use:</h3>
|
||||
@@ -196,23 +190,18 @@ problem there.</p>
|
||||
<p>If you have SDL1 installed:</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">./thadgavin_sdl</span></span></code></pre></div>
|
||||
<h2 id="judges-remarks">Judges’ remarks:</h2>
|
||||
<p>This entry is a nice play by the rules. It can use curses, if the SDL
|
||||
graphic library is not present, and is quite good at that, but the
|
||||
colors used in graphic mode (16 bit depth) are unfortunately less than
|
||||
dazzling. We could not test this entry in DOS mode.</p>
|
||||
<p>This entry is a nice play by the rules. It can use curses, if the
|
||||
SDL graphic library is not present, and is quite good at that,
|
||||
but the colors used in graphic mode (16 bit depth) are unfortunately
|
||||
less than dazzling. We could not test this entry in DOS mode.</p>
|
||||
<h2 id="authors-remarks">Authors’ remarks:</h2>
|
||||
<h3 id="to-use-under-dos">To use under DOS:</h3>
|
||||
<p>Compile using DJGPP as follows:</p>
|
||||
<div class="sourceCode" id="cb9"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb9-1"><a href="#cb9-1" aria-hidden="true" tabindex="-1"></a><span class="fu">gcc</span> thadgavin.c <span class="at">-o</span> thadgavin.exe <span class="at">-Wall</span> <span class="at">-lm</span> <span class="at">-O6</span> <span class="at">-mpentium</span> <span class="at">-fomit-frame-pointer</span> <span class="at">-ffast-math</span></span></code></pre></div>
|
||||
<h3
|
||||
id="to-use-under-windows-x-windows-or-macos-using-the-simple-directmedia-layer">To
|
||||
use under Windows, X-Windows or macOS using the Simple DirectMedia
|
||||
Layer:</h3>
|
||||
<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">gcc</span> <span class="at">-O6</span> <span class="at">-lpthread</span> <span class="at">-g</span> <span class="at">-o</span> thadgavin thadgavin.c <span class="at">-lSDL</span> <span class="at">-DSDL</span> <span class="at">-lm</span></span></code></pre></div>
|
||||
<h3 id="to-use-under-windows-x-windows-or-macos-using-the-simple-directmedia-layer">To use under Windows, X-Windows or macOS using the Simple DirectMedia Layer:</h3>
|
||||
<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">gcc</span> <span class="at">-O6</span> <span class="at">-lpthread</span> <span class="at">-g</span> <span class="at">-o</span> thadgavin thadgavin.c <span class="at">-lSDL</span> <span class="at">-DSDL</span> <span class="at">-lm</span></span></code></pre></div>
|
||||
<h3 id="to-use-curses">To use curses:</h3>
|
||||
<div class="sourceCode" id="cb11"><pre
|
||||
class="sourceCode sh"><code class="sourceCode bash"><span id="cb11-1"><a href="#cb11-1" aria-hidden="true" tabindex="-1"></a><span class="fu">gcc</span> <span class="at">-O6</span> <span class="at">-lpthread</span> <span class="at">-g</span> <span class="at">-o</span> thadgavin thadgavin.c <span class="at">-lncurses</span> <span class="at">-lm</span></span></code></pre></div>
|
||||
<div class="sourceCode" id="cb11"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb11-1"><a href="#cb11-1" aria-hidden="true" tabindex="-1"></a><span class="fu">gcc</span> <span class="at">-O6</span> <span class="at">-lpthread</span> <span class="at">-g</span> <span class="at">-o</span> thadgavin thadgavin.c <span class="at">-lncurses</span> <span class="at">-lm</span></span></code></pre></div>
|
||||
<h3 id="warnings">Warnings</h3>
|
||||
<p>In gcc you might get the following warning:</p>
|
||||
<pre><code>thadgavin.c.c:46: warning: passing arg 2 of `SDL_SetColors' from incompatible pointer type</code></pre>
|
||||
@@ -226,55 +215,35 @@ char ', possible loss of data
|
||||
<p>But don’t worry, this is completely normal.</p>
|
||||
<h3 id="recommended-dosage">Recommended dosage:</h3>
|
||||
<p>At least 3 minutes taken 3 times a day when tired.</p>
|
||||
<p>Do not exceed 3 times recommended dose. May cause sickness,
|
||||
dizziness, nausea.</p>
|
||||
<h2 id="copyright-and-cc-by-sa-4.0-license">Copyright and CC BY-SA 4.0
|
||||
License:</h2>
|
||||
<p>This file is Copyright (c) 2023 by Landon Curt Noll. All Rights
|
||||
Reserved. You are free to share and adapt this file under the terms of
|
||||
this license:</p>
|
||||
<p>Do not exceed 3 times recommended dose. May cause sickness, dizziness, nausea.</p>
|
||||
<h2 id="copyright-and-cc-by-sa-4.0-license">Copyright and CC BY-SA 4.0 License:</h2>
|
||||
<p>This file is Copyright (c) 2023 by Landon Curt Noll. All Rights Reserved.
|
||||
You are free to share and adapt this file under the terms of this license:</p>
|
||||
<pre><code>Creative Commons Attribution-ShareAlike 4.0 International (CC BY-SA 4.0)</code></pre>
|
||||
<p>For more information, see:
|
||||
https://creativecommons.org/licenses/by-sa/4.0/</p>
|
||||
<p>For more information, see: https://creativecommons.org/licenses/by-sa/4.0/</p>
|
||||
|
||||
<!-- END: this line ends content for HTML phase 21 by: bin/pandoc-wrapper.sh via bin/md2html.sh -->
|
||||
<!-- START: this line starts content for HTML phase 22 by: bin/output-index-inventory.sh via bin/md2html.sh -->
|
||||
|
||||
<!-- START: this line starts content generated by: bin/output-index-inventory.sh -->
|
||||
|
||||
<h1 id="inventory-for-2000thadgavin"><a name="inventory"></a>Inventory
|
||||
for 2000/thadgavin</h1>
|
||||
<h1 id="inventory-for-2000thadgavin"><a name="inventory"></a>Inventory for 2000/thadgavin</h1>
|
||||
<p><a href="#top">Jump to top</a></p>
|
||||
<h2 id="primary-files">Primary files</h2>
|
||||
<ul>
|
||||
<li><a
|
||||
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2000/thadgavin/thadgavin.c">thadgavin.c</a>
|
||||
- entry source</li>
|
||||
<li><a
|
||||
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2000/thadgavin/Makefile">Makefile</a>
|
||||
- entry Makefile</li>
|
||||
<li><a
|
||||
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2000/thadgavin/thadgavin.alt.c">thadgavin.alt.c</a>
|
||||
- alternative source</li>
|
||||
<li><a
|
||||
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2000/thadgavin/thadgavin.orig.c">thadgavin.orig.c</a>
|
||||
- original source</li>
|
||||
<li><a href="2000_thadgavin.tar.bz2">2000_thadgavin.tar.bz2</a> -
|
||||
download entry source</li>
|
||||
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2000/thadgavin/thadgavin.c">thadgavin.c</a> - entry source</li>
|
||||
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2000/thadgavin/Makefile">Makefile</a> - entry Makefile</li>
|
||||
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2000/thadgavin/thadgavin.alt.c">thadgavin.alt.c</a> - alternative source</li>
|
||||
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2000/thadgavin/thadgavin.orig.c">thadgavin.orig.c</a> - original source</li>
|
||||
<li><a href="2000_thadgavin.tar.bz2">2000_thadgavin.tar.bz2</a> - download entry source</li>
|
||||
</ul>
|
||||
<h2 id="secondary-files">Secondary files</h2>
|
||||
<ul>
|
||||
<li><a href="index.html">index.html</a> - entry home page</li>
|
||||
<li><a
|
||||
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2000/thadgavin/.entry.json">.entry.json</a>
|
||||
- description of entry in JSON</li>
|
||||
<li><a
|
||||
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2000/thadgavin/.gitignore">.gitignore</a>
|
||||
- list of files that should not be committed under git</li>
|
||||
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2000/thadgavin/.entry.json">.entry.json</a> - description of entry in JSON</li>
|
||||
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2000/thadgavin/.gitignore">.gitignore</a> - list of files that should not be committed under git</li>
|
||||
<li><a href=".path">.path</a> - directory path from top directory</li>
|
||||
<li><a
|
||||
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2000/thadgavin/README.md">README.md</a>
|
||||
- markdown source for index.html</li>
|
||||
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2000/thadgavin/README.md">README.md</a> - markdown source for index.html</li>
|
||||
</ul>
|
||||
|
||||
<!-- END: next line ends content generated by: bin/output-index-inventory.sh -->
|
||||
|
||||
+66
-99
@@ -129,9 +129,9 @@
|
||||
|
||||
<h2 id="author"><a name="author"></a>Author:</h2>
|
||||
<ul>
|
||||
<li>Name: <a href="../../authors.html#Thomas_P_John">Thomas P
|
||||
John</a><br> Location: <a href="../../location.html#NL">NL</a> -
|
||||
<em>Kingdom of the Netherlands</em> (<em>Netherlands</em>) <br><br></li>
|
||||
<li>Name: <a href="../../authors.html#Thomas_P_John">Thomas P John</a><br>
|
||||
Location: <a href="../../location.html#NL">NL</a> - <em>Kingdom of the Netherlands</em> (<em>Netherlands</em>)
|
||||
<br><br></li>
|
||||
</ul>
|
||||
|
||||
<!-- END: next line ends content generated by: bin/output-index-author.sh -->
|
||||
@@ -141,56 +141,51 @@ John</a><br> Location: <a href="../../location.html#NL">NL</a> -
|
||||
|
||||
<h2 id="to-build">To build:</h2>
|
||||
<div class="sourceCode" id="cb1"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb1-1"><a href="#cb1-1" aria-hidden="true" tabindex="-1"></a><span class="fu">make</span></span></code></pre></div>
|
||||
<p>There is an alternate version that compiles <a
|
||||
href="mkentry.c">mkentry.c</a>. See <a href="#alternate-code">alternate
|
||||
code</a>.</p>
|
||||
<p>There is an alternate version that compiles <a href="mkentry.c">mkentry.c</a>. See
|
||||
<a href="#alternate-code">alternate code</a>.</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">./tomx</span></span></code></pre></div>
|
||||
<h2 id="try">Try:</h2>
|
||||
<div class="sourceCode" id="cb3"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb3-1"><a href="#cb3-1" aria-hidden="true" tabindex="-1"></a><span class="ex">./try.sh</span></span></code></pre></div>
|
||||
<h2 id="alternate-code">Alternate code:</h2>
|
||||
<p>This alternate code is based on the author’s remarks with a slight
|
||||
fix so that it will do what it once did, compile and run <a
|
||||
href="mkentry.c">mkentry.c</a>. You can use it in a similar way as <a
|
||||
href="tomx.c">tomx.c</a>, both executing the source file and using it as
|
||||
a Makefile and running the code ends up running
|
||||
<code>mkentry</code>.</p>
|
||||
<p>This alternate code is based on the author’s remarks with a slight fix so that
|
||||
it will do what it once did, compile and run <a href="mkentry.c">mkentry.c</a>. You can use
|
||||
it in a similar way as <a href="tomx.c">tomx.c</a>, both executing the source file and
|
||||
using it as a Makefile and running the code ends up running <code>mkentry</code>.</p>
|
||||
<h3 id="alternate-build">Alternate build:</h3>
|
||||
<div class="sourceCode" id="cb4"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb4-1"><a href="#cb4-1" aria-hidden="true" tabindex="-1"></a><span class="fu">make</span> alt</span></code></pre></div>
|
||||
<h3 id="alternate-try">Alternate try:</h3>
|
||||
<div class="sourceCode" id="cb5"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb5-1"><a href="#cb5-1" aria-hidden="true" tabindex="-1"></a><span class="ex">./try.alt.sh</span></span></code></pre></div>
|
||||
<h2 id="judges-remarks">Judges’ remarks:</h2>
|
||||
<p>Polyglots have come and gone, but this was the first one we’d seen
|
||||
where one language <em>used</em> another to perform its tasks. An
|
||||
interesting approach. Admittedly, it’s not all that obfuscated - but
|
||||
there’s more to it than you might think, since you have to make sure
|
||||
that your changes don’t change the shell code or the Makefile.</p>
|
||||
where one language <em>used</em> another to perform its tasks. An interesting
|
||||
approach. Admittedly, it’s not all that obfuscated - but there’s more
|
||||
to it than you might think, since you have to make sure that your
|
||||
changes don’t change the shell code or the Makefile.</p>
|
||||
<h2 id="authors-remarks">Author’s remarks:</h2>
|
||||
<h3 id="summary">Summary</h3>
|
||||
<p>This program works as a C source file, a Makefile and also as a shell
|
||||
(<code>/bin/sh</code>) script. But unlike some other multi-language
|
||||
programs, this one is NOT meant to print <code>Hello, world</code> in
|
||||
all 3 cases (At least in the true sense ;-)). The C, Makefile and shell
|
||||
code build upon each other to create a C program (?) which when executed
|
||||
as a shell script will compile itself through the C compiler using a
|
||||
Makefile! - Pretty useful, Eh?</p>
|
||||
<p>Probably, this is the first entry ever to fully satisfy Rule #1
|
||||
(“Your entry must be a complete program”) in the strictest sense;-)</p>
|
||||
<h3 id="top-5-reasons-imho-why-this-code-is-an-entry-for-ioccc">Top 5
|
||||
reasons (IMHO) why this code is an entry for IOCCC</h3>
|
||||
(<code>/bin/sh</code>) script. But unlike some other multi-language programs, this one is
|
||||
NOT meant to print <code>Hello, world</code> in all 3 cases (At least in the true sense
|
||||
;-)). The C, Makefile and shell code build upon each other to create a C program (?)
|
||||
which when executed as a shell script will compile itself through the C compiler
|
||||
using a Makefile! - Pretty useful, Eh?</p>
|
||||
<p>Probably, this is the first entry ever to fully satisfy Rule #1 (“Your entry
|
||||
must be a complete program”) in the strictest sense;-)</p>
|
||||
<h3 id="top-5-reasons-imho-why-this-code-is-an-entry-for-ioccc">Top 5 reasons (IMHO) why this code is an entry for IOCCC</h3>
|
||||
<ol type="1">
|
||||
<li><p>A glance at the source itself will tell you that most of the
|
||||
Obfuscation is NOT in the C code per se, but in the comments to the C
|
||||
code. (But sadly, I could not find an “International Obfuscated C
|
||||
COMMENT contest”. So I HAD to send this entry here to the IOCCC
|
||||
itself).</p></li>
|
||||
<li><p>Of the 3 languages in the source, the least obfuscated is C (But
|
||||
again, there was NO obfuscated make/shscript contest) (Does this hint
|
||||
for a rule in IOCCC-2001 that the major obfuscation should be in C and
|
||||
not elsewhere???. Mmmmm…).</p></li>
|
||||
<li><p>Extending Argument #2… Obfuscation done in the C code (comments?)
|
||||
creates obfuscated code for the other 2 languages. This opens new
|
||||
possibilities to be explored in depth in future
|
||||
Obfuscation is NOT in the C code per se, but in the comments
|
||||
to the C code. (But sadly, I could not find an “International
|
||||
Obfuscated C COMMENT contest”. So I HAD to send this entry
|
||||
here to the IOCCC itself).</p></li>
|
||||
<li><p>Of the 3 languages in the source, the least obfuscated is
|
||||
C (But again, there was NO obfuscated make/shscript contest)
|
||||
(Does this hint for a rule in IOCCC-2001 that the major
|
||||
obfuscation should be in C and not elsewhere???. Mmmmm…).</p></li>
|
||||
<li><p>Extending Argument #2… Obfuscation done in the C code
|
||||
(comments?) creates obfuscated code for the other 2 languages.
|
||||
This opens new possibilities to be explored in depth in future
|
||||
<code>IOCCC</code>s.</p></li>
|
||||
<li><p>LOOKS like a Makefile, WORKS like a shell script and COMPILES
|
||||
like a C program.</p></li>
|
||||
@@ -198,90 +193,62 @@ like a C program.</p></li>
|
||||
</ol>
|
||||
<h3 id="notes">Notes</h3>
|
||||
<ol type="1">
|
||||
<li>The program could have been something other than the simple “Hello,
|
||||
world” program that it is. It is possible to do
|
||||
<code>#include "prog2.c"</code> in the place of the <code>main()</code>,
|
||||
leaving the complexities of the C file elsewhere and making this source
|
||||
still acceptable to <code>make</code> and <code>sh</code>. The following
|
||||
modification to the last few lines will compile the IOCCC’s famous <a
|
||||
href="mkentry.c">mkentry.c</a>.</li>
|
||||
<li>The program could have been something other than the simple “Hello, world”
|
||||
program that it is. It is possible to do <code>#include "prog2.c"</code> in the place of
|
||||
the <code>main()</code>, leaving the complexities of the C file elsewhere and making this
|
||||
source still acceptable to <code>make</code> and <code>sh</code>. The following modification to the
|
||||
last few lines will compile the IOCCC’s famous <a href="mkentry.c">mkentry.c</a>.</li>
|
||||
</ol>
|
||||
<pre><code>.PHONY: /* true clean */
|
||||
#undef true
|
||||
#include "mkentry.c"</code></pre>
|
||||
<p>Ain’t that useful?</p>
|
||||
<ol start="2" type="1">
|
||||
<li><p>By extending this program’s idea, It is possible to do some very
|
||||
interesting things like generating C code on execution by adding
|
||||
additional code in make/sh (open up a loop????). This opens the
|
||||
possibilities of generating & compiling some (obfuscated?) C code.
|
||||
(Maybe should try this if this program fails at IOCCC 2000)</p></li>
|
||||
<li><p>Changing the <code>%:%.c</code> dependency to a
|
||||
<code>$(PROG):$(PROG).c</code> form can compile this program with some
|
||||
other <code>make</code>s (I got it to work in Windows using nmake and
|
||||
Gnuwin32’s sh ;-) )</p></li>
|
||||
<li><p>Interesting things to do: try <code>./tomx.c clean</code>. This
|
||||
will do the same as <code>make clean</code> :-)). Also:
|
||||
<code>./tomx.c all</code></p></li>
|
||||
<li><p>Be careful about the tabs in the source code. Removing them or
|
||||
converting tabs to spaces can be disastrous.</p></li>
|
||||
<li><p>By extending this program’s idea, It is possible to do some
|
||||
very interesting things like generating C code on execution
|
||||
by adding additional code in make/sh (open up a loop????).
|
||||
This opens the possibilities of generating & compiling some
|
||||
(obfuscated?) C code. (Maybe should try this if this program
|
||||
fails at IOCCC 2000)</p></li>
|
||||
<li><p>Changing the <code>%:%.c</code> dependency to a <code>$(PROG):$(PROG).c</code> form
|
||||
can compile this program with some other <code>make</code>s (I got it to
|
||||
work in Windows using nmake and Gnuwin32’s sh ;-) )</p></li>
|
||||
<li><p>Interesting things to do: try <code>./tomx.c clean</code>. This will
|
||||
do the same as <code>make clean</code> :-)). Also: <code>./tomx.c all</code></p></li>
|
||||
<li><p>Be careful about the tabs in the source code. Removing them
|
||||
or converting tabs to spaces can be disastrous.</p></li>
|
||||
</ol>
|
||||
<h2 id="copyright-and-cc-by-sa-4.0-license">Copyright and CC BY-SA 4.0
|
||||
License:</h2>
|
||||
<p>This file is Copyright (c) 2023 by Landon Curt Noll. All Rights
|
||||
Reserved. You are free to share and adapt this file under the terms of
|
||||
this license:</p>
|
||||
<h2 id="copyright-and-cc-by-sa-4.0-license">Copyright and CC BY-SA 4.0 License:</h2>
|
||||
<p>This file is Copyright (c) 2023 by Landon Curt Noll. All Rights Reserved.
|
||||
You are free to share and adapt this file under the terms of this license:</p>
|
||||
<pre><code>Creative Commons Attribution-ShareAlike 4.0 International (CC BY-SA 4.0)</code></pre>
|
||||
<p>For more information, see:
|
||||
https://creativecommons.org/licenses/by-sa/4.0/</p>
|
||||
<p>For more information, see: https://creativecommons.org/licenses/by-sa/4.0/</p>
|
||||
|
||||
<!-- END: this line ends content for HTML phase 21 by: bin/pandoc-wrapper.sh via bin/md2html.sh -->
|
||||
<!-- START: this line starts content for HTML phase 22 by: bin/output-index-inventory.sh via bin/md2html.sh -->
|
||||
|
||||
<!-- START: this line starts content generated by: bin/output-index-inventory.sh -->
|
||||
|
||||
<h1 id="inventory-for-2000tomx"><a name="inventory"></a>Inventory for
|
||||
2000/tomx</h1>
|
||||
<h1 id="inventory-for-2000tomx"><a name="inventory"></a>Inventory for 2000/tomx</h1>
|
||||
<p><a href="#top">Jump to top</a></p>
|
||||
<h2 id="primary-files">Primary files</h2>
|
||||
<ul>
|
||||
<li><a
|
||||
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2000/tomx/tomx.c">tomx.c</a>
|
||||
- entry source</li>
|
||||
<li><a
|
||||
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2000/tomx/Makefile">Makefile</a>
|
||||
- entry Makefile</li>
|
||||
<li><a
|
||||
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2000/tomx/tomx.alt.c">tomx.alt.c</a>
|
||||
- alternative source</li>
|
||||
<li><a
|
||||
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2000/tomx/tomx.orig.c">tomx.orig.c</a>
|
||||
- original source</li>
|
||||
<li><a
|
||||
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2000/tomx/try.alt.sh">try.alt.sh</a>
|
||||
- how to run alternative code</li>
|
||||
<li><a
|
||||
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2000/tomx/try.sh">try.sh</a>
|
||||
- how to run</li>
|
||||
<li><a
|
||||
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2000/tomx/mkentry.c">mkentry.c</a>
|
||||
- IOCCC mkentry source from 1998</li>
|
||||
<li><a href="2000_tomx.tar.bz2">2000_tomx.tar.bz2</a> - download entry
|
||||
source</li>
|
||||
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2000/tomx/tomx.c">tomx.c</a> - entry source</li>
|
||||
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2000/tomx/Makefile">Makefile</a> - entry Makefile</li>
|
||||
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2000/tomx/tomx.alt.c">tomx.alt.c</a> - alternative source</li>
|
||||
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2000/tomx/tomx.orig.c">tomx.orig.c</a> - original source</li>
|
||||
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2000/tomx/try.alt.sh">try.alt.sh</a> - how to run alternative code</li>
|
||||
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2000/tomx/try.sh">try.sh</a> - how to run</li>
|
||||
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2000/tomx/mkentry.c">mkentry.c</a> - IOCCC mkentry source from 1998</li>
|
||||
<li><a href="2000_tomx.tar.bz2">2000_tomx.tar.bz2</a> - download entry source</li>
|
||||
</ul>
|
||||
<h2 id="secondary-files">Secondary files</h2>
|
||||
<ul>
|
||||
<li><a href="index.html">index.html</a> - entry home page</li>
|
||||
<li><a
|
||||
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2000/tomx/.entry.json">.entry.json</a>
|
||||
- description of entry in JSON</li>
|
||||
<li><a
|
||||
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2000/tomx/.gitignore">.gitignore</a>
|
||||
- list of files that should not be committed under git</li>
|
||||
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2000/tomx/.entry.json">.entry.json</a> - description of entry in JSON</li>
|
||||
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2000/tomx/.gitignore">.gitignore</a> - list of files that should not be committed under git</li>
|
||||
<li><a href=".path">.path</a> - directory path from top directory</li>
|
||||
<li><a
|
||||
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2000/tomx/README.md">README.md</a>
|
||||
- markdown source for index.html</li>
|
||||
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2000/tomx/README.md">README.md</a> - markdown source for index.html</li>
|
||||
</ul>
|
||||
|
||||
<!-- END: next line ends content generated by: bin/output-index-inventory.sh -->
|
||||
|
||||
Reference in new issue
Block a user