Files
ioccc/2000/rince/index.html
T
Landon Curt Noll f29b37e49a improve HTML menus, add social.html, prep for IOCCC28 winners
Prepare for the winners of **IOCCC28**.

> However these are not the 2024 droids you are looking for.  :-)

The HTML menu (both JavaScript and non-JavaScript) has been updated.

The `Status -> Rules and guidelines' have been replaced with two
separate menus `Status -> IOCCC rules` and `Status -> IOCCC guidelines`.

Added a new top level `social.html` page: built from a new `social.md`.

Sorted rules for building specific web pages in the top level `Makefile`.
Added `make social` to make the `social.html` page from `social.md`.

The `bin/gen-top-html.sh` now is able to process a argument of **social**
to process the new top level `social.html` page.

Changed `bin/gen-top-html.sh` VERSION from "2.0.0 2025-03-13"
to "2.0.1 2025-07-25".

Below `About -> Home page` a new `About -> IOCCC social media` menu item
as added.

Because the menu change touched every HTML file, we changed the general
copyright date range for HTML files from "1984-2024" to "1984-2025"
due to the extensive changes made for **IOCCC28**.

Those markdown files that were modified in 2025 had their copyright date
range also changed from "1984-2024" to "1984-2025".

Rebuilt tarballs and sitemap due to the extensive HTML rebuilding.

Ran `make update` to perform the above.
2025-07-26 13:06:29 -07:00

857 lines
35 KiB
HTML
Raw Blame History

This file contains ambiguous Unicode characters
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>2000/rince - Astronomically obfuscated</title>
<link rel="icon" type="image/x-icon" href="../../favicon.ico">
<meta name="description" content="2000 IOCCC entry rince - Astronomically obfuscated">
<meta name="keywords" content="IOCCC, 2000, IOCCC 2000, IOCCC entry, rince, Astronomically obfuscated">
</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: 2000/rince/README.md -->
<!-- -->
<!-- !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<!-- !!! Do not modify this web page, instead modify the file: 2000/rince/README.md !!! -->
<!-- !!! Do not modify this web page, instead modify the file: 2000/rince/README.md !!! -->
<!-- !!! Do not modify this web page, instead modify the file: 2000/rince/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>2000/rince - Astronomically obfuscated</h2>
<h3>Plots the positions of the four Galilean moons of Jupiter</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="../primenum/index.html">&larr; 2000/primenum</a>
<a class="Left" href="../index.html">&uarr; 2000 &uarr;</a>
<a class="Left" href="../robison/index.html">2000/robison &rarr;</a>
<a class="Right" href="https://github.com/ioccc-src/winner/blob/master/2000/rince/rince.c">C code</a>
<a class="Right" href="https://github.com/ioccc-src/winner/blob/master/2000/rince/Makefile">Makefile</a>
<a class="Right" href="#inventory">Inventory</a>
<a class="Right" href="https://validator.w3.org/nu/?doc=https%3A%2F%2Fwww.ioccc.org%2F2000%2Frince%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#James_Bonfield">James Bonfield</a><br>
Location: <a href="../../location.html#GB">GB</a> - <em>United Kingdom of Great Britain and Northern Ireland</em> (<em>United Kingdom</em>)</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: 2000/rince/README.md -->
<h2 id="to-build">To build:</h2>
<pre><code> make all</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: INABIAF - please DO NOT fix</strong></p>
</blockquote>
<p>For more detailed information see <a href="../../bugs.html#2000_rince">2000/rince in bugs.html</a>.</p>
<h2 id="to-use">To use:</h2>
<pre><code> ./rince number number2</code></pre>
<p>If <code>DISPLAY</code> is not set the program will very likely crash or do something
different.</p>
<h2 id="try">Try:</h2>
<pre><code> ./try.sh</code></pre>
<p>This will run the program several times with different parameters to show
different types of things. See the author’s remarks for more details.</p>
<h2 id="judges-remarks">Judges’ remarks:</h2>
<p>This program may have you going around in circles :-) Try running it first
before reading the author’s remarks below.</p>
<p>The judges verified the correctness of output for recent dates through visual
observation.</p>
<h2 id="authors-remarks">Author’s remarks:</h2>
<h3 id="how-to-use-it">How to use it</h3>
<p>The simplest way to run it is with no arguments. Just type:</p>
<pre><code> ./rince</code></pre>
<p>You will need to have access to X windows, although it doesn’t require
desperately high resolution and there are no known limitations on colour
depth.</p>
<p>The display will change slowly over time, although it may take 10 minutes
or more to be visible. For those that cannot wait that long the program
has a built in time machine. Indeed the program knows the speed of light,
which is used to ensure that we see the “live” pictures. Simply specify
the fraction of a day to skip forward for each screen refresh. I suggest:</p>
<pre><code> ./rince 0.01</code></pre>
<p>To display the output (still guessing?) for a given date, specify two
arguments. The first argument is as before and the second argument is a
Julian day number (given as a fractional component). E.g.:</p>
<pre><code> ./rince 0 2441193.6
./rince 0.01 2441193.6</code></pre>
<p>A Julian day is defined to be the number of days since January 1st in the year
<code>-4712 (4713BC)</code>, starting at 12 noon GMT.<a href="#fn1" class="footnote-ref" id="fnref1" role="doc-noteref"><sup>1</sup></a><a href="#fn2" class="footnote-ref" id="fnref2" role="doc-noteref"><sup>2</sup></a> To aid conversion from our time
(GMT) to Julian day there is a supplementary program named:
<a href="https://github.com/ioccc-src/winner/blob/master/2000/rince/dmy2jd.c">dmy2jd.c</a>. Run it with <code>day_float month year</code> as arguments. See below
for an example.</p>
<h3 id="what-it-does">What it does</h3>
<p>This program plots the positions of the four <a href="https://en.wikipedia.org/wiki/Galilean_moons">Galilean
moons</a> of
<a href="https://science.nasa.gov/jupiter/">Jupiter</a>, as seen from
<a href="https://science.nasa.gov/earth/">Earth</a>. It doesn’t correct for your
location on Earth, but I assure you that the
<a href="https://en.wikipedia.org/wiki/Parallax#Astronomy">parallax</a> is minimal!</p>
<p>The moons are labelled with Roman numerals from <code>I</code> to <code>IV</code>, <code>I</code> being the
closest to the planet and <code>IV</code> being the furthest. They are:</p>
<ul>
<li><code>I</code>
<ul>
<li><a href="https://science.nasa.gov/jupiter/moons/io">Io</a></li>
</ul></li>
<li><code>II</code>
<ul>
<li><a href="https://science.nasa.gov/jupiter/moons/europa/">Europa</a></li>
</ul></li>
<li><code>III</code>
<ul>
<li><a href="https://science.nasa.gov/jupiter/moons/ganymede/">Ganymede</a></li>
</ul></li>
<li><code>IV</code>
<ul>
<li><a href="https://science.nasa.gov/jupiter/moons/callisto">Callisto</a></li>
</ul></li>
</ul>
<p>Amazingly, all it takes is a pair of binoculars to see the Galilean moons,
so the results can be experimentally checked. (Note that at present, the
best views of Jupiter are over the autumn/winter.)</p>
<p>The positions of the moons should be correct for binoculars, but possibly
not if you have a telescope or if you are in the southern hemisphere. In
that case I suggest that to get the correct image you look at the screen
from inside the monitor whilst standing on your head. In case of
confusion, please consult the following chart (*):</p>
<pre><code> N
^
|
E &lt;---+---&gt; W
|
v
S</code></pre>
<p>(*) Not to scale.</p>
<h3 id="history">History</h3>
<p>Galileo discovered the moons in January 1610.
<a href="https://web.archive.org/web/20001204212000/http://www-isds.jpl.nasa.gov/cwo/cwo_54ga/html/cd/galileo.htm" class="uri">https://web.archive.org/web/20001204212000/http://www-isds.jpl.nasa.gov/cwo/cwo_54ga/html/cd/galileo.htm</a>
states the following:</p>
<blockquote>
<p>By early 1610, Galileo had further improved his telescope by double its power,
so it now enlarged objects a thousand times. He began looking at the stars and
couldn’t believe how many more he could now see! The number seemed infinite. He
was beginning to realize the fixed stars weren’t a flat distant wall on a globe,
but a three-dimensional expanse bigger than anyone had ever thought!</p>
<p>Then, on January 7, about an hour after sunset, Jupiter rose in the east,
and Galileo happened to turn his powerful scope on its bright disk. It wasn’t
the first time he had looked at Jupiter, but before it was with one of his
lesser-powered telescopes. This time, though, he noticed three small but bright
stars near the planet, two to one side and one to the other. He wondered at how
bright the small stars were and how they were arranged in what seemed like a
straight line. The next night he decided to look at Jupiter again, and to his
surprise, the stars had moved. But not in such a way as he would expect. If
Jupiter was moving as it normally should, the stars would be east of Jupiter.
But all three were to the west! The next night was cloudy, but on January 10,
Galileo was able to observe the planet again. One of the stars was gone, and the
other two were now on the east side. As the stars moved around Jupiter on each
succeeding night, and were finally joined by a fourth star, it dawned on Galileo
that what he had found were moons orbiting Jupiter! Almost at once he realized
that this was proof that not all objects orbited the Earth. Here were four
bodies that were orbiting Jupiter. One argument against the sun-centered theory
was, if the Earth orbited the sun, wouldn’t the moon get left behind? Here he
could see for himself that somehow, a planet could orbit the sun, and not leave
a moon behind!</p>
</blockquote>
<p>Thus we can plot Galileo’s discoveries using the following three plots:</p>
<pre><code> ./rince 0 $(./dmy2jd 7.8 1 1610)
./rince 0 $(./dmy2jd 8.8 1 1610)
./rince 0 $(./dmy2jd 10.8 1 1610)</code></pre>
<p>However we can go one better by seeing what Galileo would have seen if it
wasn’t cloudy on the 9th. Try:</p>
<pre><code> ./rince 0 $(./dmy2jd 9.85 1 1610)</code></pre>
<p>to see what he was missing out on. I wonder what he’d have made of that!</p>
<p>Galileo discovered the fourth moon a few days later.</p>
<p>I’ve tried typing these dates into two Java based Jovian moon plotters,
but both I tried had problems dealing with dates earlier than 1900. More
professional software, such as the
<a href="http://www.bmsoftware.com/skymappro9.htm">SkyMap</a> gets these values
correct and this compares well with the above description and with this
IOCCC entry.</p>
<p>The year 4713BC was chosen by <a href="https://en.wikipedia.org/wiki/Joseph_Justus_Scaliger">Joseph Justus
Scaliger</a> in the 16th
Century, so clearly this program has a long history :-) A more complete
description of the origins of Julian Days can be found at
<a href="https://web.archive.org/web/20001206152200/http://aa.usno.navy.mil/AA/faq/docs/millennium.html" class="uri">https://web.archive.org/web/20001206152200/http://aa.usno.navy.mil/AA/faq/docs/millennium.html</a>.</p>
<h3 id="assumptions">Assumptions</h3>
<p>This program assumes:</p>
<ol type="1">
<li><p>The ASCII character set is used.</p></li>
<li><p>That an enormous comet hasn’t changed the course of
<a href="https://science.nasa.gov/jupiter/">Jupiter</a> (or
<a href="https://science.nasa.gov/earth/">Earth</a>!).</p></li>
<li><p>That the date has not been specified as the gap between the
<a href="https://en.wikipedia.org/wiki/Julian_calendar">Julian</a> and
<a href="https://en.wikipedia.org/wiki/Gregorian_calendar">Gregorian</a> calendar.</p></li>
<li><p>That the <code>DISPLAY</code> environment variable is set and the X display can opened.
If this is not the case the program will crash.</p></li>
<li><p>There is a year 2000BC problem :-)</p>
<p>More specifically, the plots for dates that far back are too inaccurate to
be of realistic use. Comparisons against <a href="http://www.bmsoftware.com/skymappro9.htm">SkyMap
Pro</a> show that there is a good
similarity (but not much more) up to about 500BC.</p></li>
<li><p>The code definitely is not portable - it will produce incorrect results if
run from the surface of <a href="https://science.nasa.gov/mars/">Mars</a>.</p></li>
</ol>
<h3 id="obfuscations">Obfuscations</h3>
<p>In addition to the normal obfuscations, I feel that the code contains some less
common tricks. Taken through the standard rounds listed in the
<a href="../guidelines.txt">guidelines</a>, the code attempts to pass these as follows:</p>
<ol type="1">
<li><p>Look at the original source</p>
<p>With luck, pure casual inspection should not reveal much except
that the program contains the X Windows logo (a big clue) and
contains a date. This date may give a clue to a few people that
this is an astronomical program.</p>
<p>Unfortunately I was stretched for space which meant that the
large string constant could not be split up using a “partA”
“partB” method which clearly limits the code layout. However the
space saved by using a single long string constant is more than
outweighed by the ability to further obfuscate.</p></li>
<li><p>convert ANSI trigraphs to ASCII</p>
<p>These are not used.</p></li>
<li><p>C pre-process the source ignoring <code>#include</code> lines</p></li>
<li><p>C pre-process the source ignoring <code>#define</code> and <code>#include</code> lines</p>
<p>This does a good job of expanding out the code, but it does not
clarify things greatly. The use of <code>#define</code>s has been restricted
primarily to a space-saving mechanism.</p>
<p>Additionally, the use of <code>typedef</code>s means that the types used are
still obscured unless further replacement edits are made.</p></li>
<li><p>Run it through a C beautifier.</p>
<p>GNU <code>indent(1)</code> seems to do a reasonable job, provided that the
<code>#define</code>s are expanded first. This doesn’t lay the algorithm
particularly bare though as most of the obfuscations are not
simple code layouts.</p></li>
<li><p>Examine the algorithm.</p>
<p>The algorithm operates on two levels. The main visible level is
by taking a large string and breaking this down into a series of
opcodes (which I have termed J-code). These are then executed.</p>
<p>To get to the real method of how it works, you need to decode the opcode
string (which deliberately contains as many <code>;</code>, <code>{</code> and <code>}</code> symbols as
possible), which will give you a <a href="https://en.wikipedia.org/wiki/Reverse_Polish_notation">Reverse Polish
notation</a> chunk of
mathematics.</p>
<p>Sensible people amongst you will simply refer to the referenced book :-)</p></li>
<li><p>Lint it.</p>
<p>I no longer have lint, although I do have access to Purify. I’m
happy to say that purify does not detect any memory errors or
memory leaks.</p>
<p>See below for compilation warnings.</p></li>
<li><p>Compile it.</p>
<p>I’m sorry to say that there are several warnings issued by the
compiler.</p>
<p>Firstly, the return type for <code>X()</code> is not specified, so it defaults to <code>int</code>.
Horror of all horrors - this function does not return an integer type (it
doesn’t contain any specific <code>return</code>s). The return value from <code>X()</code> is not
accessed. The same problem occurs in <code>main()</code> - it does not return. However
<code>main()</code> never exits unless there is a serious error.</p>
<p>The 6th argument of <code>XDrawText</code> (which should be <code>XTextItem</code>) is
passed as a compatible structure, but without casting. This is
to reduce code space. A more elegant solution is to remove the
<code>struct {...} Z</code> completely and use <code>XTextItem f={i-127+r/3*2,r%3+r/3+1,0,E}</code> at the start of <code>XDrawText</code>
block. Although this is accepted by several compilers, it is not
strict ANSI due to the non-constant initialisers. A pity.</p>
<p>Note that I make use of <code>usleep()</code>. This is a POSIX call (it is BSD), but it’s
supported on many systems. It may be implemented using <code>select()</code> or <code>poll()</code> if
required, or as a final solution you can change the <code>usleep(10000)</code> to
<code>sleep(1)</code>. To compile on systems which do not have <code>usleep()</code>, but do have
<code>select()</code>, the following may suffice as an additional compiler argument:</p>
<pre><code> -Dusleep={time_t v[2]={0,10000};select(0,0,0,0,v);}</code></pre>
<p><code>gcc</code> complains about “unreachable code at beginning of switch
statement”, although removing some of this code will prevent
the algorithm from working.</p>
<p><code>gcc</code> also suggests that I should be using extra parenthesis, but
I’m taking this as good comment :-)</p></li>
</ol>
<p>In addition to the above, the program has the following useful(?)
obfuscations:</p>
<ol type="1">
<li><p>The algorithm requires many floating point numbers (about 50). These are
encoded as ASCII.</p></li>
<li><p>The J-code algorithm has opcodes designed to be space saving. They are all
one byte, but many are also considered as whitespace by the rules. This
algorithm forms part of the same string that the floating point constants are
embedded within. What does the <code>;</code> command do in J-code?</p></li>
<li><p>The J-code language is both stack based and variable based. This
“uncleanliness” is not ideal from a computer science angle, but when has
cleanliness been considered as good in IOCCC? :-)</p></li>
<li><p>Association of unconnected data by implied function usage. E.g. use of
<code>strlen()</code> and <code>sizeof()</code> simply to return useful numerical values, using
irrelevant arguments.</p></li>
<li><p>As we already have a dependency on ASCII this has been abused further.
Specifically some integer constants are specified as ASCII and some ASCII
constants are integers. This hides the true meaning for the values.</p></li>
<li><p>Red herrings: there are a couple of pieces of code whose appearance is just
there to mislead the infirm of mind. I’ve only tried to include such examples
in places where at first glance the code appears to be executed.</p></li>
</ol>
<h3 id="references">References</h3>
<!--
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: 2000/rince/README.md -->
<hr style="width:10%;text-align:left;margin-left:0">
<section id="footnotes" class="footnotes footnotes-end-of-document" role="doc-endnotes">
<h5>Footnotes</h5>
<ol>
<li id="fn1"><p>Astronomical algorithms (1st ed): page 59
Jean Meeus. Published by Willmann-Bell Inc.<a href="#fnref1" class="footnote-back" role="doc-backlink">↩︎</a></p></li>
<li id="fn2"><p>Astronomical algorithms (1st ed): pages 285-299.
Jean Meeus. Published by Willmann-Bell Inc.<a href="#fnref2" class="footnote-back" role="doc-backlink">↩︎</a></p></li>
</ol>
</section>
<!-- 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-2000rince">Inventory for 2000/rince</h1>
</div>
<h2 id="primary-files">Primary files</h2>
<ul>
<li><a href="https://github.com/ioccc-src/winner/blob/master/2000/rince/rince.c">rince.c</a> - entry source code</li>
<li><a href="https://github.com/ioccc-src/winner/blob/master/2000/rince/Makefile">Makefile</a> - entry Makefile</li>
<li><a href="https://github.com/ioccc-src/winner/blob/master/2000/rince/rince.orig.c">rince.orig.c</a> - original source code</li>
<li><a href="https://github.com/ioccc-src/winner/blob/master/2000/rince/try.sh">try.sh</a> - script to try entry</li>
<li><a href="https://github.com/ioccc-src/winner/blob/master/2000/rince/dmy2jd.c">dmy2jd.c</a> - supplementary program source</li>
</ul>
<h2 id="secondary-files">Secondary files</h2>
<ul>
<li><a href="2000_rince.tar.bz2">2000_rince.tar.bz2</a> - download entry tarball</li>
<li><a href="https://github.com/ioccc-src/winner/blob/master/2000/rince/README.md">README.md</a> - markdown source for this web page</li>
<li><a href="https://github.com/ioccc-src/winner/blob/master/2000/rince/.entry.json">.entry.json</a> - entry summary and manifest in JSON</li>
<li><a href="https://github.com/ioccc-src/winner/blob/master/2000/rince/.gitignore">.gitignore</a> - list of files that should not be committed under git</li>
<li><a href="https://github.com/ioccc-src/winner/blob/master/2000/rince/.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%2F2000%2Frince%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 -->