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
+172
-253
@@ -130,8 +130,8 @@
|
||||
<h2 id="author"><a name="author"></a>Author:</h2>
|
||||
<ul>
|
||||
<li>Name: <a href="../../authors.html#Gil_Dogon">Gil Dogon</a><br>
|
||||
Location: <a href="../../location.html#IL">IL</a> - <em>State of
|
||||
Israel</em> (<em>Israel</em>) <br><br></li>
|
||||
Location: <a href="../../location.html#IL">IL</a> - <em>State of Israel</em> (<em>Israel</em>)
|
||||
<br><br></li>
|
||||
</ul>
|
||||
|
||||
<!-- END: next line ends content generated by: bin/output-index-author.sh -->
|
||||
@@ -144,311 +144,230 @@ Israel</em> (<em>Israel</em>) <br><br></li>
|
||||
<h3 id="bugs-and-misfeatures">Bugs and (Mis)features:</h3>
|
||||
<p>The current status of this entry is:</p>
|
||||
<pre><code>STATUS: uses gets() - change to fgets() if possible</code></pre>
|
||||
<p>For more detailed information see <a
|
||||
href="../../bugs.html#2019_dogon">2019 dogon bugs</a>.</p>
|
||||
<p>For more detailed information see <a href="../../bugs.html#2019_dogon">2019 dogon 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">./prog</span> <span class="op"><</span> pattern.mc</span></code></pre></div>
|
||||
<h2 id="try">Try:</h2>
|
||||
<div class="sourceCode" id="cb4"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb4-1"><a href="#cb4-1" aria-hidden="true" tabindex="-1"></a><span class="ex">./try.sh</span></span></code></pre></div>
|
||||
<p>Make sure that you keep focus of windows in mind when going back and
|
||||
forth to the program and the script.</p>
|
||||
<p>Make sure that you keep focus of windows in mind when going back and forth to
|
||||
the program and the script.</p>
|
||||
<h2 id="judges-remarks">Judges’ remarks:</h2>
|
||||
<p><a href="../../years.html#1991_davidguy">1991/davidguy</a>, <a
|
||||
href="../../years.html#2011_blakely">2011/blakely</a>, …</p>
|
||||
<p>…This entry likely concludes the IOCCC category “Cellular automata
|
||||
simulators”; it would be very hard to beat it on its field.</p>
|
||||
<p>FYI: The <code>.mc</code> extension stands for
|
||||
<code>Golly macrocell</code> format.</p>
|
||||
<p><a href="../../years.html#1991_davidguy">1991/davidguy</a>,
|
||||
<a href="../../years.html#2011_blakely">2011/blakely</a>, …</p>
|
||||
<p>…This entry likely concludes the IOCCC category “Cellular automata simulators”;
|
||||
it would be very hard to beat it on its field.</p>
|
||||
<p>FYI: The <code>.mc</code> extension stands for <code>Golly macrocell</code> format.</p>
|
||||
<p>We truly have not much more to add, except two things:</p>
|
||||
<ul>
|
||||
<li><p>If a large sparse pattern is given, at the start of the program
|
||||
you are much more likely to see a blank board rather than the loaded
|
||||
configuration, and to see it, you may need to zoom out a few
|
||||
times.</p></li>
|
||||
<li><p>If you’re using a virtual machine with less than 4 Gb of
|
||||
available model RAM, you’d want to reduce the value of the Z define in
|
||||
the Makefile to <code>0x10000000</code>, otherwise the entry will
|
||||
promptly crash. To do this you can do:</p>
|
||||
you are much more likely to see a blank board rather than the loaded configuration,
|
||||
and to see it, you may need to zoom out a few times.</p></li>
|
||||
<li><p>If you’re using a virtual machine with less than 4 Gb of available
|
||||
model RAM, you’d want to reduce the value of the Z define in the Makefile
|
||||
to <code>0x10000000</code>, otherwise the entry will promptly crash. To do this you can do:</p>
|
||||
<p>make clobber MEMORY=0x10000000 all</p>
|
||||
<p>Notice that that value must be a power of two!</p></li>
|
||||
</ul>
|
||||
<p>In the interest of saving lives, this entry was not fuzzed.</p>
|
||||
<h2 id="authors-remarks">Author’s remarks:</h2>
|
||||
<h3 id="what-is-it">What is it?</h3>
|
||||
<p>Just run with no arguments on an X11-compatible system using one of
|
||||
the supplied input <code>.mc</code> files as standard input. Press
|
||||
<code>-</code> several time to zoom out if necessary, then press space.
|
||||
For acceleration press <code>]</code> several times. That’s rather quick
|
||||
don’t you think?</p>
|
||||
<p>Just run with no arguments on an X11-compatible system using one of the supplied
|
||||
input <code>.mc</code> files as standard input. Press <code>-</code> several time to zoom out if
|
||||
necessary, then press space. For acceleration press <code>]</code> several times. That’s
|
||||
rather quick don’t you think?</p>
|
||||
<h3 id="historical-timeline">Historical Timeline</h3>
|
||||
<ul>
|
||||
<li>Circa 3.77 - 4.28 Billion years ago: Microorganisms appear on
|
||||
Earth.</li>
|
||||
<li>3000 BC: Ankh symbol is used in Egyptian hieroglyph to represent
|
||||
life.</li>
|
||||
<li>1940s: John Von Neumann and Stanislav Ulam are interested in
|
||||
artificial life eventually kick starting research on Cellular
|
||||
Automata.</li>
|
||||
<li>1970: J.H. Conway’s research discovers a rather minimal set of rules
|
||||
that seems quite interesting. <a
|
||||
href="https://en.wikipedia.org/wiki/Conway%27s_Game_of_Life">Conway’s
|
||||
Game of Life</a> gets published in <a
|
||||
href="https://web.stanford.edu/class/sts145/Library/life.pdf">Martin
|
||||
Gardner’s Scientific American column</a>.</li>
|
||||
<li>1970s: According to Knuth, a significant portion of computer time in
|
||||
the world is spent simulating GOL, mostly without the awareness of the
|
||||
people footing the bill.</li>
|
||||
<li>1984: Bill Gosper invents the <a
|
||||
href="https://en.wikipedia.org/wiki/Hashlife">Hashlife</a> algorithm.
|
||||
His implementation runs on Symbolics Lisp Machines. Unrelated to that,
|
||||
but in a cosmic coincidence the <a href="../../years.html#1984">first
|
||||
IOCCC</a> is run!</li>
|
||||
<li>December 2000: Tom Rokicki has a breakthrough implementing <a
|
||||
href="https://en.wikipedia.org/wiki/Hashlife">Hashlife</a> in C,
|
||||
efficient, stable and production ready for modern machines.</li>
|
||||
<li>2006: First version of Golly by Andrew Trevorrow and Tomas Rokicki.
|
||||
Brings the delights of <a
|
||||
href="https://en.wikipedia.org/wiki/Hashlife">hashlife</a> to the
|
||||
masses.</li>
|
||||
<li>Circa 3.77 - 4.28 Billion years ago: Microorganisms appear on Earth.</li>
|
||||
<li>3000 BC: Ankh symbol is used in Egyptian hieroglyph to represent life.</li>
|
||||
<li>1940s: John Von Neumann and Stanislav Ulam are interested in artificial life
|
||||
eventually kick starting research on Cellular Automata.</li>
|
||||
<li>1970: J.H. Conway’s research discovers a rather minimal set of rules that
|
||||
seems quite interesting. <a href="https://en.wikipedia.org/wiki/Conway%27s_Game_of_Life">Conway’s Game of
|
||||
Life</a> gets published in
|
||||
<a href="https://web.stanford.edu/class/sts145/Library/life.pdf">Martin Gardner’s Scientific American
|
||||
column</a>.</li>
|
||||
<li>1970s: According to Knuth, a significant portion of computer time in the
|
||||
world is spent simulating GOL, mostly without the awareness of the people
|
||||
footing the bill.</li>
|
||||
<li>1984: Bill Gosper invents the
|
||||
<a href="https://en.wikipedia.org/wiki/Hashlife">Hashlife</a> algorithm. His
|
||||
implementation runs on Symbolics Lisp Machines. Unrelated to that, but in a
|
||||
cosmic coincidence the <a href="../../years.html#1984">first IOCCC</a> is run!</li>
|
||||
<li>December 2000: Tom Rokicki has a breakthrough implementing
|
||||
<a href="https://en.wikipedia.org/wiki/Hashlife">Hashlife</a> in C, efficient, stable and
|
||||
production ready for modern machines.</li>
|
||||
<li>2006: First version of Golly by Andrew Trevorrow and Tomas Rokicki. Brings
|
||||
the delights of <a href="https://en.wikipedia.org/wiki/Hashlife">hashlife</a> to the masses.</li>
|
||||
</ul>
|
||||
<p>Which brings us to the present moment in time.</p>
|
||||
<h3 id="full-documentation-and-keys-ui">Full documentation and keys
|
||||
UI</h3>
|
||||
<p>Yes, this program is a Conway’s Game of Life graphic simulator
|
||||
implementing Bill Gosper’s hashlife algorithm. The entry’s UI is rather
|
||||
terse and somewhat obfuscated, as it should be. Also, when you,
|
||||
accidentally or not, press any of the keys not specified below, some
|
||||
stuff will happen or not, there is no guarantee whatsoever.</p>
|
||||
<h3 id="full-documentation-and-keys-ui">Full documentation and keys UI</h3>
|
||||
<p>Yes, this program is a Conway’s Game of Life graphic simulator implementing Bill
|
||||
Gosper’s hashlife algorithm. The entry’s UI is rather terse and somewhat
|
||||
obfuscated, as it should be. Also, when you, accidentally or not, press any of
|
||||
the keys not specified below, some stuff will happen or not, there is no
|
||||
guarantee whatsoever.</p>
|
||||
<p>The program should be used as follows:</p>
|
||||
<p>The standard input should contain a Golly macrocell format file for a
|
||||
two state automaton. See: <a
|
||||
href="http://golly.sourceforge.net/Help/formats.html"
|
||||
class="uri">http://golly.sourceforge.net/Help/formats.html</a>. Of
|
||||
course only Conway’s GOL rules are supported, so rules in the files are
|
||||
ignored. The supplied input examples should be quite interesting. Except
|
||||
one, all are taken from Golly’s standard distribution. Information and
|
||||
credits to their designer are in the header comment of each.</p>
|
||||
<p>The standard input should contain a Golly macrocell format file for a two state
|
||||
automaton. See: <a href="http://golly.sourceforge.net/Help/formats.html" class="uri">http://golly.sourceforge.net/Help/formats.html</a>. Of course only
|
||||
Conway’s GOL rules are supported, so rules in the files are ignored. The supplied
|
||||
input examples should be quite interesting. Except one, all are taken from
|
||||
Golly’s standard distribution. Information and credits to their designer are in
|
||||
the header comment of each.</p>
|
||||
<ul>
|
||||
<li>For image navigation use the arrow keys, and zoom in and out by the
|
||||
<code>+</code>/<code>-</code> keys (without pressing the shift on the
|
||||
<code>+</code>)</li>
|
||||
<li>For image navigation use the arrow keys, and zoom in and out by the <code>+</code>/<code>-</code> keys
|
||||
(without pressing the shift on the <code>+</code>)</li>
|
||||
<li>Space : Toggle start/stop.</li>
|
||||
<li>0 (zero): Toggle single step/free run mode.</li>
|
||||
<li>Backspace: Toggle direction for the arrow of time.</li>
|
||||
<li><code>]</code>: Increase speed (time step) by a factor of 2.</li>
|
||||
<li><code>[</code>: Decrease speed (time step) by a factor of 2.</li>
|
||||
</ul>
|
||||
<p>Notice that when going backward in time we ignore the current time
|
||||
step setting and just jump by the amount that was specified before.
|
||||
However going forward is always using the current time step.</p>
|
||||
<p>There is a minimal text printout by the program, so you can know what
|
||||
Generation your are in (<code>G:</code>), Internal memory allocated till
|
||||
now (<code>M:</code>), and then which Level is the current macrocell
|
||||
(<code>L</code>) and which zoom Scale you are watching
|
||||
(<code>S</code>).</p>
|
||||
<p>Notice that when going backward in time we ignore the current time step setting
|
||||
and just jump by the amount that was specified before. However going forward is
|
||||
always using the current time step.</p>
|
||||
<p>There is a minimal text printout by the program, so you can know what Generation
|
||||
your are in (<code>G:</code>), Internal memory allocated till now (<code>M:</code>), and then which Level
|
||||
is the current macrocell (<code>L</code>) and which zoom Scale you are watching (<code>S</code>).</p>
|
||||
<h3 id="portability-issues">Portability issues</h3>
|
||||
<p>This entry is quite portable hopefully on most modern platforms. It
|
||||
assumes X Window support of course. More than 2GB of memory is
|
||||
recommended. Configuration through <a href="Makefile">Makefile</a> is
|
||||
provided for the display windows size and for the memory usage. The
|
||||
Makefile provided configuration (<code>Z=0x20000000</code>) will need a
|
||||
system with 4GB DRAM to run nicely. There are several other salient
|
||||
assumptions though:</p>
|
||||
<p>This entry is quite portable hopefully on most modern platforms. It assumes X
|
||||
Window support of course. More than 2GB of memory is recommended. Configuration
|
||||
through <a href="Makefile">Makefile</a> is provided for the display windows size and for
|
||||
the memory usage. The Makefile provided configuration (<code>Z=0x20000000</code>) will need a
|
||||
system with 4GB DRAM to run nicely. There are several other salient assumptions
|
||||
though:</p>
|
||||
<ul>
|
||||
<li>The entry assumes <code>sizeof(long)==8</code>. However it actually
|
||||
almost avoids using any pointers which are 64 bits these days, in order
|
||||
to save space. On machines with <code>sizeof(long)==4</code> try adding
|
||||
<code>#define long long long</code> …</li>
|
||||
<li>The entry assumes the X11 displays default visual has 24 bit depth
|
||||
(RGB).</li>
|
||||
<li>The entry assumes little endianness (in only one place though! If
|
||||
you have PowerPC you can try and find that place to make it work), but
|
||||
more than this it assumes unaligned loads of 64 bits <code>long</code>s
|
||||
are supported, i.e. it assumes that a <code>long</code> can be loaded
|
||||
from any address that could hold an <code>int</code> otherwise. On non
|
||||
<li>The entry assumes <code>sizeof(long)==8</code>. However it actually almost avoids using any
|
||||
pointers which are 64 bits these days, in order to save space. On machines with
|
||||
<code>sizeof(long)==4</code> try adding <code>#define long long long</code> …</li>
|
||||
<li>The entry assumes the X11 displays default visual has 24 bit depth (RGB).</li>
|
||||
<li>The entry assumes little endianness (in only one place though! If you have
|
||||
PowerPC you can try and find that place to make it work), but more than this it
|
||||
assumes unaligned loads of 64 bits <code>long</code>s are supported, i.e. it assumes that a
|
||||
<code>long</code> can be loaded from any address that could hold an <code>int</code> otherwise. On non
|
||||
antiquated X86 you’ll be fine.</li>
|
||||
<li>The entry heavily relies on bitwise arithmetic (you don’t
|
||||
say!).</li>
|
||||
<li>The entry heavily relies on bitwise arithmetic (you don’t say!).</li>
|
||||
</ul>
|
||||
<h3 id="limitations">Limitations:</h3>
|
||||
<p>Foremost the entry is very strict, unsafe and picky regarding its
|
||||
input. Anything straying from the standard Golly macrocell legal format
|
||||
will result in undefined behavior, meaning mostly a very defined core
|
||||
dump. Since aforementioned core is rather large by default (about 4GG)
|
||||
it is highly recommended to set the core dump size limit to 0 in the
|
||||
shell before playing with fire …</p>
|
||||
<p>This entry needs quite a lot of memory to be effective, but by modern
|
||||
standards that is not too much. It does not do any garbage collection,
|
||||
so sooner or later memory will run out, resulting, surprise, surprise,
|
||||
in a core dump. On the plus side, this enables the nice time reversal
|
||||
feature… Anyway the amount of memory used can be controlled by the
|
||||
Makefile <code>-DZ=...</code> argument. With the default <code>Z</code>,
|
||||
the program will support in total about 240 million 64bit
|
||||
<code>long</code>s for the internal memory, which should be sufficient
|
||||
for about 100 million nodes+leafs, as each node is 3 <code>long</code>s
|
||||
and each leaf is 2.</p>
|
||||
<p><em>Important:</em> Makefile <code>Z</code> define must be a power of
|
||||
two!</p>
|
||||
<p>Zooming out past about S58 scale will enter a buggy twilight zone as
|
||||
only <code>long</code> integers are used in the drawing code. Reverting
|
||||
to <code>double</code>s could have remedied that, but then I’d need to
|
||||
use a lot of <code>ldexp()</code>s which would take the program over the
|
||||
size limit. Also the program will crash once the universe goes past
|
||||
level 64, though this is simply fixed by modifying a single constant in
|
||||
the program, can you find it ? Anyway <code>2^58</code> squared is quite
|
||||
a big enough universe for such a tiny program to simulate, no ?</p>
|
||||
<p>In case cell memory did not run out, or your pattern did not grow too
|
||||
big, and you have had patience enough and did not increase speed too
|
||||
much, you can run out of the history buffer after <code>33333</code>
|
||||
steps.</p>
|
||||
<p>If all of the above did not happen and result in the expected core
|
||||
dump, you will encounter the final limitation, which is the absence of
|
||||
an escape key. Just close the window or use <code>^C</code>/intr to exit
|
||||
….</p>
|
||||
<p>Foremost the entry is very strict, unsafe and picky regarding its input.
|
||||
Anything straying from the standard Golly macrocell legal format will result in
|
||||
undefined behavior, meaning mostly a very defined core dump. Since
|
||||
aforementioned core is rather large by default (about 4GG) it is highly
|
||||
recommended to set the core dump size limit to 0 in the shell before playing
|
||||
with fire …</p>
|
||||
<p>This entry needs quite a lot of memory to be effective, but by modern standards
|
||||
that is not too much. It does not do any garbage collection, so sooner or later
|
||||
memory will run out, resulting, surprise, surprise, in a core dump. On the plus
|
||||
side, this enables the nice time reversal feature… Anyway the amount of memory
|
||||
used can be controlled by the Makefile <code>-DZ=...</code> argument. With the default <code>Z</code>,
|
||||
the program will support in total about 240 million 64bit <code>long</code>s for the internal
|
||||
memory, which should be sufficient for about 100 million nodes+leafs, as each
|
||||
node is 3 <code>long</code>s and each leaf is 2.</p>
|
||||
<p><em>Important:</em> Makefile <code>Z</code> define must be a power of two!</p>
|
||||
<p>Zooming out past about S58 scale will enter a buggy twilight zone as only <code>long</code>
|
||||
integers are used in the drawing code. Reverting to <code>double</code>s could have remedied
|
||||
that, but then I’d need to use a lot of <code>ldexp()</code>s which would take the program
|
||||
over the size limit. Also the program will crash once the universe goes past
|
||||
level 64, though this is simply fixed by modifying a single constant in the
|
||||
program, can you find it ? Anyway <code>2^58</code> squared is quite a big enough universe
|
||||
for such a tiny program to simulate, no ?</p>
|
||||
<p>In case cell memory did not run out, or your pattern did not grow too big, and
|
||||
you have had patience enough and did not increase speed too much, you can run
|
||||
out of the history buffer after <code>33333</code> steps.</p>
|
||||
<p>If all of the above did not happen and result in the expected core dump, you
|
||||
will encounter the final limitation, which is the absence of an escape key. Just
|
||||
close the window or use <code>^C</code>/intr to exit ….</p>
|
||||
<h3 id="warnings">Warnings</h3>
|
||||
<p>Oh don’t get me started on the torrent of litanies gcc emits when
|
||||
used with <code>-Wall</code>! Does it think I have not memorized by
|
||||
heart C’s precious operator precedence table (or at least have a cheat
|
||||
sheet nearby) that it dares suggest extra parentheses that would take
|
||||
the program over the limit ? And what if I do not use a variable here or
|
||||
there, do I have to pay extra tax for every orphaned variable?</p>
|
||||
<p>There is the reasonable warning about some <code>long</code>s printed
|
||||
as <code>int</code>s but its OK too, trust me.</p>
|
||||
<p>Then there’s the warning about <code>gets(3)</code> being unsafe,
|
||||
which is indeed the only one that appears by default in some versions of
|
||||
gcc linker. Yes Virginia, I know it is unsafe, and I would not recommend
|
||||
anyone using this entry as part of a web daemon, or a spaceship, no,
|
||||
seriously don’ do that.</p>
|
||||
<p>Oh don’t get me started on the torrent of litanies gcc emits when used with
|
||||
<code>-Wall</code>! Does it think I have not memorized by heart C’s precious operator
|
||||
precedence table (or at least have a cheat sheet nearby) that it dares suggest
|
||||
extra parentheses that would take the program over the limit ? And what if I do
|
||||
not use a variable here or there, do I have to pay extra tax for every orphaned
|
||||
variable?</p>
|
||||
<p>There is the reasonable warning about some <code>long</code>s printed as <code>int</code>s but its OK too,
|
||||
trust me.</p>
|
||||
<p>Then there’s the warning about <code>gets(3)</code> being unsafe, which is indeed the only one
|
||||
that appears by default in some versions of gcc linker. Yes Virginia, I know it
|
||||
is unsafe, and I would not recommend anyone using this entry as part of a web
|
||||
daemon, or a spaceship, no, seriously don’ do that.</p>
|
||||
<h3 id="obfuscations">Obfuscations:</h3>
|
||||
<p>Well almost none of the obfuscations are done on purpose, but mostly
|
||||
out of necessity, so all identifiers possible to be one character, are,
|
||||
and they are mercilessly reused. In the <code>main()</code> function
|
||||
there’s even a nice little identifier first used as a global and then
|
||||
reused (shadowed) in the <em>same</em> scope, and this did not produce
|
||||
even a little squeak of a warning from the compiler! Macro compression
|
||||
is rather sparingly used, however magic numbers abound everywhere, and
|
||||
bit twiddling is magical too. Do you know for example why we have
|
||||
<code>unsigned F=-1</code> ? (No warning there of course :) Hint: Later
|
||||
in the program you have <code>F/=17</code>. Did that make any sense?
|
||||
Further hint: print the resulting <code>F</code> in hexadecimal…</p>
|
||||
<p>And yes, the layout hint involves a mix of the most trendy
|
||||
typographical character juxtaposed against a very ancient one, not to
|
||||
mention the program includes some famous name dropping and documents
|
||||
itself as usual.</p>
|
||||
<h3 id="further-spoilers-engineering-and-obfuscation-galore">Further
|
||||
spoilers, engineering, and obfuscation galore:</h3>
|
||||
<p>Those wait for you, curious and intrepid reader, in the attached <a
|
||||
href="apholife.c">apholife.c</a> file, which is a partially obfuscated
|
||||
version of the program I wrote with a lot of helpful annotations and
|
||||
comments for myself and posterity, revealing some of the magic under the
|
||||
hood. This program is also a somewhat improved version which uses
|
||||
<code>ldexp()</code>s in the draw routine and has bigger constants, so
|
||||
it can zoom up to level 1024 if memory allows, and it tries its best to
|
||||
avoid dumping core on the poor user when its memory runs out, rather it
|
||||
enters freeze mode where you can still travel in calculated frozen
|
||||
space-time. Well, it’s not nice and tame, it even has an escape key,
|
||||
usage message, and to top it all it even avoids
|
||||
<code>gets(3)</code>!</p>
|
||||
<p>Well almost none of the obfuscations are done on purpose, but mostly out of
|
||||
necessity, so all identifiers possible to be one character, are, and they are
|
||||
mercilessly reused. In the <code>main()</code> function there’s even a nice little
|
||||
identifier first used as a global and then reused (shadowed) in the <em>same</em>
|
||||
scope, and this did not produce even a little squeak of a warning from the
|
||||
compiler! Macro compression is rather sparingly used, however magic numbers
|
||||
abound everywhere, and bit twiddling is magical too. Do you know for example why
|
||||
we have <code>unsigned F=-1</code> ? (No warning there of course :) Hint: Later in the
|
||||
program you have <code>F/=17</code>. Did that make any sense? Further hint: print the
|
||||
resulting <code>F</code> in hexadecimal…</p>
|
||||
<p>And yes, the layout hint involves a mix of the most trendy typographical
|
||||
character juxtaposed against a very ancient one, not to mention the program
|
||||
includes some famous name dropping and documents itself as usual.</p>
|
||||
<h3 id="further-spoilers-engineering-and-obfuscation-galore">Further spoilers, engineering, and obfuscation galore:</h3>
|
||||
<p>Those wait for you, curious and intrepid reader, in the attached
|
||||
<a href="apholife.c">apholife.c</a> file, which is a partially obfuscated version of the
|
||||
program I wrote with a lot of helpful annotations and comments for myself and
|
||||
posterity, revealing some of the magic under the hood. This program is also a
|
||||
somewhat improved version which uses <code>ldexp()</code>s in the draw routine and has
|
||||
bigger constants, so it can zoom up to level 1024 if memory allows, and it tries
|
||||
its best to avoid dumping core on the poor user when its memory runs out, rather
|
||||
it enters freeze mode where you can still travel in calculated frozen
|
||||
space-time. Well, it’s not nice and tame, it even has an escape key, usage
|
||||
message, and to top it all it even avoids <code>gets(3)</code>!</p>
|
||||
<h3 id="special-thanks">Special thanks:</h3>
|
||||
<p>To Tom Rockiki, the original co-writer of Golly, a personal friend
|
||||
and hashlife master, who reviewed some earlier versions of the entry and
|
||||
freely shared some of his vast knowledge regarding GOL programming and
|
||||
hashlife. As a free bonus, Tom has allowed me to show his code which is
|
||||
probably the most efficient yet most obfuscated way of calculating the
|
||||
GOL function on a 64 bits <code>8*8</code> leaf:</p>
|
||||
<p>To Tom Rockiki, the original co-writer of Golly, a personal friend and hashlife
|
||||
master, who reviewed some earlier versions of the entry and freely shared some
|
||||
of his vast knowledge regarding GOL programming and hashlife. As a free bonus,
|
||||
Tom has allowed me to show his code which is probably the most efficient yet
|
||||
most obfuscated way of calculating the GOL function on a 64 bits <code>8*8</code> leaf:</p>
|
||||
<div class="sourceCode" id="cb5"><pre class="sourceCode c"><code class="sourceCode c"><span id="cb5-1"><a href="#cb5-1" aria-hidden="true" tabindex="-1"></a><span class="dt">unsigned</span> <span class="dt">long</span> life8x8<span class="op">(</span><span class="dt">long</span> a<span class="op">)</span> <span class="op">{</span> <span class="dt">unsigned</span> <span class="dt">long</span> aw <span class="op">=</span> a <span class="op"><<</span> <span class="dv">1</span><span class="op">,</span> ae <span class="op">=</span> a <span class="op">>></span> <span class="dv">1</span><span class="op">,</span> s0 <span class="op">=</span> aw</span>
|
||||
<span id="cb5-2"><a href="#cb5-2" aria-hidden="true" tabindex="-1"></a><span class="op">^</span> ae<span class="op">,</span> s1 <span class="op">=</span> aw <span class="op">&</span> ae<span class="op">,</span> hs0 <span class="op">=</span> s0 <span class="op">^</span> a<span class="op">,</span> hs1 <span class="op">=</span> <span class="op">(</span>s0 <span class="op">&</span> a<span class="op">)</span> <span class="op">|</span> s1<span class="op">,</span> hs0w8 <span class="op">=</span> hs0 <span class="op">>></span> <span class="dv">8</span><span class="op">,</span> hs0e8 <span class="op">=</span></span>
|
||||
<span id="cb5-3"><a href="#cb5-3" aria-hidden="true" tabindex="-1"></a>hs0 <span class="op"><<</span> <span class="dv">8</span><span class="op">,</span> hs1w8 <span class="op">=</span> hs1 <span class="op">>></span> <span class="dv">8</span><span class="op">,</span> hs1e8 <span class="op">=</span> hs1 <span class="op"><<</span> <span class="dv">8</span><span class="op">,</span> ts0 <span class="op">=</span> hs0w8 <span class="op">^</span> hs0e8<span class="op">,</span> ts1 <span class="op">=</span> <span class="op">(</span>hs0w8</span>
|
||||
<span id="cb5-4"><a href="#cb5-4" aria-hidden="true" tabindex="-1"></a><span class="op">&</span> hs0e8<span class="op">)</span> <span class="op">|</span> <span class="op">(</span>ts0 <span class="op">&</span> s0<span class="op">);</span> <span class="cf">return</span> <span class="op">(</span>hs1w8 <span class="op">^</span> hs1e8 <span class="op">^</span> ts1 <span class="op">^</span> s1<span class="op">)</span> <span class="op">&</span> <span class="op">((</span>hs1w8 <span class="op">|</span> hs1e8<span class="op">)</span> <span class="op">^</span></span>
|
||||
<span id="cb5-5"><a href="#cb5-5" aria-hidden="true" tabindex="-1"></a><span class="op">(</span>ts1 <span class="op">|</span> s1<span class="op">))</span> <span class="op">&</span> <span class="op">((</span>ts0 <span class="op">^</span> s0<span class="op">)</span> <span class="op">|</span> a<span class="op">);</span> <span class="op">}</span></span></code></pre></div>
|
||||
<p>This uses only 19 bitwise operations and six shifts to calculate the
|
||||
inner 6x6 next generation bits of the input 8x8 !</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 uses only 19 bitwise operations and six shifts to calculate the inner 6x6
|
||||
next generation bits of the input 8x8 !</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-2019dogon"><a name="inventory"></a>Inventory for
|
||||
2019/dogon</h1>
|
||||
<h1 id="inventory-for-2019dogon"><a name="inventory"></a>Inventory for 2019/dogon</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/2019/dogon/prog.c">prog.c</a>
|
||||
- entry source</li>
|
||||
<li><a
|
||||
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2019/dogon/Makefile">Makefile</a>
|
||||
- entry Makefile</li>
|
||||
<li><a
|
||||
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2019/dogon/prog.orig.c">prog.orig.c</a>
|
||||
- original source</li>
|
||||
<li><a
|
||||
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2019/dogon/glider.mc">glider.mc</a>
|
||||
- Golly macrocell input file</li>
|
||||
<li><a
|
||||
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2019/dogon/gotts-dots.mc">gotts-dots.mc</a>
|
||||
- Golly macrocell input file</li>
|
||||
<li><a
|
||||
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2019/dogon/infinite.mc">infinite.mc</a>
|
||||
- Golly macrocell input file</li>
|
||||
<li><a
|
||||
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2019/dogon/infinite_10cell.mc">infinite_10cell.mc</a>
|
||||
- Golly macrocell input file</li>
|
||||
<li><a
|
||||
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2019/dogon/infinite_5x5.mc">infinite_5x5.mc</a>
|
||||
- Golly macrocell input file</li>
|
||||
<li><a
|
||||
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2019/dogon/infinite_minimal.mc">infinite_minimal.mc</a>
|
||||
- Golly macrocell input file</li>
|
||||
<li><a
|
||||
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2019/dogon/jagged.mc">jagged.mc</a>
|
||||
- Golly macrocell input file</li>
|
||||
<li><a
|
||||
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2019/dogon/message.mc">message.mc</a>
|
||||
- Golly macrocell input file</li>
|
||||
<li><a
|
||||
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2019/dogon/metacatacryst.mc">metacatacryst.mc</a>
|
||||
- Golly macrocell input file</li>
|
||||
<li><a
|
||||
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2019/dogon/metapixel-parity64.mc">metapixel-parity64.mc</a>
|
||||
- Golly macrocell input file</li>
|
||||
<li><a
|
||||
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2019/dogon/mosquito5.mc">mosquito5.mc</a>
|
||||
- Golly macrocell input file</li>
|
||||
<li><a
|
||||
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2019/dogon/try.sh">try.sh</a>
|
||||
- how to run</li>
|
||||
<li><a
|
||||
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2019/dogon/unlimited-novelty.mc">unlimited-novelty.mc</a>
|
||||
- Golly macrocell input file</li>
|
||||
<li><a
|
||||
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2019/dogon/apholife.c">apholife.c</a>
|
||||
- partially obfuscated source</li>
|
||||
<li><a href="2019_dogon.tar.bz2">2019_dogon.tar.bz2</a> - download entry
|
||||
source</li>
|
||||
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2019/dogon/prog.c">prog.c</a> - entry source</li>
|
||||
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2019/dogon/Makefile">Makefile</a> - entry Makefile</li>
|
||||
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2019/dogon/prog.orig.c">prog.orig.c</a> - original source</li>
|
||||
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2019/dogon/glider.mc">glider.mc</a> - Golly macrocell input file</li>
|
||||
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2019/dogon/gotts-dots.mc">gotts-dots.mc</a> - Golly macrocell input file</li>
|
||||
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2019/dogon/infinite.mc">infinite.mc</a> - Golly macrocell input file</li>
|
||||
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2019/dogon/infinite_10cell.mc">infinite_10cell.mc</a> - Golly macrocell input file</li>
|
||||
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2019/dogon/infinite_5x5.mc">infinite_5x5.mc</a> - Golly macrocell input file</li>
|
||||
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2019/dogon/infinite_minimal.mc">infinite_minimal.mc</a> - Golly macrocell input file</li>
|
||||
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2019/dogon/jagged.mc">jagged.mc</a> - Golly macrocell input file</li>
|
||||
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2019/dogon/message.mc">message.mc</a> - Golly macrocell input file</li>
|
||||
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2019/dogon/metacatacryst.mc">metacatacryst.mc</a> - Golly macrocell input file</li>
|
||||
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2019/dogon/metapixel-parity64.mc">metapixel-parity64.mc</a> - Golly macrocell input file</li>
|
||||
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2019/dogon/mosquito5.mc">mosquito5.mc</a> - Golly macrocell input file</li>
|
||||
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2019/dogon/try.sh">try.sh</a> - how to run</li>
|
||||
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2019/dogon/unlimited-novelty.mc">unlimited-novelty.mc</a> - Golly macrocell input file</li>
|
||||
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2019/dogon/apholife.c">apholife.c</a> - partially obfuscated source</li>
|
||||
<li><a href="2019_dogon.tar.bz2">2019_dogon.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/2019/dogon/.entry.json">.entry.json</a>
|
||||
- description of entry in JSON</li>
|
||||
<li><a
|
||||
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2019/dogon/.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/2019/dogon/.entry.json">.entry.json</a> - description of entry in JSON</li>
|
||||
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2019/dogon/.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/2019/dogon/README.md">README.md</a>
|
||||
- markdown source for index.html</li>
|
||||
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2019/dogon/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