Files
ioccc/2019/dogon/index.html
T
Landon Curt Noll a1c86c8a7a add original C links to entry navigation bars
The navigation bar for a winning entry now has a "_Original C_" link
(between the ✅ and the Inventory on the right hand side) so that one
may easily view the original C code that was submitted for IOCCC judging.

Ran `make www timestamp` to perform the above.
2025-08-10 12:46:23 -07:00

804 lines
35 KiB
HTML
Raw Blame History

This file contains invisible Unicode characters
This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<!-- START: two lines up starts content from: inc/top.default.html -->
<!-- END: this line ends content from: inc/top.default.html -->
<!-- START: this line starts content from: inc/head.default.html -->
<head>
<link rel="stylesheet" href="../../ioccc.css">
<link href="https://fonts.googleapis.com/css2?family=Outfit:wght@100..900&display=swap" rel="stylesheet">
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=yes">
<title>2019/dogon - Best use of space and time</title>
<link rel="icon" type="image/x-icon" href="../../favicon.ico">
<meta name="description" content="2019 IOCCC entry dogon - Best use of space and time">
<meta name="keywords" content="IOCCC, 2019, IOCCC 2019, IOCCC entry, dogon, Best use of space and time">
</head>
<!-- !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<!-- !!! DO NOT MODIFY THIS FILE - This file is generated by a tool !!! -->
<!-- !!! DO NOT MODIFY THIS FILE - This file is generated by a tool !!! -->
<!-- !!! DO NOT MODIFY THIS FILE - This file is generated by a tool !!! -->
<!-- !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<!-- END: this line ends content from: inc/head.default.html -->
<!-- -->
<!-- This web page was formed via the tool: bin/readme2index.sh -->
<!-- The content of main section of this web page came from: 2019/dogon/README.md -->
<!-- -->
<!-- !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<!-- !!! Do not modify this web page, instead modify the file: 2019/dogon/README.md !!! -->
<!-- !!! Do not modify this web page, instead modify the file: 2019/dogon/README.md !!! -->
<!-- !!! Do not modify this web page, instead modify the file: 2019/dogon/README.md !!! -->
<!-- !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<!-- Markdown content was converted into HTML via the tool: bin/md2html.sh -->
<!-- START: this line starts content from: inc/body.default.html -->
<body>
<!-- END: this line ends content from: inc/body.default.html -->
<!-- START: this line starts content from: inc/topbar.default.html -->
<div class="theader">
<nav class="topbar">
<div class="container">
<div class="logo">
<a href="../../index.html" class="logo-link">
IOCCC
</a>
</div>
<div class="topbar-items">
<div class="item">
<span class="item-header">
Entries
</span>
<div class="sub-item">
<div class="outfit-font">
<a href="../../years.html" class="sub-item-link">
Winning entries
</a>
</div>
<div class="outfit-font">
<a href="../../authors.html" class="sub-item-link">
Winning authors
</a>
</div>
<div class="outfit-font">
<a href="../../location.html" class="sub-item-link">
Location of authors
</a>
</div>
<div class="outfit-font">
<a href="../../bugs.html" class="sub-item-link">
Bugs and (mis)features
</a>
</div>
<div class="outfit-font">
<a href="../../faq.html#fix_an_entry" class="sub-item-link">
Fixing entries
</a>
</div>
<div class="outfit-font">
<a href="../../faq.html#fix_author" class="sub-item-link">
Updating author info
</a>
</div>
</div>
</div>
<div class="item">
<span class="item-header">
Status
</span>
<div class="sub-item">
<div class="outfit-font">
<a href="../../news.html" class="sub-item-link">
News
</a>
</div>
<div class="outfit-font">
<a href="../../status.html" class="sub-item-link">
Contest status
</a>
</div>
<div class="outfit-font">
<a href="../../next/rules.html" class="sub-item-link">
IOCCC rules
</a>
</div>
<div class="outfit-font">
<a href="../../next/guidelines.html" class="sub-item-link">
IOCCC guidelines
</a>
</div>
<div class="outfit-font">
<a href="../../markdown.html" class="sub-item-link">
Markdown guidelines
</a>
</div>
<div class="outfit-font">
<a href="../../SECURITY.html" class="sub-item-link">
Security policy
</a>
</div>
</div>
</div>
<div class="item">
<span class="item-header">
FAQ
</span>
<div class="sub-item">
<div class="outfit-font">
<a href="../../faq.html" class="sub-item-link">
Frequently asked questions
</a>
</div>
<div class="outfit-font">
<a href="../../quick-start.html#enter" class="sub-item-link">
Enter the IOCCC
</a>
</div>
<div class="outfit-font">
<a href="../../faq.html#compiling" class="sub-item-link">
Compiling entries
</a>
</div>
<div class="outfit-font">
<a href="../../faq.html#running_entries" class="sub-item-link">
Running entries
</a>
</div>
<div class="outfit-font">
<a href="../../faq.html#help" class="sub-item-link">
How to help
</a>
</div>
</div>
</div>
<div class="item">
<span class="item-header">
About
</span>
<div class="sub-item">
<div class="outfit-font">
<a href="../../index.html" class="sub-item-link">
Home page
</a>
</div>
<div class="outfit-font">
<a href="../../social.html" class="sub-item-link">
IOCCC social media
</a>
</div>
<div class="outfit-font">
<a href="../../about.html" class="sub-item-link">
About the IOCCC
</a>
</div>
<div class="outfit-font">
<a href="../../judges.html" class="sub-item-link">
The judges
</a>
</div>
<div class="outfit-font">
<a href="../../thanks-for-help.html" class="sub-item-link">
Thanks for the help
</a>
</div>
<div class="outfit-font">
<a href="../../contact.html" class="sub-item-link">
Contact us
</a>
</div>
</div>
</div>
</div>
</div>
</nav>
<div class="header-mobile-menu">
<noscript>
<a href="../../nojs-menu.html" class="topbar-js-label">
Please Enable JavaScript
</a>
</noscript>
<button id="header-open-menu-button" class="topbar-mobile-menu">
<img
src="../../png/hamburger-icon-open.png"
alt="hamburger style menu icon - open state"
width=48
height=48>
</button>
<button id="header-close-menu-button" class="hide-content">
<img
src="../../png/hamburger-icon-closed.png"
alt="hamburger style menu icon - closed state"
width=48
height=48>
</button>
<div id="mobile-menu-panel" class="hide-content">
<div class="mobile-menu-container">
<div class="mobile-menu-wrapper">
<div class="mobile-menu-item">
Entries
</div>
<div class="mobile-submenu-wrapper">
<a class="mobile-submenu-item" href="../../years.html">
Winning entries
</a>
<a class="mobile-submenu-item" href="../../authors.html">
Winning authors
</a>
<a class="mobile-submenu-item" href="../../location.html">
Location of authors
</a>
<a class="mobile-submenu-item" href="../../bugs.html">
Bugs and (mis)features
</a>
<a class="mobile-submenu-item" href="../../faq.html#fix_an_entry">
Fixing entries
</a>
<a class="mobile-submenu-item" href="../../faq.html#fix_author">
Updating author info
</a>
<a class="mobile-submenu-item" href="../../thanks-for-help.html">
Thanks for the help
</a>
</div>
</div>
<div class="mobile-menu-wrapper">
<div class="mobile-menu-item">
Status
</div>
<div class="mobile-submenu-wrapper">
<a class="mobile-submenu-item" href="../../news.html">
News
</a>
<a class="mobile-submenu-item" href="../../status.html">
Contest status
</a>
<a class="mobile-submenu-item" href="../../next/rules.html">
IOCCC rules
</a>
<a class="mobile-submenu-item" href="../../next/guidelines.html">
IOCCC guidelines
</a>
<a class="mobile-submenu-item" href="../../markdown.html">
Markdown guidelines
</a>
<a class="mobile-submenu-item" href="../../SECURITY.html">
Security policy
</a>
</div>
</div>
<div class="mobile-menu-wrapper">
<div class="mobile-menu-item">
FAQ
</div>
<div class="mobile-submenu-wrapper">
<a class="mobile-submenu-item" href="../../faq.html">
Frequently asked questions
</a>
<a class="mobile-submenu-item" href="../../quick-start.html#enter">
Enter the IOCCC
</a>
<a class="mobile-submenu-item" href="../../faq.html#compiling">
Compiling entries
</a>
<a class="mobile-submenu-item" href="../../faq.html#running_entries">
Running entries
</a>
<a class="mobile-submenu-item" href="../../faq.html#help">
How to help
</a>
</div>
</div>
<div class="mobile-menu-wrapper">
<div class="mobile-menu-item">
About
</div>
<div class="mobile-submenu-wrapper">
<a class="mobile-submenu-item" href="../../index.html">
Home page
</a>
<a class="mobile-submenu-item" href="../../social.html">
IOCCC social media
</a>
<a class="mobile-submenu-item" href="../../about.html">
About the IOCCC
</a>
<a class="mobile-submenu-item" href="../../judges.html">
The judges
</a>
<a class="mobile-submenu-item" href="../../contact.html">
Contact us
</a>
</div>
</div>
</div>
</div>
</div>
</div>
<script>
var headerOpenMenuButton = document.getElementById("header-open-menu-button");
var headerCloseMenuButton = document.getElementById("header-close-menu-button");
var mobileMenuPanel = document.getElementById("mobile-menu-panel");
headerOpenMenuButton.addEventListener("click", () => {
headerOpenMenuButton.classList.remove("topbar-mobile-menu");
headerOpenMenuButton.classList.add("hide-content");
headerCloseMenuButton.classList.remove("hide-content");
headerCloseMenuButton.classList.add("topbar-mobile-menu");
mobileMenuPanel.classList.remove("hide-content");
mobileMenuPanel.classList.add("topbar-mobile-panel");
});
headerCloseMenuButton.addEventListener("click", () => {
headerCloseMenuButton.classList.remove("topbar-mobile-menu");
headerCloseMenuButton.classList.add("hide-content");
mobileMenuPanel.classList.add("hide-content");
mobileMenuPanel.classList.remove("topbar-mobile-panel");
headerOpenMenuButton.classList.add("topbar-mobile-menu");
headerOpenMenuButton.classList.remove("hide-content");
});
</script>
<!-- END: this line ends content from: inc/topbar.default.html -->
<!-- START: this line starts content from: inc/header.default.html -->
<div class="header">
<a href="../../2011/zucker/index.html">
<img src="../../png/ioccc.png"
alt="IOCCC image by Matt Zucker"
width=300
height=110>
</a>
<h1>The International Obfuscated C Code Contest</h1>
<h2>2019/dogon - Best use of space and time</h2>
<h3>X11 Golly game of Life</h3>
</div>
<!-- END: this line ends content from: inc/header.default.html -->
<!-- START: this line starts content from: inc/navbar.mid.html -->
<div class="navbar">
<a class="Left" href="../diels-grabsch2/index.html">&larr; 2019/diels-grabsch2</a>
<a class="Left" href="../index.html">&uarr; 2019 &uarr;</a>
<a class="Left" href="../duble/index.html">2019/duble &rarr;</a>
<a class="Right" href="https://github.com/ioccc-src/winner/blob/master/2019/dogon/prog.c">C code</a>
<a class="Right" href="https://github.com/ioccc-src/winner/blob/master/2019/dogon/Makefile">Makefile</a>
<a class="Right" href="#inventory">Inventory</a>
<a class="Right" href="https://github.com/ioccc-src/winner/blob/master/2019/dogon/prog.orig.c">Original C</a>
<a class="Right" href="https://validator.w3.org/nu/?doc=https%3A%2F%2Fwww.ioccc.org%2F2019%2Fdogon%2Findex.html">&#x2713;</a>
</div>
<!-- END: this line ends content from: inc/navbar.mid.html -->
<!-- START: this line starts content from: inc/before-content.default.html -->
<div class="content" id="content">
<!-- END: this line ends content from: inc/before-content.default.html -->
<!-- START: this line starts content for HTML phase 20 by: bin/output-index-author.sh via bin/md2html.sh -->
<!-- START: this line starts content generated by: bin/output-index-author.sh -->
<h2 id="author">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>)</li>
</ul>
<!-- END: next line ends content generated by: bin/output-index-author.sh -->
<!-- END: this line ends content for HTML phase 20 by: bin/output-index-author.sh via bin/md2html.sh -->
<!-- START: this line starts content for HTML phase 21 by: bin/pandoc-wrapper.sh via bin/md2html.sh -->
<!-- BEFORE: 1st line of markdown file: 2019/dogon/README.md -->
<h2 id="to-build">To build:</h2>
<pre><code> make</code></pre>
<p><strong>NOTE</strong>: this entry requires the <code>X11/Xlib.h</code> header file and the X11 library to
compile. For more information see the
FAQ on “<a href="../../faq.html#X11">X11</a>”.</p>
<h3 id="bugs-and-misfeatures">Bugs and (Mis)features:</h3>
<p>The current status of this entry is:</p>
<blockquote>
<p><strong>STATUS: uses gets() - change to fgets() if possible</strong></p>
</blockquote>
<p>For more detailed information see <a href="../../bugs.html#2019_dogon">2019/dogon in bugs.html</a>.</p>
<h2 id="to-use">To use:</h2>
<pre><code> ./prog &lt; pattern.mc</code></pre>
<h2 id="try">Try:</h2>
<pre><code> ./try.sh</code></pre>
<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="../../1991/davidguy/index.html">1991/davidguy</a>,
<a href="../../2011/blakely/index.html">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><strong>FYI</strong>: 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></li>
</ul>
<pre><code> make clobber MEMORY=0x10000000 all</code></pre>
<p>Notice that that value must be a power of two!</p>
<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>
<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>
</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>
<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>
<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>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>
<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="https://github.com/ioccc-src/winner/blob/master/2019/dogon/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
antiquated X86 you’ll be fine.</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>
<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>
<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="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>
<pre><code> unsigned long life8x8(long a) { unsigned long aw = a &lt;&lt; 1, ae = a &gt;&gt; 1, s0 = aw
^ ae, s1 = aw &amp; ae, hs0 = s0 ^ a, hs1 = (s0 &amp; a) | s1, hs0w8 = hs0 &gt;&gt; 8, hs0e8 =
hs0 &lt;&lt; 8, hs1w8 = hs1 &gt;&gt; 8, hs1e8 = hs1 &lt;&lt; 8, ts0 = hs0w8 ^ hs0e8, ts1 = (hs0w8
&amp; hs0e8) | (ts0 &amp; s0); return (hs1w8 ^ hs1e8 ^ ts1 ^ s1) &amp; ((hs1w8 | hs1e8) ^
(ts1 | s1)) &amp; ((ts0 ^ s0) | a); }</code></pre>
<p>This uses only 19 bitwise operations and six shifts to calculate the inner 6x6
next generation bits of the input 8x8 !</p>
<h3 id="notice-to-those-who-wish-for-a-greater-challenge">NOTICE to those who wish for a greater challenge:</h3>
<p><strong>If you want a greater challenge, don’t read any further</strong>:
just try to understand the program via the source.</p>
<p>If you get stuck, come back and read below for additional hints and information.</p>
<h3 id="further-information-engineering-and-obfuscation-galore">Further information, engineering, and obfuscation galore:</h3>
<p>Those wait for you, curious and intrepid reader, in the attached
<a href="https://github.com/ioccc-src/winner/blob/master/2019/dogon/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>
<!--
Copyright © 1984-2024 by Landon Curt Noll. All Rights Reserved.
You are free to share and adapt this file under the terms of this license:
Creative Commons Attribution-ShareAlike 4.0 International (CC BY-SA 4.0)
For more information, see:
https://creativecommons.org/licenses/by-sa/4.0/
-->
<!-- AFTER: last line of markdown file: 2019/dogon/README.md -->
<!-- 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 -->
<div id="inventory">
<h1 id="inventory-for-2019dogon">Inventory for 2019/dogon</h1>
</div>
<h2 id="primary-files">Primary files</h2>
<ul>
<li><a href="https://github.com/ioccc-src/winner/blob/master/2019/dogon/prog.c">prog.c</a> - entry source code</li>
<li><a href="https://github.com/ioccc-src/winner/blob/master/2019/dogon/Makefile">Makefile</a> - entry Makefile</li>
<li><a href="https://github.com/ioccc-src/winner/blob/master/2019/dogon/prog.orig.c">prog.orig.c</a> - original source code</li>
<li><a href="glider.mc">glider.mc</a> - Golly macrocell input file</li>
<li><a href="https://github.com/ioccc-src/winner/blob/master/2019/dogon/gotts-dots.mc">gotts-dots.mc</a> - Golly macrocell input file</li>
<li><a href="https://github.com/ioccc-src/winner/blob/master/2019/dogon/infinite_10cell.mc">infinite_10cell.mc</a> - Golly macrocell input file</li>
<li><a href="https://github.com/ioccc-src/winner/blob/master/2019/dogon/infinite_5x5.mc">infinite_5x5.mc</a> - Golly macrocell input file</li>
<li><a href="https://github.com/ioccc-src/winner/blob/master/2019/dogon/infinite.mc">infinite.mc</a> - Golly macrocell input file</li>
<li><a href="https://github.com/ioccc-src/winner/blob/master/2019/dogon/infinite_minimal.mc">infinite_minimal.mc</a> - Golly macrocell input file</li>
<li><a href="https://github.com/ioccc-src/winner/blob/master/2019/dogon/jagged.mc">jagged.mc</a> - Golly macrocell input file</li>
<li><a href="https://github.com/ioccc-src/winner/blob/master/2019/dogon/message.mc">message.mc</a> - Golly macrocell input file</li>
<li><a href="https://github.com/ioccc-src/winner/blob/master/2019/dogon/metacatacryst.mc">metacatacryst.mc</a> - Golly macrocell input file</li>
<li><a href="https://github.com/ioccc-src/winner/blob/master/2019/dogon/metapixel-parity64.mc">metapixel-parity64.mc</a> - Golly macrocell input file</li>
<li><a href="https://github.com/ioccc-src/winner/blob/master/2019/dogon/mosquito5.mc">mosquito5.mc</a> - Golly macrocell input file</li>
<li><a href="https://github.com/ioccc-src/winner/blob/master/2019/dogon/try.sh">try.sh</a> - script to try entry</li>
<li><a href="https://github.com/ioccc-src/winner/blob/master/2019/dogon/unlimited-novelty.mc">unlimited-novelty.mc</a> - Golly macrocell input file</li>
<li><a href="https://github.com/ioccc-src/winner/blob/master/2019/dogon/apholife.c">apholife.c</a> - partially obfuscated 64-bit Hash Life source code</li>
</ul>
<h2 id="secondary-files">Secondary files</h2>
<ul>
<li><a href="2019_dogon.tar.bz2">2019_dogon.tar.bz2</a> - download entry tarball</li>
<li><a href="https://github.com/ioccc-src/winner/blob/master/2019/dogon/README.md">README.md</a> - markdown source for this web page</li>
<li><a href="https://github.com/ioccc-src/winner/blob/master/2019/dogon/.entry.json">.entry.json</a> - entry summary and manifest in JSON</li>
<li><a href="https://github.com/ioccc-src/winner/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/winner/blob/master/2019/dogon/.path">.path</a> - directory path from top level directory</li>
<li><a href="index.html">index.html</a> - this web page</li>
</ul>
<hr style="width:10%;text-align:left;margin-left:0">
<h4>
Jump to: <a href="#">top</a>
</h4>
<!-- END: next line ends content generated by: bin/output-index-inventory.sh -->
<!-- END: this line ends content for HTML phase 22 by: bin/output-index-inventory.sh via bin/md2html.sh -->
<!-- START: this line starts content from: inc/after-content.default.html -->
</div>
<!-- END: this line ends content from: inc/after-content.default.html -->
<!-- START: this line starts content from: inc/footer.inventory.html -->
<!--
Copyright © 1984-2025 by Landon Curt Noll. All Rights Reserved.
You are free to share and adapt this file under the terms of this license:
Creative Commons Attribution-ShareAlike 4.0 International (CC BY-SA 4.0)
For more information, see:
https://creativecommons.org/licenses/by-sa/4.0/
-->
<div class="footer">
<div id="copyright"><h3>Copyright &copy; 1984-2025 by Landon Curt Noll:
<a href="https://creativecommons.org/faq/#what-does-some-rights-reserved-mean"
target="_blank"
rel="license noopener noreferrer">Some Rights Reserved</a></h3>
<p>
This work is <b>licensed by Landon Curt Noll</b> under
<b><a href="https://creativecommons.org/licenses/by-sa/4.0/?ref=chooser-v1"
target="_blank"
rel="license noopener noreferrer"
style="display:inline-block;">CC BY-SA 4.0</a></b>.
<img style="height:22px!important;margin-left:3px;vertical-align:text-bottom;"
src="../../png/cc.png"
alt="cc inside circle symbol">
<img style="height:22px!important;margin-left:3px;vertical-align:text-bottom;"
src="../../png/by.png"
alt="person inside circle symbol">
<img style="height:22px!important;margin-left:3px;vertical-align:text-bottom;"
src="../../png/sa.png"
alt="arrow looping back on itself inside circle symbol"><br>
You should <b>carefully review</b> the
<b><a href="https://creativecommons.org/licenses/by-sa/4.0/legalcode.en"
target="_blank"
rel="license noopener noreferrer">CC BY-SA 4.0 LEGAL CODE</a></b>
before using the licensed material.<br>
You may wish to review the
<b><a href="../../license.html"
target="_blank"
rel="license noopener noreferrer">highlights of some of the key features and terms</a></b>
of <b>CC BY-SA 4.0</b>.<br>
</p>
</div>
<div id="coda"><h3>Coda</h3>
<p>
<a href="https://validator.w3.org/nu/?doc=https%3A%2F%2Fwww.ioccc.org%2F2019%2Fdogon%2Findex.html" rel="nofollow">Nu HTML check this web page</a><br>
<a href="#top">Jump to top</a> <a href="#content">Jump to Content</a> <a href="#inventory">Jump to Inventory</a><br>
</p>
</div>
</div>
<!-- END: this line ends content from: inc/footer.inventory.html -->
<!-- START: this line starts content from: inc/bottom.default.html -->
</body>
</html>
<!-- END: this line ends content from: inc/bottom.default.html -->