force use of pandoc version >= 3.1.12.2
The `bin/pandoc-wrapper.sh` tool will verify that the ssytem has a recent enough version of `pandoc(1)`. We explain why we insist on `pandoc(1)`. version >= 3.1.12.2 in comments where the $PANDOC_MIN_VERSION is set. Added `--wrap=preserve` as a default argument to `pandoc(1)`. While this change will impact every HTML file generated, we believe this will improve the ability of someone to look at the generated HTML and correlate with the original markdown. Changed `bin/pandoc-wrapper.sh` VERSION from "1.4.2 2024-03-17" to "1.4.3 2024-03-18". Performed `make www` to achieve all of the above and to generate HTML using the new `--wrap=preserve` `pandoc(1)` mode.
This commit is contained in:
1 parent
9eb7a54e9f
commit
b0b212acb1
402 files changed
+37061
-55132
No files matched your search
+122
-165
@@ -129,12 +129,12 @@
|
||||
|
||||
<h2 id="authors"><a name="author"></a>Authors:</h2>
|
||||
<ul>
|
||||
<li>Name: <a href="../../authors.html#Alexander_Prishchepov">Alexander
|
||||
Prishchepov</a><br> Location: <a href="../../location.html#US">US</a> -
|
||||
<em>United States of America</em> (<em>United States</em>) <br><br></li>
|
||||
<li>Name: <a href="../../authors.html#Michael_Birken">Michael
|
||||
Birken</a><br> Location: <a href="../../location.html#US">US</a> -
|
||||
<em>United States of America</em> (<em>United States</em>) <br><br></li>
|
||||
<li>Name: <a href="../../authors.html#Alexander_Prishchepov">Alexander Prishchepov</a><br>
|
||||
Location: <a href="../../location.html#US">US</a> - <em>United States of America</em> (<em>United States</em>)
|
||||
<br><br></li>
|
||||
<li>Name: <a href="../../authors.html#Michael_Birken">Michael Birken</a><br>
|
||||
Location: <a href="../../location.html#US">US</a> - <em>United States of America</em> (<em>United States</em>)
|
||||
<br><br></li>
|
||||
</ul>
|
||||
|
||||
<!-- END: next line ends content generated by: bin/output-index-author.sh -->
|
||||
@@ -144,10 +144,9 @@ Birken</a><br> Location: <a href="../../location.html#US">US</a> -
|
||||
|
||||
<h2 id="to-build">To build:</h2>
|
||||
<div class="sourceCode" id="cb1"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb1-1"><a href="#cb1-1" aria-hidden="true" tabindex="-1"></a><span class="fu">make</span></span></code></pre></div>
|
||||
<p>There is alternate code that lets you redefine the port to bind to,
|
||||
in case there is a firewall issue, and also lets you redefine the timing
|
||||
constant, <code>STARDATE</code>. See <a
|
||||
href="#alternate%20code">Alternate code</a> below.</p>
|
||||
<p>There is alternate code that lets you redefine the port to bind to, in case
|
||||
there is a firewall issue, and also lets you redefine the timing constant,
|
||||
<code>STARDATE</code>. See <a href="#alternate%20code">Alternate code</a> below.</p>
|
||||
<h2 id="to-use">To use:</h2>
|
||||
<div class="sourceCode" id="cb2"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb2-1"><a href="#cb2-1" aria-hidden="true" tabindex="-1"></a><span class="ex">./prog</span> <span class="op"><</span> some_secret_or_something</span>
|
||||
<span id="cb2-2"><a href="#cb2-2" aria-hidden="true" tabindex="-1"></a></span>
|
||||
@@ -160,14 +159,12 @@ href="#alternate%20code">Alternate code</a> below.</p>
|
||||
<div class="sourceCode" id="cb5"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb5-1"><a href="#cb5-1" aria-hidden="true" tabindex="-1"></a><span class="ex">./prog</span> http://127.0.0.1:1701</span></code></pre></div>
|
||||
<p>What happens if you specify instead of a regular file something like
|
||||
<code>/dev/null</code> ?</p>
|
||||
<p>But there’s more! Try opening in a browser the same address and then
|
||||
see what happens. This is explained by the authors when explaining their
|
||||
inspiration.</p>
|
||||
<p>But there’s more! Try opening in a browser the same address and then see what
|
||||
happens. This is explained by the authors when explaining their inspiration.</p>
|
||||
<h2 id="alternate-code">Alternate code:</h2>
|
||||
<p>This version allows you to redefine the port to bind to, should 1701
|
||||
be a problem for some reason, and it also allows you to change the
|
||||
timing as described by the author. See <a
|
||||
href="#configuration">configuration</a> below.</p>
|
||||
<p>This version allows you to redefine the port to bind to, should 1701 be a
|
||||
problem for some reason, and it also allows you to change the timing as
|
||||
described by the author. See <a href="#configuration">configuration</a> below.</p>
|
||||
<h3 id="alternate-build">Alternate build:</h3>
|
||||
<p>To specify the port to say, 31337, try:</p>
|
||||
<div class="sourceCode" id="cb6"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb6-1"><a href="#cb6-1" aria-hidden="true" tabindex="-1"></a><span class="fu">make</span> clobber PORT=31337 alt</span></code></pre></div>
|
||||
@@ -175,131 +172,112 @@ href="#configuration">configuration</a> below.</p>
|
||||
<div class="sourceCode" id="cb7"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb7-1"><a href="#cb7-1" aria-hidden="true" tabindex="-1"></a><span class="fu">make</span> clobber TIME=5000000 alt</span></code></pre></div>
|
||||
<p>You can combine them both of course.</p>
|
||||
<h3 id="alternate-use">Alternate use:</h3>
|
||||
<p>Use <code>prog.alt</code> as you would <code>prog</code> above.
|
||||
Remember that ports < 1024 are privileged ports that unprivileged
|
||||
users cannot use.</p>
|
||||
<p>Use <code>prog.alt</code> as you would <code>prog</code> above. Remember that ports < 1024 are
|
||||
privileged ports that unprivileged users cannot use.</p>
|
||||
<h2 id="judges-remarks">Judges’ remarks:</h2>
|
||||
<p>Port 1701? Well this is not the l2f registered TCP/1701 protocol.
|
||||
Sniff the traffic to/from that port. You will see HTTP client and server
|
||||
traffic. The HTML content you may see is static and immutable. Nothing
|
||||
funny with the HTTP status codes. Even the timestamp cookie, once set,
|
||||
remains static throughout the session. The data appears to not be
|
||||
transmitted within the binary content communicated between client and
|
||||
server.</p>
|
||||
Sniff the traffic to/from that port. You will see HTTP client
|
||||
and server traffic. The HTML content you may see is static and
|
||||
immutable. Nothing funny with the HTTP status codes. Even the
|
||||
timestamp cookie, once set, remains static throughout the
|
||||
session. The data appears to not be transmitted within the
|
||||
binary content communicated between client and server.</p>
|
||||
<p>So how does this program do it? A trek though the cloak of
|
||||
obfuscation awaits the reader of the source!</p>
|
||||
<h2 id="authors-remarks">Authors’ remarks:</h2>
|
||||
<h3 id="abstract">Abstract</h3>
|
||||
<p>When launched in web server mode, this application appears to deliver
|
||||
nothing more than a static HTML page. But, in actuality, it allows
|
||||
covert file transfer over the Internet. This is demonstrated by starting
|
||||
the application as a client-side downloader. The hidden transmitted data
|
||||
cannot be reconstructed or even detected from the binary content of the
|
||||
traffic between the client and the server.</p>
|
||||
<p>When launched in web server mode, this application appears to deliver nothing
|
||||
more than a static HTML page. But, in actuality, it allows covert file
|
||||
transfer over the Internet. This is demonstrated by starting the application as
|
||||
a client-side downloader. The hidden transmitted data cannot be reconstructed
|
||||
or even detected from the binary content of the traffic between the client and
|
||||
the server.</p>
|
||||
<h2 id="to-use-web-server">To use web server</h2>
|
||||
<div class="sourceCode" id="cb8"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb8-1"><a href="#cb8-1" aria-hidden="true" tabindex="-1"></a><span class="ex">./prog</span> <span class="op"><</span> secret_file_to_be_downloaded</span></code></pre></div>
|
||||
<p>Try using the program’s source code as the secret file:</p>
|
||||
<div class="sourceCode" id="cb9"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb9-1"><a href="#cb9-1" aria-hidden="true" tabindex="-1"></a><span class="ex">./prog</span> <span class="op"><</span> prog.c</span></code></pre></div>
|
||||
<h2 id="to-use-client-side-downloader">To use client-side
|
||||
downloader</h2>
|
||||
<div class="sourceCode" id="cb10"><pre
|
||||
class="sourceCode sh"><code class="sourceCode bash"><span id="cb10-1"><a href="#cb10-1" aria-hidden="true" tabindex="-1"></a><span class="ex">./prog</span> http://host<span class="pp">[</span><span class="ss">:port</span><span class="pp">]</span></span></code></pre></div>
|
||||
<p>The optional port defaults to 1701. If the web server instance is
|
||||
started on the same box, try:</p>
|
||||
<div class="sourceCode" id="cb11"><pre
|
||||
class="sourceCode sh"><code class="sourceCode bash"><span id="cb11-1"><a href="#cb11-1" aria-hidden="true" tabindex="-1"></a><span class="ex">./prog</span> http://127.0.0.1:1701</span></code></pre></div>
|
||||
<p>It will incrementally display the contents of the hidden file at a
|
||||
rate of approximately 1 baud.</p>
|
||||
<p>The client-side downloader will automatically terminate if the web
|
||||
server is bounced.</p>
|
||||
<h2 id="to-use-client-side-downloader">To use client-side downloader</h2>
|
||||
<div class="sourceCode" id="cb10"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb10-1"><a href="#cb10-1" aria-hidden="true" tabindex="-1"></a><span class="ex">./prog</span> http://host<span class="pp">[</span><span class="ss">:port</span><span class="pp">]</span></span></code></pre></div>
|
||||
<p>The optional port defaults to 1701. If the web server instance is started on
|
||||
the same box, try:</p>
|
||||
<div class="sourceCode" id="cb11"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb11-1"><a href="#cb11-1" aria-hidden="true" tabindex="-1"></a><span class="ex">./prog</span> http://127.0.0.1:1701</span></code></pre></div>
|
||||
<p>It will incrementally display the contents of the hidden file at a rate of
|
||||
approximately 1 baud.</p>
|
||||
<p>The client-side downloader will automatically terminate if the web server is
|
||||
bounced.</p>
|
||||
<h3 id="html-content">HTML content</h3>
|
||||
<p>Plug the URL into a browser to view a static HTML page containing
|
||||
ASCII artwork.</p>
|
||||
<p>Plug the URL into a browser to view a static HTML page containing ASCII artwork.</p>
|
||||
<h3 id="exploration">Exploration</h3>
|
||||
<p>Studying the network traffic will reveal that the HTML content is
|
||||
static and immutable, the HTTP request and response fields do not
|
||||
contain anything remarkable, HTTP status and error codes are not
|
||||
exploited, no unusual or deprecated features of HTTP are used, and while
|
||||
the cookie is based on a timestamp, its value also remains unchanged
|
||||
throughout the session. As mentioned in the abstract, the data is not
|
||||
transmitted within the binary content communicated between the client
|
||||
and the server. A full explanation of the protocol appears below, but
|
||||
feel free to explore before reading further.</p>
|
||||
<p>Studying the network traffic will reveal that the HTML content is static and
|
||||
immutable, the HTTP request and response fields do not contain anything
|
||||
remarkable, HTTP status and error codes are not exploited, no unusual or
|
||||
deprecated features of HTTP are used, and while the cookie is based on a
|
||||
timestamp, its value also remains unchanged throughout the session. As
|
||||
mentioned in the abstract, the data is not transmitted within the binary content
|
||||
communicated between the client and the server. A full explanation of the
|
||||
protocol appears below, but feel free to explore before reading further.</p>
|
||||
<h3 id="inspiration">Inspiration</h3>
|
||||
<p>The inspiration for this program comes from <a
|
||||
href="https://memory-alpha.fandom.com/wiki/Star_Trek_VI:_The_Undiscovered_Country">Star
|
||||
Trek VI: The Undiscovered Country</a>, specifically the final
|
||||
confrontation between the <a
|
||||
href="https://memory-alpha.fandom.com/wiki/USS_Enterprise_(NCC-1701)">Enterprise</a>
|
||||
and the enhanced prototype <a
|
||||
href="https://memory-alpha.fandom.com/wiki/Klingon_Bird-of-Prey">Klingon
|
||||
Bird of Prey</a>. The definitive feature of the prototype was its
|
||||
ability to fire while cloaked. But, perhaps even more impressive was its
|
||||
ability to keep an open communication channel with the Enterprise
|
||||
throughout the battle, enabling the antagonist <a
|
||||
href="https://memory-alpha.fandom.com/wiki/Chang_(General)">Chang</a> to
|
||||
taunt <a
|
||||
href="https://memory-alpha.fandom.com/wiki/James_T._Kirk">Captain
|
||||
Kirk</a> with <a
|
||||
href="https://en.wikipedia.org/wiki/William_Shakespeare">Shakespearian</a>
|
||||
quotes while he slowly pelted his ship with torpedoes. Normally, cloaked
|
||||
vessels must maintain silent running to avoid detection.</p>
|
||||
<p>The battle is commemorated in the form of ASCII artwork depicting the
|
||||
ships faced head-to-head in the page delivered by the web server. Plus,
|
||||
the program source code is formatted in the shape of a Klingon Bird of
|
||||
Prey. The code itself includes a number of Star Trek references: the
|
||||
registry number of the Enterprise (NCC-1701) is defined as a constant;
|
||||
variable names spell out Cpt. James T. Kirk and <a
|
||||
href="https://memory-alpha.fandom.com/wiki/Odo">Odo</a> (the <a
|
||||
href="https://memory-alpha.fandom.com/wiki/Star_Trek:_Deep_Space_Nine">Deep
|
||||
Space 9</a> character was played by René Auberjonois who also appeared
|
||||
as <a href="https://memory-alpha.fandom.com/wiki/West">Colonel West</a>
|
||||
in <a
|
||||
href="https://memory-alpha.fandom.com/wiki/Star_Trek_VI:_The_Undiscovered_Country">Star
|
||||
Trek VI</a>); the <code>STARDATE</code> constant makes timing
|
||||
configurable; and, the constant <code>k</code> stands for <a
|
||||
href="https://memory-alpha.fandom.com/wiki/Khan_Noonien_Singh">Khan</a>
|
||||
(in the final engagement in <a
|
||||
href="https://memory-alpha.fandom.com/wiki/Star_Trek_II:_The_Wrath_of_Khan">Star
|
||||
Trek II: The Wrath of Khan</a>, the damaged Enterprise managed to
|
||||
disable the USS <a
|
||||
href="https://memory-alpha.fandom.com/wiki/USS_Reliant_(NCC-1864)">Reliant</a>’s
|
||||
shield generator by accessing its prefix code: 16309).</p>
|
||||
<p>The inspiration for this program comes from <a href="https://memory-alpha.fandom.com/wiki/Star_Trek_VI:_The_Undiscovered_Country">Star Trek VI: The Undiscovered
|
||||
Country</a>,
|
||||
specifically the final confrontation between the
|
||||
<a href="https://memory-alpha.fandom.com/wiki/USS_Enterprise_(NCC-1701)">Enterprise</a> and
|
||||
the enhanced prototype <a href="https://memory-alpha.fandom.com/wiki/Klingon_Bird-of-Prey">Klingon Bird of
|
||||
Prey</a>. The definitive
|
||||
feature of the prototype was its ability to fire while cloaked. But, perhaps
|
||||
even more impressive was its ability to keep an open communication channel with
|
||||
the Enterprise throughout the battle, enabling the antagonist
|
||||
<a href="https://memory-alpha.fandom.com/wiki/Chang_(General)">Chang</a> to taunt <a href="https://memory-alpha.fandom.com/wiki/James_T._Kirk">Captain
|
||||
Kirk</a> with
|
||||
<a href="https://en.wikipedia.org/wiki/William_Shakespeare">Shakespearian</a> quotes while
|
||||
he slowly pelted his ship with torpedoes. Normally, cloaked vessels must
|
||||
maintain silent running to avoid detection.</p>
|
||||
<p>The battle is commemorated in the form of ASCII artwork depicting the ships
|
||||
faced head-to-head in the page delivered by the web server. Plus, the program
|
||||
source code is formatted in the shape of a Klingon Bird of Prey. The code
|
||||
itself includes a number of Star Trek references: the registry number of the
|
||||
Enterprise (NCC-1701) is defined as a constant; variable names spell out Cpt.
|
||||
James T. Kirk and <a href="https://memory-alpha.fandom.com/wiki/Odo">Odo</a> (the <a href="https://memory-alpha.fandom.com/wiki/Star_Trek:_Deep_Space_Nine">Deep
|
||||
Space 9</a>
|
||||
character was played by René Auberjonois who also appeared as <a href="https://memory-alpha.fandom.com/wiki/West">Colonel
|
||||
West</a> in <a href="https://memory-alpha.fandom.com/wiki/Star_Trek_VI:_The_Undiscovered_Country">Star Trek
|
||||
VI</a>);
|
||||
the <code>STARDATE</code> constant makes timing configurable; and, the constant <code>k</code> stands
|
||||
for <a href="https://memory-alpha.fandom.com/wiki/Khan_Noonien_Singh">Khan</a> (in the
|
||||
final engagement in <a href="https://memory-alpha.fandom.com/wiki/Star_Trek_II:_The_Wrath_of_Khan">Star Trek II: The Wrath of
|
||||
Khan</a>, the
|
||||
damaged Enterprise managed to disable the USS
|
||||
<a href="https://memory-alpha.fandom.com/wiki/USS_Reliant_(NCC-1864)">Reliant</a>’s shield
|
||||
generator by accessing its prefix code: 16309).</p>
|
||||
<h3 id="secondary-size-limit">Secondary size limit</h3>
|
||||
<p>As obligated by a program that employs 23rd century cloaking
|
||||
technology, when the source is fed as input to <a
|
||||
href="../iocccsize.c">IOCCC size tool version 2014-09-23-v19</a>, and
|
||||
the <code>-i</code> command line option is used, the value printed is
|
||||
0.</p>
|
||||
<h3 id="transmission-protocol-revealed">Transmission protocol
|
||||
revealed</h3>
|
||||
<p>The client-side downloader relies on the response time of the web
|
||||
server rather than the binary content of the response. The server
|
||||
transmits 1 nibble at a time by counting to the nibble value via a
|
||||
sequence of rapid responses terminated by a long response. For instance,
|
||||
the value 5 would be transmitted by making a series of requests that
|
||||
result in 5 near instantaneous responses followed by a half-second
|
||||
delayed response. The long delay is skipped in the case of 15, the
|
||||
maximal nibble value. With the aid of an ASCII table, it is actually
|
||||
possible to read the nibbles by repeatedly pressing the refresh button
|
||||
<p>As obligated by a program that employs 23rd century cloaking technology, when
|
||||
the source is fed as input to <a href="../iocccsize.c">IOCCC size tool version
|
||||
2014-09-23-v19</a>, and the <code>-i</code> command line option is used, the
|
||||
value printed is 0.</p>
|
||||
<h3 id="transmission-protocol-revealed">Transmission protocol revealed</h3>
|
||||
<p>The client-side downloader relies on the response time of the web server rather
|
||||
than the binary content of the response. The server transmits 1 nibble at a
|
||||
time by counting to the nibble value via a sequence of rapid responses
|
||||
terminated by a long response. For instance, the value 5 would be transmitted
|
||||
by making a series of requests that result in 5 near instantaneous responses
|
||||
followed by a half-second delayed response. The long delay is skipped in the
|
||||
case of 15, the maximal nibble value. With the aid of an ASCII table, it is
|
||||
actually possible to read the nibbles by repeatedly pressing the refresh button
|
||||
within a browser and observing the page refresh delay.</p>
|
||||
<p>Nibble Count Coding (file transfer protocol NCC-1701) is faster than
|
||||
transmitting each individual bit as a short or long delay because it
|
||||
sends each byte with 2 long delays whereas communicating individual bits
|
||||
requires 8 long delays in the worst case scenario. In fact, Nibble Count
|
||||
Coding is faster than applying Huffman Coding since that is designed to
|
||||
produce compact codes under the assumption that the bit value does not
|
||||
affect transmission time.</p>
|
||||
<p>The server relies on the cookie to identify each client uniquely,
|
||||
enabling it to transfer the sequence independently to each client.</p>
|
||||
transmitting each individual bit as a short or long delay because it sends each
|
||||
byte with 2 long delays whereas communicating individual bits requires 8 long
|
||||
delays in the worst case scenario. In fact, Nibble Count Coding is faster than
|
||||
applying Huffman Coding since that is designed to produce compact codes under
|
||||
the assumption that the bit value does not affect transmission time.</p>
|
||||
<p>The server relies on the cookie to identify each client uniquely, enabling it to
|
||||
transfer the sequence independently to each client.</p>
|
||||
<h3 id="configuration">Configuration</h3>
|
||||
<p>As with all network communication, accurate transmission of data
|
||||
relies on the nature of hardware revealed through statistics and
|
||||
timeouts set accordingly. The long delay is arbitrarily set to
|
||||
<code>0.5</code> seconds. This is microsecond tunable via the
|
||||
<code>STARDATE</code> constant defined at the top of the source code.
|
||||
Increase the value in the event of transmission errors. Decrease the
|
||||
value to download faster and less reliably.</p>
|
||||
<p>As with all network communication, accurate transmission of data relies on the
|
||||
nature of hardware revealed through statistics and timeouts set accordingly.
|
||||
The long delay is arbitrarily set to <code>0.5</code> seconds. This is microsecond tunable
|
||||
via the <code>STARDATE</code> constant defined at the top of the source code. Increase the
|
||||
value in the event of transmission errors. Decrease the value to download
|
||||
faster and less reliably.</p>
|
||||
<p>The NCC constant is the web server port number.</p>
|
||||
<h3 id="obfuscations">Obfuscations</h3>
|
||||
<ul>
|
||||
@@ -310,14 +288,13 @@ referenced via pointers.</li>
|
||||
<li>Short and meaningless identifiers are used throughout.</li>
|
||||
<li>Reversed array indexing was applied immoderately.</li>
|
||||
<li>Minus is used in place of not-equals.</li>
|
||||
<li><code>O</code> and <code>l</code> were selected for their
|
||||
resemblance to <code>0</code> and <code>1</code> respectively.</li>
|
||||
<li>Standard constants and ASCII characters were replaced with their
|
||||
respective numerical values.</li>
|
||||
<li><code>O</code> and <code>l</code> were selected for their resemblance to <code>0</code> and <code>1</code> respectively.</li>
|
||||
<li>Standard constants and ASCII characters were replaced with their respective
|
||||
numerical values.</li>
|
||||
</ul>
|
||||
<h3 id="compiler-warnings">Compiler warnings</h3>
|
||||
<p>For space considerations, the following include statements were
|
||||
dropped resulting in compiler warnings:</p>
|
||||
<p>For space considerations, the following include statements were dropped
|
||||
resulting in compiler warnings:</p>
|
||||
<div class="sourceCode" id="cb12"><pre class="sourceCode c"><code class="sourceCode c"><span id="cb12-1"><a href="#cb12-1" aria-hidden="true" tabindex="-1"></a><span class="pp">#include </span><span class="im"><asm/byteorder.h></span></span>
|
||||
<span id="cb12-2"><a href="#cb12-2" aria-hidden="true" tabindex="-1"></a><span class="pp">#include </span><span class="im"><ctype.h></span></span>
|
||||
<span id="cb12-3"><a href="#cb12-3" aria-hidden="true" tabindex="-1"></a><span class="pp">#include </span><span class="im"><netinet/in.h></span></span>
|
||||
@@ -327,55 +304,35 @@ dropped resulting in compiler warnings:</p>
|
||||
<span id="cb12-7"><a href="#cb12-7" aria-hidden="true" tabindex="-1"></a><span class="pp">#include </span><span class="im"><sys/socket.h></span></span>
|
||||
<span id="cb12-8"><a href="#cb12-8" aria-hidden="true" tabindex="-1"></a><span class="pp">#include </span><span class="im"><sys/types.h></span></span>
|
||||
<span id="cb12-9"><a href="#cb12-9" aria-hidden="true" tabindex="-1"></a><span class="pp">#include </span><span class="im"><sys/unistd.h></span></span></code></pre></div>
|
||||
<p>It may be necessary to restore some of these under certain
|
||||
environments.</p>
|
||||
<h2 id="copyright-and-cc-by-sa-4.0-license">Copyright and CC BY-SA 4.0
|
||||
License:</h2>
|
||||
<p>This file is Copyright (c) 2023 by Landon Curt Noll. All Rights
|
||||
Reserved. You are free to share and adapt this file under the terms of
|
||||
this license:</p>
|
||||
<p>It may be necessary to restore some of these under certain environments.</p>
|
||||
<h2 id="copyright-and-cc-by-sa-4.0-license">Copyright and CC BY-SA 4.0 License:</h2>
|
||||
<p>This file is Copyright (c) 2023 by Landon Curt Noll. All Rights Reserved.
|
||||
You are free to share and adapt this file under the terms of this license:</p>
|
||||
<pre><code>Creative Commons Attribution-ShareAlike 4.0 International (CC BY-SA 4.0)</code></pre>
|
||||
<p>For more information, see:
|
||||
https://creativecommons.org/licenses/by-sa/4.0/</p>
|
||||
<p>For more information, see: https://creativecommons.org/licenses/by-sa/4.0/</p>
|
||||
|
||||
<!-- END: this line ends content for HTML phase 21 by: bin/pandoc-wrapper.sh via bin/md2html.sh -->
|
||||
<!-- START: this line starts content for HTML phase 22 by: bin/output-index-inventory.sh via bin/md2html.sh -->
|
||||
|
||||
<!-- START: this line starts content generated by: bin/output-index-inventory.sh -->
|
||||
|
||||
<h1 id="inventory-for-2014birken"><a name="inventory"></a>Inventory for
|
||||
2014/birken</h1>
|
||||
<h1 id="inventory-for-2014birken"><a name="inventory"></a>Inventory for 2014/birken</h1>
|
||||
<p><a href="#top">Jump to top</a></p>
|
||||
<h2 id="primary-files">Primary files</h2>
|
||||
<ul>
|
||||
<li><a
|
||||
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2014/birken/prog.c">prog.c</a>
|
||||
- entry source</li>
|
||||
<li><a
|
||||
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2014/birken/Makefile">Makefile</a>
|
||||
- entry Makefile</li>
|
||||
<li><a
|
||||
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2014/birken/prog.alt.c">prog.alt.c</a>
|
||||
- alternative source</li>
|
||||
<li><a
|
||||
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2014/birken/prog.orig.c">prog.orig.c</a>
|
||||
- original source</li>
|
||||
<li><a href="2014_birken.tar.bz2">2014_birken.tar.bz2</a> - download
|
||||
entry source</li>
|
||||
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2014/birken/prog.c">prog.c</a> - entry source</li>
|
||||
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2014/birken/Makefile">Makefile</a> - entry Makefile</li>
|
||||
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2014/birken/prog.alt.c">prog.alt.c</a> - alternative source</li>
|
||||
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2014/birken/prog.orig.c">prog.orig.c</a> - original source</li>
|
||||
<li><a href="2014_birken.tar.bz2">2014_birken.tar.bz2</a> - download entry source</li>
|
||||
</ul>
|
||||
<h2 id="secondary-files">Secondary files</h2>
|
||||
<ul>
|
||||
<li><a href="index.html">index.html</a> - entry home page</li>
|
||||
<li><a
|
||||
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2014/birken/.entry.json">.entry.json</a>
|
||||
- description of entry in JSON</li>
|
||||
<li><a
|
||||
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2014/birken/.gitignore">.gitignore</a>
|
||||
- list of files that should not be committed under git</li>
|
||||
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2014/birken/.entry.json">.entry.json</a> - description of entry in JSON</li>
|
||||
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2014/birken/.gitignore">.gitignore</a> - list of files that should not be committed under git</li>
|
||||
<li><a href=".path">.path</a> - directory path from top directory</li>
|
||||
<li><a
|
||||
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2014/birken/README.md">README.md</a>
|
||||
- markdown source for index.html</li>
|
||||
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2014/birken/README.md">README.md</a> - markdown source for index.html</li>
|
||||
</ul>
|
||||
|
||||
<!-- END: next line ends content generated by: bin/output-index-inventory.sh -->
|
||||
|
||||
+47
-76
@@ -130,8 +130,8 @@
|
||||
<h2 id="author"><a name="author"></a>Author:</h2>
|
||||
<ul>
|
||||
<li>Name: <a href="../../authors.html#Ferenc_Deak">Ferenc Deak</a><br>
|
||||
Location: <a href="../../location.html#ZZ">ZZ</a> - <em>Unknown
|
||||
location</em> <br><br></li>
|
||||
Location: <a href="../../location.html#ZZ">ZZ</a> - <em>Unknown location</em>
|
||||
<br><br></li>
|
||||
</ul>
|
||||
|
||||
<!-- END: next line ends content generated by: bin/output-index-author.sh -->
|
||||
@@ -141,11 +141,10 @@ location</em> <br><br></li>
|
||||
|
||||
<h2 id="to-build">To build:</h2>
|
||||
<div class="sourceCode" id="cb1"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb1-1"><a href="#cb1-1" aria-hidden="true" tabindex="-1"></a><span class="fu">make</span></span></code></pre></div>
|
||||
<p>There is an alternate version that the author provided but fixed in
|
||||
2023 to compile with modern systems and to allow one to reconfigure the
|
||||
constants <code>X1</code>, <code>X2</code>, <code>Y1</code> and
|
||||
<code>Y2</code> (which were magic numbers). See <a
|
||||
href="#alternate-code">Alternate code</a> below.</p>
|
||||
<p>There is an alternate version that the author provided but fixed in 2023 to
|
||||
compile with modern systems and to allow one to reconfigure the constants <code>X1</code>,
|
||||
<code>X2</code>, <code>Y1</code> and <code>Y2</code> (which were magic numbers). See <a href="#alternate-code">Alternate
|
||||
code</a> below.</p>
|
||||
<h2 id="to-use">To use:</h2>
|
||||
<div class="sourceCode" id="cb2"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb2-1"><a href="#cb2-1" aria-hidden="true" tabindex="-1"></a><span class="ex">./prog</span></span></code></pre></div>
|
||||
<h2 id="try">Try:</h2>
|
||||
@@ -153,16 +152,14 @@ href="#alternate-code">Alternate code</a> below.</p>
|
||||
<p>Try changing bounding box coordinates in the source to explore
|
||||
various regions of the fractal.</p>
|
||||
<h2 id="alternate-code">Alternate code:</h2>
|
||||
<p>The alternate code is included as <a href="prog.alt.c">prog.alt.c</a>
|
||||
so you can more easily see the difference in what it might look like if
|
||||
the C was more recognisable and also to let you reconfigure the
|
||||
coordinates.</p>
|
||||
<p>The alternate code is included as <a href="prog.alt.c">prog.alt.c</a> so you can more
|
||||
easily see the difference in what it might look like if the C was more
|
||||
recognisable and also to let you reconfigure the coordinates.</p>
|
||||
<h3 id="alternate-build">Alternate build:</h3>
|
||||
<div class="sourceCode" id="cb4"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb4-1"><a href="#cb4-1" aria-hidden="true" tabindex="-1"></a><span class="fu">make</span> alt</span></code></pre></div>
|
||||
<p>If you wish to redefine the coordinates you can do so by defining
|
||||
<code>X1</code>, <code>X2</code>, <code>Y1</code> and/or
|
||||
<code>Y2</code>, which default to: <code>-2</code>, <code>1</code>,
|
||||
<code>-1.3</code> and <code>1.3</code> respectively. For instance:</p>
|
||||
<p>If you wish to redefine the coordinates you can do so by defining <code>X1</code>, <code>X2</code>,
|
||||
<code>Y1</code> and/or <code>Y2</code>, which default to: <code>-2</code>, <code>1</code>, <code>-1.3</code> and <code>1.3</code> respectively.
|
||||
For instance:</p>
|
||||
<div class="sourceCode" id="cb5"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb5-1"><a href="#cb5-1" aria-hidden="true" tabindex="-1"></a><span class="fu">make</span> clobber X1=-3 X2=2 Y1=-2.3 Y2=2.3 alt</span></code></pre></div>
|
||||
<p>You may pick and choose which ones to redefine.</p>
|
||||
<h3 id="alternate-use">Alternate use:</h3>
|
||||
@@ -172,26 +169,22 @@ coordinates.</p>
|
||||
<h2 id="judges-remarks">Judges’ remarks:</h2>
|
||||
<p>We consider this entry a tribute to all “Abuse of the C preprocessor”
|
||||
and Mandelbrot fractal drawing entries we’ve seen over the years.</p>
|
||||
<p>We liked the use of unary notation facilitated by variadic
|
||||
macros.</p>
|
||||
<p>We liked the use of unary notation facilitated by variadic macros.</p>
|
||||
<h2 id="authors-remarks">Author’s remarks:</h2>
|
||||
<h3 id="portability">Portability</h3>
|
||||
<p>The application was written on a standard Ubuntu 14.04 and tested
|
||||
with gcc 4.9.1 and clang 3.5 on a 64 bit system (though this should not
|
||||
matter). The application makes no assumption regarding any system
|
||||
specific settings, and it only needs a console to run. The provided
|
||||
Makefile is just to have an easy compilation. I don’t see any problems
|
||||
porting it to different compiler/system as long as it supports the C99
|
||||
standard.</p>
|
||||
<p>The application was written on a standard Ubuntu 14.04 and tested with
|
||||
gcc 4.9.1 and clang 3.5 on a 64 bit system (though this should not matter).
|
||||
The application makes no assumption regarding any system specific settings,
|
||||
and it only needs a console to run. The provided Makefile is just to have
|
||||
an easy compilation. I don’t see any problems porting it to different
|
||||
compiler/system as long as it supports the C99 standard.</p>
|
||||
<h3 id="the-application">The application</h3>
|
||||
<p>The purpose of the application is mainly to illustrate the weird
|
||||
possibilities of the C preprocessor, rather than to be a full featured
|
||||
console mode Mandelbrot drawer. There are tools much better suited for
|
||||
drawing fractals.</p>
|
||||
<p>The usage of recognizable elements from the C programming language in
|
||||
the application source code is intentionally kept to a bare minimum. If
|
||||
this phrase would not be true, the application would be the
|
||||
following:</p>
|
||||
<p>The purpose of the application is mainly to illustrate the weird possibilities
|
||||
of the C preprocessor, rather than to be a full featured console mode Mandelbrot
|
||||
drawer. There are tools much better suited for drawing fractals.</p>
|
||||
<p>The usage of recognizable elements from the C programming language in the
|
||||
application source code is intentionally kept to a bare minimum. If this phrase
|
||||
would not be true, the application would be the following:</p>
|
||||
<div class="sourceCode" id="cb7"><pre class="sourceCode c"><code class="sourceCode c"><span id="cb7-1"><a href="#cb7-1" aria-hidden="true" tabindex="-1"></a><span class="dt">double</span> _<span class="op">[]={-</span><span class="dv">2</span></span>
|
||||
<span id="cb7-2"><a href="#cb7-2" aria-hidden="true" tabindex="-1"></a><span class="op">,</span><span class="dv">1</span><span class="op">,-</span><span class="fl">1.3</span> <span class="op">,</span><span class="fl">1.3</span><span class="op">,</span> <span class="dv">0</span><span class="op">,</span> <span class="dv">0</span><span class="op">,</span><span class="dv">0</span><span class="op">,</span><span class="dv">0</span></span>
|
||||
<span id="cb7-3"><a href="#cb7-3" aria-hidden="true" tabindex="-1"></a><span class="op">,</span><span class="dv">0</span> <span class="op">,</span><span class="dv">0</span><span class="op">,</span><span class="dv">50</span><span class="op">,</span> <span class="dv">80</span><span class="op">,</span> <span class="dv">0</span><span class="op">,</span><span class="dv">0</span><span class="op">,</span><span class="dv">0</span> <span class="op">,</span><span class="dv">255</span></span>
|
||||
@@ -211,66 +204,44 @@ following:</p>
|
||||
<span id="cb7-17"><a href="#cb7-17" aria-hidden="true" tabindex="-1"></a><span class="dv">0</span><span class="op">)</span> <span class="op">;</span>_<span class="op">[</span><span class="dv">12</span><span class="op">]++;</span> _<span class="op">[</span><span class="dv">13</span><span class="op">]</span> <span class="op">=</span><span class="dv">0</span></span>
|
||||
<span id="cb7-18"><a href="#cb7-18" aria-hidden="true" tabindex="-1"></a><span class="op">;</span><span class="cf">if</span><span class="op">(</span>_ <span class="op">[</span><span class="dv">17</span><span class="op">]</span> <span class="op">!=</span><span class="dv">1</span><span class="op">)</span> putchar</span>
|
||||
<span id="cb7-19"><a href="#cb7-19" aria-hidden="true" tabindex="-1"></a><span class="op">(</span><span class="bn">0xa</span><span class="op">);</span> main<span class="op">(</span><span class="dv">1</span><span class="op">);}</span></span></code></pre></div>
|
||||
<p>The application expects no parameters, the only way you can change
|
||||
the behaviour is to modify the source code at the indicated location:
|
||||
the line <code>/* <-- Configure here: X1, X2, Y1, Y2 */</code> is
|
||||
intentionally not obfuscated so that the adventurous programmer can
|
||||
manually modify the coordinates of the fractal to be drawn on the
|
||||
screen.</p>
|
||||
<p>The application expects no parameters, the only way you can change the behaviour
|
||||
is to modify the source code at the indicated location: the line
|
||||
<code>/* <-- Configure here: X1, X2, Y1, Y2 */</code> is intentionally not obfuscated so
|
||||
that the adventurous programmer can manually modify the coordinates of the
|
||||
fractal to be drawn on the screen.</p>
|
||||
<h3 id="compiler-warnings">Compiler warnings</h3>
|
||||
<p>Yes, unfortunately there are compiler warnings of the kind
|
||||
“initialization makes integer from pointer without a cast” but the
|
||||
provided Makefile automatically disables them.</p>
|
||||
<h2 id="copyright-and-cc-by-sa-4.0-license">Copyright and CC BY-SA 4.0
|
||||
License:</h2>
|
||||
<p>This file is Copyright (c) 2023 by Landon Curt Noll. All Rights
|
||||
Reserved. You are free to share and adapt this file under the terms of
|
||||
this license:</p>
|
||||
<p>Yes, unfortunately there are compiler warnings of the kind “initialization makes
|
||||
integer from pointer without a cast” but the provided Makefile automatically
|
||||
disables them.</p>
|
||||
<h2 id="copyright-and-cc-by-sa-4.0-license">Copyright and CC BY-SA 4.0 License:</h2>
|
||||
<p>This file is Copyright (c) 2023 by Landon Curt Noll. All Rights Reserved.
|
||||
You are free to share and adapt this file under the terms of this license:</p>
|
||||
<pre><code>Creative Commons Attribution-ShareAlike 4.0 International (CC BY-SA 4.0)</code></pre>
|
||||
<p>For more information, see:
|
||||
https://creativecommons.org/licenses/by-sa/4.0/</p>
|
||||
<p>For more information, see: https://creativecommons.org/licenses/by-sa/4.0/</p>
|
||||
|
||||
<!-- END: this line ends content for HTML phase 21 by: bin/pandoc-wrapper.sh via bin/md2html.sh -->
|
||||
<!-- START: this line starts content for HTML phase 22 by: bin/output-index-inventory.sh via bin/md2html.sh -->
|
||||
|
||||
<!-- START: this line starts content generated by: bin/output-index-inventory.sh -->
|
||||
|
||||
<h1 id="inventory-for-2014deak"><a name="inventory"></a>Inventory for
|
||||
2014/deak</h1>
|
||||
<h1 id="inventory-for-2014deak"><a name="inventory"></a>Inventory for 2014/deak</h1>
|
||||
<p><a href="#top">Jump to top</a></p>
|
||||
<h2 id="primary-files">Primary files</h2>
|
||||
<ul>
|
||||
<li><a
|
||||
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2014/deak/prog.c">prog.c</a>
|
||||
- entry source</li>
|
||||
<li><a
|
||||
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2014/deak/Makefile">Makefile</a>
|
||||
- entry Makefile</li>
|
||||
<li><a
|
||||
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2014/deak/prog.alt.c">prog.alt.c</a>
|
||||
- alternative source</li>
|
||||
<li><a
|
||||
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2014/deak/prog.orig.c">prog.orig.c</a>
|
||||
- original source</li>
|
||||
<li><a
|
||||
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2014/deak/try.alt.sh">try.alt.sh</a>
|
||||
- how to run alternative code</li>
|
||||
<li><a href="2014_deak.tar.bz2">2014_deak.tar.bz2</a> - download entry
|
||||
source</li>
|
||||
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2014/deak/prog.c">prog.c</a> - entry source</li>
|
||||
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2014/deak/Makefile">Makefile</a> - entry Makefile</li>
|
||||
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2014/deak/prog.alt.c">prog.alt.c</a> - alternative source</li>
|
||||
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2014/deak/prog.orig.c">prog.orig.c</a> - original source</li>
|
||||
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2014/deak/try.alt.sh">try.alt.sh</a> - how to run alternative code</li>
|
||||
<li><a href="2014_deak.tar.bz2">2014_deak.tar.bz2</a> - download entry source</li>
|
||||
</ul>
|
||||
<h2 id="secondary-files">Secondary files</h2>
|
||||
<ul>
|
||||
<li><a href="index.html">index.html</a> - entry home page</li>
|
||||
<li><a
|
||||
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2014/deak/.entry.json">.entry.json</a>
|
||||
- description of entry in JSON</li>
|
||||
<li><a
|
||||
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2014/deak/.gitignore">.gitignore</a>
|
||||
- list of files that should not be committed under git</li>
|
||||
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2014/deak/.entry.json">.entry.json</a> - description of entry in JSON</li>
|
||||
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2014/deak/.gitignore">.gitignore</a> - list of files that should not be committed under git</li>
|
||||
<li><a href=".path">.path</a> - directory path from top directory</li>
|
||||
<li><a
|
||||
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2014/deak/README.md">README.md</a>
|
||||
- markdown source for index.html</li>
|
||||
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2014/deak/README.md">README.md</a> - markdown source for index.html</li>
|
||||
</ul>
|
||||
|
||||
<!-- END: next line ends content generated by: bin/output-index-inventory.sh -->
|
||||
|
||||
+47
-107
@@ -145,139 +145,79 @@ Location: <a href="../../location.html#JP">JP</a> - <em>Japan</em>
|
||||
<div class="sourceCode" id="cb2"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb2-1"><a href="#cb2-1" aria-hidden="true" tabindex="-1"></a><span class="ex">./prog</span> <span class="op">></span> foo.c</span></code></pre></div>
|
||||
<h2 id="try">Try:</h2>
|
||||
<div class="sourceCode" id="cb3"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb3-1"><a href="#cb3-1" aria-hidden="true" tabindex="-1"></a><span class="ex">./try.sh</span></span></code></pre></div>
|
||||
<p>The script will ask you if you wish to run <code>make rake</code> but
|
||||
this is not necessary to fully enjoy the entry. <code>make rake</code>
|
||||
will run the <a href="rake.sh">rake.sh</a> script and then
|
||||
<code>prog</code> if all is built okay. If <code>rake</code> is not
|
||||
installed then it will check that <code>gem</code> is installed. If
|
||||
<code>gem</code> is not installed it will tell you where to get it and
|
||||
then tell you how to install <code>rake</code>. Otherwise, if
|
||||
<code>rake</code> is installed it will try running <code>rake</code> and
|
||||
if that fails to run it will tell you to run a <code>gem</code> command
|
||||
as either root or via sudo and then to try running
|
||||
<code>make rake</code> or <code>./rake.sh</code> again. If
|
||||
<code>rake</code> succeeds it will run <code>./prog</code> which can be
|
||||
used to build <code>main.c</code>.</p>
|
||||
<p>What is the difference between running <code>./prog</code> and
|
||||
<code>main</code>?</p>
|
||||
<p>The script will ask you if you wish to run <code>make rake</code> but this is not necessary
|
||||
to fully enjoy the entry. <code>make rake</code> will run the <a href="rake.sh">rake.sh</a> script and
|
||||
then <code>prog</code> if all is built okay. If <code>rake</code> is not installed then it will check
|
||||
that <code>gem</code> is installed. If <code>gem</code> is not installed it will tell you where to get
|
||||
it and then tell you how to install <code>rake</code>. Otherwise, if <code>rake</code> is installed it
|
||||
will try running <code>rake</code> and if that fails to run it will tell you to run a
|
||||
<code>gem</code> command as either root or via sudo and then to try running <code>make rake</code> or
|
||||
<code>./rake.sh</code> again. If <code>rake</code> succeeds it will run <code>./prog</code> which can be used to
|
||||
build <code>main.c</code>.</p>
|
||||
<p>What is the difference between running <code>./prog</code> and <code>main</code>?</p>
|
||||
<h2 id="judges-remarks">Judges’ remarks:</h2>
|
||||
<p>Big terminals with tiny fonts have their uses in certain cases. One
|
||||
of them is:</p>
|
||||
<p>Big terminals with tiny fonts have their uses in certain cases.
|
||||
One of them is:</p>
|
||||
<div class="sourceCode" id="cb4"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb4-1"><a href="#cb4-1" aria-hidden="true" tabindex="-1"></a><span class="fu">make</span> treacl</span>
|
||||
<span id="cb4-2"><a href="#cb4-2" aria-hidden="true" tabindex="-1"></a><span class="ex">./treacl</span></span></code></pre></div>
|
||||
<p>which is shorthand for:</p>
|
||||
<div class="sourceCode" id="cb5"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb5-1"><a href="#cb5-1" aria-hidden="true" tabindex="-1"></a><span class="ex">./prog</span> <span class="op"><</span> prog.c <span class="op">></span> treacle.c</span>
|
||||
<span id="cb5-2"><a href="#cb5-2" aria-hidden="true" tabindex="-1"></a><span class="fu">make</span> treacle</span>
|
||||
<span id="cb5-3"><a href="#cb5-3" aria-hidden="true" tabindex="-1"></a><span class="ex">./treacle</span></span></code></pre></div>
|
||||
<p>When using a smartphone to read the output, you may need to step back
|
||||
to see the bigger picture because that picture is worth more than 1000
|
||||
words.</p>
|
||||
<p>When using a smartphone to read the output, you may need to
|
||||
step back to see the bigger picture because that picture is worth
|
||||
more than 1000 words.</p>
|
||||
<h2 id="authors-remarks">Author’s remarks:</h2>
|
||||
<h3 id="remarks">Remarks</h3>
|
||||
<p>You may want to use a large display with a very small terminal
|
||||
font.</p>
|
||||
<p>You may want to use a large display with a very small terminal font.</p>
|
||||
<h3 id="spoiler">Spoiler</h3>
|
||||
<p>See <a href="spoilers.html">spoilers.html</a>.</p>
|
||||
<h2 id="copyright-and-cc-by-sa-4.0-license">Copyright and CC BY-SA 4.0
|
||||
License:</h2>
|
||||
<p>This file is Copyright (c) 2023 by Landon Curt Noll. All Rights
|
||||
Reserved. You are free to share and adapt this file under the terms of
|
||||
this license:</p>
|
||||
<h2 id="copyright-and-cc-by-sa-4.0-license">Copyright and CC BY-SA 4.0 License:</h2>
|
||||
<p>This file is Copyright (c) 2023 by Landon Curt Noll. All Rights Reserved.
|
||||
You are free to share and adapt this file under the terms of this license:</p>
|
||||
<pre><code>Creative Commons Attribution-ShareAlike 4.0 International (CC BY-SA 4.0)</code></pre>
|
||||
<p>For more information, see:
|
||||
https://creativecommons.org/licenses/by-sa/4.0/</p>
|
||||
<p>For more information, see: https://creativecommons.org/licenses/by-sa/4.0/</p>
|
||||
|
||||
<!-- END: this line ends content for HTML phase 21 by: bin/pandoc-wrapper.sh via bin/md2html.sh -->
|
||||
<!-- START: this line starts content for HTML phase 22 by: bin/output-index-inventory.sh via bin/md2html.sh -->
|
||||
|
||||
<!-- START: this line starts content generated by: bin/output-index-inventory.sh -->
|
||||
|
||||
<h1 id="inventory-for-2014endoh1"><a name="inventory"></a>Inventory for
|
||||
2014/endoh1</h1>
|
||||
<h1 id="inventory-for-2014endoh1"><a name="inventory"></a>Inventory for 2014/endoh1</h1>
|
||||
<p><a href="#top">Jump to top</a></p>
|
||||
<h2 id="primary-files">Primary files</h2>
|
||||
<ul>
|
||||
<li><a
|
||||
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2014/endoh1/prog.c">prog.c</a>
|
||||
- entry source</li>
|
||||
<li><a
|
||||
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2014/endoh1/Makefile">Makefile</a>
|
||||
- entry Makefile</li>
|
||||
<li><a
|
||||
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2014/endoh1/prog.orig.c">prog.orig.c</a>
|
||||
- original source</li>
|
||||
<li><a
|
||||
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2014/endoh1/Rakefile">Rakefile</a>
|
||||
- Ruby makefile</li>
|
||||
<li><a
|
||||
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2014/endoh1/rake.sh">rake.sh</a>
|
||||
- make rake script</li>
|
||||
<li><a href="spoilers.html">spoilers.html</a> - spoilers about Q(uine)R
|
||||
code generator</li>
|
||||
<li><a
|
||||
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2014/endoh1/try.sh">try.sh</a>
|
||||
- how to run</li>
|
||||
<li><a
|
||||
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2014/endoh1/alpha.rb">alpha.rb</a>
|
||||
- support program for Rakefile</li>
|
||||
<li><a
|
||||
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2014/endoh1/assemble.rb">assemble.rb</a>
|
||||
- support program for Rakefile</li>
|
||||
<li><a
|
||||
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2014/endoh1/ast-def.rb">ast-def.rb</a>
|
||||
- support program for Rakefile</li>
|
||||
<li><a
|
||||
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2014/endoh1/gen-prog.rb">gen-prog.rb</a>
|
||||
- support program for Rakefile</li>
|
||||
<li><a
|
||||
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2014/endoh1/gen-table.rb">gen-table.rb</a>
|
||||
- support program for Rakefile</li>
|
||||
<li><a
|
||||
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2014/endoh1/link.rb">link.rb</a>
|
||||
- support program for Rakefile</li>
|
||||
<li><a
|
||||
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2014/endoh1/machine.rb">machine.rb</a>
|
||||
- support program for Rakefile</li>
|
||||
<li><a
|
||||
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2014/endoh1/parse.rb">parse.rb</a>
|
||||
- support program for Rakefile</li>
|
||||
<li><a
|
||||
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2014/endoh1/prog-tmpl.c">prog-tmpl.c</a>
|
||||
- source code template used by gen-prog</li>
|
||||
<li><a
|
||||
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2014/endoh1/register.rb">register.rb</a>
|
||||
- support program for Rakefile</li>
|
||||
<li><a
|
||||
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2014/endoh1/serialize.rb">serialize.rb</a>
|
||||
- support program for Rakefile</li>
|
||||
<li><a
|
||||
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2014/endoh1/src.rb">src.rb</a>
|
||||
- support program for Rakefile</li>
|
||||
<li><a
|
||||
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2014/endoh1/tool.rb">tool.rb</a>
|
||||
- support program for Rakefile</li>
|
||||
<li><a
|
||||
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2014/endoh1/vm.c">vm.c</a>
|
||||
- source code of the VM</li>
|
||||
<li><a href="2014_endoh1.tar.bz2">2014_endoh1.tar.bz2</a> - download
|
||||
entry source</li>
|
||||
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2014/endoh1/prog.c">prog.c</a> - entry source</li>
|
||||
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2014/endoh1/Makefile">Makefile</a> - entry Makefile</li>
|
||||
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2014/endoh1/prog.orig.c">prog.orig.c</a> - original source</li>
|
||||
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2014/endoh1/Rakefile">Rakefile</a> - Ruby makefile</li>
|
||||
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2014/endoh1/rake.sh">rake.sh</a> - make rake script</li>
|
||||
<li><a href="spoilers.html">spoilers.html</a> - spoilers about Q(uine)R code generator</li>
|
||||
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2014/endoh1/try.sh">try.sh</a> - how to run</li>
|
||||
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2014/endoh1/alpha.rb">alpha.rb</a> - support program for Rakefile</li>
|
||||
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2014/endoh1/assemble.rb">assemble.rb</a> - support program for Rakefile</li>
|
||||
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2014/endoh1/ast-def.rb">ast-def.rb</a> - support program for Rakefile</li>
|
||||
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2014/endoh1/gen-prog.rb">gen-prog.rb</a> - support program for Rakefile</li>
|
||||
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2014/endoh1/gen-table.rb">gen-table.rb</a> - support program for Rakefile</li>
|
||||
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2014/endoh1/link.rb">link.rb</a> - support program for Rakefile</li>
|
||||
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2014/endoh1/machine.rb">machine.rb</a> - support program for Rakefile</li>
|
||||
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2014/endoh1/parse.rb">parse.rb</a> - support program for Rakefile</li>
|
||||
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2014/endoh1/prog-tmpl.c">prog-tmpl.c</a> - source code template used by gen-prog</li>
|
||||
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2014/endoh1/register.rb">register.rb</a> - support program for Rakefile</li>
|
||||
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2014/endoh1/serialize.rb">serialize.rb</a> - support program for Rakefile</li>
|
||||
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2014/endoh1/src.rb">src.rb</a> - support program for Rakefile</li>
|
||||
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2014/endoh1/tool.rb">tool.rb</a> - support program for Rakefile</li>
|
||||
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2014/endoh1/vm.c">vm.c</a> - source code of the VM</li>
|
||||
<li><a href="2014_endoh1.tar.bz2">2014_endoh1.tar.bz2</a> - download entry source</li>
|
||||
</ul>
|
||||
<h2 id="secondary-files">Secondary files</h2>
|
||||
<ul>
|
||||
<li><a href="index.html">index.html</a> - entry home page</li>
|
||||
<li><a
|
||||
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2014/endoh1/.entry.json">.entry.json</a>
|
||||
- description of entry in JSON</li>
|
||||
<li><a
|
||||
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2014/endoh1/.gitignore">.gitignore</a>
|
||||
- list of files that should not be committed under git</li>
|
||||
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2014/endoh1/.entry.json">.entry.json</a> - description of entry in JSON</li>
|
||||
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2014/endoh1/.gitignore">.gitignore</a> - list of files that should not be committed under git</li>
|
||||
<li><a href=".path">.path</a> - directory path from top directory</li>
|
||||
<li><a
|
||||
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2014/endoh1/README.md">README.md</a>
|
||||
- markdown source for index.html</li>
|
||||
<li><a
|
||||
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2014/endoh1/spoilers.md">spoilers.md</a>
|
||||
- markdown source for spoilers.html</li>
|
||||
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2014/endoh1/README.md">README.md</a> - markdown source for index.html</li>
|
||||
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2014/endoh1/spoilers.md">spoilers.md</a> - markdown source for spoilers.html</li>
|
||||
</ul>
|
||||
|
||||
<!-- END: next line ends content generated by: bin/output-index-inventory.sh -->
|
||||
|
||||
+42
-65
@@ -122,38 +122,32 @@
|
||||
|
||||
<h1 id="quiner-code-generator">Q(uine)R code generator</h1>
|
||||
<h2 id="what-is-difficult">What is difficult?</h2>
|
||||
<p>As you may know, QR code (specification: ISO/IEC 18004) is quite
|
||||
complex. It requires a bit stream, Reed-Solomon codes, BCH codes, data
|
||||
relocation, big (and irregular!) numerical tables, human-oriented
|
||||
pattern arrangement (difficult to implement by a small program),
|
||||
etc.</p>
|
||||
<p>On the other hand, a quine has a big restriction: it needs to have
|
||||
two copies of the program!</p>
|
||||
<p>Do you think that it is possible to write QR code encoder in C within
|
||||
<em>1kB</em>?</p>
|
||||
<p>As you may know, QR code (specification: ISO/IEC 18004) is quite complex. It
|
||||
requires a bit stream, Reed-Solomon codes, BCH codes, data relocation, big (and
|
||||
irregular!) numerical tables, human-oriented pattern arrangement (difficult to
|
||||
implement by a small program), etc.</p>
|
||||
<p>On the other hand, a quine has a big restriction: it needs to have two copies of
|
||||
the program!</p>
|
||||
<p>Do you think that it is possible to write QR code encoder in C within <em>1kB</em>?</p>
|
||||
<h2 id="how-did-i-achieve-that">How did I achieve that?</h2>
|
||||
<p>It is known that we can mitigate the quine restriction by
|
||||
<code>eval</code>. For example, this is a quine written in Ruby:</p>
|
||||
<div class="sourceCode" id="cb1"><pre
|
||||
class="sourceCode ruby"><code class="sourceCode ruby"><span id="cb1-1"><a href="#cb1-1" aria-hidden="true" tabindex="-1"></a><span class="fu">eval</span> s<span class="kw">=</span><span class="st">"print 'eval s='; p s"</span></span></code></pre></div>
|
||||
<p>It is known that we can mitigate the quine restriction by <code>eval</code>.
|
||||
For example, this is a quine written in Ruby:</p>
|
||||
<div class="sourceCode" id="cb1"><pre class="sourceCode ruby"><code class="sourceCode ruby"><span id="cb1-1"><a href="#cb1-1" aria-hidden="true" tabindex="-1"></a><span class="fu">eval</span> s<span class="kw">=</span><span class="st">"print 'eval s='; p s"</span></span></code></pre></div>
|
||||
<p>Note that <code>print</code> appears just once in the program.</p>
|
||||
<p>To emulate this approach in C, I adopted the following structure.</p>
|
||||
<pre><code>char s[]="<main code>int main() { <VM code> }";
|
||||
int main() { <VM code>; }</code></pre>
|
||||
<ul>
|
||||
<li><code><VM code></code> : An own VM implementation (written in
|
||||
C) that executes the main code.</li>
|
||||
<li><code><main code></code> : An object code of quine and QR code
|
||||
encoder (written in the assembly language of the VM).</li>
|
||||
<li><code><VM code></code> : An own VM implementation (written in C) that executes the main
|
||||
code.</li>
|
||||
<li><code><main code></code> : An object code of quine and QR code encoder (written in the
|
||||
assembly language of the VM).</li>
|
||||
</ul>
|
||||
<p><code><main code></code> (about 1100 bytes) appears once and
|
||||
<code><VM code></code> (about 450 bytes) appears twice. So the
|
||||
whole code is about 1100 + 450 * 2 = 2000 bytes. Hooray!</p>
|
||||
<p><code><main code></code> (about 1100 bytes) appears once and <code><VM code></code> (about 450 bytes)
|
||||
appears twice. So the whole code is about 1100 + 450 * 2 = 2000 bytes. Hooray!</p>
|
||||
<h2 id="what-sort-of-vm-is-that">What sort of VM is that?</h2>
|
||||
<p>The VM is a kind of stack machine which makes the object code
|
||||
compact. The instruction set is carefully selected to minimize the sizes
|
||||
of both <code><main code></code> and
|
||||
<code><VM code></code>.</p>
|
||||
<p>The VM is a kind of stack machine which makes the object code compact. The
|
||||
instruction set is carefully selected to minimize the sizes of both <code><main code></code> and <code><VM code></code>.</p>
|
||||
<ul>
|
||||
<li>21 integer registers access
|
||||
<ul>
|
||||
@@ -178,22 +172,17 @@ of both <code><main code></code> and
|
||||
<li>putchar, exit</li>
|
||||
</ul></li>
|
||||
</ul>
|
||||
<p>The instructions have variable lengths, but many of them are
|
||||
represented as one printable character. (See <a
|
||||
href="machine.rb">machine.rb</a> and <a
|
||||
href="assemble.rb">assemble.rb</a> in detail.) The mapping between
|
||||
instructions and characters is also carefully designed to minimize
|
||||
<code><VM code></code>, which makes the resulted program
|
||||
non-human-readable.</p>
|
||||
<h2 id="how-did-i-create-the-main-code">How did I create the main
|
||||
code?</h2>
|
||||
<p>It is too tedious to write the machine language directly. So I wrote
|
||||
the source code in Ruby syntax and created a Ruby-to-VM compiler that
|
||||
involves alpha renaming and automatic register allocation only for this
|
||||
purpose.</p>
|
||||
<p>The instructions have variable lengths, but many of them are represented as one
|
||||
printable character. (See <a href="machine.rb">machine.rb</a> and
|
||||
<a href="assemble.rb">assemble.rb</a> in detail.) The mapping between instructions and
|
||||
characters is also carefully designed to minimize <code><VM code></code>, which makes the
|
||||
resulted program non-human-readable.</p>
|
||||
<h2 id="how-did-i-create-the-main-code">How did I create the main code?</h2>
|
||||
<p>It is too tedious to write the machine language directly. So I wrote the source
|
||||
code in Ruby syntax and created a Ruby-to-VM compiler that involves alpha
|
||||
renaming and automatic register allocation only for this purpose.</p>
|
||||
<ul>
|
||||
<li><a href="src.rb">src.rb</a>: the source code of QR code encoder
|
||||
written in Ruby syntax.</li>
|
||||
<li><a href="src.rb">src.rb</a>: the source code of QR code encoder written in Ruby syntax.</li>
|
||||
<li><a href="vm.c">vm.c</a>: the source code of the VM.</li>
|
||||
</ul>
|
||||
<p>The compiler tool chain is the following.</p>
|
||||
@@ -230,39 +219,28 @@ raw.txt |
|
||||
prog.c</code></pre>
|
||||
<ul>
|
||||
<li><a href="parse.rb">parse.rb</a> converts Ruby to AST.</li>
|
||||
<li><a href="serialize.rb">serialize.rb</a> converts AST to intermediate
|
||||
instruction sequence.</li>
|
||||
<li><a href="alpha.rb">alpha.rb</a> applies “alpha-renaming” to the
|
||||
instruction sequence.</li>
|
||||
<li><a href="register.rb">register.rb</a> applies “register
|
||||
allocation”.</li>
|
||||
<li><a href="assemble.rb">assemble.rb</a> converts the sequence to the
|
||||
final stack-machine instructions.</li>
|
||||
<li><a href="serialize.rb">serialize.rb</a> converts AST to intermediate instruction sequence.</li>
|
||||
<li><a href="alpha.rb">alpha.rb</a> applies “alpha-renaming” to the instruction sequence.</li>
|
||||
<li><a href="register.rb">register.rb</a> applies “register allocation”.</li>
|
||||
<li><a href="assemble.rb">assemble.rb</a> converts the sequence to the final stack-machine instructions.</li>
|
||||
<li><a href="interp.c">interp.c</a> is an implementation of the VM.</li>
|
||||
<li><a href="link.rb">link.rb</a> generates <code>main.c</code> by
|
||||
linking the instructions and interpreter source.</li>
|
||||
<li><a href="gen-prog.c">gen-prog.c</a> generates <a
|
||||
href="prog.c">prog.c</a> based on <code>main.c</code>.</li>
|
||||
<li><a href="link.rb">link.rb</a> generates <code>main.c</code> by linking the instructions and interpreter source.</li>
|
||||
<li><a href="gen-prog.c">gen-prog.c</a> generates <a href="prog.c">prog.c</a> based on <code>main.c</code>.</li>
|
||||
</ul>
|
||||
<p>You can run the process by <code>rake</code> command.
|
||||
<code>ruby-minisat</code> gem is needed.</p>
|
||||
<p>You can run the process by <code>rake</code> command. <code>ruby-minisat</code> gem is needed.</p>
|
||||
<div class="sourceCode" id="cb4"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb4-1"><a href="#cb4-1" aria-hidden="true" tabindex="-1"></a><span class="ex">$</span> gem install ruby-minisat</span>
|
||||
<span id="cb4-2"><a href="#cb4-2" aria-hidden="true" tabindex="-1"></a><span class="ex">$</span> rake</span></code></pre></div>
|
||||
<h2 id="tools">Tools</h2>
|
||||
<p>I checked that the following QR code readers can read the output of
|
||||
my program.</p>
|
||||
<p>I checked that the following QR code readers can read the output of my program.</p>
|
||||
<ul>
|
||||
<li>Linux: <a href="http://zbar.sourceforge.net/">ZBar bar code
|
||||
reader</a>.</li>
|
||||
<li>Linux: <a href="http://zbar.sourceforge.net/">ZBar bar code reader</a>.</li>
|
||||
</ul>
|
||||
<h3 id="a-note-from-the-judges-in-2023">A note from the judges in
|
||||
2023:</h3>
|
||||
<p>The author also tested an Android app called Barcode Scanner which
|
||||
used to be found at
|
||||
<h3 id="a-note-from-the-judges-in-2023">A note from the judges in 2023:</h3>
|
||||
<p>The author also tested an Android app called Barcode Scanner which used to be
|
||||
found at
|
||||
<code>https://play.google.com/store/apps/details?id=com.google.zxing.client.android</code>
|
||||
but it appears to no longer exist.</p>
|
||||
<p>You can use <a href="tool.rb">tool.rb</a> to convert the output to a
|
||||
png file.</p>
|
||||
<p>You can use <a href="tool.rb">tool.rb</a> to convert the output to a png file.</p>
|
||||
<div class="sourceCode" id="cb5"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb5-1"><a href="#cb5-1" aria-hidden="true" tabindex="-1"></a><span class="ex">./main</span> Hello <span class="kw">|</span> <span class="ex">ruby</span> tool.rb <span class="op">></span> hello.png</span>
|
||||
<span id="cb5-2"><a href="#cb5-2" aria-hidden="true" tabindex="-1"></a></span>
|
||||
<span id="cb5-3"><a href="#cb5-3" aria-hidden="true" tabindex="-1"></a><span class="ex">$</span> zbarimg <span class="at">-q</span> hello.png</span>
|
||||
@@ -273,8 +251,7 @@ png file.</p>
|
||||
<h2 id="limitations">Limitations</h2>
|
||||
<ul>
|
||||
<li>QR code error correction level is fixed to L (Low).</li>
|
||||
<li>It supports only byte mode (not numeric, alphanumeric, kanji
|
||||
mode…).</li>
|
||||
<li>It supports only byte mode (not numeric, alphanumeric, kanji mode…).</li>
|
||||
<li>The mask pattern is fixed to 4.</li>
|
||||
<li>The mask is not applied to the remained bits.</li>
|
||||
</ul>
|
||||
|
||||
+27
-49
@@ -146,75 +146,53 @@ Location: <a href="../../location.html#JP">JP</a> - <em>Japan</em>
|
||||
<h2 id="try">Try:</h2>
|
||||
<div class="sourceCode" id="cb3"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb3-1"><a href="#cb3-1" aria-hidden="true" tabindex="-1"></a><span class="ex">./try.sh</span></span></code></pre></div>
|
||||
<h2 id="judges-remarks">Judges’ remarks:</h2>
|
||||
<p>If you look closely at the source, you will see code that appears to
|
||||
puts C code that includes itself. How and why? Perhaps it is in the DNA
|
||||
code of the code? Perhaps there are 23 reasons? :-)</p>
|
||||
<p>If you look closely at the source, you will see code that appears
|
||||
to puts C code that includes itself. How and why? Perhaps it is
|
||||
in the DNA code of the code? Perhaps there are 23 reasons? :-)</p>
|
||||
<h2 id="authors-remarks">Author’s remarks:</h2>
|
||||
<h3 id="remarks">Remarks</h3>
|
||||
<p>This chromosome program synthesizes a double helix. The helix can
|
||||
also be compiled as a C program.</p>
|
||||
<p>This chromosome program synthesizes a double helix.
|
||||
The helix can also be compiled as a C program.</p>
|
||||
<p>Enjoy DNA programming!</p>
|
||||
<h3 id="for-more-information-background-reading">For more information /
|
||||
background reading:</h3>
|
||||
<h3 id="for-more-information-background-reading">For more information / background reading:</h3>
|
||||
<ul>
|
||||
<li><p>This program was inspired by Acme::DoubleHelix: <a
|
||||
href="http://search.cpan.org/~xern/Acme-DoubleHelix-0.01/"
|
||||
class="uri">http://search.cpan.org/~xern/Acme-DoubleHelix-0.01/</a></p></li>
|
||||
<li><p>The synthesized helix just includes the original program at the
|
||||
head. Do you see how <a href="prog.c">prog.c</a> determines whether it
|
||||
was invoked as a standalone program or included as a header file? Note
|
||||
that it does not use any gcc extension such as
|
||||
<code>__INCLUDE_LEVEL__</code>.</p></li>
|
||||
<li><p>The synthesized helix of course follows the base-pairing rules
|
||||
for DNA: A is bonding only to T, and C is bonding only to G.</p></li>
|
||||
<li><p>This program was inspired by Acme::DoubleHelix:
|
||||
<a href="http://search.cpan.org/~xern/Acme-DoubleHelix-0.01/" class="uri">http://search.cpan.org/~xern/Acme-DoubleHelix-0.01/</a></p></li>
|
||||
<li><p>The synthesized helix just includes the original program at the head.
|
||||
Do you see how <a href="prog.c">prog.c</a> determines whether it was invoked as a
|
||||
standalone program or included as a header file? Note that it does not use any
|
||||
gcc extension such as <code>__INCLUDE_LEVEL__</code>.</p></li>
|
||||
<li><p>The synthesized helix of course follows the base-pairing rules for DNA:
|
||||
A is bonding only to T, and C is bonding only to G.</p></li>
|
||||
</ul>
|
||||
<h2 id="copyright-and-cc-by-sa-4.0-license">Copyright and CC BY-SA 4.0
|
||||
License:</h2>
|
||||
<p>This file is Copyright (c) 2023 by Landon Curt Noll. All Rights
|
||||
Reserved. You are free to share and adapt this file under the terms of
|
||||
this license:</p>
|
||||
<h2 id="copyright-and-cc-by-sa-4.0-license">Copyright and CC BY-SA 4.0 License:</h2>
|
||||
<p>This file is Copyright (c) 2023 by Landon Curt Noll. All Rights Reserved.
|
||||
You are free to share and adapt this file under the terms of this license:</p>
|
||||
<pre><code>Creative Commons Attribution-ShareAlike 4.0 International (CC BY-SA 4.0)</code></pre>
|
||||
<p>For more information, see:
|
||||
https://creativecommons.org/licenses/by-sa/4.0/</p>
|
||||
<p>For more information, see: https://creativecommons.org/licenses/by-sa/4.0/</p>
|
||||
|
||||
<!-- END: this line ends content for HTML phase 21 by: bin/pandoc-wrapper.sh via bin/md2html.sh -->
|
||||
<!-- START: this line starts content for HTML phase 22 by: bin/output-index-inventory.sh via bin/md2html.sh -->
|
||||
|
||||
<!-- START: this line starts content generated by: bin/output-index-inventory.sh -->
|
||||
|
||||
<h1 id="inventory-for-2014endoh2"><a name="inventory"></a>Inventory for
|
||||
2014/endoh2</h1>
|
||||
<h1 id="inventory-for-2014endoh2"><a name="inventory"></a>Inventory for 2014/endoh2</h1>
|
||||
<p><a href="#top">Jump to top</a></p>
|
||||
<h2 id="primary-files">Primary files</h2>
|
||||
<ul>
|
||||
<li><a
|
||||
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2014/endoh2/prog.c">prog.c</a>
|
||||
- entry source</li>
|
||||
<li><a
|
||||
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2014/endoh2/Makefile">Makefile</a>
|
||||
- entry Makefile</li>
|
||||
<li><a
|
||||
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2014/endoh2/prog.orig.c">prog.orig.c</a>
|
||||
- original source</li>
|
||||
<li><a
|
||||
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2014/endoh2/try.sh">try.sh</a>
|
||||
- how to run</li>
|
||||
<li><a href="2014_endoh2.tar.bz2">2014_endoh2.tar.bz2</a> - download
|
||||
entry source</li>
|
||||
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2014/endoh2/prog.c">prog.c</a> - entry source</li>
|
||||
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2014/endoh2/Makefile">Makefile</a> - entry Makefile</li>
|
||||
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2014/endoh2/prog.orig.c">prog.orig.c</a> - original source</li>
|
||||
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2014/endoh2/try.sh">try.sh</a> - how to run</li>
|
||||
<li><a href="2014_endoh2.tar.bz2">2014_endoh2.tar.bz2</a> - download entry source</li>
|
||||
</ul>
|
||||
<h2 id="secondary-files">Secondary files</h2>
|
||||
<ul>
|
||||
<li><a href="index.html">index.html</a> - entry home page</li>
|
||||
<li><a
|
||||
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2014/endoh2/.entry.json">.entry.json</a>
|
||||
- description of entry in JSON</li>
|
||||
<li><a
|
||||
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2014/endoh2/.gitignore">.gitignore</a>
|
||||
- list of files that should not be committed under git</li>
|
||||
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2014/endoh2/.entry.json">.entry.json</a> - description of entry in JSON</li>
|
||||
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2014/endoh2/.gitignore">.gitignore</a> - list of files that should not be committed under git</li>
|
||||
<li><a href=".path">.path</a> - directory path from top directory</li>
|
||||
<li><a
|
||||
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2014/endoh2/README.md">README.md</a>
|
||||
- markdown source for index.html</li>
|
||||
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2014/endoh2/README.md">README.md</a> - markdown source for index.html</li>
|
||||
</ul>
|
||||
|
||||
<!-- END: next line ends content generated by: bin/output-index-inventory.sh -->
|
||||
|
||||
+65
-90
@@ -123,87 +123,75 @@
|
||||
<!-- END: this line ends content from: inc/before-content.default.html -->
|
||||
<!-- START: this line starts content for HTML phase 21 by: bin/pandoc-wrapper.sh via bin/md2html.sh -->
|
||||
|
||||
<h1 id="twenty-third-international-obfuscated-c-code-contest">Twenty
|
||||
Third International Obfuscated C Code Contest</h1>
|
||||
<h1 id="twenty-third-international-obfuscated-c-code-contest">Twenty Third International Obfuscated C Code Contest</h1>
|
||||
<h2 id="standard-ioccc-stuff">Standard IOCCC stuff</h2>
|
||||
<p>View the <code>index.html</code> web page for the given winning entry
|
||||
for information on how compile the entry and how to run the winning
|
||||
program. Look at the winning source and try to figure how it does what
|
||||
it does! You may then wish to look at the Author’s remarks for even more
|
||||
details.</p>
|
||||
<p>The IOCCC has a web site and now has a number of international
|
||||
mirrors. The primary site can be found at <a
|
||||
href="https://www.ioccc.org">www.ioccc.org</a>.</p>
|
||||
<p>Use make to compile entries. It is possible that on non-Unix /
|
||||
non-Linux systems the Makefile needs to be changed. See the Makefile for
|
||||
details.</p>
|
||||
<p>Look at the source and try to figure out what the programs do, and
|
||||
run them with various inputs. If you want to, look at the hints files
|
||||
for spoilers - this year we included most of the information included by
|
||||
the submitter.</p>
|
||||
<p>Read over the README.md for compile/build issues. Your system may
|
||||
require certain changes (add or remove a library, add or remove a
|
||||
<code>#define</code>).</p>
|
||||
<p>View the <code>index.html</code> web page for the given winning entry for information on how
|
||||
compile the entry and how to run the winning program. Look at the winning
|
||||
source and try to figure how it does what it does! You may then wish to look at
|
||||
the Author’s remarks for even more details.</p>
|
||||
<p>The IOCCC has a web site and now has a number of international mirrors.
|
||||
The primary site can be found at <a href="https://www.ioccc.org">www.ioccc.org</a>.</p>
|
||||
<p>Use make to compile entries. It is possible that on non-Unix / non-Linux
|
||||
systems the Makefile needs to be changed. See the Makefile for details.</p>
|
||||
<p>Look at the source and try to figure out what the programs do, and run
|
||||
them with various inputs. If you want to, look at the hints files for
|
||||
spoilers - this year we included most of the information included
|
||||
by the submitter.</p>
|
||||
<p>Read over the README.md for compile/build issues. Your system may require
|
||||
certain changes (add or remove a library, add or remove a <code>#define</code>).</p>
|
||||
<p>Some ANSI C compilers are not quite as good as they should be. If
|
||||
yours is lacking, you may need to compile using gcc instead of your
|
||||
local compiler.</p>
|
||||
<h2 id="remarks-on-some-of-the-entries">Remarks on some of the
|
||||
entries</h2>
|
||||
<p>We believe you will again be impressed with this year’s winning
|
||||
entries.</p>
|
||||
<h2 id="remarks-on-some-of-the-entries">Remarks on some of the entries</h2>
|
||||
<p>We believe you will again be impressed with this year’s winning entries.</p>
|
||||
<p>This year, 2014:</p>
|
||||
<p>We, the judges, were very surprised by this as many of the multiple
|
||||
authors submitted very different styles of entries.</p>
|
||||
<p>This year was the second time the IOCCC size tool was used. Rule 2
|
||||
required that when program source is fed as input to the current IOCCC
|
||||
size tool, and the IOCCC size tool <code>-i</code> command line option
|
||||
is used, the value printed should be less than or equal to 2053.</p>
|
||||
<p>We were pleased to see that abuse of the rules was extended to abuse
|
||||
to the IOCCC size tool. <a href="../authors.html#Matt_Zucker">Matt
|
||||
Zucker</a>, followed by a few users, were able to discover clever use of
|
||||
certain <code>//</code> comments to perplex the size tool. The abuse was
|
||||
so bad that the judges released a critical and mandatory patch to the
|
||||
IOCCC size tool on 2014-09-23.</p>
|
||||
<p>There were some great entries that did not win. Unfortunately some
|
||||
entries lost because they:</p>
|
||||
required that when program source is fed as input to the current IOCCC size
|
||||
tool, and the IOCCC size tool <code>-i</code> command line option is used, the value
|
||||
printed should be less than or equal to 2053.</p>
|
||||
<p>We were pleased to see that abuse of the rules was extended to abuse to the
|
||||
IOCCC size tool. <a href="../authors.html#Matt_Zucker">Matt Zucker</a>, followed by a few
|
||||
users, were able to discover clever use of certain <code>//</code> comments to perplex the
|
||||
size tool. The abuse was so bad that the judges released a critical and
|
||||
mandatory patch to the IOCCC size tool on 2014-09-23.</p>
|
||||
<p>There were some great entries that did not win. Unfortunately
|
||||
some entries lost because they:</p>
|
||||
<ul>
|
||||
<li><p>were too large according the IOCCC size tool and didn’t even
|
||||
attempt to justify their excess by a clever abuse of the rules</p></li>
|
||||
<li><p>were too large according the IOCCC size tool and didn’t
|
||||
even attempt to justify their excess by a clever abuse of the rules</p></li>
|
||||
<li><p>depended on a single obfuscation trick</p></li>
|
||||
<li><p>didn’t work as documented</p></li>
|
||||
</ul>
|
||||
<p>We hope the authors of some of those entries will fix and re-submit
|
||||
them for the next IOCCC.</p>
|
||||
<p>There is a risk in submitting an entry that is similar to a well used
|
||||
theme by previous winning entries. Previous authors set a very high bar.
|
||||
A new winning entry must not only compete against submissions from the
|
||||
current year, they must also excel over any similar entries in some
|
||||
particularly impressive way.</p>
|
||||
<h2 id="on-the-delay-in-releasing-the-winning-entries">On the delay in
|
||||
releasing the winning entries</h2>
|
||||
<p>There is a risk in submitting an entry that is similar to a well
|
||||
used theme by previous winning entries. Previous authors set a very high
|
||||
bar. A new winning entry must not only compete against submissions
|
||||
from the current year, they must also excel over any similar entries
|
||||
in some particularly impressive way.</p>
|
||||
<h2 id="on-the-delay-in-releasing-the-winning-entries">On the delay in releasing the winning entries</h2>
|
||||
<p>We apologize on the delay of sending the authors the tarball for them
|
||||
to review. There were some unforeseen events, such as unplanned
|
||||
mandatory business travel, the death of an IOCCC judge’s mother, etc.
|
||||
that impacted our planned schedule for building the tarball of this
|
||||
year’s winning entries.</p>
|
||||
<p>During some of these forced delays, we took the time to better
|
||||
automate some of the tools needed to package the source for the winning
|
||||
entries to review and to post the edited entries to the web site. It is
|
||||
our intent that these changes made during those delays will make
|
||||
releasing future winning IOCCC entries a faster procedure.</p>
|
||||
<p>p.s. The final advice given to Landon by his mom: “Have fun.” We
|
||||
recommend following this advice where possible.</p>
|
||||
to review. There were some unforeseen events, such as unplanned mandatory
|
||||
business travel, the death of an IOCCC judge’s mother, etc. that impacted
|
||||
our planned schedule for building the tarball of this year’s winning entries.</p>
|
||||
<p>During some of these forced delays, we took the time to better automate
|
||||
some of the tools needed to package the source for the winning entries to review
|
||||
and to post the edited entries to the web site. It is our intent that
|
||||
these changes made during those delays will make releasing future winning IOCCC
|
||||
entries a faster procedure.</p>
|
||||
<p>p.s. The final advice given to Landon by his mom: “Have fun.”
|
||||
We recommend following this advice where possible.</p>
|
||||
<h2 id="final-comments">Final Comments</h2>
|
||||
<p>Please feel free to send us comments and suggestions about the
|
||||
competition, this README or anything else that you would like to see in
|
||||
future contests.</p>
|
||||
<p>If you use, distribute or publish these entries in some way, please
|
||||
drop us a line. We enjoy seeing who, where and how the contest is
|
||||
used.</p>
|
||||
<p>If you have problems with any of the entries, AND YOU HAVE A FIX,
|
||||
please send us the fix (patch file or the entire changed file).</p>
|
||||
<p>For the latest information on how to contact the IOCCC Judges please
|
||||
visit</p>
|
||||
<p>If you use, distribute or publish these entries in some way, please drop
|
||||
us a line. We enjoy seeing who, where and how the contest is used.</p>
|
||||
<p>If you have problems with any of the entries, AND YOU HAVE A FIX, please
|
||||
send us the fix (patch file or the entire changed file).</p>
|
||||
<p>For the latest information on how to contact the IOCCC Judges please visit</p>
|
||||
<ul>
|
||||
<li><a href="../contact.html">contact.html</a></li>
|
||||
</ul>
|
||||
@@ -212,41 +200,28 @@ visit</p>
|
||||
<li><a href="../news/html">news.html</a></li>
|
||||
</ul>
|
||||
<h1 id="copyright-and-license">Copyright and License</h1>
|
||||
<p>Copyright (C) 2014,2024, Landon Curt Noll and Leonid A. Broukhis. All
|
||||
Rights Reserved. This work is licensed under a <a
|
||||
href="https://creativecommons.org/licenses/by-sa/4.0/">Creative Commons
|
||||
CC BY-SA 4.0 DEED Attribution-ShareAlike 4.0 International</a> license.
|
||||
If you do use this work in some form, the <a href="../judges.html">IOCCC
|
||||
judges</a> would appreciate (but does not require) if you were to <a
|
||||
href="../contact.html">send us a note about your use</a>.</p>
|
||||
<p>Copyright (C) 2014,2024, Landon Curt Noll and Leonid A. Broukhis. All Rights Reserved.
|
||||
This work is licensed under a <a href="https://creativecommons.org/licenses/by-sa/4.0/">Creative Commons CC BY-SA 4.0 DEED Attribution-ShareAlike
|
||||
4.0 International</a> license.
|
||||
If you do use this work in some form, the <a href="../judges.html">IOCCC judges</a> would appreciate
|
||||
(but does not require) if you were to <a href="../contact.html">send us a note about your use</a>.</p>
|
||||
|
||||
<!-- END: this line ends content for HTML phase 21 by: bin/pandoc-wrapper.sh via bin/md2html.sh -->
|
||||
<!-- START: this line starts content for HTML phase 22 by: bin/output-year-index.sh via bin/md2html.sh -->
|
||||
|
||||
<!-- START: this line starts content generated by: bin/output-year-index.sh -->
|
||||
|
||||
<h1
|
||||
id="winning-entries-of-2014---the-23rd-ioccc"><a name=inventory></a><a name=2014></a>Winning
|
||||
Entries of 2014 - The 23rd IOCCC</h1>
|
||||
<p><strong>Download IOCCC</strong> <a
|
||||
href="2014/ioccc.2014.tar.bz2">2014 entry source</a></p>
|
||||
<h1 id="winning-entries-of-2014---the-23rd-ioccc"><a name=inventory></a><a name=2014></a>Winning Entries of 2014 - The 23rd IOCCC</h1>
|
||||
<p><strong>Download IOCCC</strong> <a href="2014/ioccc.2014.tar.bz2">2014 entry source</a></p>
|
||||
<ul>
|
||||
<li><a href="birken/index.html">2014/birken</a> - Best use of port
|
||||
1701</li>
|
||||
<li><a href="deak/index.html">2014/deak</a> - Most underscored
|
||||
argument</li>
|
||||
<li><a href="endoh1/index.html">2014/endoh1</a> - Most square (YODA
|
||||
award)</li>
|
||||
<li><a href="endoh2/index.html">2014/endoh2</a> - Best use of
|
||||
bioinformatics</li>
|
||||
<li><a href="maffiodo1/index.html">2014/maffiodo1</a> - Homage to a
|
||||
classic game</li>
|
||||
<li><a href="maffiodo2/index.html">2014/maffiodo2</a> - Most tweetable
|
||||
entry</li>
|
||||
<li><a href="morgan/index.html">2014/morgan</a> - Most likely to
|
||||
succeed</li>
|
||||
<li><a href="sinon/index.html">2014/sinon</a> - Best choice of
|
||||
optimization</li>
|
||||
<li><a href="birken/index.html">2014/birken</a> - Best use of port 1701</li>
|
||||
<li><a href="deak/index.html">2014/deak</a> - Most underscored argument</li>
|
||||
<li><a href="endoh1/index.html">2014/endoh1</a> - Most square (YODA award)</li>
|
||||
<li><a href="endoh2/index.html">2014/endoh2</a> - Best use of bioinformatics</li>
|
||||
<li><a href="maffiodo1/index.html">2014/maffiodo1</a> - Homage to a classic game</li>
|
||||
<li><a href="maffiodo2/index.html">2014/maffiodo2</a> - Most tweetable entry</li>
|
||||
<li><a href="morgan/index.html">2014/morgan</a> - Most likely to succeed</li>
|
||||
<li><a href="sinon/index.html">2014/sinon</a> - Best choice of optimization</li>
|
||||
<li><a href="skeggs/index.html">2014/skeggs</a> - Most dynamic</li>
|
||||
<li><a href="vik/index.html">2014/vik</a> - Best handling of beeps</li>
|
||||
<li><a href="wiedijk/index.html">2014/wiedijk</a> - Most functional</li>
|
||||
|
||||
+115
-169
@@ -129,9 +129,9 @@
|
||||
|
||||
<h2 id="author"><a name="author"></a>Author:</h2>
|
||||
<ul>
|
||||
<li>Name: <a href="../../authors.html#Sandro_Maffiodo">Sandro
|
||||
Maffiodo</a><br> Location: <a href="../../location.html#IT">IT</a> -
|
||||
<em>Italian Republic</em> (<em>Italy</em>) <br><br></li>
|
||||
<li>Name: <a href="../../authors.html#Sandro_Maffiodo">Sandro Maffiodo</a><br>
|
||||
Location: <a href="../../location.html#IT">IT</a> - <em>Italian Republic</em> (<em>Italy</em>)
|
||||
<br><br></li>
|
||||
</ul>
|
||||
|
||||
<!-- END: next line ends content generated by: bin/output-index-author.sh -->
|
||||
@@ -140,15 +140,13 @@ Maffiodo</a><br> Location: <a href="../../location.html#IT">IT</a> -
|
||||
<!-- START: this line starts content for HTML phase 21 by: bin/pandoc-wrapper.sh via bin/md2html.sh -->
|
||||
|
||||
<h2 id="to-build">To build:</h2>
|
||||
<p>This entry requires SDL to be installed. See <a
|
||||
href="../../faq.html#SDL">FAQ 3.8</a> if you don’t know how to do this
|
||||
for your system.</p>
|
||||
<p>This entry requires SDL to be installed. See <a href="../../faq.html#SDL">FAQ 3.8</a> if you
|
||||
don’t know how to do this for your system.</p>
|
||||
<div class="sourceCode" id="cb1"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb1-1"><a href="#cb1-1" aria-hidden="true" tabindex="-1"></a><span class="fu">make</span></span></code></pre></div>
|
||||
<h3 id="bugs-and-misfeatures">Bugs and (Mis)features:</h3>
|
||||
<p>The current status of this entry is:</p>
|
||||
<pre><code>STATUS: INABIAF - please **DO NOT** fix</code></pre>
|
||||
<p>For more detailed information see <a
|
||||
href="../../bugs.html#2014_maffiodo1">2014 maffiodo1 bugs</a>.</p>
|
||||
<p>For more detailed information see <a href="../../bugs.html#2014_maffiodo1">2014 maffiodo1 bugs</a>.</p>
|
||||
<h2 id="to-use">To use:</h2>
|
||||
<div class="sourceCode" id="cb3"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb3-1"><a href="#cb3-1" aria-hidden="true" tabindex="-1"></a><span class="fu">cat</span> game.level <span class="kw">|</span> <span class="ex">./prog</span> 320 200 800 300 128 144 game.rgba game.wav 10343679</span></code></pre></div>
|
||||
<p>The parameters to the program are:</p>
|
||||
@@ -161,88 +159,79 @@ href="../../bugs.html#2014_maffiodo1">2014 maffiodo1 bugs</a>.</p>
|
||||
<li>Sprites image height.</li>
|
||||
<li>Filename of the sprites image (raw RGBA image).</li>
|
||||
<li>Filename of the music (WAVE 8000 Hz 8bit Mono).</li>
|
||||
<li>Sky color. This number depends on the system where you run the
|
||||
program. See note on macOS.</li>
|
||||
<li>Sky color. This number depends on the system where you run the program. See
|
||||
note on macOS.</li>
|
||||
</ol>
|
||||
<h2 id="try">Try:</h2>
|
||||
<div class="sourceCode" id="cb4"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb4-1"><a href="#cb4-1" aria-hidden="true" tabindex="-1"></a><span class="ex">./giana.sh</span></span>
|
||||
<span id="cb4-2"><a href="#cb4-2" aria-hidden="true" tabindex="-1"></a></span>
|
||||
<span id="cb4-3"><a href="#cb4-3" aria-hidden="true" tabindex="-1"></a><span class="ex">./mario.sh</span></span></code></pre></div>
|
||||
<p>If you end up telnetting to the server (feature of <a
|
||||
href="mario.sh">mario.sh</a>) you can try:</p>
|
||||
<p>If you end up telnetting to the server (feature of <a href="mario.sh">mario.sh</a>) you can
|
||||
try:</p>
|
||||
<pre><code>ls # show files including games
|
||||
wumpus.bas # play Hunt the Wumpus
|
||||
advent.gam # you know what this is! :-)
|
||||
starwars # animated Star Wars 'film'</code></pre>
|
||||
<p>If you wish to change the width and height, defaulting at 640 x 480,
|
||||
say to 800 x 800, try:</p>
|
||||
<p>If you wish to change the width and height, defaulting at 640 x 480, say to
|
||||
800 x 800, try:</p>
|
||||
<div class="sourceCode" id="cb6"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb6-1"><a href="#cb6-1" aria-hidden="true" tabindex="-1"></a><span class="va">ROWS</span><span class="op">=</span>800 <span class="va">COLS</span><span class="op">=</span>800 <span class="ex">./mario.sh</span></span>
|
||||
<span id="cb6-2"><a href="#cb6-2" aria-hidden="true" tabindex="-1"></a></span>
|
||||
<span id="cb6-3"><a href="#cb6-3" aria-hidden="true" tabindex="-1"></a><span class="va">ROWS</span><span class="op">=</span>800 <span class="va">COLS</span><span class="op">=</span>800 <span class="ex">./giana.sh</span></span></code></pre></div>
|
||||
<h2 id="judges-remarks">Judges’ remarks:</h2>
|
||||
<p>A classic for a particular generation. Like all good programs, being
|
||||
data driven means you can do fun things in small spaces.</p>
|
||||
<p>NOTE: the author states to use <code>tabsize=4</code> to see the
|
||||
magic of the formatting of the code. In <code>vim</code> you can do:</p>
|
||||
<p>A classic for a particular generation. Like all good programs, being data
|
||||
driven means you can do fun things in small spaces.</p>
|
||||
<p>NOTE: the author states to use <code>tabsize=4</code> to see the magic of the formatting of
|
||||
the code. In <code>vim</code> you can do:</p>
|
||||
<pre><code>:set tabstop=4</code></pre>
|
||||
<p>in command mode to see this effect. You don’t need to modify your
|
||||
<code>.vimrc</code> file! You can also use <code>expand</code> as
|
||||
described below by the author if your terminal has enough rows and you
|
||||
don’t want to move about in the code. The vim command should immediately
|
||||
take effect.</p>
|
||||
<p>in command mode to see this effect. You don’t need to modify your <code>.vimrc</code> file!
|
||||
You can also use <code>expand</code> as described below by the author if your terminal has
|
||||
enough rows and you don’t want to move about in the code. The vim command should
|
||||
immediately take effect.</p>
|
||||
<h2 id="authors-remarks">Author’s remarks:</h2>
|
||||
<h3 id="remarks">Remarks</h3>
|
||||
<p>Use <code>tabsize=4</code> to see the magic.</p>
|
||||
<div class="sourceCode" id="cb8"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb8-1"><a href="#cb8-1" aria-hidden="true" tabindex="-1"></a><span class="fu">expand</span> <span class="at">-t</span> 4 prog.c</span></code></pre></div>
|
||||
<p>The program returns 0 if the player wins or <em>non-zero</em> if the
|
||||
player loses so you can test it and make something useful (or not), like
|
||||
this:</p>
|
||||
<p>The program returns 0 if the player wins or <em>non-zero</em> if the player loses so
|
||||
you can test it and make something useful (or not), like this:</p>
|
||||
<div class="sourceCode" id="cb9"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb9-1"><a href="#cb9-1" aria-hidden="true" tabindex="-1"></a><span class="fu">cat</span> mario.level <span class="kw">|</span> <span class="ex">./prog</span> 320 200 800 300 128 144 mario.rgba mario8.wav 10343679 <span class="kw">&&</span> <span class="ex">telnet</span> telehack.com 23</span></code></pre></div>
|
||||
<p>and type in: <code>starwars</code></p>
|
||||
<p>This is an engine for <a
|
||||
href="https://en.wikipedia.org/wiki/Platform_game">platform game</a>. It
|
||||
can be used to create games like the legendary <a
|
||||
href="http://en.wikipedia.org/wiki/Super_Mario_Bros.">Super Mario
|
||||
<p>This is an engine for <a href="https://en.wikipedia.org/wiki/Platform_game">platform
|
||||
game</a>. It can be used to create
|
||||
games like the legendary <a href="http://en.wikipedia.org/wiki/Super_Mario_Bros.">Super Mario
|
||||
Bros</a>.</p>
|
||||
<p>With this simple and clear source code you can create all the games
|
||||
you want, for free!</p>
|
||||
<p>In my two tests I tried to create one level of <a
|
||||
href="http://en.wikipedia.org/wiki/Super_Mario_Bros.">Super Mario
|
||||
Bros</a> and one of <a
|
||||
href="http://en.wikipedia.org/wiki/The_Great_Giana_Sisters">The Great
|
||||
<p>With this simple and clear source code you can create all the games you want,
|
||||
for free!</p>
|
||||
<p>In my two tests I tried to create one level of <a href="http://en.wikipedia.org/wiki/Super_Mario_Bros.">Super Mario
|
||||
Bros</a> and one of <a href="http://en.wikipedia.org/wiki/The_Great_Giana_Sisters">The Great
|
||||
Giana Sisters</a>.</p>
|
||||
<p>Both games are classic <a
|
||||
href="https://en.wikipedia.org/wiki/Platform_game">platform games</a>
|
||||
and both share the same fundamental rules:</p>
|
||||
<p>Both games are classic <a href="https://en.wikipedia.org/wiki/Platform_game">platform
|
||||
games</a> and both share the same
|
||||
fundamental rules:</p>
|
||||
<ul>
|
||||
<li><p>There is a character.</p></li>
|
||||
<li><p>There are power-ups that can change the look of the character
|
||||
and/or give the character more or different powers or
|
||||
abilities!</p></li>
|
||||
<li><p>There are walls, floors and ceilings. The character can move and
|
||||
jump over these type of obstacles but cannot walk through them.</p></li>
|
||||
<li><p>There are enemies and if the character collides with an enemy,
|
||||
the character dies or loses its powers.</p></li>
|
||||
<li><p>There are power-ups that can change the look of the character and/or give the
|
||||
character more or different powers or abilities!</p></li>
|
||||
<li><p>There are walls, floors and ceilings. The character can move and jump over
|
||||
these type of obstacles but cannot walk through them.</p></li>
|
||||
<li><p>There are enemies and if the character collides with an enemy, the character
|
||||
dies or loses its powers.</p></li>
|
||||
</ul>
|
||||
<h3 id="running-under-macos">Running under macOS</h3>
|
||||
<p>[NOTE: this seems to no longer be the case as of 2023 and most likely
|
||||
much earlier. However one can change the look of the game doing this
|
||||
anyway:]</p>
|
||||
<p>The color of the sky is wrong on macOS. You need to flip some bytes
|
||||
from the last parameter of the program:</p>
|
||||
<p>[NOTE: this seems to no longer be the case as of 2023 and most likely much
|
||||
earlier. However one can change the look of the game doing this anyway:]</p>
|
||||
<p>The color of the sky is wrong on macOS. You need to flip some bytes from the
|
||||
last parameter of the program:</p>
|
||||
<ul>
|
||||
<li><p>MARIO LAST PARAMETER: <code>4292124159</code></p></li>
|
||||
<li><p>GIANA LAST PARAMETER: <code>3243070463</code></p></li>
|
||||
</ul>
|
||||
<h3 id="regarding-how-to-compile">Regarding how to compile</h3>
|
||||
<p>The code requires <code>SDL1</code>.</p>
|
||||
<p>The build process will generate some warnings (~60 with clang)
|
||||
about:</p>
|
||||
<p>The build process will generate some warnings (~60 with clang) about:</p>
|
||||
<ul>
|
||||
<li><code>incompatible pointer types</code>: because all pointers are
|
||||
declared to <code>int</code> or <code>char</code>, to save bytes.</li>
|
||||
<li><code>type specifier missing, defaults to 'int'</code>: because I
|
||||
need to save bytes.</li>
|
||||
<li><code>incompatible pointer types</code>: because all pointers are declared to <code>int</code> or
|
||||
<code>char</code>, to save bytes.</li>
|
||||
<li><code>type specifier missing, defaults to 'int'</code>: because I need to save bytes.</li>
|
||||
<li><code>using the result of an assignment as a condition without parentheses</code>:
|
||||
because <code>while(c=getchar())</code> is not evil.</li>
|
||||
</ul>
|
||||
@@ -257,18 +246,17 @@ because <code>while(c=getchar())</code> is not evil.</li>
|
||||
<li>Sprites image height.</li>
|
||||
<li>Filename of the sprites image (raw RGBA image).</li>
|
||||
<li>Filename of the music (WAVE 8000 Hz 8bit Mono).</li>
|
||||
<li>Sky color. This number depends on the system where you run the
|
||||
program. See note on macOS.</li>
|
||||
<li>Sky color. This number depends on the system where you run the program. See
|
||||
note on macOS.</li>
|
||||
</ol>
|
||||
<h2 id="sprites">Sprites</h2>
|
||||
<p>The program read a single image that contains all the game sprites.
|
||||
The image must be a grid of 8xN sprites. The size of a single sprite
|
||||
must be square. The program calculates the size in this way:</p>
|
||||
<p>The program read a single image that contains all the game sprites. The image
|
||||
must be a grid of 8xN sprites. The size of a single sprite must be square. The
|
||||
program calculates the size in this way:</p>
|
||||
<pre><code>sprite_size = image_width / 8</code></pre>
|
||||
<p>Each sprite is identified by its position inside the grid, counting
|
||||
line by line, from left to right (for example sprite 0 is the top left
|
||||
sprite in the grid, sprite 8 is the first sprite of the second row of
|
||||
the grid etc.).</p>
|
||||
<p>Each sprite is identified by its position inside the grid, counting line by
|
||||
line, from left to right (for example sprite 0 is the top left sprite in the
|
||||
grid, sprite 8 is the first sprite of the second row of the grid etc.).</p>
|
||||
<p>Some positions of the grid have a predefined purpose:</p>
|
||||
<pre><code>Position | Description
|
||||
:-----------------|:--------------
|
||||
@@ -291,32 +279,25 @@ the grid etc.).</p>
|
||||
24 | Player dead
|
||||
32 | Player won
|
||||
40 | Super player won</code></pre>
|
||||
<p>All the others sprites can be used as you want, depending on the game
|
||||
you want to create.</p>
|
||||
<p>All the others sprites can be used as you want, depending on the game you want
|
||||
to create.</p>
|
||||
<h2 id="levels">Levels</h2>
|
||||
<p>The program reads the level description from <code>stdin</code>.</p>
|
||||
<p>The level description is a sequence of rows where each row describe
|
||||
an object. You can input as many objects as you want but the maximum
|
||||
number of objects handled by the program is 333. You can modify this
|
||||
value by editing the source here:</p>
|
||||
<p>The level description is a sequence of rows where each row describe an object.
|
||||
You can input as many objects as you want but the maximum number of objects
|
||||
handled by the program is 333. You can modify this value by editing the source
|
||||
here:</p>
|
||||
<div class="sourceCode" id="cb12"><pre class="sourceCode c"><code class="sourceCode c"><span id="cb12-1"><a href="#cb12-1" aria-hidden="true" tabindex="-1"></a>C<span class="op">[</span><span class="dv">333</span><span class="op">*</span><span class="dv">7</span><span class="op">],</span>d<span class="op">=</span><span class="dv">333</span><span class="op">;</span></span></code></pre></div>
|
||||
<p>Each row has six columns:</p>
|
||||
<ol type="1">
|
||||
<li><code>Screen X</code> : <code>x</code> position of the object in the
|
||||
level.</li>
|
||||
<li><code>Screen Y</code> : <code>y</code> position of the object in the
|
||||
level.</li>
|
||||
<li><code>Sprite</code> : <code>id</code> of the sprite to be used for
|
||||
the object.</li>
|
||||
<li><code>CLASSFLAGS</code> : a bitmask that describe how the object
|
||||
behaves.</li>
|
||||
<li><code>CLASSPARAM0</code>: a parameter that depends on
|
||||
<code>CLASSFLAGS</code>.</li>
|
||||
<li><code>CLASSPARAM1</code>: a parameter that depends on
|
||||
<code>CLASSFLAGS</code>.</li>
|
||||
<li><code>Screen X</code> : <code>x</code> position of the object in the level.</li>
|
||||
<li><code>Screen Y</code> : <code>y</code> position of the object in the level.</li>
|
||||
<li><code>Sprite</code> : <code>id</code> of the sprite to be used for the object.</li>
|
||||
<li><code>CLASSFLAGS</code> : a bitmask that describe how the object behaves.</li>
|
||||
<li><code>CLASSPARAM0</code>: a parameter that depends on <code>CLASSFLAGS</code>.</li>
|
||||
<li><code>CLASSPARAM1</code>: a parameter that depends on <code>CLASSFLAGS</code>.</li>
|
||||
</ol>
|
||||
<p><code>CLASSFLAGS</code> must be a combination (bitwise OR) of some of
|
||||
these constants:</p>
|
||||
<p><code>CLASSFLAGS</code> must be a combination (bitwise OR) of some of these constants:</p>
|
||||
<ul>
|
||||
<li><p><code>ENEMY</code> (<code>1</code>)</p>
|
||||
<pre><code> An enemy. CLASSPARAM0 can be 0 if the enemies don't move, 1 if the
|
||||
@@ -352,111 +333,76 @@ these constants:</p>
|
||||
<pre><code> This object is like a BLOCK but when the player hits the object
|
||||
from below, the object disappears.</code></pre></li>
|
||||
</ul>
|
||||
<p>If <code>CLASSFLAGS</code> is <code>0</code> the object only has an
|
||||
aesthetic function.</p>
|
||||
<p>The last row of the level descriptor must have all its columns set
|
||||
equal to <code>-1</code>.</p>
|
||||
<p>If <code>CLASSFLAGS</code> is <code>0</code> the object only has an aesthetic function.</p>
|
||||
<p>The last row of the level descriptor must have all its columns set equal to
|
||||
<code>-1</code>.</p>
|
||||
<h3 id="limitations">Limitations</h3>
|
||||
<p>Some classical features are missing: throwing objects, shooting,
|
||||
multiple lives, score tracking. You can add those features if you
|
||||
want!</p>
|
||||
<p>The program allows only one level. It’s easy to add a menu and
|
||||
multiple levels but the size of the engine would too big for the
|
||||
contest.</p>
|
||||
<p>When the <code>Super character</code> becomes bigger
|
||||
(<code>ZOOM</code> flag), the character can collide with blocks and get
|
||||
stuck inside them. This is a KNOWN BUG. When your player become bigger,
|
||||
stay away from blocks!</p>
|
||||
<p>Some classical features are missing: throwing objects, shooting, multiple lives,
|
||||
score tracking. You can add those features if you want!</p>
|
||||
<p>The program allows only one level. It’s easy to add a menu and multiple levels
|
||||
but the size of the engine would too big for the contest.</p>
|
||||
<p>When the <code>Super character</code> becomes bigger (<code>ZOOM</code> flag), the character can
|
||||
collide with blocks and get stuck inside them. This is a KNOWN BUG. When your
|
||||
player become bigger, stay away from blocks!</p>
|
||||
<p>There’s only one audio track (game effects are missing).</p>
|
||||
<h3 id="credits">Credits</h3>
|
||||
<p>Some of the sprites used in the examples are identical to those of
|
||||
the original games; the others were designed by me.</p>
|
||||
<p>The music used in the examples have been <a
|
||||
href="https://en.wikipedia.org/wiki/Sample-rate_conversion">resampled</a>,
|
||||
starting from the original versions for the <a
|
||||
href="http://en.wikipedia.org/wiki/Amiga">Commodore Amiga</a> and <a
|
||||
href="http://en.wikipedia.org/wiki/Nintendo_Entertainment_System">Nintendo
|
||||
<p>Some of the sprites used in the examples are identical to those of the original
|
||||
games; the others were designed by me.</p>
|
||||
<p>The music used in the examples have been
|
||||
<a href="https://en.wikipedia.org/wiki/Sample-rate_conversion">resampled</a>, starting from
|
||||
the original versions for the <a href="http://en.wikipedia.org/wiki/Amiga">Commodore
|
||||
Amiga</a> and <a href="http://en.wikipedia.org/wiki/Nintendo_Entertainment_System">Nintendo
|
||||
NES</a>.</p>
|
||||
<p><a href="http://en.wikipedia.org/wiki/Super_Mario_Bros.">Super Mario
|
||||
Bros</a> is a game created by <a
|
||||
href="https://en.wikipedia.org/wiki/Nintendo">Nintendo Co., Ltd</a>. My
|
||||
use of the <a
|
||||
href="https://en.wikipedia.org/wiki/Sprite_(computer_graphics)">sprites</a>
|
||||
does not intend to infringe the <a
|
||||
href="https://en.wikipedia.org/wiki/Intellectual_property">intellectual
|
||||
property</a> of Nintendo but only demonstrates the operation of the
|
||||
program. From my point of view this is a tribute to the legendary game
|
||||
<a href="http://en.wikipedia.org/wiki/Super_Mario_Bros.">Super Mario
|
||||
<p><a href="http://en.wikipedia.org/wiki/Super_Mario_Bros.">Super Mario Bros</a> is a game
|
||||
created by <a href="https://en.wikipedia.org/wiki/Nintendo">Nintendo Co., Ltd</a>. My use
|
||||
of the <a href="https://en.wikipedia.org/wiki/Sprite_(computer_graphics)">sprites</a> does
|
||||
not intend to infringe the <a href="https://en.wikipedia.org/wiki/Intellectual_property">intellectual
|
||||
property</a> of Nintendo but
|
||||
only demonstrates the operation of the program. From my point of view this is a
|
||||
tribute to the legendary game <a href="http://en.wikipedia.org/wiki/Super_Mario_Bros.">Super Mario
|
||||
Bros</a>!</p>
|
||||
<p><a href="http://en.wikipedia.org/wiki/The_Great_Giana_Sisters">The
|
||||
Great Giana Sisters</a> is the game created by <a
|
||||
href="https://www.ign.com/games/producer/time-warp-productions">Time
|
||||
Warp Productions</a> and my justification for the sprites for Mario are
|
||||
the same for this game. Long live <a
|
||||
href="http://en.wikipedia.org/wiki/The_Great_Giana_Sisters">The Great
|
||||
Giana Sisters</a> !! :)</p>
|
||||
<h2 id="copyright-and-cc-by-sa-4.0-license">Copyright and CC BY-SA 4.0
|
||||
License:</h2>
|
||||
<p>This file is Copyright (c) 2023 by Landon Curt Noll. All Rights
|
||||
Reserved. You are free to share and adapt this file under the terms of
|
||||
this license:</p>
|
||||
<p><a href="http://en.wikipedia.org/wiki/The_Great_Giana_Sisters">The Great Giana
|
||||
Sisters</a> is the game
|
||||
created by <a href="https://www.ign.com/games/producer/time-warp-productions">Time Warp
|
||||
Productions</a> and my
|
||||
justification for the sprites for Mario are the same for this game. Long live
|
||||
<a href="http://en.wikipedia.org/wiki/The_Great_Giana_Sisters">The Great Giana
|
||||
Sisters</a> !! :)</p>
|
||||
<h2 id="copyright-and-cc-by-sa-4.0-license">Copyright and CC BY-SA 4.0 License:</h2>
|
||||
<p>This file is Copyright (c) 2023 by Landon Curt Noll. All Rights Reserved.
|
||||
You are free to share and adapt this file under the terms of this license:</p>
|
||||
<pre><code>Creative Commons Attribution-ShareAlike 4.0 International (CC BY-SA 4.0)</code></pre>
|
||||
<p>For more information, see:
|
||||
https://creativecommons.org/licenses/by-sa/4.0/</p>
|
||||
<p>For more information, see: https://creativecommons.org/licenses/by-sa/4.0/</p>
|
||||
|
||||
<!-- END: this line ends content for HTML phase 21 by: bin/pandoc-wrapper.sh via bin/md2html.sh -->
|
||||
<!-- START: this line starts content for HTML phase 22 by: bin/output-index-inventory.sh via bin/md2html.sh -->
|
||||
|
||||
<!-- START: this line starts content generated by: bin/output-index-inventory.sh -->
|
||||
|
||||
<h1 id="inventory-for-2014maffiodo1"><a name="inventory"></a>Inventory
|
||||
for 2014/maffiodo1</h1>
|
||||
<h1 id="inventory-for-2014maffiodo1"><a name="inventory"></a>Inventory for 2014/maffiodo1</h1>
|
||||
<p><a href="#top">Jump to top</a></p>
|
||||
<h2 id="primary-files">Primary files</h2>
|
||||
<ul>
|
||||
<li><a
|
||||
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2014/maffiodo1/prog.c">prog.c</a>
|
||||
- entry source</li>
|
||||
<li><a
|
||||
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2014/maffiodo1/Makefile">Makefile</a>
|
||||
- entry Makefile</li>
|
||||
<li><a
|
||||
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2014/maffiodo1/prog.orig.c">prog.orig.c</a>
|
||||
- original source</li>
|
||||
<li><a
|
||||
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2014/maffiodo1/giana.sh">giana.sh</a>
|
||||
- demonstrate with The Great Giana Sisters</li>
|
||||
<li><a
|
||||
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2014/maffiodo1/mario.sh">mario.sh</a>
|
||||
- demonstrate with Super Mario Brothers</li>
|
||||
<li><a href="screenshot-giana.png">screenshot-giana.png</a> - gameplay
|
||||
screenshot</li>
|
||||
<li><a href="screenshot-mario.png">screenshot-mario.png</a> - gameplay
|
||||
screenshot</li>
|
||||
<li><a
|
||||
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2014/maffiodo1/giana.level">giana.level</a>
|
||||
- game level data</li>
|
||||
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2014/maffiodo1/prog.c">prog.c</a> - entry source</li>
|
||||
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2014/maffiodo1/Makefile">Makefile</a> - entry Makefile</li>
|
||||
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2014/maffiodo1/prog.orig.c">prog.orig.c</a> - original source</li>
|
||||
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2014/maffiodo1/giana.sh">giana.sh</a> - demonstrate with The Great Giana Sisters</li>
|
||||
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2014/maffiodo1/mario.sh">mario.sh</a> - demonstrate with Super Mario Brothers</li>
|
||||
<li><a href="screenshot-giana.png">screenshot-giana.png</a> - gameplay screenshot</li>
|
||||
<li><a href="screenshot-mario.png">screenshot-mario.png</a> - gameplay screenshot</li>
|
||||
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2014/maffiodo1/giana.level">giana.level</a> - game level data</li>
|
||||
<li><a href="giana8.wav">giana8.wav</a> - sound file for game</li>
|
||||
<li><a
|
||||
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2014/maffiodo1/mario.level">mario.level</a>
|
||||
- game level data</li>
|
||||
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2014/maffiodo1/mario.level">mario.level</a> - game level data</li>
|
||||
<li><a href="mario8.wav">mario8.wav</a> - sound file for game</li>
|
||||
<li><a href="2014_maffiodo1.tar.bz2">2014_maffiodo1.tar.bz2</a> -
|
||||
download entry source</li>
|
||||
<li><a href="2014_maffiodo1.tar.bz2">2014_maffiodo1.tar.bz2</a> - download entry source</li>
|
||||
</ul>
|
||||
<h2 id="secondary-files">Secondary files</h2>
|
||||
<ul>
|
||||
<li><a href="index.html">index.html</a> - entry home page</li>
|
||||
<li><a
|
||||
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2014/maffiodo1/.entry.json">.entry.json</a>
|
||||
- description of entry in JSON</li>
|
||||
<li><a
|
||||
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2014/maffiodo1/.gitignore">.gitignore</a>
|
||||
- list of files that should not be committed under git</li>
|
||||
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2014/maffiodo1/.entry.json">.entry.json</a> - description of entry in JSON</li>
|
||||
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2014/maffiodo1/.gitignore">.gitignore</a> - list of files that should not be committed under git</li>
|
||||
<li><a href=".path">.path</a> - directory path from top directory</li>
|
||||
<li><a
|
||||
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2014/maffiodo1/README.md">README.md</a>
|
||||
- markdown source for index.html</li>
|
||||
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2014/maffiodo1/README.md">README.md</a> - markdown source for index.html</li>
|
||||
<li><a href="giana.rgba">giana.rgba</a> - raw RGBA image</li>
|
||||
<li><a href="mario.rgba">mario.rgba</a> - raw RGBA image</li>
|
||||
</ul>
|
||||
|
||||
+46
-76
@@ -129,9 +129,9 @@
|
||||
|
||||
<h2 id="author"><a name="author"></a>Author:</h2>
|
||||
<ul>
|
||||
<li>Name: <a href="../../authors.html#Sandro_Maffiodo">Sandro
|
||||
Maffiodo</a><br> Location: <a href="../../location.html#IT">IT</a> -
|
||||
<em>Italian Republic</em> (<em>Italy</em>) <br><br></li>
|
||||
<li>Name: <a href="../../authors.html#Sandro_Maffiodo">Sandro Maffiodo</a><br>
|
||||
Location: <a href="../../location.html#IT">IT</a> - <em>Italian Republic</em> (<em>Italy</em>)
|
||||
<br><br></li>
|
||||
</ul>
|
||||
|
||||
<!-- END: next line ends content generated by: bin/output-index-author.sh -->
|
||||
@@ -141,45 +141,40 @@ Maffiodo</a><br> Location: <a href="../../location.html#IT">IT</a> -
|
||||
|
||||
<h2 id="to-build">To build:</h2>
|
||||
<div class="sourceCode" id="cb1"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb1-1"><a href="#cb1-1" aria-hidden="true" tabindex="-1"></a><span class="fu">make</span></span></code></pre></div>
|
||||
<p>There is a 121 byte version provided by the author. See <a
|
||||
href="#alternate-code">Alternate code</a> below.</p>
|
||||
<p>There is a 121 byte version provided by the author. See <a href="#alternate-code">Alternate
|
||||
code</a> below.</p>
|
||||
<h3 id="bugs-and-misfeatures">Bugs and (Mis)features:</h3>
|
||||
<p>The current status of this entry is:</p>
|
||||
<pre><code>STATUS: INABIAF - please **DO NOT** fix</code></pre>
|
||||
<p>For more detailed information see <a
|
||||
href="../../bugs.html#2014_maffiodo2">2014 maffiodo2 bugs</a>.</p>
|
||||
<p>For more detailed information see <a href="../../bugs.html#2014_maffiodo2">2014 maffiodo2 bugs</a>.</p>
|
||||
<h2 id="to-use">To use:</h2>
|
||||
<div class="sourceCode" id="cb3"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb3-1"><a href="#cb3-1" aria-hidden="true" tabindex="-1"></a><span class="ex">./prog</span> arg</span></code></pre></div>
|
||||
<h2 id="try">Try:</h2>
|
||||
<div class="sourceCode" id="cb4"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb4-1"><a href="#cb4-1" aria-hidden="true" tabindex="-1"></a><span class="ex">./try.sh</span></span></code></pre></div>
|
||||
<h2 id="alternate-code">Alternate code:</h2>
|
||||
<p>This shorter version is provided by the author. It has a fixed ramp
|
||||
and so not as fun but it’s 121 bytes instead of 140.</p>
|
||||
<p>This shorter version is provided by the author. It has a fixed ramp and so not
|
||||
as fun but it’s 121 bytes instead of 140.</p>
|
||||
<h3 id="alternate-build">Alternate build:</h3>
|
||||
<div class="sourceCode" id="cb5"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb5-1"><a href="#cb5-1" aria-hidden="true" tabindex="-1"></a><span class="fu">make</span> alt</span></code></pre></div>
|
||||
<h3 id="alternate-use">Alternate use:</h3>
|
||||
<div class="sourceCode" id="cb6"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb6-1"><a href="#cb6-1" aria-hidden="true" tabindex="-1"></a><span class="fu">cat</span> image.rgb <span class="kw">|</span> <span class="ex">./prog.alt</span></span></code></pre></div>
|
||||
<h2 id="judges-remarks">Judges’ remarks:</h2>
|
||||
<p>On the face of it :-) given what this program does one might wonder
|
||||
what makes this winning entry special. But when you realize the source
|
||||
is small enough for posting to social media that has a small size
|
||||
limit.</p>
|
||||
<p>Who will be the first to tweet this source? How many re-tweets will
|
||||
such tweet get? And how many people will really understand the
|
||||
tweet?</p>
|
||||
<p>Judges’ 2023 update: Last year we would have referred to a <a
|
||||
href="https://en.wikipedia.org/wiki/Mastodon_(social_network)#Comparison_to_Twitter">toot</a>,
|
||||
as in a <a href="https://fosstodon.org/@ioccc">Mastodon</a>
|
||||
<em>toot</em>. This year we might have mentioned the term <a
|
||||
href="https://www.itechpost.com/articles/115087/20221116/mastodon-officially-replaced-toot-publish.htm">publish</a>
|
||||
although we remain fond of the <a
|
||||
href="https://gizmodo.com/mastodon-toot-retired-twitter-tweet-equivalent-1849786221">historic
|
||||
Mastodon term, toot</a>.</p>
|
||||
<p>On the face of it :-) given what this program does one might wonder what makes
|
||||
this winning entry special. But when you realize the source is small enough for posting
|
||||
to social media that has a small size limit.</p>
|
||||
<p>Who will be the first to tweet this source? How many re-tweets will such tweet
|
||||
get? And how many people will really understand the tweet?</p>
|
||||
<p>Judges’ 2023 update: Last year we would have referred to a
|
||||
<a href="https://en.wikipedia.org/wiki/Mastodon_(social_network)#Comparison_to_Twitter">toot</a>,
|
||||
as in a <a href="https://fosstodon.org/@ioccc">Mastodon</a> <em>toot</em>.
|
||||
This year we might have mentioned the term
|
||||
<a href="https://www.itechpost.com/articles/115087/20221116/mastodon-officially-replaced-toot-publish.htm">publish</a>
|
||||
although we remain fond of the
|
||||
<a href="https://gizmodo.com/mastodon-toot-retired-twitter-tweet-equivalent-1849786221">historic Mastodon term, toot</a>.</p>
|
||||
<h2 id="authors-remarks">Author’s remarks:</h2>
|
||||
<h3 id="remarks">Remarks</h3>
|
||||
<p>This program convert an image to an ASCII ART. The program reads a
|
||||
raw RGB image from <code>stdin</code> and print the ASCII ART to
|
||||
<code>stdout</code>.</p>
|
||||
<p>This program convert an image to an ASCII ART. The program reads a raw RGB image
|
||||
from <code>stdin</code> and print the ASCII ART to <code>stdout</code>.</p>
|
||||
<p>The build process will raise some warnings about:</p>
|
||||
<ul>
|
||||
<li>declaration specifier missing, defaulting to ‘int’</li>
|
||||
@@ -187,82 +182,57 @@ raw RGB image from <code>stdin</code> and print the ASCII ART to
|
||||
</ul>
|
||||
<p>The program will crash if run without parameters.</p>
|
||||
<h3 id="screen-size">Screen size</h3>
|
||||
<p>If you have a terminal geometry than is different from the common
|
||||
80x25 you can modify the <em>output width</em> by changing the value of
|
||||
the first variable:</p>
|
||||
<p>If you have a terminal geometry than is different from the common 80x25 you can
|
||||
modify the <em>output width</em> by changing the value of the first variable:</p>
|
||||
<div class="sourceCode" id="cb7"><pre class="sourceCode c"><code class="sourceCode c"><span id="cb7-1"><a href="#cb7-1" aria-hidden="true" tabindex="-1"></a>d<span class="op">=</span><span class="dv">80</span><span class="op">,</span></span></code></pre></div>
|
||||
<h3 id="something-to-try">Something to try</h3>
|
||||
<p>Type this:</p>
|
||||
<div class="sourceCode" id="cb8"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb8-1"><a href="#cb8-1" aria-hidden="true" tabindex="-1"></a><span class="fu">cat</span> image.rgb <span class="kw">|</span> <span class="ex">./prog</span> <span class="st">" .:;Y0"</span></span></code></pre></div>
|
||||
<p>You can use your own image. Convert the image to a raw RGB image.
|
||||
Using ImageMagick it’s very simple:</p>
|
||||
<p>You can use your own image. Convert the image to a raw RGB image. Using
|
||||
ImageMagick it’s very simple:</p>
|
||||
<div class="sourceCode" id="cb9"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb9-1"><a href="#cb9-1" aria-hidden="true" tabindex="-1"></a><span class="ex">convert</span> <span class="at">-geometry</span> 80x source.jpg image.rgb</span></code></pre></div>
|
||||
<p>This program require one parameter or it will crash. The parameter of
|
||||
the program is the <em>conversion ramp</em>. You can use different ramps
|
||||
or create your own (for example using some letters of your name).</p>
|
||||
<p>This program require one parameter or it will crash. The parameter of the
|
||||
program is the <em>conversion ramp</em>. You can use different ramps or create your own
|
||||
(for example using some letters of your name).</p>
|
||||
<p>These are some ramps you can try:</p>
|
||||
<div class="sourceCode" id="cb10"><pre
|
||||
class="sourceCode sh"><code class="sourceCode bash"><span id="cb10-1"><a href="#cb10-1" aria-hidden="true" tabindex="-1"></a><span class="ex">./prog</span> <span class="st">" :1"</span></span>
|
||||
<div class="sourceCode" id="cb10"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb10-1"><a href="#cb10-1" aria-hidden="true" tabindex="-1"></a><span class="ex">./prog</span> <span class="st">" :1"</span></span>
|
||||
<span id="cb10-2"><a href="#cb10-2" aria-hidden="true" tabindex="-1"></a><span class="ex">./prog</span> <span class="st">" .:;Y0"</span></span>
|
||||
<span id="cb10-3"><a href="#cb10-3" aria-hidden="true" tabindex="-1"></a><span class="ex">./prog</span> <span class="st">" .:-=+*#%@"</span></span>
|
||||
<span id="cb10-4"><a href="#cb10-4" aria-hidden="true" tabindex="-1"></a><span class="ex">./prog</span> <span class="st">" .,:!-iots&8%#@$"</span></span></code></pre></div>
|
||||
<h3 id="byte-version">121 byte version</h3>
|
||||
<p>An alternative version of this program is only 121bytes long:</p>
|
||||
<div class="sourceCode" id="cb11"><pre class="sourceCode c"><code class="sourceCode c"><span id="cb11-1"><a href="#cb11-1" aria-hidden="true" tabindex="-1"></a>d<span class="op">=</span><span class="dv">80</span><span class="op">,</span>e<span class="op">,</span>j<span class="op">;</span>g<span class="op">(){</span>j<span class="op">+=</span>getchar<span class="op">();}</span>main<span class="op">(){</span><span class="cf">for</span><span class="op">(;;){</span>j<span class="op">=</span><span class="dv">0</span><span class="op">;</span>g<span class="op">();</span><span class="cf">if</span><span class="op">(</span>j<span class="op"><</span><span class="dv">0</span><span class="op">)</span><span class="cf">break</span><span class="op">;</span>g<span class="op">(</span>g<span class="op">());</span>putchar<span class="op">(</span><span class="st">" .:#@"</span><span class="op">[</span>j<span class="op">/</span><span class="dv">3</span><span class="op">*</span><span class="dv">5</span><span class="op">>></span><span class="dv">8</span><span class="op">]);</span><span class="cf">if</span><span class="op">(!(++</span>e<span class="op">%</span>d<span class="op">))</span>puts<span class="op">(</span><span class="st">""</span><span class="op">);}}</span></span></code></pre></div>
|
||||
<p>This alternative version has a <strong>fixed ramp</strong>. It’s
|
||||
smaller but it’s not so fun to use…</p>
|
||||
<h2 id="copyright-and-cc-by-sa-4.0-license">Copyright and CC BY-SA 4.0
|
||||
License:</h2>
|
||||
<p>This file is Copyright (c) 2023 by Landon Curt Noll. All Rights
|
||||
Reserved. You are free to share and adapt this file under the terms of
|
||||
this license:</p>
|
||||
<p>This alternative version has a <strong>fixed ramp</strong>. It’s smaller but it’s not so fun to use…</p>
|
||||
<h2 id="copyright-and-cc-by-sa-4.0-license">Copyright and CC BY-SA 4.0 License:</h2>
|
||||
<p>This file is Copyright (c) 2023 by Landon Curt Noll. All Rights Reserved.
|
||||
You are free to share and adapt this file under the terms of this license:</p>
|
||||
<pre><code>Creative Commons Attribution-ShareAlike 4.0 International (CC BY-SA 4.0)</code></pre>
|
||||
<p>For more information, see:
|
||||
https://creativecommons.org/licenses/by-sa/4.0/</p>
|
||||
<p>For more information, see: https://creativecommons.org/licenses/by-sa/4.0/</p>
|
||||
|
||||
<!-- END: this line ends content for HTML phase 21 by: bin/pandoc-wrapper.sh via bin/md2html.sh -->
|
||||
<!-- START: this line starts content for HTML phase 22 by: bin/output-index-inventory.sh via bin/md2html.sh -->
|
||||
|
||||
<!-- START: this line starts content generated by: bin/output-index-inventory.sh -->
|
||||
|
||||
<h1 id="inventory-for-2014maffiodo2"><a name="inventory"></a>Inventory
|
||||
for 2014/maffiodo2</h1>
|
||||
<h1 id="inventory-for-2014maffiodo2"><a name="inventory"></a>Inventory for 2014/maffiodo2</h1>
|
||||
<p><a href="#top">Jump to top</a></p>
|
||||
<h2 id="primary-files">Primary files</h2>
|
||||
<ul>
|
||||
<li><a
|
||||
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2014/maffiodo2/prog.c">prog.c</a>
|
||||
- entry source</li>
|
||||
<li><a
|
||||
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2014/maffiodo2/Makefile">Makefile</a>
|
||||
- entry Makefile</li>
|
||||
<li><a
|
||||
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2014/maffiodo2/prog.alt.c">prog.alt.c</a>
|
||||
- alternative source</li>
|
||||
<li><a
|
||||
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2014/maffiodo2/prog.orig.c">prog.orig.c</a>
|
||||
- original source</li>
|
||||
<li><a
|
||||
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2014/maffiodo2/try.sh">try.sh</a>
|
||||
- how to run</li>
|
||||
<li><a href="2014_maffiodo2.tar.bz2">2014_maffiodo2.tar.bz2</a> -
|
||||
download entry source</li>
|
||||
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2014/maffiodo2/prog.c">prog.c</a> - entry source</li>
|
||||
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2014/maffiodo2/Makefile">Makefile</a> - entry Makefile</li>
|
||||
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2014/maffiodo2/prog.alt.c">prog.alt.c</a> - alternative source</li>
|
||||
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2014/maffiodo2/prog.orig.c">prog.orig.c</a> - original source</li>
|
||||
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2014/maffiodo2/try.sh">try.sh</a> - how to run</li>
|
||||
<li><a href="2014_maffiodo2.tar.bz2">2014_maffiodo2.tar.bz2</a> - download entry source</li>
|
||||
</ul>
|
||||
<h2 id="secondary-files">Secondary files</h2>
|
||||
<ul>
|
||||
<li><a href="index.html">index.html</a> - entry home page</li>
|
||||
<li><a
|
||||
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2014/maffiodo2/.entry.json">.entry.json</a>
|
||||
- description of entry in JSON</li>
|
||||
<li><a
|
||||
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2014/maffiodo2/.gitignore">.gitignore</a>
|
||||
- list of files that should not be committed under git</li>
|
||||
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2014/maffiodo2/.entry.json">.entry.json</a> - description of entry in JSON</li>
|
||||
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2014/maffiodo2/.gitignore">.gitignore</a> - list of files that should not be committed under git</li>
|
||||
<li><a href=".path">.path</a> - directory path from top directory</li>
|
||||
<li><a
|
||||
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2014/maffiodo2/README.md">README.md</a>
|
||||
- markdown source for index.html</li>
|
||||
<li><a href="image.rgb">image.rgb</a> - sample input in the form of a
|
||||
raw RGB image</li>
|
||||
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2014/maffiodo2/README.md">README.md</a> - markdown source for index.html</li>
|
||||
<li><a href="image.rgb">image.rgb</a> - sample input in the form of a raw RGB image</li>
|
||||
</ul>
|
||||
|
||||
<!-- END: next line ends content generated by: bin/output-index-inventory.sh -->
|
||||
|
||||
+35
-62
@@ -129,9 +129,9 @@
|
||||
|
||||
<h2 id="author"><a name="author"></a>Author:</h2>
|
||||
<ul>
|
||||
<li>Name: <a href="../../authors.html#Yves-Marie_Morgan">Yves-Marie
|
||||
Morgan</a><br> Location: <a href="../../location.html#FR">FR</a> -
|
||||
<em>French Republic</em> (<em>France</em>) <br><br></li>
|
||||
<li>Name: <a href="../../authors.html#Yves-Marie_Morgan">Yves-Marie Morgan</a><br>
|
||||
Location: <a href="../../location.html#FR">FR</a> - <em>French Republic</em> (<em>France</em>)
|
||||
<br><br></li>
|
||||
</ul>
|
||||
|
||||
<!-- END: next line ends content generated by: bin/output-index-author.sh -->
|
||||
@@ -147,47 +147,39 @@ Morgan</a><br> Location: <a href="../../location.html#FR">FR</a> -
|
||||
<div class="sourceCode" id="cb3"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb3-1"><a href="#cb3-1" aria-hidden="true" tabindex="-1"></a><span class="ex">./try.sh</span></span></code></pre></div>
|
||||
<h2 id="judges-remarks">Judges’ remarks:</h2>
|
||||
<p>Think of this as a Maker Faire’s make. :-)</p>
|
||||
<p>It works reasonably well. While not super ultra-featured, it does
|
||||
fair well with the Makefile we supplied. Not only that, it helped
|
||||
uncover a bug we had in our special Makefile rules.</p>
|
||||
<p>It works reasonably well. While not super ultra-featured, it does fair well
|
||||
with the Makefile we supplied. Not only that, it helped uncover a bug we had in
|
||||
our special Makefile rules.</p>
|
||||
<h2 id="authors-remarks">Author’s remarks:</h2>
|
||||
<h3 id="remarks">Remarks</h3>
|
||||
<p>This program is a tiny <code>make(1)</code> clone.</p>
|
||||
<p>It is able to parse a subset of the <code>make(1)</code> syntax and
|
||||
will execute rules for goals given in arguments if they need to (based
|
||||
on timestamp of dependencies of rule targets).</p>
|
||||
<p>It is able to parse a subset of the <code>make(1)</code> syntax and will execute rules for
|
||||
goals given in arguments if they need to (based on timestamp of dependencies
|
||||
of rule targets).</p>
|
||||
<h2 id="supported-features">Supported features</h2>
|
||||
<ul>
|
||||
<li>Variable assignments (only recursive ones). Variable references with
|
||||
recursion.</li>
|
||||
<li>Variable assignments (only recursive ones). Variable references with recursion.</li>
|
||||
<li>Environment variables are available.</li>
|
||||
<li>It is possible to specify variables in command line:
|
||||
<code>name=value</code>.</li>
|
||||
<li>Variables given in command line will have precedence over variables
|
||||
defined in Makefile, which will have precedence over environment
|
||||
variables.</li>
|
||||
<li>If no target given in command line, the first target defined will be
|
||||
used.</li>
|
||||
<li>It is possible to specify variables in command line: <code>name=value</code>.</li>
|
||||
<li>Variables given in command line will have precedence over variables defined
|
||||
in Makefile, which will have precedence over environment variables.</li>
|
||||
<li>If no target given in command line, the first target defined will be used.</li>
|
||||
<li>Comments, escaped comments, escaped new lines.</li>
|
||||
</ul>
|
||||
<p>It should be able to build programs of previous years with the
|
||||
provided <code>Makefile</code> found in previous contest archives.
|
||||
Simply use this program instead of <code>make</code>. It will
|
||||
recursively use itself for sub-make (the <code>MAKE=</code> assignment
|
||||
inside <code>Makefile</code> will be ignored to continue using
|
||||
itself).</p>
|
||||
<p>It should be able to build programs of previous years with the provided <code>Makefile</code>
|
||||
found in previous contest archives. Simply use this program instead of <code>make</code>.
|
||||
It will recursively use itself for sub-make (the <code>MAKE=</code> assignment inside
|
||||
<code>Makefile</code> will be ignored to continue using itself).</p>
|
||||
<h2 id="limitations-known-issues">Limitations / Known issues</h2>
|
||||
<ul>
|
||||
<li>There are a lot of memory leaks (not a single free).</li>
|
||||
<li>The opened file is not closed.</li>
|
||||
<li>The input file shall be named <code>Makefile</code>.</li>
|
||||
<li>No diagnostic message, but the exit status is non zero to indicates
|
||||
failure (failed command in a rule or missing target).</li>
|
||||
<li>Only <code>$<</code> and <code>$@</code> are supported for
|
||||
automatic variables in commands.</li>
|
||||
<li>No diagnostic message, but the exit status is non zero to indicates failure
|
||||
(failed command in a rule or missing target).</li>
|
||||
<li>Only <code>$<</code> and <code>$@</code> are supported for automatic variables in commands.</li>
|
||||
<li>No parallel execution (<code>-j</code> option).</li>
|
||||
<li>No <code>:=</code> <code>+=</code> <code>?=</code> syntax for
|
||||
variable assignment.</li>
|
||||
<li>No <code>:=</code> <code>+=</code> <code>?=</code> syntax for variable assignment.</li>
|
||||
<li>No built-in function available.</li>
|
||||
<li>No pattern targets.</li>
|
||||
<li>No pattern substitution variables.</li>
|
||||
@@ -200,53 +192,34 @@ variable assignment.</li>
|
||||
<pre><code>prog.c:22:15: warning: return makes integer from pointer without a cast [enabled by default]
|
||||
prog.c:23:72: warning: signed and unsigned type in conditional expression [-Wsign-compare]
|
||||
prog.c:12:11: warning: suggest parentheses around ‘&&’ within ‘||’ [-Wparentheses]</code></pre>
|
||||
<h2 id="copyright-and-cc-by-sa-4.0-license">Copyright and CC BY-SA 4.0
|
||||
License:</h2>
|
||||
<p>This file is Copyright (c) 2023 by Landon Curt Noll. All Rights
|
||||
Reserved. You are free to share and adapt this file under the terms of
|
||||
this license:</p>
|
||||
<h2 id="copyright-and-cc-by-sa-4.0-license">Copyright and CC BY-SA 4.0 License:</h2>
|
||||
<p>This file is Copyright (c) 2023 by Landon Curt Noll. All Rights Reserved.
|
||||
You are free to share and adapt this file under the terms of this license:</p>
|
||||
<pre><code>Creative Commons Attribution-ShareAlike 4.0 International (CC BY-SA 4.0)</code></pre>
|
||||
<p>For more information, see:
|
||||
https://creativecommons.org/licenses/by-sa/4.0/</p>
|
||||
<p>For more information, see: https://creativecommons.org/licenses/by-sa/4.0/</p>
|
||||
|
||||
<!-- END: this line ends content for HTML phase 21 by: bin/pandoc-wrapper.sh via bin/md2html.sh -->
|
||||
<!-- START: this line starts content for HTML phase 22 by: bin/output-index-inventory.sh via bin/md2html.sh -->
|
||||
|
||||
<!-- START: this line starts content generated by: bin/output-index-inventory.sh -->
|
||||
|
||||
<h1 id="inventory-for-2014morgan"><a name="inventory"></a>Inventory for
|
||||
2014/morgan</h1>
|
||||
<h1 id="inventory-for-2014morgan"><a name="inventory"></a>Inventory for 2014/morgan</h1>
|
||||
<p><a href="#top">Jump to top</a></p>
|
||||
<h2 id="primary-files">Primary files</h2>
|
||||
<ul>
|
||||
<li><a
|
||||
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2014/morgan/prog.c">prog.c</a>
|
||||
- entry source</li>
|
||||
<li><a
|
||||
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2014/morgan/Makefile">Makefile</a>
|
||||
- entry Makefile</li>
|
||||
<li><a
|
||||
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2014/morgan/prog.orig.c">prog.orig.c</a>
|
||||
- original source</li>
|
||||
<li><a
|
||||
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2014/morgan/try.sh">try.sh</a>
|
||||
- how to run</li>
|
||||
<li><a href="2014_morgan.tar.bz2">2014_morgan.tar.bz2</a> - download
|
||||
entry source</li>
|
||||
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2014/morgan/prog.c">prog.c</a> - entry source</li>
|
||||
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2014/morgan/Makefile">Makefile</a> - entry Makefile</li>
|
||||
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2014/morgan/prog.orig.c">prog.orig.c</a> - original source</li>
|
||||
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2014/morgan/try.sh">try.sh</a> - how to run</li>
|
||||
<li><a href="2014_morgan.tar.bz2">2014_morgan.tar.bz2</a> - download entry source</li>
|
||||
</ul>
|
||||
<h2 id="secondary-files">Secondary files</h2>
|
||||
<ul>
|
||||
<li><a href="index.html">index.html</a> - entry home page</li>
|
||||
<li><a
|
||||
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2014/morgan/.entry.json">.entry.json</a>
|
||||
- description of entry in JSON</li>
|
||||
<li><a
|
||||
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2014/morgan/.gitignore">.gitignore</a>
|
||||
- list of files that should not be committed under git</li>
|
||||
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2014/morgan/.entry.json">.entry.json</a> - description of entry in JSON</li>
|
||||
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2014/morgan/.gitignore">.gitignore</a> - list of files that should not be committed under git</li>
|
||||
<li><a href=".path">.path</a> - directory path from top directory</li>
|
||||
<li><a
|
||||
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2014/morgan/README.md">README.md</a>
|
||||
- markdown source for index.html</li>
|
||||
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2014/morgan/README.md">README.md</a> - markdown source for index.html</li>
|
||||
</ul>
|
||||
|
||||
<!-- END: next line ends content generated by: bin/output-index-inventory.sh -->
|
||||
|
||||
+46
-74
@@ -130,8 +130,8 @@
|
||||
<h2 id="author"><a name="author"></a>Author:</h2>
|
||||
<ul>
|
||||
<li>Name: <a href="../../authors.html#Don_Yang">Don Yang</a><br>
|
||||
Location: <a href="../../location.html#US">US</a> - <em>United States of
|
||||
America</em> (<em>United States</em>) <br><br></li>
|
||||
Location: <a href="../../location.html#US">US</a> - <em>United States of America</em> (<em>United States</em>)
|
||||
<br><br></li>
|
||||
</ul>
|
||||
|
||||
<!-- END: next line ends content generated by: bin/output-index-author.sh -->
|
||||
@@ -147,17 +147,16 @@ America</em> (<em>United States</em>) <br><br></li>
|
||||
<span id="cb2-3"><a href="#cb2-3" aria-hidden="true" tabindex="-1"></a><span class="ex">./glock.sh</span></span></code></pre></div>
|
||||
<h2 id="try">Try:</h2>
|
||||
<div class="sourceCode" id="cb3"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb3-1"><a href="#cb3-1" aria-hidden="true" tabindex="-1"></a><span class="ex">./try.sh</span></span></code></pre></div>
|
||||
<p>This script will ask you if you wish to try again after each run.
|
||||
Type in any character other than <code>y</code> or <code>Y</code> to
|
||||
exit at this point.</p>
|
||||
<p>This script will ask you if you wish to try again after each run. Type in any
|
||||
character other than <code>y</code> or <code>Y</code> to exit at this point.</p>
|
||||
<h2 id="judges-remarks">Judges’ remarks:</h2>
|
||||
<p>Try to figure out how this entry determines the optimization level
|
||||
with which it had been compiled. Is this an example of undefined
|
||||
behavior or unspecified behavior?</p>
|
||||
<p>Try to figure out how this entry determines the optimization level with
|
||||
which it had been compiled. Is this an example of undefined behavior
|
||||
or unspecified behavior?</p>
|
||||
<h2 id="authors-remarks">Author’s remarks:</h2>
|
||||
<h3 id="summary">Summary</h3>
|
||||
<p><code>Sinon</code> is a game of timing, the goal is to eliminate all
|
||||
enemies in under one minute.</p>
|
||||
<p><code>Sinon</code> is a game of timing, the goal is to eliminate all enemies in
|
||||
under one minute.</p>
|
||||
<p>To start, compile and run the program. To resume, compile and run the
|
||||
output repeatedly until you have won/lost the game. For example:</p>
|
||||
<div class="sourceCode" id="cb4"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb4-1"><a href="#cb4-1" aria-hidden="true" tabindex="-1"></a><span class="fu">cp</span> prog.c run.c</span>
|
||||
@@ -165,35 +164,33 @@ output repeatedly until you have won/lost the game. For example:</p>
|
||||
<span id="cb4-3"><a href="#cb4-3" aria-hidden="true" tabindex="-1"></a><span class="fu">gcc</span> <span class="at">-O2</span> run.c <span class="at">-o</span> run <span class="kw">&&</span> <span class="ex">./run</span> <span class="kw">|</span> <span class="fu">tee</span> run.c</span>
|
||||
<span id="cb4-4"><a href="#cb4-4" aria-hidden="true" tabindex="-1"></a><span class="ex">...</span></span></code></pre></div>
|
||||
<h3 id="details">Details</h3>
|
||||
<p><code>Sinon</code> is played by compiling and running the output
|
||||
repeatedly. Two factors determine what actions are taken:</p>
|
||||
<p><code>Sinon</code> is played by compiling and running the output repeatedly. Two
|
||||
factors determine what actions are taken:</p>
|
||||
<ul>
|
||||
<li>Time since last compilation.</li>
|
||||
<li>Whether compiler optimizations are enabled or not.</li>
|
||||
</ul>
|
||||
<p>If you fire too quickly, the weapon will jam. If you fire too slowly,
|
||||
you will not be able to eliminate all the enemies in time. Thus the
|
||||
primary objective of the game is to time your compilations just
|
||||
right.</p>
|
||||
<p><code>Sinon</code> has two weapons that are selected based on
|
||||
compiler optimization level:</p>
|
||||
primary objective of the game is to time your compilations just right.</p>
|
||||
<p><code>Sinon</code> has two weapons that are selected based on compiler optimization
|
||||
level:</p>
|
||||
<ul>
|
||||
<li><p>“gcc -O2” or “clang -O2” will fire Hecate II, a powerful rifle
|
||||
that requires longer time to cool off.</p></li>
|
||||
<li><p>“gcc -O0” or “clang -O0” will fire Glock 18C, a less powerful
|
||||
pistol that requires less time to cool off.</p></li>
|
||||
<li><p>“gcc -O2” or “clang -O2” will fire Hecate II, a powerful rifle that
|
||||
requires longer time to cool off.</p></li>
|
||||
<li><p>“gcc -O0” or “clang -O0” will fire Glock 18C, a less powerful pistol
|
||||
that requires less time to cool off.</p></li>
|
||||
</ul>
|
||||
<p>Because the weapons cool off independently, the best strategy is to
|
||||
alternate between the two weapons. It is fairly easy to win the game
|
||||
with this strategy even with occasional jams.</p>
|
||||
<p>If your compiler does not have the right optimizations, only Glock
|
||||
18C would be available. It is still possible to win, but your timing
|
||||
will need to be more precise. This is effectively playing the game on
|
||||
<p>If your compiler does not have the right optimizations, only Glock 18C
|
||||
would be available. It is still possible to win, but your timing will
|
||||
need to be more precise. This is effectively playing the game on
|
||||
“hard” mode. It is worth trying this mode even if you have the right
|
||||
compilers.</p>
|
||||
<h3 id="compatibility">Compatibility</h3>
|
||||
<p><code>Sinon</code> has been tested and verified to work on these
|
||||
platforms:</p>
|
||||
<p><code>Sinon</code> has been tested and verified to work on these platforms:</p>
|
||||
<ul>
|
||||
<li>gcc 4.4.3 on Linux.</li>
|
||||
<li>gcc 4.4.5 on Linux.</li>
|
||||
@@ -208,72 +205,47 @@ available).</li>
|
||||
</ul>
|
||||
<p><code>Sinon</code> is intended to be played in a 80x25 terminal.</p>
|
||||
<h3 id="miscellaneous-features">Miscellaneous features</h3>
|
||||
<p><code>Sinon</code> might be the first game that uses compiler
|
||||
optimization level as a primary input.</p>
|
||||
<p><code>Sinon</code> has a demo mode that plays the game automatically.
|
||||
Make sure that there are no files named “run” and “run.c” in current
|
||||
directory (they will be overwritten) and run:</p>
|
||||
<p><code>Sinon</code> might be the first game that uses compiler optimization level as
|
||||
a primary input.</p>
|
||||
<p><code>Sinon</code> has a demo mode that plays the game automatically. Make sure
|
||||
that there are no files named “run” and “run.c” in current directory
|
||||
(they will be overwritten) and run:</p>
|
||||
<div class="sourceCode" id="cb5"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb5-1"><a href="#cb5-1" aria-hidden="true" tabindex="-1"></a><span class="fu">perl</span> prog.c <span class="kw">|</span> <span class="fu">bash</span></span></code></pre></div>
|
||||
<p>File size and CRC32 of <a href="prog.c">prog.c</a> are embedded in
|
||||
line 7.</p>
|
||||
<p>Process for making <code>Sinon</code> is included in <a
|
||||
href="spoiler.html">spoiler.html</a>.</p>
|
||||
<p>Layout of this code is based on Asada Shino, also known as
|
||||
“<code>Sinon</code>”, from Sword Art Online.</p>
|
||||
<h2 id="copyright-and-cc-by-sa-4.0-license">Copyright and CC BY-SA 4.0
|
||||
License:</h2>
|
||||
<p>This file is Copyright (c) 2023 by Landon Curt Noll. All Rights
|
||||
Reserved. You are free to share and adapt this file under the terms of
|
||||
this license:</p>
|
||||
<p>File size and CRC32 of <a href="prog.c">prog.c</a> are embedded in line 7.</p>
|
||||
<p>Process for making <code>Sinon</code> is included in <a href="spoiler.html">spoiler.html</a>.</p>
|
||||
<p>Layout of this code is based on Asada Shino, also known as “<code>Sinon</code>”,
|
||||
from Sword Art Online.</p>
|
||||
<h2 id="copyright-and-cc-by-sa-4.0-license">Copyright and CC BY-SA 4.0 License:</h2>
|
||||
<p>This file is Copyright (c) 2023 by Landon Curt Noll. All Rights Reserved.
|
||||
You are free to share and adapt this file under the terms of this license:</p>
|
||||
<pre><code>Creative Commons Attribution-ShareAlike 4.0 International (CC BY-SA 4.0)</code></pre>
|
||||
<p>For more information, see:
|
||||
https://creativecommons.org/licenses/by-sa/4.0/</p>
|
||||
<p>For more information, see: https://creativecommons.org/licenses/by-sa/4.0/</p>
|
||||
|
||||
<!-- END: this line ends content for HTML phase 21 by: bin/pandoc-wrapper.sh via bin/md2html.sh -->
|
||||
<!-- START: this line starts content for HTML phase 22 by: bin/output-index-inventory.sh via bin/md2html.sh -->
|
||||
|
||||
<!-- START: this line starts content generated by: bin/output-index-inventory.sh -->
|
||||
|
||||
<h1 id="inventory-for-2014sinon"><a name="inventory"></a>Inventory for
|
||||
2014/sinon</h1>
|
||||
<h1 id="inventory-for-2014sinon"><a name="inventory"></a>Inventory for 2014/sinon</h1>
|
||||
<p><a href="#top">Jump to top</a></p>
|
||||
<h2 id="primary-files">Primary files</h2>
|
||||
<ul>
|
||||
<li><a
|
||||
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2014/sinon/prog.c">prog.c</a>
|
||||
- entry source</li>
|
||||
<li><a
|
||||
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2014/sinon/Makefile">Makefile</a>
|
||||
- entry Makefile</li>
|
||||
<li><a
|
||||
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2014/sinon/prog.orig.c">prog.orig.c</a>
|
||||
- original source</li>
|
||||
<li><a
|
||||
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2014/sinon/glock.sh">glock.sh</a>
|
||||
- how to run</li>
|
||||
<li><a
|
||||
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2014/sinon/hecate.sh">hecate.sh</a>
|
||||
- how to run</li>
|
||||
<li><a
|
||||
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2014/sinon/try.sh">try.sh</a>
|
||||
- how to run</li>
|
||||
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2014/sinon/prog.c">prog.c</a> - entry source</li>
|
||||
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2014/sinon/Makefile">Makefile</a> - entry Makefile</li>
|
||||
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2014/sinon/prog.orig.c">prog.orig.c</a> - original source</li>
|
||||
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2014/sinon/glock.sh">glock.sh</a> - how to run</li>
|
||||
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2014/sinon/hecate.sh">hecate.sh</a> - how to run</li>
|
||||
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2014/sinon/try.sh">try.sh</a> - how to run</li>
|
||||
<li><a href="spoiler.html">spoiler.html</a> - SPOILER WARNING</li>
|
||||
<li><a href="2014_sinon.tar.bz2">2014_sinon.tar.bz2</a> - download entry
|
||||
source</li>
|
||||
<li><a href="2014_sinon.tar.bz2">2014_sinon.tar.bz2</a> - download entry source</li>
|
||||
</ul>
|
||||
<h2 id="secondary-files">Secondary files</h2>
|
||||
<ul>
|
||||
<li><a href="index.html">index.html</a> - entry home page</li>
|
||||
<li><a
|
||||
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2014/sinon/.entry.json">.entry.json</a>
|
||||
- description of entry in JSON</li>
|
||||
<li><a
|
||||
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2014/sinon/.gitignore">.gitignore</a>
|
||||
- list of files that should not be committed under git</li>
|
||||
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2014/sinon/.entry.json">.entry.json</a> - description of entry in JSON</li>
|
||||
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2014/sinon/.gitignore">.gitignore</a> - list of files that should not be committed under git</li>
|
||||
<li><a href=".path">.path</a> - directory path from top directory</li>
|
||||
<li><a
|
||||
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2014/sinon/README.md">README.md</a>
|
||||
- markdown source for index.html</li>
|
||||
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2014/sinon/README.md">README.md</a> - markdown source for index.html</li>
|
||||
</ul>
|
||||
|
||||
<!-- END: next line ends content generated by: bin/output-index-inventory.sh -->
|
||||
|
||||
+111
-153
@@ -130,8 +130,8 @@
|
||||
<h2 id="author"><a name="author"></a>Author:</h2>
|
||||
<ul>
|
||||
<li>Name: <a href="../../authors.html#Cel_Skeggs">Cel Skeggs</a><br>
|
||||
Location: <a href="../../location.html#US">US</a> - <em>United States of
|
||||
America</em> (<em>United States</em>) <br><br></li>
|
||||
Location: <a href="../../location.html#US">US</a> - <em>United States of America</em> (<em>United States</em>)
|
||||
<br><br></li>
|
||||
</ul>
|
||||
|
||||
<!-- END: next line ends content generated by: bin/output-index-author.sh -->
|
||||
@@ -143,20 +143,19 @@ America</em> (<em>United States</em>) <br><br></li>
|
||||
<div class="sourceCode" id="cb1"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb1-1"><a href="#cb1-1" aria-hidden="true" tabindex="-1"></a><span class="fu">make</span></span></code></pre></div>
|
||||
<h2 id="to-use">To use:</h2>
|
||||
<div class="sourceCode" id="cb2"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb2-1"><a href="#cb2-1" aria-hidden="true" tabindex="-1"></a><span class="ex">./prog</span></span></code></pre></div>
|
||||
<p>HINT: Try pressing the left and right arrow keys as needed. Also try
|
||||
pressing space/enter to select options. Pressing Q or Escape may end the
|
||||
fun before you are ready. :-)</p>
|
||||
<p>HINT: Try pressing the left and right arrow keys as needed.
|
||||
Also try pressing space/enter to select options.
|
||||
Pressing Q or Escape may end the fun before you are ready. :-)</p>
|
||||
<h2 id="judges-remarks">Judges’ remarks:</h2>
|
||||
<p>When the code looks like lemons, it is probably because the
|
||||
LEMONPEOPLE, or at least the LEMONLORD was involved. :-)</p>
|
||||
<p>Look at some of the C pre-processor macros in the source code. Ask
|
||||
yourself why C source is being passed as arguments to some of those
|
||||
macros.</p>
|
||||
<p>Now you may observe, while it is running, that some C source code is
|
||||
being written to a file and then compiled. And yet that compiled code is
|
||||
somehow executed from <code>main()</code>. But how? How is
|
||||
<code>main()</code> able to call code that was written and compiled just
|
||||
in time for execution?</p>
|
||||
<p>When the code looks like lemons, it is probably because the LEMONPEOPLE,
|
||||
or at least the LEMONLORD was involved. :-)</p>
|
||||
<p>Look at some of the C pre-processor macros in the source code.
|
||||
Ask yourself why C source is being passed as arguments to some
|
||||
of those macros.</p>
|
||||
<p>Now you may observe, while it is running, that some C source code is being
|
||||
written to a file and then compiled. And yet that compiled code is somehow
|
||||
executed from <code>main()</code>. But how? How is <code>main()</code> able to call code that was
|
||||
written and compiled just in time for execution?</p>
|
||||
<h2 id="authors-remarks">Author’s remarks:</h2>
|
||||
<h3 id="table-of-contents">TABLE OF CONTENTS</h3>
|
||||
<ul>
|
||||
@@ -167,142 +166,117 @@ in time for execution?</p>
|
||||
<li>Q&A</li>
|
||||
</ul>
|
||||
<h3 id="backstory">BACKSTORY</h3>
|
||||
<p>It was ten yours ago when THE LEMONPEOPLE invaded, juicing all in
|
||||
their path.</p>
|
||||
<p>Attempting to free the Earth from their tyranny, you have endured
|
||||
pulpy and sour battles.</p>
|
||||
<p>This has now culminated in you reaching the throne room of THE
|
||||
LEMONLORD.</p>
|
||||
<p>It was ten yours ago when THE LEMONPEOPLE invaded, juicing all in their path.</p>
|
||||
<p>Attempting to free the Earth from their tyranny, you have endured pulpy and
|
||||
sour battles.</p>
|
||||
<p>This has now culminated in you reaching the throne room of THE LEMONLORD.</p>
|
||||
<p>Armed with your right-facing curly brace, you charge into battle.</p>
|
||||
<p>(Use left and right arrow keys and space/enter to select options.
|
||||
Press Q or Escape to quit.)</p>
|
||||
<p>(Use left and right arrow keys and space/enter to select options. Press Q or
|
||||
Escape to quit.)</p>
|
||||
<h3 id="known-compiler-warnings">KNOWN COMPILER WARNINGS</h3>
|
||||
<p>Unfortunately, it became very difficult to get this entry to fit
|
||||
within the size requirements. It’s currently at 2052 according to <a
|
||||
href="../iocccsize.c">iocccsize</a>, and 3994 according to
|
||||
<code>wc -c</code>.</p>
|
||||
<p>The current size is a third to a half of the original size before
|
||||
compression.</p>
|
||||
<p>Unfortunately, it became very difficult to get this entry to fit within the
|
||||
size requirements. It’s currently at 2052 according to
|
||||
<a href="../iocccsize.c">iocccsize</a>, and 3994 according to <code>wc -c</code>.</p>
|
||||
<p>The current size is a third to a half of the original size before compression.</p>
|
||||
<p>Due to this, it does LOTS of things that subtly annoy compilers!</p>
|
||||
<ul>
|
||||
<li><ol start="10" type="1">
|
||||
<li>data argument not used by format string</li>
|
||||
</ol>
|
||||
<p>This occurs because some of the <code>fprintf(3)</code> invocations
|
||||
don’t use all their parameters. The program should still work
|
||||
fine!</p></li>
|
||||
<p>This occurs because some of the <code>fprintf(3)</code> invocations don’t use all their
|
||||
parameters. The program should still work fine!</p></li>
|
||||
<li><ol type="1">
|
||||
<li>using the result of an assignment as a condition without
|
||||
parentheses</li>
|
||||
<li>using the result of an assignment as a condition without parentheses</li>
|
||||
</ol>
|
||||
<p>Somewhere, I needed to set a variable and then branch on the result.
|
||||
The shortest way was to combine them. Some self-proclaimed “EXPERTS”
|
||||
think this is a bad programming practice, but what do they know?
|
||||
:P</p></li>
|
||||
<p>Somewhere, I needed to set a variable and then branch on the result. The
|
||||
shortest way was to combine them. Some self-proclaimed “EXPERTS” think this
|
||||
is a bad programming practice, but what do they know? :P</p></li>
|
||||
<li><ol type="1">
|
||||
<li>implicit declaration of function ‘time’ is invalid in C99</li>
|
||||
</ol>
|
||||
<p>An <code>#include</code> statement is expensive, and I’m
|
||||
broke.</p></li>
|
||||
<p>An <code>#include</code> statement is expensive, and I’m broke.</p></li>
|
||||
<li><ol type="1">
|
||||
<li>control may reach end of non-void function</li>
|
||||
</ol>
|
||||
<p>Turns out that sometimes, a <code>return</code> statement is too
|
||||
much. This will never actually occur, but some C compilers think they
|
||||
know more about my program than I do! :P</p></li>
|
||||
<li><p>(?) Under some systems, <code>-fPIC</code> is irrelevant for
|
||||
shared libraries. If so, you should remove it from the
|
||||
Makefile.</p></li>
|
||||
<p>Turns out that sometimes, a <code>return</code> statement is too much. This will never
|
||||
actually occur, but some C compilers think they know more about my program
|
||||
than I do! :P</p></li>
|
||||
<li><p>(?) Under some systems, <code>-fPIC</code> is irrelevant for shared libraries. If so,
|
||||
you should remove it from the Makefile.</p></li>
|
||||
</ul>
|
||||
<h2
|
||||
id="obfuscation-what-obfuscation-this-is-a-perfectly-normal-c-program">OBFUSCATION?
|
||||
WHAT OBFUSCATION? THIS IS A PERFECTLY NORMAL C PROGRAM!</h2>
|
||||
<h2 id="obfuscation-what-obfuscation-this-is-a-perfectly-normal-c-program">OBFUSCATION? WHAT OBFUSCATION? THIS IS A PERFECTLY NORMAL C PROGRAM!</h2>
|
||||
<h1 id="the-cool-part">THE COOL PART</h1>
|
||||
<p>Take a close look at how it works. Notice that it’s passing C code to
|
||||
certain macros…</p>
|
||||
<p>Guess what? It’s a very simple kind of JIT compiler, though not used
|
||||
as deeply as would be cool.</p>
|
||||
<p>Essentially, it generates C code at runtime, dumps it to a file, and
|
||||
then runs a C compiler on that file, telling the C compiler to generate
|
||||
a shared library. Then it loads the shared library with
|
||||
<code>dlopen(3)</code>, and…</p>
|
||||
<p>Take a close look at how it works. Notice that it’s passing C code to certain
|
||||
macros…</p>
|
||||
<p>Guess what? It’s a very simple kind of JIT compiler, though not used as deeply
|
||||
as would be cool.</p>
|
||||
<p>Essentially, it generates C code at runtime, dumps it to a file, and then runs
|
||||
a C compiler on that file, telling the C compiler to generate a shared library.
|
||||
Then it loads the shared library with <code>dlopen(3)</code>, and…</p>
|
||||
<p>Ignores the result?</p>
|
||||
<p>That can’t be right.</p>
|
||||
<p>Well, it is. Instead of using <code>dlsym(3)</code> like a normal
|
||||
programmer, I mark one of the generated functions with
|
||||
<code>__attribute__((constructor))</code>. This means that it gets
|
||||
called immediately on load, so it can make its functions available.</p>
|
||||
<p>But wait - how can it link into the main program, either? It has no
|
||||
way to reference anything in the main executable!</p>
|
||||
<p>But it does: I’m injecting certain addresses into the generated code,
|
||||
which it then casts to pointers and accesses! It uses this to make
|
||||
certain functions available to the main program, so the main program’s
|
||||
generated code will then enter itself where it’s needed.</p>
|
||||
<p>Well, it is. Instead of using <code>dlsym(3)</code> like a normal programmer, I mark one of the
|
||||
generated functions with <code>__attribute__((constructor))</code>. This means that it
|
||||
gets called immediately on load, so it can make its functions available.</p>
|
||||
<p>But wait - how can it link into the main program, either? It has no way to
|
||||
reference anything in the main executable!</p>
|
||||
<p>But it does: I’m injecting certain addresses into the generated code, which it
|
||||
then casts to pointers and accesses! It uses this to make certain functions
|
||||
available to the main program, so the main program’s generated code will then
|
||||
enter itself where it’s needed.</p>
|
||||
<h1 id="the-not-so-cool-part">THE NOT-SO-COOL PART</h1>
|
||||
<p>There are also lots of <code>#defines</code>.</p>
|
||||
<p>No, these are not obfuscation. These are compression.</p>
|
||||
<p>There is a little bit of obfuscation gained from using the
|
||||
stringification operator. (I can never remember what it’s actually
|
||||
called, but it’s the <code>#</code> operator in a preprocessor macro) -
|
||||
this allows me to pass C code in arguments to the macros, meaning that
|
||||
it gets interpreted as C code instead of a string by the <a
|
||||
href="../iocccsize.c">iocccsize</a> tool, so it gets counted as smaller!
|
||||
:D</p>
|
||||
<p>There is a little bit of obfuscation gained from using the stringification
|
||||
operator. (I can never remember what it’s actually called, but it’s the <code>#</code>
|
||||
operator in a preprocessor macro) - this allows me to pass C code in arguments
|
||||
to the macros, meaning that it gets interpreted as C code instead of a string
|
||||
by the <a href="../iocccsize.c">iocccsize</a> tool, so it gets counted as smaller! :D</p>
|
||||
<h1 id="a-slightly-cool-part">A SLIGHTLY COOL PART</h1>
|
||||
<p>As part of the JIT compiling, the program hides the fact that it
|
||||
needs ncurses: it just links ncurses with one of the generated shared
|
||||
libraries, and then can access the contents of the ncurses library!</p>
|
||||
<p>As part of the JIT compiling, the program hides the fact that it needs ncurses:
|
||||
it just links ncurses with one of the generated shared libraries, and then can
|
||||
access the contents of the ncurses library!</p>
|
||||
<h1 id="wait-what">WAIT WHAT</h1>
|
||||
<p>Also, note where functions start and end…</p>
|
||||
<p>I’ve messed with the syntax so that it’s not actually formatted
|
||||
properly. It almost looks like it is, but it isn’t.</p>
|
||||
<p>This isn’t significant obfuscation as long as you run it through a C
|
||||
source code beautifier.</p>
|
||||
<p>I’ve messed with the syntax so that it’s not actually formatted properly. It
|
||||
almost looks like it is, but it isn’t.</p>
|
||||
<p>This isn’t significant obfuscation as long as you run it through a C source
|
||||
code beautifier.</p>
|
||||
<p>But wait… if you aren’t careful, running it through a C source code
|
||||
beautifier won’t work. Remember how I’m interlacing generated C code
|
||||
with actual C code? Note that this WRECKS some beautifiers. I hope you
|
||||
have a good one!</p>
|
||||
<p>(There’s an obvious way around this but I’m not going to spell it out
|
||||
for you. That’d be too easy!)</p>
|
||||
beautifier won’t work. Remember how I’m interlacing generated C code with
|
||||
actual C code? Note that this WRECKS some beautifiers. I hope you have a good
|
||||
one!</p>
|
||||
<p>(There’s an obvious way around this but I’m not going to spell it out for you.
|
||||
That’d be too easy!)</p>
|
||||
<h3 id="miscellaneous-stuff">MISCELLANEOUS STUFF</h3>
|
||||
<p>Do note that there are some other miscellaneous obfuscations, but
|
||||
they should be easy to understand once you figure out the ones
|
||||
above.</p>
|
||||
<p>Do note that there are some other miscellaneous obfuscations, but they should
|
||||
be easy to understand once you figure out the ones above.</p>
|
||||
<h3 id="troubleshooting-guide">TROUBLESHOOTING GUIDE</h3>
|
||||
<p>This program is a very easy program to cause to fail!</p>
|
||||
<p>Some things to check</p>
|
||||
<ul>
|
||||
<li><p>On line 16, where it says <code>%cinclude "prog.c"</code>, is
|
||||
<code>prog.c</code> the name of the original source code file?</p></li>
|
||||
<li><p>On line 16, where it says <code>%cinclude "prog.c"</code>, is <code>prog.c</code> the name of the
|
||||
original source code file?</p></li>
|
||||
<li><p>Do you have ncurses installed?</p></li>
|
||||
<li><p>Does your system have <code>ncurses.h</code> (like a nice system)
|
||||
or <code>ncurses/ncurses.h</code> (like a rude system) ?</p>
|
||||
<p>If it’s the latter (or some other path), you’ll need to update line
|
||||
97.</p>
|
||||
<li><p>Does your system have <code>ncurses.h</code> (like a nice system) or
|
||||
<code>ncurses/ncurses.h</code> (like a rude system) ?</p>
|
||||
<p>If it’s the latter (or some other path), you’ll need to update line 97.</p>
|
||||
<p>(I had to do this under Cygwin.)</p></li>
|
||||
<li><p>Does your system need <code>-fPIC</code> (or other arcane
|
||||
invocations) to compile a shared library? If so, make sure that you
|
||||
include it in the <code>-DCC</code> argument in the build
|
||||
script.</p></li>
|
||||
<li><p>Does your system have a vague dislike for <code>-fPIC</code>?
|
||||
(Like Cygwin.) You might need to remove it from the build
|
||||
script.</p></li>
|
||||
<li><p>Does your system support
|
||||
<code>__attribute__((constructor))</code>? It needs to.</p></li>
|
||||
<li><p>Check the file <code>err</code>. Maybe it will help you figure
|
||||
out why a runtime- generated program failed. The failing program should
|
||||
be found in <code>t.c</code>.</p></li>
|
||||
<li><p>Can’t run a beautifier on the source code? I’m not going to help
|
||||
you there.</p></li>
|
||||
<li><p>Does your system need <code>-fPIC</code> (or other arcane invocations) to compile a
|
||||
shared library? If so, make sure that you include it in the <code>-DCC</code> argument in
|
||||
the build script.</p></li>
|
||||
<li><p>Does your system have a vague dislike for <code>-fPIC</code>? (Like Cygwin.) You might
|
||||
need to remove it from the build script.</p></li>
|
||||
<li><p>Does your system support <code>__attribute__((constructor))</code>? It needs to.</p></li>
|
||||
<li><p>Check the file <code>err</code>. Maybe it will help you figure out why a runtime-
|
||||
generated program failed. The failing program should be found in <code>t.c</code>.</p></li>
|
||||
<li><p>Can’t run a beautifier on the source code? I’m not going to help you there.</p></li>
|
||||
</ul>
|
||||
<p>I’ve tested it on the following platforms, in case you need to try it
|
||||
on one:</p>
|
||||
<p>I’ve tested it on the following platforms, in case you need to try it on one:</p>
|
||||
<ul>
|
||||
<li>64-bit Windows 7 32-bit Cygwin with gcc 4.8.2 and standards c89,
|
||||
c90, c99, and c11. Note that the program ran as 32-bit due to the
|
||||
version of cygwin.</li>
|
||||
<li>64-bit Arch Linux with gcc 4.9.1 and standards c89, c90, c99,
|
||||
c11.</li>
|
||||
<li>64-bit Windows 7 32-bit Cygwin with gcc 4.8.2 and standards c89, c90, c99,
|
||||
and c11. Note that the program ran as 32-bit due to the version of cygwin.</li>
|
||||
<li>64-bit Arch Linux with gcc 4.9.1 and standards c89, c90, c99, c11.</li>
|
||||
<li>64-bit Arch Linux with clang 3.5.0 and standards c89 and c11.</li>
|
||||
</ul>
|
||||
<p>I ran out of time to test it on more systems.</p>
|
||||
@@ -311,60 +285,44 @@ c11.</li>
|
||||
<li><p>Who am I?</p>
|
||||
<p>Yes.</p></li>
|
||||
<li><p>Why doesn’t your program require a pet fish license?</p>
|
||||
<p>THE LEMONLORD’s pet LEMONFISH was not rendered in the game, and so
|
||||
does not require a pet fish license.</p></li>
|
||||
<p>THE LEMONLORD’s pet LEMONFISH was not rendered in the game, and so does not
|
||||
require a pet fish license.</p></li>
|
||||
<li><p>Was this inspired by anything?</p>
|
||||
<p>Yes, this was inspired by a minigame from an open-source codebase of
|
||||
Space Station 13. I didn’t, however, look at the minigame at all during
|
||||
the development of this entry.</p></li>
|
||||
<li><p>What’s the length of this README file according to the <a
|
||||
href="../iocccsize.c">iocccsize</a> tool?</p>
|
||||
<p>$ ./iocccsize -i < README.md 6057</p></li>
|
||||
<p>Yes, this was inspired by a minigame from an open-source codebase of Space
|
||||
Station 13. I didn’t, however, look at the minigame at all during the
|
||||
development of this entry.</p></li>
|
||||
<li><p>What’s the length of this README file according to the
|
||||
<a href="../iocccsize.c">iocccsize</a> tool?</p>
|
||||
<p>$ ./iocccsize -i < README.md
|
||||
6057</p></li>
|
||||
</ul>
|
||||
<h2 id="copyright-and-cc-by-sa-4.0-license">Copyright and CC BY-SA 4.0
|
||||
License:</h2>
|
||||
<p>This file is Copyright (c) 2023 by Landon Curt Noll. All Rights
|
||||
Reserved. You are free to share and adapt this file under the terms of
|
||||
this license:</p>
|
||||
<h2 id="copyright-and-cc-by-sa-4.0-license">Copyright and CC BY-SA 4.0 License:</h2>
|
||||
<p>This file is Copyright (c) 2023 by Landon Curt Noll. All Rights Reserved.
|
||||
You are free to share and adapt this file under the terms of this license:</p>
|
||||
<pre><code>Creative Commons Attribution-ShareAlike 4.0 International (CC BY-SA 4.0)</code></pre>
|
||||
<p>For more information, see:
|
||||
https://creativecommons.org/licenses/by-sa/4.0/</p>
|
||||
<p>For more information, see: https://creativecommons.org/licenses/by-sa/4.0/</p>
|
||||
|
||||
<!-- END: this line ends content for HTML phase 21 by: bin/pandoc-wrapper.sh via bin/md2html.sh -->
|
||||
<!-- START: this line starts content for HTML phase 22 by: bin/output-index-inventory.sh via bin/md2html.sh -->
|
||||
|
||||
<!-- START: this line starts content generated by: bin/output-index-inventory.sh -->
|
||||
|
||||
<h1 id="inventory-for-2014skeggs"><a name="inventory"></a>Inventory for
|
||||
2014/skeggs</h1>
|
||||
<h1 id="inventory-for-2014skeggs"><a name="inventory"></a>Inventory for 2014/skeggs</h1>
|
||||
<p><a href="#top">Jump to top</a></p>
|
||||
<h2 id="primary-files">Primary files</h2>
|
||||
<ul>
|
||||
<li><a
|
||||
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2014/skeggs/prog.c">prog.c</a>
|
||||
- entry source</li>
|
||||
<li><a
|
||||
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2014/skeggs/Makefile">Makefile</a>
|
||||
- entry Makefile</li>
|
||||
<li><a
|
||||
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2014/skeggs/prog.orig.c">prog.orig.c</a>
|
||||
- original source</li>
|
||||
<li><a href="2014_skeggs.tar.bz2">2014_skeggs.tar.bz2</a> - download
|
||||
entry source</li>
|
||||
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2014/skeggs/prog.c">prog.c</a> - entry source</li>
|
||||
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2014/skeggs/Makefile">Makefile</a> - entry Makefile</li>
|
||||
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2014/skeggs/prog.orig.c">prog.orig.c</a> - original source</li>
|
||||
<li><a href="2014_skeggs.tar.bz2">2014_skeggs.tar.bz2</a> - download entry source</li>
|
||||
</ul>
|
||||
<h2 id="secondary-files">Secondary files</h2>
|
||||
<ul>
|
||||
<li><a href="index.html">index.html</a> - entry home page</li>
|
||||
<li><a
|
||||
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2014/skeggs/.entry.json">.entry.json</a>
|
||||
- description of entry in JSON</li>
|
||||
<li><a
|
||||
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2014/skeggs/.gitignore">.gitignore</a>
|
||||
- list of files that should not be committed under git</li>
|
||||
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2014/skeggs/.entry.json">.entry.json</a> - description of entry in JSON</li>
|
||||
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2014/skeggs/.gitignore">.gitignore</a> - list of files that should not be committed under git</li>
|
||||
<li><a href=".path">.path</a> - directory path from top directory</li>
|
||||
<li><a
|
||||
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2014/skeggs/README.md">README.md</a>
|
||||
- markdown source for index.html</li>
|
||||
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2014/skeggs/README.md">README.md</a> - markdown source for index.html</li>
|
||||
</ul>
|
||||
|
||||
<!-- END: next line ends content generated by: bin/output-index-inventory.sh -->
|
||||
|
||||
+46
-76
@@ -130,8 +130,8 @@
|
||||
<h2 id="author"><a name="author"></a>Author:</h2>
|
||||
<ul>
|
||||
<li>Name: <a href="../../authors.html#Daniel_Vik">Daniel Vik</a><br>
|
||||
Location: <a href="../../location.html#US">US</a> - <em>United States of
|
||||
America</em> (<em>United States</em>) <br><br></li>
|
||||
Location: <a href="../../location.html#US">US</a> - <em>United States of America</em> (<em>United States</em>)
|
||||
<br><br></li>
|
||||
</ul>
|
||||
|
||||
<!-- END: next line ends content generated by: bin/output-index-author.sh -->
|
||||
@@ -141,14 +141,13 @@ America</em> (<em>United States</em>) <br><br></li>
|
||||
|
||||
<h2 id="to-build">To build:</h2>
|
||||
<div class="sourceCode" id="cb1"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb1-1"><a href="#cb1-1" aria-hidden="true" tabindex="-1"></a><span class="fu">make</span></span></code></pre></div>
|
||||
<p>There is an alternate version that will theoretically work with
|
||||
Windows compilers (if anything in Windows works :-) ). See the <a
|
||||
href="#alternate-code">Alternate code</a> section below.</p>
|
||||
<p>There is an alternate version that will theoretically work with Windows
|
||||
compilers (if anything in Windows works :-) ). See the <a href="#alternate-code">Alternate
|
||||
code</a> section below.</p>
|
||||
<h3 id="bugs-and-misfeatures">Bugs and (Mis)features:</h3>
|
||||
<p>The current status of this entry is:</p>
|
||||
<pre><code>STATUS: known bug - please help us fix</code></pre>
|
||||
<p>For more detailed information see <a
|
||||
href="../../bugs.html#2014_vik">2014 vik bugs</a>.</p>
|
||||
<p>For more detailed information see <a href="../../bugs.html#2014_vik">2014 vik bugs</a>.</p>
|
||||
<h2 id="to-use">To use:</h2>
|
||||
<div class="sourceCode" id="cb3"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb3-1"><a href="#cb3-1" aria-hidden="true" tabindex="-1"></a><span class="bu">echo</span> foo <span class="kw">|</span> <span class="ex">./prog</span> <span class="op">></span> audio_file.raw</span>
|
||||
<span id="cb3-2"><a href="#cb3-2" aria-hidden="true" tabindex="-1"></a></span>
|
||||
@@ -156,13 +155,12 @@ href="../../bugs.html#2014_vik">2014 vik bugs</a>.</p>
|
||||
<h2 id="try">Try:</h2>
|
||||
<div class="sourceCode" id="cb4"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb4-1"><a href="#cb4-1" aria-hidden="true" tabindex="-1"></a><span class="ex">./try.sh</span></span></code></pre></div>
|
||||
<h2 id="alternate-code">Alternate code:</h2>
|
||||
<p>The alternate code, <a href="prog.alt.c">prog.alt.c</a>, is based on
|
||||
the author’s instructions on how to get it to work with Windows.</p>
|
||||
<p>The alternate code, <a href="prog.alt.c">prog.alt.c</a>, is based on the author’s
|
||||
instructions on how to get it to work with Windows.</p>
|
||||
<h3 id="alternate-build">Alternate build:</h3>
|
||||
<div class="sourceCode" id="cb5"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb5-1"><a href="#cb5-1" aria-hidden="true" tabindex="-1"></a><span class="fu">make</span> alt</span></code></pre></div>
|
||||
<h3 id="alternate-use">Alternate use:</h3>
|
||||
<p>Use <code>prog.alt</code> as you would <code>prog</code> above as
|
||||
well as below.</p>
|
||||
<p>Use <code>prog.alt</code> as you would <code>prog</code> above as well as below.</p>
|
||||
<h2 id="judges-remarks">Judges’ remarks:</h2>
|
||||
<p>This program sets a new tone for obfuscation. But do you understand
|
||||
what it says about obfuscation? Perhaps:</p>
|
||||
@@ -172,92 +170,64 @@ what it says about obfuscation? Perhaps:</p>
|
||||
<p>might help? :-)</p>
|
||||
<h2 id="authors-remarks">Author’s remarks:</h2>
|
||||
<h3 id="remarks">Remarks</h3>
|
||||
<p>This program converts ASCII text to Morse audio file and vice versa.
|
||||
As far as I can tell, there are at least six chocolate references in
|
||||
this program.</p>
|
||||
<p>This program can convert text to Morse to a raw 44.1kHz stereo audio
|
||||
file. Via streaming to <code>mplayer(1)</code>, you can listen to the
|
||||
Morse audio.</p>
|
||||
<p>Don’t forget the last ‘<code>-</code>’ as it makes
|
||||
<code>mplayer(1)</code> read from <code>stdin</code>.</p>
|
||||
<h2 id="convert-audio-file-with-morse-signals-to-text">Convert audio
|
||||
file with Morse signals to text</h2>
|
||||
<p>This program converts ASCII text to Morse audio file and vice versa. As far as
|
||||
I can tell, there are at least six chocolate references in this program.</p>
|
||||
<p>This program can convert text to Morse to a raw 44.1kHz stereo audio file.
|
||||
Via streaming to <code>mplayer(1)</code>, you can listen to the Morse audio.</p>
|
||||
<p>Don’t forget the last ‘<code>-</code>’ as it makes <code>mplayer(1)</code> read from <code>stdin</code>.</p>
|
||||
<h2 id="convert-audio-file-with-morse-signals-to-text">Convert audio file with Morse signals to text</h2>
|
||||
<div class="sourceCode" id="cb8"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb8-1"><a href="#cb8-1" aria-hidden="true" tabindex="-1"></a><span class="ex">./prog</span> e <span class="op"><</span> audio_file.raw</span></code></pre></div>
|
||||
<p>or alternatively pass a .wav file as input.</p>
|
||||
<p>The preferred input format 44.1kHz stereo, but it does a decent job
|
||||
on mono input and different frequencies as well.</p>
|
||||
<p>The preferred input format 44.1kHz stereo, but it does a decent job on mono
|
||||
input and different frequencies as well.</p>
|
||||
<h3 id="portability">Portability</h3>
|
||||
<p>The program is portable to most platforms. The only system dependency
|
||||
is that the program relies on writing binary data to
|
||||
<code>stdout</code>.</p>
|
||||
<p>Microsoft compilers add a carriage return to newlines, and to compile
|
||||
the program with this platform, the following line can be added to
|
||||
<code>main()</code> before any code in order for the program to run
|
||||
correctly:</p>
|
||||
<p>The program is portable to most platforms. The only system dependency is that
|
||||
the program relies on writing binary data to <code>stdout</code>.</p>
|
||||
<p>Microsoft compilers add a carriage return to newlines, and to compile the
|
||||
program with this platform, the following line can be added to <code>main()</code> before
|
||||
any code in order for the program to run correctly:</p>
|
||||
<div class="sourceCode" id="cb9"><pre class="sourceCode c"><code class="sourceCode c"><span id="cb9-1"><a href="#cb9-1" aria-hidden="true" tabindex="-1"></a>_setmode<span class="op">(</span>_fileno<span class="op">(</span>stdout<span class="op">),</span> <span class="bn">0x8000</span><span class="op">);</span></span></code></pre></div>
|
||||
<p>NOTE: see the <a href="prog.alt.c">alternate code</a> for this.</p>
|
||||
<h3 id="known-issues">Known Issues</h3>
|
||||
<p>The program uses a quite simple algorithm for detecting tone on and
|
||||
off events in the Morse signal. Hence the program does not work well
|
||||
with noisy input signals. I have tested it with several samples of man
|
||||
made Morse recordings as well as computer generated ones.</p>
|
||||
<p>Generally, any recording from ham radio transmissions does not decode
|
||||
due to noise and echoes. Other man made recordings may decode, but some
|
||||
characters can be incorrect due to too big variation in length of tones
|
||||
and pauses. However I found some man made recordings on that decode
|
||||
reasonable well.</p>
|
||||
<p>If a recording doesn’t decode, you could try to pre-process the input
|
||||
with a narrow bandpass filter on the frequency of the transmission.</p>
|
||||
<h2 id="copyright-and-cc-by-sa-4.0-license">Copyright and CC BY-SA 4.0
|
||||
License:</h2>
|
||||
<p>This file is Copyright (c) 2023 by Landon Curt Noll. All Rights
|
||||
Reserved. You are free to share and adapt this file under the terms of
|
||||
this license:</p>
|
||||
<p>The program uses a quite simple algorithm for detecting tone on and off events
|
||||
in the Morse signal. Hence the program does not work well with noisy input
|
||||
signals. I have tested it with several samples of man made Morse recordings as
|
||||
well as computer generated ones.</p>
|
||||
<p>Generally, any recording from ham radio transmissions does not decode due to
|
||||
noise and echoes. Other man made recordings may decode, but some characters
|
||||
can be incorrect due to too big variation in length of tones and pauses.
|
||||
However I found some man made recordings on that decode reasonable well.</p>
|
||||
<p>If a recording doesn’t decode, you could try to pre-process the input with a
|
||||
narrow bandpass filter on the frequency of the transmission.</p>
|
||||
<h2 id="copyright-and-cc-by-sa-4.0-license">Copyright and CC BY-SA 4.0 License:</h2>
|
||||
<p>This file is Copyright (c) 2023 by Landon Curt Noll. All Rights Reserved.
|
||||
You are free to share and adapt this file under the terms of this license:</p>
|
||||
<pre><code>Creative Commons Attribution-ShareAlike 4.0 International (CC BY-SA 4.0)</code></pre>
|
||||
<p>For more information, see:
|
||||
https://creativecommons.org/licenses/by-sa/4.0/</p>
|
||||
<p>For more information, see: https://creativecommons.org/licenses/by-sa/4.0/</p>
|
||||
|
||||
<!-- END: this line ends content for HTML phase 21 by: bin/pandoc-wrapper.sh via bin/md2html.sh -->
|
||||
<!-- START: this line starts content for HTML phase 22 by: bin/output-index-inventory.sh via bin/md2html.sh -->
|
||||
|
||||
<!-- START: this line starts content generated by: bin/output-index-inventory.sh -->
|
||||
|
||||
<h1 id="inventory-for-2014vik"><a name="inventory"></a>Inventory for
|
||||
2014/vik</h1>
|
||||
<h1 id="inventory-for-2014vik"><a name="inventory"></a>Inventory for 2014/vik</h1>
|
||||
<p><a href="#top">Jump to top</a></p>
|
||||
<h2 id="primary-files">Primary files</h2>
|
||||
<ul>
|
||||
<li><a
|
||||
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2014/vik/prog.c">prog.c</a>
|
||||
- entry source</li>
|
||||
<li><a
|
||||
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2014/vik/Makefile">Makefile</a>
|
||||
- entry Makefile</li>
|
||||
<li><a
|
||||
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2014/vik/prog.alt.c">prog.alt.c</a>
|
||||
- alternative source</li>
|
||||
<li><a
|
||||
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2014/vik/prog.orig.c">prog.orig.c</a>
|
||||
- original source</li>
|
||||
<li><a
|
||||
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2014/vik/try.sh">try.sh</a>
|
||||
- how to run</li>
|
||||
<li><a href="2014_vik.tar.bz2">2014_vik.tar.bz2</a> - download entry
|
||||
source</li>
|
||||
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2014/vik/prog.c">prog.c</a> - entry source</li>
|
||||
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2014/vik/Makefile">Makefile</a> - entry Makefile</li>
|
||||
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2014/vik/prog.alt.c">prog.alt.c</a> - alternative source</li>
|
||||
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2014/vik/prog.orig.c">prog.orig.c</a> - original source</li>
|
||||
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2014/vik/try.sh">try.sh</a> - how to run</li>
|
||||
<li><a href="2014_vik.tar.bz2">2014_vik.tar.bz2</a> - download entry source</li>
|
||||
</ul>
|
||||
<h2 id="secondary-files">Secondary files</h2>
|
||||
<ul>
|
||||
<li><a href="index.html">index.html</a> - entry home page</li>
|
||||
<li><a
|
||||
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2014/vik/.entry.json">.entry.json</a>
|
||||
- description of entry in JSON</li>
|
||||
<li><a
|
||||
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2014/vik/.gitignore">.gitignore</a>
|
||||
- list of files that should not be committed under git</li>
|
||||
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2014/vik/.entry.json">.entry.json</a> - description of entry in JSON</li>
|
||||
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2014/vik/.gitignore">.gitignore</a> - list of files that should not be committed under git</li>
|
||||
<li><a href=".path">.path</a> - directory path from top directory</li>
|
||||
<li><a
|
||||
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2014/vik/README.md">README.md</a>
|
||||
- markdown source for index.html</li>
|
||||
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2014/vik/README.md">README.md</a> - markdown source for index.html</li>
|
||||
</ul>
|
||||
|
||||
<!-- END: next line ends content generated by: bin/output-index-inventory.sh -->
|
||||
|
||||
+38
-69
@@ -129,9 +129,9 @@
|
||||
|
||||
<h2 id="author"><a name="author"></a>Author:</h2>
|
||||
<ul>
|
||||
<li>Name: <a href="../../authors.html#Freek_Wiedijk">Freek
|
||||
Wiedijk</a><br> Location: <a href="../../location.html#NL">NL</a> -
|
||||
<em>Kingdom of the Netherlands</em> (<em>Netherlands</em>) <br><br></li>
|
||||
<li>Name: <a href="../../authors.html#Freek_Wiedijk">Freek Wiedijk</a><br>
|
||||
Location: <a href="../../location.html#NL">NL</a> - <em>Kingdom of the Netherlands</em> (<em>Netherlands</em>)
|
||||
<br><br></li>
|
||||
</ul>
|
||||
|
||||
<!-- END: next line ends content generated by: bin/output-index-author.sh -->
|
||||
@@ -145,103 +145,72 @@ Wiedijk</a><br> Location: <a href="../../location.html#NL">NL</a> -
|
||||
<div class="sourceCode" id="cb2"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb2-1"><a href="#cb2-1" aria-hidden="true" tabindex="-1"></a><span class="ex">./prog</span></span></code></pre></div>
|
||||
<h2 id="try">Try:</h2>
|
||||
<div class="sourceCode" id="cb3"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb3-1"><a href="#cb3-1" aria-hidden="true" tabindex="-1"></a><span class="ex">./try.sh</span></span></code></pre></div>
|
||||
<p>By default that will use <code>indent(1)</code> found by the shell
|
||||
<code>type -P indent</code> and <code>sed(1)</code> found by the shell
|
||||
<code>type -P sed</code> but if you want to change these, say to try a
|
||||
different beautifier, you can do it like:</p>
|
||||
<p>By default that will use <code>indent(1)</code> found by the shell <code>type -P indent</code> and
|
||||
<code>sed(1)</code> found by the shell <code>type -P sed</code> but if you want to change these, say
|
||||
to try a different beautifier, you can do it like:</p>
|
||||
<div class="sourceCode" id="cb4"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb4-1"><a href="#cb4-1" aria-hidden="true" tabindex="-1"></a><span class="va">INDENT</span><span class="op">=</span>bcpp <span class="ex">./try.sh</span></span></code></pre></div>
|
||||
<p>which would change it to use <code>bcpp(1)</code> instead of
|
||||
<code>indent(1)</code>. Do similar for <code>sed(1)</code> only use the
|
||||
name <code>SED</code>.</p>
|
||||
<p>which would change it to use <code>bcpp(1)</code> instead of <code>indent(1)</code>. Do similar for
|
||||
<code>sed(1)</code> only use the name <code>SED</code>.</p>
|
||||
<h2 id="judges-remarks">Judges’ remarks:</h2>
|
||||
<p>C11 features definitely help this entry to be as concise as it
|
||||
is.</p>
|
||||
<p>The judges would like to think that they had almost understood how
|
||||
this entry works.</p>
|
||||
<p>C11 features definitely help this entry to be as concise as it is.</p>
|
||||
<p>The judges would like to think that they had almost understood how this entry works.</p>
|
||||
<p>If you win a bet by demonstrating this entry, please let us know.</p>
|
||||
<h2 id="authors-remarks">Author’s remarks:</h2>
|
||||
<h3 id="remarks">Remarks</h3>
|
||||
<ul>
|
||||
<li>Computes the factorial function.</li>
|
||||
<li>No loops, no explicit recursion.</li>
|
||||
<li>Untyped C without any casts, using a <code>w</code> word
|
||||
datatype.</li>
|
||||
<li>Varargs not essential, <code>w(*)(w,w*)</code> works just as
|
||||
well.</li>
|
||||
<li>Untyped C without any casts, using a <code>w</code> word datatype.</li>
|
||||
<li>Varargs not essential, <code>w(*)(w,w*)</code> works just as well.</li>
|
||||
<li>Conforming to ISO C.</li>
|
||||
<li>No warnings when compiled with
|
||||
<code>-std=c99 -Wall -Wextra -pedantic</code>.</li>
|
||||
<li>No warnings when compiled with <code>-std=c99 -Wall -Wextra -pedantic</code>.</li>
|
||||
<li>Comments in the code explain what this really is about.</li>
|
||||
<li>C as a functional programming language: untyped lambda calculus
|
||||
compiled to executable C functions.</li>
|
||||
<li>Untagged closures (just a function pointer followed by some
|
||||
values).</li>
|
||||
<li>Recursion implemented through Curry’s paradoxical combinator
|
||||
<code>Y</code>.</li>
|
||||
<li>The readable implementation of <code>Y</code> is on lines
|
||||
29-30:</li>
|
||||
<li>C as a functional programming language: untyped lambda calculus compiled to
|
||||
executable C functions.</li>
|
||||
<li>Untagged closures (just a function pointer followed by some values).</li>
|
||||
<li>Recursion implemented through Curry’s paradoxical combinator <code>Y</code>.</li>
|
||||
<li>The readable implementation of <code>Y</code> is on lines 29-30:</li>
|
||||
</ul>
|
||||
<pre><code>W_f = \x.f(xx)
|
||||
Y = \f.W_f W_f</code></pre>
|
||||
<ul>
|
||||
<li>A mixture of strict and lazy evaluation, with a <code>_</code> force
|
||||
function (John Tromp notes that if Turing’s fixed-point combinator
|
||||
<code>(\xy.y\z.xxyz)(\xy.y\z.xxyz)</code> had been used, all
|
||||
applications could have been strict).</li>
|
||||
<li>Uses <code>Y</code> to implement factorial on native
|
||||
<code>int</code>s.</li>
|
||||
<li>A mixture of strict and lazy evaluation, with a <code>_</code> force function
|
||||
(John Tromp notes that if Turing’s fixed-point combinator
|
||||
<code>(\xy.y\z.xxyz)(\xy.y\z.xxyz)</code> had been used,
|
||||
all applications could have been strict).</li>
|
||||
<li>Uses <code>Y</code> to implement factorial on native <code>int</code>s.</li>
|
||||
<li>10! seconds = 6 weeks.</li>
|
||||
<li>Answers the <a
|
||||
href="https://hitchhikers.fandom.com/wiki/42">ultimate question of life,
|
||||
the universe and everything</a>.</li>
|
||||
<li>Answers the <a href="https://hitchhikers.fandom.com/wiki/42">ultimate question of life, the universe and
|
||||
everything</a>.</li>
|
||||
</ul>
|
||||
<h2 id="copyright-and-cc-by-sa-4.0-license">Copyright and CC BY-SA 4.0
|
||||
License:</h2>
|
||||
<p>This file is Copyright (c) 2023 by Landon Curt Noll. All Rights
|
||||
Reserved. You are free to share and adapt this file under the terms of
|
||||
this license:</p>
|
||||
<h2 id="copyright-and-cc-by-sa-4.0-license">Copyright and CC BY-SA 4.0 License:</h2>
|
||||
<p>This file is Copyright (c) 2023 by Landon Curt Noll. All Rights Reserved.
|
||||
You are free to share and adapt this file under the terms of this license:</p>
|
||||
<pre><code>Creative Commons Attribution-ShareAlike 4.0 International (CC BY-SA 4.0)</code></pre>
|
||||
<p>For more information, see:
|
||||
https://creativecommons.org/licenses/by-sa/4.0/</p>
|
||||
<p>For more information, see: https://creativecommons.org/licenses/by-sa/4.0/</p>
|
||||
|
||||
<!-- END: this line ends content for HTML phase 21 by: bin/pandoc-wrapper.sh via bin/md2html.sh -->
|
||||
<!-- START: this line starts content for HTML phase 22 by: bin/output-index-inventory.sh via bin/md2html.sh -->
|
||||
|
||||
<!-- START: this line starts content generated by: bin/output-index-inventory.sh -->
|
||||
|
||||
<h1 id="inventory-for-2014wiedijk"><a name="inventory"></a>Inventory for
|
||||
2014/wiedijk</h1>
|
||||
<h1 id="inventory-for-2014wiedijk"><a name="inventory"></a>Inventory for 2014/wiedijk</h1>
|
||||
<p><a href="#top">Jump to top</a></p>
|
||||
<h2 id="primary-files">Primary files</h2>
|
||||
<ul>
|
||||
<li><a
|
||||
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2014/wiedijk/prog.c">prog.c</a>
|
||||
- entry source</li>
|
||||
<li><a
|
||||
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2014/wiedijk/Makefile">Makefile</a>
|
||||
- entry Makefile</li>
|
||||
<li><a
|
||||
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2014/wiedijk/prog.orig.c">prog.orig.c</a>
|
||||
- original source</li>
|
||||
<li><a
|
||||
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2014/wiedijk/try.sh">try.sh</a>
|
||||
- how to run</li>
|
||||
<li><a href="2014_wiedijk.tar.bz2">2014_wiedijk.tar.bz2</a> - download
|
||||
entry source</li>
|
||||
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2014/wiedijk/prog.c">prog.c</a> - entry source</li>
|
||||
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2014/wiedijk/Makefile">Makefile</a> - entry Makefile</li>
|
||||
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2014/wiedijk/prog.orig.c">prog.orig.c</a> - original source</li>
|
||||
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2014/wiedijk/try.sh">try.sh</a> - how to run</li>
|
||||
<li><a href="2014_wiedijk.tar.bz2">2014_wiedijk.tar.bz2</a> - download entry source</li>
|
||||
</ul>
|
||||
<h2 id="secondary-files">Secondary files</h2>
|
||||
<ul>
|
||||
<li><a href="index.html">index.html</a> - entry home page</li>
|
||||
<li><a
|
||||
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2014/wiedijk/.entry.json">.entry.json</a>
|
||||
- description of entry in JSON</li>
|
||||
<li><a
|
||||
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2014/wiedijk/.gitignore">.gitignore</a>
|
||||
- list of files that should not be committed under git</li>
|
||||
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2014/wiedijk/.entry.json">.entry.json</a> - description of entry in JSON</li>
|
||||
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2014/wiedijk/.gitignore">.gitignore</a> - list of files that should not be committed under git</li>
|
||||
<li><a href=".path">.path</a> - directory path from top directory</li>
|
||||
<li><a
|
||||
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2014/wiedijk/README.md">README.md</a>
|
||||
- markdown source for index.html</li>
|
||||
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2014/wiedijk/README.md">README.md</a> - markdown source for index.html</li>
|
||||
</ul>
|
||||
|
||||
<!-- END: next line ends content generated by: bin/output-index-inventory.sh -->
|
||||
|
||||
Reference in new issue
Block a user