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.
757 lines
30 KiB
HTML
757 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>2015/dogon - Most crafty</title>
|
||
<link rel="icon" type="image/x-icon" href="../../favicon.ico">
|
||
<meta name="description" content="2015 IOCCC entry dogon - Most crafty">
|
||
<meta name="keywords" content="IOCCC, 2015, IOCCC 2015, IOCCC entry, dogon, Most crafty">
|
||
</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: 2015/dogon/README.md -->
|
||
<!-- -->
|
||
|
||
<!-- !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
|
||
<!-- !!! Do not modify this web page, instead modify the file: 2015/dogon/README.md !!! -->
|
||
<!-- !!! Do not modify this web page, instead modify the file: 2015/dogon/README.md !!! -->
|
||
<!-- !!! Do not modify this web page, instead modify the file: 2015/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>2015/dogon - Most crafty</h2>
|
||
<h3>X11 Minecraft demo</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="../burton/index.html">← 2015/burton</a>
|
||
<a class="Left" href="../index.html">↑ 2015 ↑</a>
|
||
<a class="Left" href="../duble/index.html">2015/duble →</a>
|
||
<a class="Right" href="https://github.com/ioccc-src/winner/blob/master/2015/dogon/prog.c">C code</a>
|
||
<a class="Right" href="https://github.com/ioccc-src/winner/blob/master/2015/dogon/Makefile">Makefile</a>
|
||
<a class="Right" href="#inventory">Inventory</a>
|
||
<a class="Right" href="https://github.com/ioccc-src/winner/blob/master/2015/dogon/prog.orig.c">Original C</a>
|
||
<a class="Right" href="https://validator.w3.org/nu/?doc=https%3A%2F%2Fwww.ioccc.org%2F2015%2Fdogon%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#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: 2015/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>
|
||
<p>To change the dimensions you can use the <code>WIDTH</code> and <code>HEIGHT</code> variables when
|
||
compiling (default 1024 x 800):</p>
|
||
<pre><code> make clobber WIDTH=640 HEIGHT=480</code></pre>
|
||
<p>to make the game 640 x 480. Obviously changing it to non numbers or negative
|
||
numbers or too large numbers will cause problems.</p>
|
||
<p>There is an alternate version that is based on the author’s suggestion to change
|
||
a value in order to see a bug that they avoided in their entry. See <a href="#alternate-code">Alternate
|
||
code</a> below.</p>
|
||
<h2 id="to-use">To use:</h2>
|
||
<pre><code> ./prog</code></pre>
|
||
<h2 id="try">Try:</h2>
|
||
<pre><code> ./prog</code></pre>
|
||
<p>Press and hold the Left Arrow key until you turn 90-degrees to the left.</p>
|
||
<p>When you see a long tunnel, press the function key F2.</p>
|
||
<p>Use the Up, Down, Left and Right keys to change your path.</p>
|
||
<p>Press function higher numbered function keys (F3, F4, …) to go faster.</p>
|
||
<p>Press F1 to stop.</p>
|
||
<p>Turn 90-degrees to one side.</p>
|
||
<p>Press F4 to drill into some blocks for a bit.</p>
|
||
<p>Press F1 to stop.</p>
|
||
<p>Turn 180-degrees to face the way you came.</p>
|
||
<p>Press F2 and navigate back down the new hole until you reach the long tunnel
|
||
again.</p>
|
||
<p>Press F1 to stop.</p>
|
||
<p>etc.</p>
|
||
<p>Press the ESC key.</p>
|
||
<h2 id="alternate-code">Alternate code:</h2>
|
||
<p>The author suggested that one change <code>q</code> to <code>0x82000820000000</code> instead of
|
||
<code>0x820008202625a0</code> to see a bug that they avoided, writing:</p>
|
||
<blockquote>
|
||
<p>To see this bug in action change the assignment above to <code>q=0x82000820000000</code>,
|
||
and look towards the negative direction of the main tunnel.</p>
|
||
</blockquote>
|
||
<p>This alt version does this for you.</p>
|
||
<h3 id="alternate-build">Alternate build:</h3>
|
||
<pre><code> make alt</code></pre>
|
||
<h3 id="alternate-use">Alternate use:</h3>
|
||
<p>Use <code>prog.alt</code> as you would <code>prog</code> above.</p>
|
||
<h3 id="alternate-try">Alternate try:</h3>
|
||
<p>Try locating the issue the author suggested exists.</p>
|
||
<h2 id="judges-remarks">Judges’ remarks:</h2>
|
||
<p>You are in a twisty maze blocks, almost all alike.</p>
|
||
<p>Those blocks are generated by twisty maze of code blocks, almost all different.</p>
|
||
<p>Can you find your way around either and understand where you are?</p>
|
||
<p>How many function keys does your keyboard have? Can you generate very high
|
||
number function keys such as F30 or F31? :-)</p>
|
||
<p><em>Textures? We don’t need no stinking textures.</em></p>
|
||
<h2 id="authors-remarks">Author’s remarks:</h2>
|
||
<h3 id="what-is-it">What is it?</h3>
|
||
<p>Just run <code>./prog</code> with no arguments on an X11-compatible system. The scenery, though
|
||
pseudo-randomly generated should be strangely familiar, especially to those still
|
||
in their teenage years. You can navigate using the keyboard arrow keys and the
|
||
function keys. Your speed is a linear function of <code>(n-1)</code> where <code>Fn</code> is the last
|
||
function key you have pressed, and you always move in the direction you are
|
||
looking at. Be aware that you are probably some kind of a Creeper as is obvious
|
||
from looking at the program, hence your movement is destructive to the
|
||
environment. So after pressing F12 for warp speed, and moving around randomly,
|
||
you might find yourself in a 3D maze of twisty little passages, from which there
|
||
is only one Esc(ape) key. Note that in theory if you have a specialty keyboard
|
||
with 32 function keys you may even press F31 to reach infinite improbability
|
||
drive speed, though the author had never tested this feature. However a hidden
|
||
comment in <code>keysymdef.h</code> suggests the existence of a mythical Sun Keyboard with 35
|
||
function keys :)</p>
|
||
<h3 id="full-disclosure">Full disclosure:</h3>
|
||
<p>This entry, though pretty thoroughly obfuscated, is not entirely original, nor
|
||
am I Notch. The inspiration for this entry is a demo code written by the Notch
|
||
himself, which was released with the following license: “you may use the code
|
||
in here for any purpose in any way you want, at your own risk”. That version
|
||
will henceforth be referred to as the original. Though the original in itself
|
||
was quite nice and rather dense piece of code, it was not written in C, nor
|
||
entirely and meticulously obfuscated, a state of things I hopefully rectified.</p>
|
||
<h3 id="some-extra-features">Some extra features:</h3>
|
||
<p>Basing it on the original which already had a wonderful simple and concise ray
|
||
casting through a generated voxel world rendering, I added a few tweaks of my
|
||
own device:</p>
|
||
<ul>
|
||
<li>Two pass optimized rendering. The program first calculates 1/16 of the output
|
||
image by ray casting and then, when possible, uses texture interpolation on the
|
||
voxel faces. It speeds up the rendering by at least a factor of 4 on most
|
||
scenes, but extra care must be taken when passing rays through the leaves voxels
|
||
…</li>
|
||
<li>Fixed a small omission in the original. When you looked though a transparent
|
||
leaves voxel, you did not see the leaves at voxel faces that were far from you.
|
||
In this version the rendering of those (far face leaves) is correct.</li>
|
||
<li>Window rendering size specified in Makefile.</li>
|
||
<li>Added the keyboard controls for navigation (and destruction).</li>
|
||
</ul>
|
||
<h3 id="portability-issues">Portability issues:</h3>
|
||
<p>This entry is rather portable I think on modern platforms. It assumes of course
|
||
basic X-windows availability. There are several other salient assumptions
|
||
though:</p>
|
||
<ul>
|
||
<li>The entry assumes <code>sizeof(int)==4</code>. This seems to cover pretty much everything
|
||
that supports X-windows so would be broken only on quite ancient machines,
|
||
embedded processors, or some big iron 64 bit system where <code>sizeof(int)=8</code>.</li>
|
||
<li>The entry assumes the default visual has 24 bit depth (RGB). This seems to be
|
||
the case on most X Servers these days.</li>
|
||
<li>The entry, does a thing which is an absolute No-No for X-windows program, i.e.
|
||
assuming it knows some numeric values for keysyms defined in <code>keysymdef.h</code>. I
|
||
have searched far and wide the lord Google’s domain, yet was unable to find a
|
||
version of the file where those assumptions were broken. This enables the
|
||
important support of up to 32 function keys keyboards without spilling over the
|
||
size limit, and allows us to use such fun expression for arrow view control as
|
||
the following:</li>
|
||
</ul>
|
||
<pre><code> *(a&1?&C:&B)-=(.05 -a/2%2*.1)*!(a-1&4092^3920)</code></pre>
|
||
<h3 id="precision-issues">Precision issues:</h3>
|
||
<p>The entry, on purpose (see the section about SIMD below), does not use enough
|
||
bits of precision, so sometimes the ray will miss the intersection of two voxel
|
||
faces and push on through. That’s why you may notice some noise along close up
|
||
voxel edges. Fixing this issue would have taken the entry over the size limit
|
||
regrettably.</p>
|
||
<h3 id="obfuscations">Obfuscations:</h3>
|
||
<p>Well, of course you have all the usual suspects, used for extreme compression,
|
||
and such a nice layout: not very informative identifiers, which are being reused
|
||
all over the place, some rather gruesome looking expressions, a whole load of
|
||
magic constants with apparently no rhyme or reason (including a Lagrange
|
||
polynomial), and a message from our friendly Cetaceans. However it also includes
|
||
some clever and not so obvious though instructive techniques, to subtly make the
|
||
code more magical and efficient, at the same time.</p>
|
||
<p>Those techniques are about the use of 64 bit integers in order to do SIMD work,
|
||
in a portable way without ever using any SSE/AVX or other non-portable compiler
|
||
inline functions! The irony though, is that when compiling the program on modern
|
||
X86 architectures indeed SSE/AVX is used for the long longs. Following is some
|
||
obfuscation information, So if you want to play tough, stop reading at this point.</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="portable-simd-programming">Portable SIMD programming:</h3>
|
||
<p>So how is this done? Quite simply by using the whole <code>long long</code> arithmetic’s
|
||
capability. I think the C99 standard assures us that <code>long long</code> has at least 64
|
||
bits. Most of those bits are unused in normal programs, however here we use them
|
||
more wisely. For example, in the inner loop of the program you have the innocent
|
||
looking expression <code>i+=d</code>. What it does in fact, is a SIMD addition of two
|
||
vectors, each with three signed fixed point coordinates, advancing our ray in 3D
|
||
space!</p>
|
||
<p>To spell it out, the macro producing such vectors is <code>P</code>, and the assignment
|
||
<code>q=0x820008202625a0</code> sets our creeper original position to about <code>(32.5, 32.5019, 2441.406)</code>.</p>
|
||
<p>Evidently when doing such arithmetics, care must me taken to avoid overflow from
|
||
one component to the other, but since our voxel world is a torus of size 64 in
|
||
each dimension this hardly matters. A subtle issue, is how to deal with signed
|
||
quantities. In the <code>i+=d</code> expression above <code>i</code> has 3 positive components, but
|
||
<code>d</code> has arbitrary signed components, as our ray may face in any direction. It
|
||
seems things should not work, specially as we defined both <code>i</code> and <code>d</code> as
|
||
<code>unsigned</code>! However notice that the <code>T</code> (and <code>P</code>) macros convert <code>float</code> to
|
||
<code>signed long long</code>s.</p>
|
||
<p>Once sign is extended from a least component into higher bits, it seems at first
|
||
to be recipe for disaster, however everything works beautifully, and you get
|
||
precise component results when the final accumulation components in <code>i</code> are
|
||
positive. This only gets broken a bit when the final accumulation has a least
|
||
significant negative component. To see this bug in action change the assignment
|
||
above to <code>q=0x82000820000000</code>, and look towards the negative direction of the main
|
||
tunnel.</p>
|
||
<p>Similar technique is used on the RGB components so their brightness can be
|
||
adjusted simultaneously by the expression: <code>o=o*b>>8</code>. Of course some spare bits
|
||
are needed between the components, so they are spread in the <code>long long</code> and
|
||
reordered as RBG.</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: 2015/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-2015dogon">Inventory for 2015/dogon</h1>
|
||
</div>
|
||
<h2 id="primary-files">Primary files</h2>
|
||
<ul>
|
||
<li><a href="https://github.com/ioccc-src/winner/blob/master/2015/dogon/prog.c">prog.c</a> - entry source code</li>
|
||
<li><a href="https://github.com/ioccc-src/winner/blob/master/2015/dogon/Makefile">Makefile</a> - entry Makefile</li>
|
||
<li><a href="https://github.com/ioccc-src/winner/blob/master/2015/dogon/prog.alt.c">prog.alt.c</a> - alternate source code</li>
|
||
<li><a href="https://github.com/ioccc-src/winner/blob/master/2015/dogon/prog.orig.c">prog.orig.c</a> - original source code</li>
|
||
</ul>
|
||
<h2 id="secondary-files">Secondary files</h2>
|
||
<ul>
|
||
<li><a href="2015_dogon.tar.bz2">2015_dogon.tar.bz2</a> - download entry tarball</li>
|
||
<li><a href="https://github.com/ioccc-src/winner/blob/master/2015/dogon/README.md">README.md</a> - markdown source for this web page</li>
|
||
<li><a href="https://github.com/ioccc-src/winner/blob/master/2015/dogon/.entry.json">.entry.json</a> - entry summary and manifest in JSON</li>
|
||
<li><a href="https://github.com/ioccc-src/winner/blob/master/2015/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/2015/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 © 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%2F2015%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 -->
|