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.
756 lines
30 KiB
HTML
756 lines
30 KiB
HTML
<!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>2011/blakely - Most devolving</title>
|
||
<link rel="icon" type="image/x-icon" href="../../favicon.ico">
|
||
<meta name="description" content="2011 IOCCC entry blakely - Most devolving">
|
||
<meta name="keywords" content="IOCCC, 2011, IOCCC 2011, IOCCC entry, blakely, Most devolving">
|
||
</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: 2011/blakely/README.md -->
|
||
<!-- -->
|
||
|
||
<!-- !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
|
||
<!-- !!! Do not modify this web page, instead modify the file: 2011/blakely/README.md !!! -->
|
||
<!-- !!! Do not modify this web page, instead modify the file: 2011/blakely/README.md !!! -->
|
||
<!-- !!! Do not modify this web page, instead modify the file: 2011/blakely/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>2011/blakely - Most devolving</h2>
|
||
<h3>Life/reverse 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="../akari/index.html">← 2011/akari</a>
|
||
<a class="Left" href="../index.html">↑ 2011 ↑</a>
|
||
<a class="Left" href="../borsanyi/index.html">2011/borsanyi →</a>
|
||
<a class="Right" href="https://github.com/ioccc-src/winner/blob/master/2011/blakely/blakely.c">C code</a>
|
||
<a class="Right" href="https://github.com/ioccc-src/winner/blob/master/2011/blakely/Makefile">Makefile</a>
|
||
<a class="Right" href="#inventory">Inventory</a>
|
||
<a class="Right" href="https://github.com/ioccc-src/winner/blob/master/2011/blakely/blakely.orig.c">Original C</a>
|
||
<a class="Right" href="https://validator.w3.org/nu/?doc=https%3A%2F%2Fwww.ioccc.org%2F2011%2Fblakely%2Findex.html">✓</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#Philip_Blakely">Philip Blakely</a><br>
|
||
Location: <a href="../../location.html#GB">GB</a> - <em>United Kingdom of Great Britain and Northern Ireland</em> (<em>United Kingdom</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: 2011/blakely/README.md -->
|
||
<h2 id="to-build">To build:</h2>
|
||
<pre><code> make</code></pre>
|
||
<h2 id="to-use">To use:</h2>
|
||
<p>Zoom out and make your terminal window 53 or more lines deep.</p>
|
||
<pre><code> ./blakely < blakely.c | head -300</code></pre>
|
||
<h2 id="try">Try:</h2>
|
||
<pre><code> ./try.sh</code></pre>
|
||
<p>For those who have a lot of time, try:</p>
|
||
<pre><code> ./blakely < t0_3.dat</code></pre>
|
||
<p>though one might or might not need to kill it, depending on your boredom
|
||
threshold.</p>
|
||
<h2 id="judges-remarks">Judges’ remarks:</h2>
|
||
<p>This program plays <a href="https://en.wikipedia.org/wiki/Conway%27s_Game_of_Life">Life</a>
|
||
(see <a href="https://conwaylife.com">here</a> also), computes Pi to 16 digits
|
||
if given its own source as input, and allows to check if your garden
|
||
is a <a href="http://en.wikipedia.org/wiki/Garden_of_Eden_%28cellular_automaton%29">Garden of Eden</a>, all in one source.</p>
|
||
<p>If you have enough time to spare, put the plan of your garden in a text file,
|
||
and run:</p>
|
||
<pre><code> ./blakely - < garden.txt</code></pre>
|
||
<h2 id="authors-remarks">Author’s remarks:</h2>
|
||
<p>This program uses a well-known algorithm in order to display pi to fifteen
|
||
decimal places. The source-layout itself demonstrates the importance of using
|
||
the correct amount of whitespace in code and the clear superiority of spaces
|
||
over tabs.</p>
|
||
<p>In order to see the main feature of the code, type:</p>
|
||
<pre><code> ./blakely < blakely.c</code></pre>
|
||
<p>and wait for about four seconds before using Ctrl-C (or whatever) to end the program. The
|
||
results are best viewed in a terminal window at least 60 characters
|
||
high and wide. Alternatively, redirect the output to a separate file
|
||
(killing when necessary).</p>
|
||
<h3 id="overview">Overview</h3>
|
||
<p>The program emulates John Conway’s cellular automaton known as “<a href="https://conwaylife.com">The Game of
|
||
Life</a>”, using standard input as a starting grid. The
|
||
layout of the source-code is such that it evolves to a digital representation of
|
||
the first 15 decimal places of pi after 4 time steps. This was setup using the
|
||
other feature of the program which can be demonstrated as follows:</p>
|
||
<pre><code> ./blakely - < 3.dat</code></pre>
|
||
<p>The program will first display the grid given in <a href="https://github.com/ioccc-src/winner/blob/master/2011/blakely/3.dat">3.dat</a>, and then three
|
||
more grids (taking a few minutes to display the last). Waiting for any more
|
||
grids will take a substantial amount of time. The final grid has been put into
|
||
<a href="https://github.com/ioccc-src/winner/blob/master/2011/blakely/evolve_to_3.dat">evolve_to_3.dat</a>, and if you type</p>
|
||
<pre><code> ./blakely < evolve_to_3.dat</code></pre>
|
||
<p>then the 3 will reappear after three time steps.</p>
|
||
<p>As should now be clear, this use of the program will attempt to evolve a given setup
|
||
backwards in time according to the Life rules. The resulting grid is clearly not
|
||
necessarily unique. The program will evolve backwards given <em>any</em> single command
|
||
line option.</p>
|
||
<p>When evolving forwards, the code can only be stopped by killing the
|
||
program. In the reverse direction, the code can either be killed, or
|
||
will stop if it is unable to find a grid that will evolve to the
|
||
current layout correctly. This can be seen with the sample grid
|
||
<a href="https://github.com/ioccc-src/winner/blob/master/2011/blakely/t0_3.dat">t0_3.dat</a>, which evolves backwards by only two time-steps.</p>
|
||
<h3 id="input-file-format">Input file format</h3>
|
||
<p>The input files must encode a square grid, where a space is a dead cell, and any
|
||
other character (except a newline) is a living cell. Each line must be the same
|
||
length, and end with a single newline character <code>\n</code> (ASCII 10), including the
|
||
last line. When designing grids, it may help to type full-stops (dots) in place
|
||
of spaces, and do a global replace afterwards. Any deviation from this format
|
||
will cause errors in the output.</p>
|
||
<h3 id="limitations">Limitations</h3>
|
||
<p>This is only an approximation to the original Life, as it takes place
|
||
on a finite grid, with borders that are automatically killed off
|
||
before each time step. However, when evolving backwards, the resulting
|
||
grids will not cause any cells on the boundaries to come alive.
|
||
As the display is performed before killing off the borders, some
|
||
boundary cells may sometimes appear to be alive, but not be treated as
|
||
such for the following time-step, although any living cells on the
|
||
right border will never be displayed.</p>
|
||
<p>The maximum grid size is currently 99 by 99 (exceeding this will cause a
|
||
segfault), but changing the two <code>9802</code>s to <code>MAX_SIZE*MAX_SIZE+1</code> will
|
||
solve this, although some reformatting of the code might have to be done to allow
|
||
larger numbers.</p>
|
||
<h3 id="compiler-warningsassumptions">Compiler warnings/assumptions</h3>
|
||
<p>When compiled with the <code>-Wall -pedantic -ansi</code> options of gcc, some warnings
|
||
suggesting extra parentheses occur (not necessary for anyone fully conversant
|
||
with operator precedence). There is one unused variable, <code>v</code>, but unnamed
|
||
function parameters are not permitted in ANSI C, so naming it is necessary, and
|
||
gcc no longer warns about its existence, although earlier versions do.</p>
|
||
<p>Since the program calculates ASCII character values for display, an ASCII based
|
||
system is required to run it. Also, as mentioned above, any system that uses
|
||
anything other than a plain <code>\n</code> to end a line will cause problems when reading
|
||
in files.</p>
|
||
<h3 id="obfuscation">Obfuscation</h3>
|
||
<p>Given the finely-tuned layout required to evolve into pi, this is one of the
|
||
main obfuscations used in the code. However, running the code through the
|
||
preprocessor, expanding the <code>#define</code>s, and applying GNU’s indent, although
|
||
making the location of functions and statements clear, by no means makes the
|
||
code entirely clear. Note that expanding out the <code>#define</code>s does not take the
|
||
program over the character limit. The main reason for these is to do with the
|
||
layout, since there are few places that keywords or tokens of over 2
|
||
characters can be fitted, and requiring the first few lines to be <code>#include</code>s
|
||
would cause similar problems.</p>
|
||
<p>Other obfuscations used are:</p>
|
||
<ul>
|
||
<li>Use of the classic <code>2[a]</code> syntax to access the third element of the
|
||
array <code>a</code>.</li>
|
||
<li>Nested ternary operators, combined with shortcut evaluation being
|
||
required for correct operation.</li>
|
||
<li>Use of the comma operator to embed operations inside one another.</li>
|
||
<li>Calculation of ASCII codes.</li>
|
||
<li>Needlessly recursive functions.</li>
|
||
<li>Use of bitwise-operations.</li>
|
||
<li>Storing a variable whose value could easily be found from another.</li>
|
||
<li>Use of <code>goto</code>s to emulate a <code>for</code> loop.</li>
|
||
</ul>
|
||
<h3 id="algorithm">Algorithm</h3>
|
||
<p>The forwards evolution of the grid is straightforward.</p>
|
||
<p>The reverse evolution is done using a brute-force method. As far as I
|
||
know, a brute-force method is the only viable automatic approach for
|
||
general grids, although more intelligent algorithms would be possible
|
||
given more space.</p>
|
||
<p>The program starts with an empty “trial” grid and, starting from the
|
||
top-left, tries all possibilities for the neighbours of the current
|
||
cell that will cause the cell to evolve to the required state. It then
|
||
proceeds to the right and down. Thus, it only ever needs to look at
|
||
the cells below and to the right when testing. However, the already
|
||
defined cells above and/or to the left of the cell may mean that there
|
||
are no possibilities that will give the correct state, in which case
|
||
the code backtracks and tries other possibilities on previous
|
||
cells. The program knows it has a valid grid if it gets to the last
|
||
cell. If it cannot find a valid grid, the program exits.</p>
|
||
<p>Since this uses brute-force, it can be very slow. (In fact, the
|
||
various obfuscations have, at least for the gcc compiler,
|
||
caused a substantial slowdown.)</p>
|
||
<h3 id="program-layout">Program layout</h3>
|
||
<p>The “calculation” of pi was chosen purely because algorithms to find pi are
|
||
numerous, but the <a href="https://en.wikipedia.org/wiki/Conway%27s_Game_of_Life">Game of
|
||
Life</a> is rarely (if
|
||
ever?) used for this purpose. Also, separate digits made determining the layout
|
||
somewhat easier.</p>
|
||
<p>Deriving the layout was the most complicated part of the program. As is clear
|
||
from the final layout featuring pi, the grid was divided into sixteen squares,
|
||
and layouts that would evolve to each of the nine digits required were found.
|
||
(This used the three-by-five digit-layout embedded in, at first, a nine-by-nine
|
||
grid, then in larger grids, until fifteen-by-fifteen was reached.) The
|
||
fifteen-by-fifteen grids give enough blank cells around them that the digits
|
||
will not collide when evolving.</p>
|
||
<p>However, this did not allow for sufficient characters to fit the code
|
||
into. Therefore it was necessary to add some regions that would quickly die off
|
||
without expanding to collide with the digits’ evolution.
|
||
Groups of cells such as singletons, pairs, and larger groups like</p>
|
||
<pre><code> * * * * * * * * * *
|
||
*****************
|
||
* * * * * * * * * *</code></pre>
|
||
<p>were useful in this regard.</p>
|
||
<p>Other problems were keywords which need to be all in one
|
||
string, keywords requiring space after them, and
|
||
multi-character tokens. Some of these problems were dealt with by
|
||
using the <code>#define</code>s and <code>#include</code>s given in the build-script, as there
|
||
was no way to have sufficient separate lines in the code to do this
|
||
without causing many difficulties. Some rejigging of the grid’s layout
|
||
as the code was fitted into its format was also done, resorting to
|
||
trial-and-improvement in some cases. Occasional use of constructs such
|
||
as <code>f -= -3</code> was made as <code>f += 3</code> could not be fitted into the required format.
|
||
The fact that the borders would be killed off immediately was also helpful.</p>
|
||
<p>It should be noted that evolving a full 60-by-60 grid backwards using
|
||
this code would probably take us at least up to the heat-death of the
|
||
universe.</p>
|
||
<p>The command <code>./blakely - < blakely.c</code> is therefore <em>not</em> recommended.</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: 2011/blakely/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-2011blakely">Inventory for 2011/blakely</h1>
|
||
</div>
|
||
<h2 id="primary-files">Primary files</h2>
|
||
<ul>
|
||
<li><a href="https://github.com/ioccc-src/winner/blob/master/2011/blakely/blakely.c">blakely.c</a> - entry source code</li>
|
||
<li><a href="https://github.com/ioccc-src/winner/blob/master/2011/blakely/Makefile">Makefile</a> - entry Makefile</li>
|
||
<li><a href="https://github.com/ioccc-src/winner/blob/master/2011/blakely/blakely.orig.c">blakely.orig.c</a> - original source code</li>
|
||
<li><a href="https://github.com/ioccc-src/winner/blob/master/2011/blakely/3.dat">3.dat</a> - input data file</li>
|
||
<li><a href="https://github.com/ioccc-src/winner/blob/master/2011/blakely/evolve_to_3.dat">evolve_to_3.dat</a> - input data file</li>
|
||
<li><a href="https://github.com/ioccc-src/winner/blob/master/2011/blakely/t0_3.dat">t0_3.dat</a> - input data file</li>
|
||
<li><a href="https://github.com/ioccc-src/winner/blob/master/2011/blakely/try.sh">try.sh</a> - script to try entry</li>
|
||
</ul>
|
||
<h2 id="secondary-files">Secondary files</h2>
|
||
<ul>
|
||
<li><a href="2011_blakely.tar.bz2">2011_blakely.tar.bz2</a> - download entry tarball</li>
|
||
<li><a href="https://github.com/ioccc-src/winner/blob/master/2011/blakely/README.md">README.md</a> - markdown source for this web page</li>
|
||
<li><a href="https://github.com/ioccc-src/winner/blob/master/2011/blakely/.entry.json">.entry.json</a> - entry summary and manifest in JSON</li>
|
||
<li><a href="https://github.com/ioccc-src/winner/blob/master/2011/blakely/.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/2011/blakely/.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 © 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%2F2011%2Fblakely%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 -->
|