Remove hint.html and index.html
As per discussions on GitHub the index.html and hint.html files should be deleted in favour of README.md files (from any .text/.txt/.markdown/.md files which will be turned into README.md in an upcoming commit).
This commit is contained in:
1 parent
ee8a36310f
commit
77fb0f11a2
143 files changed
-28606
No files matched your search
@@ -1,159 +0,0 @@
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
|
||||
<html>
|
||||
<head>
|
||||
<meta name="GENERATOR" content="mkd2html 2.1.5a DL=DISCOUNT">
|
||||
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=utf-8">
|
||||
<link rel="stylesheet"
|
||||
type="text/css"
|
||||
href="../hint.css">
|
||||
<title>Best use of port 1701</title>
|
||||
</head>
|
||||
<body>
|
||||
<h1>Best use of port 1701</h1>
|
||||
|
||||
<p>Michael Birken<br>
|
||||
<a href="mailto:o__1@hotmail.com">o__1@hotmail.com</a><br>
|
||||
<a href="http://www.meatfighter.com/">http://www.meatfighter.com/</a></p>
|
||||
|
||||
<p>Alexander Prishchepov<br>
|
||||
<a href="https://github.com/sans17/">https://github.com/sans17/</a></p>
|
||||
|
||||
<h2>Judges' comments:</h2>
|
||||
|
||||
<h3>To build:</h3>
|
||||
|
||||
<pre><code>make
|
||||
</code></pre>
|
||||
|
||||
<h3>To run:</h3>
|
||||
|
||||
<pre><code>./prog < some_secret_or_something
|
||||
|
||||
./prog http://host[:port]
|
||||
</code></pre>
|
||||
|
||||
<h3>Try:</h3>
|
||||
|
||||
<pre><code>./prog.c
|
||||
|
||||
./prog http://127.0.0.1:1701
|
||||
</code></pre>
|
||||
|
||||
<h3>Selected Judges Remarks:</h3>
|
||||
|
||||
<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>
|
||||
|
||||
<p>So how does this program do it? A trek though the cloak of
|
||||
obfuscation awaits the reader of the source!</p>
|
||||
|
||||
<h2>Author’s comments:</h2>
|
||||
|
||||
<h3>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 provides 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>
|
||||
|
||||
<h3>To run web server</h3>
|
||||
|
||||
<pre><code>./prog < secret_file_to_be_downloaded
|
||||
</code></pre>
|
||||
|
||||
<p>Try using the program’s source code as the secret file:</p>
|
||||
|
||||
<pre><code>./prog < prog.c
|
||||
</code></pre>
|
||||
|
||||
<h3>To run client-side downloader</h3>
|
||||
|
||||
<pre><code>./prog http://host[:port]
|
||||
</code></pre>
|
||||
|
||||
<p>The optional port defaults to 1701. If the web server instance is started on the same box, try:</p>
|
||||
|
||||
<pre><code>./prog http://127.0.0.1:1701
|
||||
</code></pre>
|
||||
|
||||
<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>HTML content</h3>
|
||||
|
||||
<p>Plug the URL into a browser to view a static HTML page containing ASCII artwork.</p>
|
||||
|
||||
<h3>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>
|
||||
|
||||
<h3>Inspiration</h3>
|
||||
|
||||
<p>The inspiration for this program comes from <em>Star Trek VI: The Undiscovered Country</em>, specifically the final confrontation between the <em>Enterprise</em> and the enhanced prototype Klingon Bird of Prey. The definitive feature of the prototype was its ability to fire while cloaked. But, perhaps even more impressive was its able to keep an open communication channel with the <em>Enterprise</em> throughout the battle, enabling the antagonist Chang to taunt Captain Kirk with Shakespearian 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 <em>Enterprise</em> (NCC-1701) is defined as a constant; variable names spell out Cpt. James T. Kirk and Odo (the Deep Space 9 character was played by René Auberjonois who also appeared as Colonel West in <em>Star Trek VI</em>); the STARDATE constant makes timing configurable; and, the constant k stands for Khan (in the final engagement in <em>Star Trek II: The Wrath of Khan</em>, the damaged <em>Enterprise</em> managed to disable the USS <em>Reliant</em>’s shield generator by accessing its prefix code: 16309).</p>
|
||||
|
||||
<h3>Secondary size limit</h3>
|
||||
|
||||
<p>As obligated by a program that employs 23rd century cloaking technology, when the source is fed as input to IOCCC size tool version 2014-09-23-v19, and the -i command line option is used, the value printed is 0.</p>
|
||||
|
||||
<h3>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>
|
||||
|
||||
<h3>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 0.5 seconds. This is microsecond tunable via the STARDATE 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>Obfuscations</h3>
|
||||
|
||||
<ul>
|
||||
<li>The ASCII artwork is compressed using run-length encoding.</li>
|
||||
<li>One long string stores a series of strings concatenated together and referenced via pointers.</li>
|
||||
<li>The long string is shift encrypted.</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>O and l were selected for their resemblance to 0 and 1 respectively.</li>
|
||||
<li>Standard constants and ASCII characters were replaced with their respective numerical values.</li>
|
||||
</ul>
|
||||
|
||||
|
||||
<h3>Compiler warnings</h3>
|
||||
|
||||
<p>For space considerations, the following include statements were dropped resulting in compiler warnings:</p>
|
||||
|
||||
<pre><code>#include <asm/byteorder.h>
|
||||
#include <ctype.h>
|
||||
#include <netinet/in.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <sys/select.h>
|
||||
#include <sys/socket.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/unistd.h>
|
||||
</code></pre>
|
||||
|
||||
<p>It may be necessary to restore some of these under certain environments.</p>
|
||||
|
||||
<hr />
|
||||
|
||||
<TABLE><TR>
|
||||
<TD><a rel="license" href="http://creativecommons.org/licenses/by-sa/3.0/"><img alt="Creative Commons License" style="border-width:0" src="http://i.creativecommons.org/l/by-sa/3.0/88x31.png" /></a></TD>
|
||||
<TD><P>© Copyright 1984-2015,
|
||||
<A HREF="/judges.html">Leo Broukhis, Simon Cooper, Landon Curt Noll</A>
|
||||
- All rights reserved<BR>
|
||||
This work is licensed under a <a rel="license" href="http://creativecommons.org/licenses/by-sa/3.0/">Creative Commons Attribution-ShareAlike 3.0 Unported License</a>.</P></TD>
|
||||
<TD> <!--<a href="http://validator.w3.org/check?uri=referer"><img src="http://www.w3.org/Icons/valid-html401" alt="Valid HTML 4.01 Transitional" height="31" width="88"></a>--></TD>
|
||||
</TR></TABLE>
|
||||
</body>
|
||||
</html>
|
||||
@@ -1,107 +0,0 @@
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
|
||||
<html>
|
||||
<head>
|
||||
<meta name="GENERATOR" content="mkd2html 2.1.5a DL=DISCOUNT">
|
||||
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=utf-8">
|
||||
<link rel="stylesheet"
|
||||
type="text/css"
|
||||
href="../hint.css">
|
||||
<title>Most underscored argument</title>
|
||||
</head>
|
||||
<body>
|
||||
<h1>Most underscored argument</h1>
|
||||
|
||||
<p>Ferenc Deak<br>
|
||||
<a href="mailto:fritzone@gmail.com">fritzone@gmail.com</a></p>
|
||||
|
||||
<h2>Judges' comments:</h2>
|
||||
|
||||
<h3>To build:</h3>
|
||||
|
||||
<pre><code>make deak
|
||||
</code></pre>
|
||||
|
||||
<h3>To run:</h3>
|
||||
|
||||
<pre><code>./prog
|
||||
</code></pre>
|
||||
|
||||
<h3>Try:</h3>
|
||||
|
||||
<pre><code>Changing bounding box coordinates in the source to explore
|
||||
various regions of the fractal.
|
||||
</code></pre>
|
||||
|
||||
<h3>Selected Judges Remarks:</h3>
|
||||
|
||||
<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>
|
||||
|
||||
<h2>Author’s comments:</h2>
|
||||
|
||||
<h3>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 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>The application</h3>
|
||||
|
||||
<p>The purpose of the application is mainly to illustrate the weird possibilities
|
||||
of the C preprocessor, 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>
|
||||
|
||||
<pre><code> double _[]={-2
|
||||
,1,-1.3 ,1.3, 0, 0,0,0
|
||||
,0 ,0,50, 80, 0,0,0 ,255
|
||||
, 8,0}; int main (
|
||||
int j) {if (j== 1 ){ if(
|
||||
_[12] >_[10] )_[17]=1 ;} if
|
||||
(_[13] >_[11 ] ||_[17]==1) return
|
||||
;_[6] = _ [13] / _[11]*(_[1]-_[ 0])
|
||||
+_[ 0]; _ [7]=_[12]/_[10]*(_[3]-_[2] )+_
|
||||
[2];_[8]=_[9]=_[14]=0;l2:_[4]=_[8] * _ [8]
|
||||
;_[ 5]= _ [9]*_[9];_[9]=2*_[8]*_[9]+ _[7
|
||||
];_[8 ] = _ [ 4 ]-_[5]+_[6];_[14 ]++
|
||||
;if((_ [14]< _ [15])&&(_[4]+ _[ 5]
|
||||
<_[16 ])) goto l2; putchar(
|
||||
" #@*+ "[( int) _[14]%
|
||||
5 ]);_ [13 ] ++ ; main (
|
||||
0) ;_[12]++; _[13] =0
|
||||
;if(_ [17] !=1) putchar
|
||||
(0xa); main(1);}
|
||||
</code></pre>
|
||||
|
||||
<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>Compiler warnings</h3>
|
||||
|
||||
<p>Yes, unfortunately there are compiler warnings of the kind “initialization makes
|
||||
integer from pointer without a cast” the provided Makefile automatically
|
||||
disables them.</p>
|
||||
|
||||
<hr />
|
||||
|
||||
<TABLE><TR>
|
||||
<TD><a rel="license" href="http://creativecommons.org/licenses/by-sa/3.0/"><img alt="Creative Commons License" style="border-width:0" src="http://i.creativecommons.org/l/by-sa/3.0/88x31.png" /></a></TD>
|
||||
<TD><P>© Copyright 1984-2015,
|
||||
<A HREF="/judges.html">Leo Broukhis, Simon Cooper, Landon Curt Noll</A>
|
||||
- All rights reserved<BR>
|
||||
This work is licensed under a <a rel="license" href="http://creativecommons.org/licenses/by-sa/3.0/">Creative Commons Attribution-ShareAlike 3.0 Unported License</a>.</P></TD>
|
||||
<TD> <!--<a href="http://validator.w3.org/check?uri=referer"><img src="http://www.w3.org/Icons/valid-html401" alt="Valid HTML 4.01 Transitional" height="31" width="88"></a>--></TD>
|
||||
</TR></TABLE>
|
||||
</body>
|
||||
</html>
|
||||
@@ -1,74 +0,0 @@
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
|
||||
<html>
|
||||
<head>
|
||||
<meta name="GENERATOR" content="mkd2html 2.1.5a DL=DISCOUNT">
|
||||
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=utf-8">
|
||||
<link rel="stylesheet"
|
||||
type="text/css"
|
||||
href="../hint.css">
|
||||
<title>Most square (YODA award)</title>
|
||||
</head>
|
||||
<body>
|
||||
<h1>Most square (YODA award)</h1>
|
||||
|
||||
<p>Yusuke Endoh<br>
|
||||
<a href="mailto:mame@ruby-lang.org">mame@ruby-lang.org</a><br>
|
||||
<a href="https://github.com/mame/">https://github.com/mame/</a></p>
|
||||
|
||||
<h2>Judges' comments:</h2>
|
||||
|
||||
<h3>To build:</h3>
|
||||
|
||||
<pre><code>make
|
||||
</code></pre>
|
||||
|
||||
<h3>To run:</h3>
|
||||
|
||||
<pre><code>./prog > foo.c
|
||||
</code></pre>
|
||||
|
||||
<h3>Try:</h3>
|
||||
|
||||
<pre><code>./prog > main.c
|
||||
|
||||
make main
|
||||
./main Hello
|
||||
</code></pre>
|
||||
|
||||
<h3>Selected Judges Remarks:</h3>
|
||||
|
||||
<p>Big terminals with tiny fonts have their uses in certain cases.
|
||||
One of them is:</p>
|
||||
|
||||
<pre><code>./prog < prog.c > treacle.c
|
||||
make treacle
|
||||
# or instead of make: cc -Wno-empty-body -funsigned-char treacle.c -o treacle
|
||||
./treacle
|
||||
</code></pre>
|
||||
|
||||
<p>When using a smart phone 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>Author’s comments:</h2>
|
||||
|
||||
<h3>Remarks</h3>
|
||||
|
||||
<p>You may want to use a large display with a very small-font terminal.</p>
|
||||
|
||||
<h3>Spoiler</h3>
|
||||
|
||||
<p>Decompress <code>src.zip</code> if you need explanation.</p>
|
||||
|
||||
<hr />
|
||||
|
||||
<TABLE><TR>
|
||||
<TD><a rel="license" href="http://creativecommons.org/licenses/by-sa/3.0/"><img alt="Creative Commons License" style="border-width:0" src="http://i.creativecommons.org/l/by-sa/3.0/88x31.png" /></a></TD>
|
||||
<TD><P>© Copyright 1984-2015,
|
||||
<A HREF="/judges.html">Leo Broukhis, Simon Cooper, Landon Curt Noll</A>
|
||||
- All rights reserved<BR>
|
||||
This work is licensed under a <a rel="license" href="http://creativecommons.org/licenses/by-sa/3.0/">Creative Commons Attribution-ShareAlike 3.0 Unported License</a>.</P></TD>
|
||||
<TD> <!--<a href="http://validator.w3.org/check?uri=referer"><img src="http://www.w3.org/Icons/valid-html401" alt="Valid HTML 4.01 Transitional" height="31" width="88"></a>--></TD>
|
||||
</TR></TABLE>
|
||||
</body>
|
||||
</html>
|
||||
@@ -1,78 +0,0 @@
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
|
||||
<html>
|
||||
<head>
|
||||
<meta name="GENERATOR" content="mkd2html 2.1.5a DL=DISCOUNT">
|
||||
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=utf-8">
|
||||
<link rel="stylesheet"
|
||||
type="text/css"
|
||||
href="../hint.css">
|
||||
<title>Best use of bioinformatics</title>
|
||||
</head>
|
||||
<body>
|
||||
<h1>Best use of bioinformatics</h1>
|
||||
|
||||
<p>Yusuke Endoh<br>
|
||||
<a href="mailto:mame@ruby-lang.org">mame@ruby-lang.org</a><br>
|
||||
<a href="https://github.com/mame/">https://github.com/mame/</a></p>
|
||||
|
||||
<h2>Judges' comments:</h2>
|
||||
|
||||
<h3>To build:</h3>
|
||||
|
||||
<pre><code>make
|
||||
</code></pre>
|
||||
|
||||
<h3>To run:</h3>
|
||||
|
||||
<pre><code>./prog < input > output
|
||||
</code></pre>
|
||||
|
||||
<h3>Try:</h3>
|
||||
|
||||
<pre><code>echo Hello | ./prog
|
||||
|
||||
echo Hello | ./prog > hello.c
|
||||
make hello
|
||||
./hello
|
||||
</code></pre>
|
||||
|
||||
<h3>Selected Judges Remarks:</h3>
|
||||
|
||||
<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>Author’s comments:</h2>
|
||||
|
||||
<h3>Remarks</h3>
|
||||
|
||||
<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>For more information / backgroud reading:</h3>
|
||||
|
||||
<ul>
|
||||
<li><p>This program was inspired by Acme::DoubleHelix:
|
||||
http://search.cpan.org/~xern/Acme-DoubleHelix-0.01/</p></li>
|
||||
<li><p>The synthesized helix just includes the original program at the head.
|
||||
Do you see how <code>prog.c</code> 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>
|
||||
|
||||
|
||||
<hr />
|
||||
|
||||
<TABLE><TR>
|
||||
<TD><a rel="license" href="http://creativecommons.org/licenses/by-sa/3.0/"><img alt="Creative Commons License" style="border-width:0" src="http://i.creativecommons.org/l/by-sa/3.0/88x31.png" /></a></TD>
|
||||
<TD><P>© Copyright 1984-2015,
|
||||
<A HREF="/judges.html">Leo Broukhis, Simon Cooper, Landon Curt Noll</A>
|
||||
- All rights reserved<BR>
|
||||
This work is licensed under a <a rel="license" href="http://creativecommons.org/licenses/by-sa/3.0/">Creative Commons Attribution-ShareAlike 3.0 Unported License</a>.</P></TD>
|
||||
<TD> <!--<a href="http://validator.w3.org/check?uri=referer"><img src="http://www.w3.org/Icons/valid-html401" alt="Valid HTML 4.01 Transitional" height="31" width="88"></a>--></TD>
|
||||
</TR></TABLE>
|
||||
</body>
|
||||
</html>
|
||||
@@ -1,321 +0,0 @@
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
|
||||
<html>
|
||||
<head>
|
||||
<meta name="GENERATOR" content="mkd2html 2.1.5a DL=DISCOUNT">
|
||||
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=utf-8">
|
||||
<link rel="stylesheet"
|
||||
type="text/css"
|
||||
href="../hint.css">
|
||||
<title>Homage to a classic game</title>
|
||||
</head>
|
||||
<body>
|
||||
<h1>Homage to a classic game</h1>
|
||||
|
||||
<p>Sandro Maffiodo<br>
|
||||
<a href="mailto:smaffer@gmail.com">smaffer@gmail.com</a><br>
|
||||
<a href="http://www.assezeta.com/sandromaffiodo">http://www.assezeta.com/sandromaffiodo</a></p>
|
||||
|
||||
<h2>Judges' comments:</h2>
|
||||
|
||||
<h3>To build:</h3>
|
||||
|
||||
<pre><code>make
|
||||
</code></pre>
|
||||
|
||||
<h3>To run:</h3>
|
||||
|
||||
<pre><code>cat mario.level | ./prog 320 200 800 300 128 144 mario.rgba mario8.wav 10343679
|
||||
</code></pre>
|
||||
|
||||
<h3>Try:</h3>
|
||||
|
||||
<pre><code>cat giana.level | ./prog 320 200 1000 300 192 168 giana.rgba giana8.wav 5459393
|
||||
|
||||
cat mario.level | ./prog 320 200 800 300 128 144 mario.rgba mario8.wav 10343679 && telnet towel.blinkenlights.nl
|
||||
</code></pre>
|
||||
|
||||
<h3>Selected Judges Remarks:</h3>
|
||||
|
||||
<p>A classic for a particular generation. Like all good programs, being data
|
||||
driven means you can do fun things in small spaces.</p>
|
||||
|
||||
<h2>Author’s comments:</h2>
|
||||
|
||||
<h3>Remarks</h3>
|
||||
|
||||
<p>Use tabsize=4 to see the magic</p>
|
||||
|
||||
<pre><code>./expand -t 4 < prog.c
|
||||
</code></pre>
|
||||
|
||||
<p>The program returns 0 if the user win or <em>not-zero</em> if loose so you can test it and make something useful (or not), like that:</p>
|
||||
|
||||
<pre><code>cat mario.level | ./prog 320 200 800 300 128 144 mario.rgba mario8.wav 10343679 && telnet towel.blinkenlights.nl
|
||||
</code></pre>
|
||||
|
||||
<p>This is an engine for <strong>Platform Games</strong>. It can be used to create games like the legendary <a href="http://en.wikipedia.org/wiki/Super_Mario_Bros.">Super Mario Bros</a>.
|
||||
With this simple and clear sourcecode 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 The Sisters</a>.
|
||||
Both games are classic <em>platform games</em> and both share the same fundamental rules:</p>
|
||||
|
||||
<ul>
|
||||
<li>there is a player</li>
|
||||
<li>there is a powerup that can change the look of the player and/or give to him/her more power!</li>
|
||||
<li>there are walls, floors and ceilings. the player can move and jump over these type of obstacles but cannot walk through them</li>
|
||||
<li>there are enemies and, if the player collides with an enemy, the player dies or loses its powers</li>
|
||||
</ul>
|
||||
|
||||
|
||||
<h3>Regards running under Mac OS X</h3>
|
||||
|
||||
<p>The color of the sky is wrong on MacOS. You need to flip some bytes from the last parameter of the program:</p>
|
||||
|
||||
<pre><code>MARIO LAST PARAMETER: 4292124159
|
||||
|
||||
GIANA LAST PARAMETER: 3243070463
|
||||
</code></pre>
|
||||
|
||||
<h3>Regarding how to compile</h3>
|
||||
|
||||
<p>The code requires libSDL1.X.</p>
|
||||
|
||||
<p>The build process will generate some warnings (60~ on clang) about:</p>
|
||||
|
||||
<ul>
|
||||
<li><strong>incompatible pointer types</strong>: because all pointers are declared to <em>int</em> or <em>char</em>, to save tokens</li>
|
||||
<li><strong>type specifier missing, defaults to ‘int’</strong>: because i need to save tokens</li>
|
||||
<li><strong>using the result of an assignment as a condition without parentheses</strong>: because while(c=getchar()) is not evil</li>
|
||||
</ul>
|
||||
|
||||
|
||||
<h3>How it works</h3>
|
||||
|
||||
<h2>Parameters</h2>
|
||||
|
||||
<ol>
|
||||
<li>Window width</li>
|
||||
<li>Window height</li>
|
||||
<li>Level width</li>
|
||||
<li>Level height</li>
|
||||
<li>Sprites image width</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 <strong>NOTE on MacOS</strong></li>
|
||||
</ol>
|
||||
|
||||
|
||||
<h2>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>
|
||||
|
||||
<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).</p>
|
||||
|
||||
<p>Some positions of the grid have a predefined purpose:</p>
|
||||
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th align="left">Position </th>
|
||||
<th align="left"> Description</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td align="left">0 </td>
|
||||
<td align="left"> Player stand right</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="left">1 </td>
|
||||
<td align="left"> Player walk right frame 0</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="left">2 </td>
|
||||
<td align="left"> Player walk right frame 1</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="left">3 </td>
|
||||
<td align="left"> Player jump right</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="left">4 </td>
|
||||
<td align="left"> Player stand left</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="left">5 </td>
|
||||
<td align="left"> Player walk left frame 0</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="left">6 </td>
|
||||
<td align="left"> Player walk left frame 1</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="left">7 </td>
|
||||
<td align="left"> Player jump left</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="left">8 <em>(second row)</em> </td>
|
||||
<td align="left"> Super player stand right</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="left">9 </td>
|
||||
<td align="left"> Super player walk right frame 0</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="left">10 </td>
|
||||
<td align="left"> Super player walk right frame 1</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="left">11 </td>
|
||||
<td align="left"> Super player jump right</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="left">12 </td>
|
||||
<td align="left"> Super player stand left</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="left">13 </td>
|
||||
<td align="left"> Super player walk left frame 0</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="left">14 </td>
|
||||
<td align="left"> Super player walk left frame 1</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="left">15 </td>
|
||||
<td align="left"> Super player jump left</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="left">24 </td>
|
||||
<td align="left"> Player dead</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="left">32 </td>
|
||||
<td align="left"> Player win</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="left">40 </td>
|
||||
<td align="left"> Super player win</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
|
||||
<p>All the others sprites can be used as you want, depending on the game you want to create.</p>
|
||||
|
||||
<h2>Levels</h2>
|
||||
|
||||
<p>The program reads the level description from <strong>stdin</strong>.</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>
|
||||
|
||||
<pre><code>C[333*7],d=333;
|
||||
</code></pre>
|
||||
|
||||
<p>Each row have six columns:</p>
|
||||
|
||||
<ol>
|
||||
<li>Screen X: x position of the object in the level</li>
|
||||
<li>Screen Y: y position of the object in the level</li>
|
||||
<li>Sprite: id of the sprite to be used for the object</li>
|
||||
<li>CLASSFLAGS: a bitmask that describe how the object behaves</li>
|
||||
<li>CLASSPARAM0: a parameter that depends on CLASSFLAGS</li>
|
||||
<li>CLASSPARAM1: a parameter that depends on CLASSFLAGS</li>
|
||||
</ol>
|
||||
|
||||
|
||||
<p>CLASSFLAGS must be a combination (bitwise or) of some of these constants:</p>
|
||||
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th align="left">NAME </th>
|
||||
<th align="left"> CONSTANT </th>
|
||||
<th align="left"> CLASS</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td align="left">ENEMY </td>
|
||||
<td align="left"> 1 </td>
|
||||
<td align="left"> An enemy. CLASSPARAM0 can be 0 if the enemy don’t move, 1 if the initial move direction is right, -1 if direction is left. All enemies that walk will change its direction after 20 pixels. The sprite of an enemy must have 2 others adjacent sprites: SPRITE-1, used when the enemy die, and SPRITE+1, used when it walks</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="left">BLOCK </td>
|
||||
<td align="left"> 2 </td>
|
||||
<td align="left"> A wall. Player can walk over the object but can not pass through it</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="left">GIFT BLOCK </td>
|
||||
<td align="left"> 4 </td>
|
||||
<td align="left"> When the player hits the object from below, a new object is created. CLASSFLAGS of the new object is defined in CLASSPARAM0. The sprite used for the new object is defined in CLASSPARAM1. The sprite of the gift object must have an adjacent sprite: SPRITE+1, used when the block is hit</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="left">POWERUP </td>
|
||||
<td align="left"> 8 </td>
|
||||
<td align="left"> This is the classic Mario’s mushroom. When the player hit the powerup object, the player become <em>Super player</em>. If CLASSFLAGS has the bit ZOOM, the player height will be doubled.<br>The <em>Super player</em> can hit the enemies without die, but when this happens, the <em>Super player</em> goes back to being normal</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="left">END </td>
|
||||
<td align="left"> 16 </td>
|
||||
<td align="left"> When the player hits this object the level ends. Player win</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="left">ZOOM </td>
|
||||
<td align="left"> 32 </td>
|
||||
<td align="left"> This flag can be used with POWERUP to indicate a powerup that will doubles the size of the player (like Mario’s mushroom)</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="left">DESTROY </td>
|
||||
<td align="left"> 64 </td>
|
||||
<td align="left"> When the player hits the object the object disappear. This is the classic Mario’s coin, but the engine does not counts the points, so, from the user point of view, this object is useless</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="left">DESTROYUP </td>
|
||||
<td align="left"> 128 </td>
|
||||
<td align="left"> This object is like a BLOCK but when the player hits the object from below, the object disappear</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
|
||||
<p>If CLASSFLAGS is zero the object has only an aesthetic function.</p>
|
||||
|
||||
<p>The last row of the level descriptor must have all its columns set equal to -1.</p>
|
||||
|
||||
<h3>Limitations</h3>
|
||||
|
||||
<p>Some classical features are missing: throw objects, shoot, multiple lives, points counter. You can add those features if you want!</p>
|
||||
|
||||
<p>The program allow to run one level only. It’s easy to add a menu and multiple levels but the size of the engine will grow too much.</p>
|
||||
|
||||
<p>When the <em>Super player</em> become bigger (ZOOM flag), the player 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 is one audio track only (game effects are missing).</p>
|
||||
|
||||
<h3>Credits</h3>
|
||||
|
||||
<p>Some of the sprites used in the examples are identical to those of the original games, others were designed by me.</p>
|
||||
|
||||
<p>The music used in the examples have been resampled, 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 Nintendo Entertainment, my use of the sprites does not intend to infringe the intellectual property of Nintendo but only demonstrate 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 The Sisters</a> is the game created by Time Warp Productions and also for this game worth my previous notes. Long live <a href="http://en.wikipedia.org/wiki/The_Great_Giana_Sisters">The Great Giana The Sisters</a> !! :)</p>
|
||||
|
||||
<hr />
|
||||
|
||||
<TABLE><TR>
|
||||
<TD><a rel="license" href="http://creativecommons.org/licenses/by-sa/3.0/"><img alt="Creative Commons License" style="border-width:0" src="http://i.creativecommons.org/l/by-sa/3.0/88x31.png" /></a></TD>
|
||||
<TD><P>© Copyright 1984-2015,
|
||||
<A HREF="/judges.html">Leo Broukhis, Simon Cooper, Landon Curt Noll</A>
|
||||
- All rights reserved<BR>
|
||||
This work is licensed under a <a rel="license" href="http://creativecommons.org/licenses/by-sa/3.0/">Creative Commons Attribution-ShareAlike 3.0 Unported License</a>.</P></TD>
|
||||
<TD> <!--<a href="http://validator.w3.org/check?uri=referer"><img src="http://www.w3.org/Icons/valid-html401" alt="Valid HTML 4.01 Transitional" height="31" width="88"></a>--></TD>
|
||||
</TR></TABLE>
|
||||
</body>
|
||||
</html>
|
||||
@@ -1,108 +0,0 @@
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
|
||||
<html>
|
||||
<head>
|
||||
<meta name="GENERATOR" content="mkd2html 2.1.5a DL=DISCOUNT">
|
||||
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=utf-8">
|
||||
<link rel="stylesheet"
|
||||
type="text/css"
|
||||
href="../hint.css">
|
||||
<title>Most tweetable entry</title>
|
||||
</head>
|
||||
<body>
|
||||
<h1>Most tweetable entry</h1>
|
||||
|
||||
<p>Sandro Maffiodo<br>
|
||||
<a href="mailto:smaffer@gmail.com">smaffer@gmail.com</a><br>
|
||||
<a href="http://www.assezeta.com/sandromaffiodo">http://www.assezeta.com/sandromaffiodo</a></p>
|
||||
|
||||
<h2>Judges' comments:</h2>
|
||||
|
||||
<h3>To build:</h3>
|
||||
|
||||
<pre><code>make
|
||||
</code></pre>
|
||||
|
||||
<h3>To run:</h3>
|
||||
|
||||
<pre><code>./prog arg
|
||||
</code></pre>
|
||||
|
||||
<h3>Try:</h3>
|
||||
|
||||
<pre><code>cat image.rgb | ./prog ' .,:;!$#@'
|
||||
</code></pre>
|
||||
|
||||
<h3>Selected Judges Remarks:</h3>
|
||||
|
||||
<p>On the face of it :-) given what this program one might wonder what makes this winner special.
|
||||
But when you realize the source is small enough to tweet on twitter you understand.</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>
|
||||
|
||||
<h2>Author’s comments:</h2>
|
||||
|
||||
<h3>Remarks</h3>
|
||||
|
||||
<p>This program convert an image to an ASCII ART. The program reads a raw RGB image from <strong>stdin</strong> and print the ASCII ART to <strong>stdout</strong>.</p>
|
||||
|
||||
<p>The build process will raise some warnings about:</p>
|
||||
|
||||
<ul>
|
||||
<li>declaration specifier missing, defaulting to ‘int’</li>
|
||||
<li>implicitly declaring library function</li>
|
||||
</ul>
|
||||
|
||||
|
||||
<p>The program crash if run without parameters.</p>
|
||||
|
||||
<h3>Screen size</h3>
|
||||
|
||||
<p>If you have a terminal geometry than if different from the common 80x25 you can modify the <em>output width</em> by changing the value of the first variable:</p>
|
||||
|
||||
<pre><code>d=80
|
||||
</code></pre>
|
||||
|
||||
<h3>Something to try</h3>
|
||||
|
||||
<p>Type this:</p>
|
||||
|
||||
<pre><code>cat image.rgb | ./prog " .:;Y0"
|
||||
</code></pre>
|
||||
|
||||
<p>You can use your own image. Convert the image to a raw RGB image, using imagemagick it’s very simple:</p>
|
||||
|
||||
<pre><code>convert -geometry 80x source.jpg image.rgb
|
||||
</code></pre>
|
||||
|
||||
<p>This program require one parameter, or crash. The parameter of the program is the <em>convertion ramp</em>. You can use different ramps or create your own (for ex. using some letters of your name).
|
||||
These are some ramps you can try:</p>
|
||||
|
||||
<pre><code>./prog " :1"
|
||||
./prog " .:;Y0"
|
||||
./prog " .:-=+*#%@"
|
||||
./prog " .,:!-iots&8%#@$"
|
||||
./prog "$@B%8&WM#*oahkbdpqwmZO0QLCJUYXzcvunxrjft/\|()1{}[]?-_+~<>i!lI;:,"^`'. "
|
||||
</code></pre>
|
||||
|
||||
<h3>121 byte version</h3>
|
||||
|
||||
<p>An alternative version of this program is only 121bytes long:</p>
|
||||
|
||||
<pre><code>d=80,e,j;g(){j+=getchar();}main(){for(;;){j=0;g();if(j<0)break;g(g());putchar(" .:#@"[j/3*5>>8]);if(!(++e%d))puts("");}}
|
||||
</code></pre>
|
||||
|
||||
<p>This alternative version have a <strong>fixed ramp</strong>. It’s smaller but it’s not so fun to use…</p>
|
||||
|
||||
<hr />
|
||||
|
||||
<TABLE><TR>
|
||||
<TD><a rel="license" href="http://creativecommons.org/licenses/by-sa/3.0/"><img alt="Creative Commons License" style="border-width:0" src="http://i.creativecommons.org/l/by-sa/3.0/88x31.png" /></a></TD>
|
||||
<TD><P>© Copyright 1984-2015,
|
||||
<A HREF="/judges.html">Leo Broukhis, Simon Cooper, Landon Curt Noll</A>
|
||||
- All rights reserved<BR>
|
||||
This work is licensed under a <a rel="license" href="http://creativecommons.org/licenses/by-sa/3.0/">Creative Commons Attribution-ShareAlike 3.0 Unported License</a>.</P></TD>
|
||||
<TD> <!--<a href="http://validator.w3.org/check?uri=referer"><img src="http://www.w3.org/Icons/valid-html401" alt="Valid HTML 4.01 Transitional" height="31" width="88"></a>--></TD>
|
||||
</TR></TABLE>
|
||||
</body>
|
||||
</html>
|
||||
@@ -1,120 +0,0 @@
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
|
||||
<html>
|
||||
<head>
|
||||
<meta name="GENERATOR" content="mkd2html 2.1.5a DL=DISCOUNT">
|
||||
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=utf-8">
|
||||
<link rel="stylesheet"
|
||||
type="text/css"
|
||||
href="../hint.css">
|
||||
<title>Most likely to succeed</title>
|
||||
</head>
|
||||
<body>
|
||||
<h1>Most likely to succeed</h1>
|
||||
|
||||
<p>Yves-Marie Morgan<br>
|
||||
<a href="mailto:yves-marie.morgan@parrot.com">yves-marie.morgan@parrot.com</a></p>
|
||||
|
||||
<h2>Judges' comments:</h2>
|
||||
|
||||
<h3>To build:</h3>
|
||||
|
||||
<pre><code>make
|
||||
</code></pre>
|
||||
|
||||
<h3>To run:</h3>
|
||||
|
||||
<pre><code>./prog [arg ..]
|
||||
</code></pre>
|
||||
|
||||
<h3>Try:</h3>
|
||||
|
||||
<pre><code>make
|
||||
cp -f prog morgan
|
||||
./morgan clobber
|
||||
ls
|
||||
|
||||
./morgan all install
|
||||
ls
|
||||
|
||||
./prog love haste waste supernova
|
||||
ls
|
||||
|
||||
make
|
||||
./prog magic
|
||||
ls
|
||||
</code></pre>
|
||||
|
||||
<h3>Selected Judges Remarks:</h3>
|
||||
|
||||
<p>Think of this as a Maker Faire’s make. :-)</p>
|
||||
|
||||
<p>It works reasomably 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>Author’s comments:</h2>
|
||||
|
||||
<h3>Remarks</h3>
|
||||
|
||||
<p>This program is a tiny <code>make</code> clone.</p>
|
||||
|
||||
<p>It is able to parse a subset of the <code>make</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>Supported features</h2>
|
||||
|
||||
<ul>
|
||||
<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 goal 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 submake (the <code>MAKE=</code> assignment inside
|
||||
<code>Makefile</code> will be ignored to continue using itself).</p>
|
||||
|
||||
<h2>Limitations / Known issues</h2>
|
||||
|
||||
<ul>
|
||||
<li>There is a lot of memory leak (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 parallel execution (<code>-j</code> option).</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>
|
||||
<li>No built-in rules.</li>
|
||||
<li>No built-in variables (except the one from environment).</li>
|
||||
<li>No conditional directives.</li>
|
||||
</ul>
|
||||
|
||||
|
||||
<h3>Compilation warnings</h3>
|
||||
|
||||
<p>with gcc 4.8.2 on Linux Ubuntu 14.04 64-bit :
|
||||
* 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]</p>
|
||||
|
||||
<hr />
|
||||
|
||||
<TABLE><TR>
|
||||
<TD><a rel="license" href="http://creativecommons.org/licenses/by-sa/3.0/"><img alt="Creative Commons License" style="border-width:0" src="http://i.creativecommons.org/l/by-sa/3.0/88x31.png" /></a></TD>
|
||||
<TD><P>© Copyright 1984-2015,
|
||||
<A HREF="/judges.html">Leo Broukhis, Simon Cooper, Landon Curt Noll</A>
|
||||
- All rights reserved<BR>
|
||||
This work is licensed under a <a rel="license" href="http://creativecommons.org/licenses/by-sa/3.0/">Creative Commons Attribution-ShareAlike 3.0 Unported License</a>.</P></TD>
|
||||
<TD> <!--<a href="http://validator.w3.org/check?uri=referer"><img src="http://www.w3.org/Icons/valid-html401" alt="Valid HTML 4.01 Transitional" height="31" width="88"></a>--></TD>
|
||||
</TR></TABLE>
|
||||
</body>
|
||||
</html>
|
||||
@@ -1,146 +0,0 @@
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
|
||||
<html>
|
||||
<head>
|
||||
<meta name="GENERATOR" content="mkd2html 2.1.5a DL=DISCOUNT">
|
||||
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=utf-8">
|
||||
<link rel="stylesheet"
|
||||
type="text/css"
|
||||
href="../hint.css">
|
||||
<title>Best choice of optimization</title>
|
||||
</head>
|
||||
<body>
|
||||
<h1>Best choice of optimization</h1>
|
||||
|
||||
<p>Don Yang<br>
|
||||
<a href="mailto:omoikane@uguu.org">omoikane@uguu.org</a><br>
|
||||
<a href="http://uguu.org/">http://uguu.org/</a></p>
|
||||
|
||||
<h2>Judges' comments:</h2>
|
||||
|
||||
<h3>To build:</h3>
|
||||
|
||||
<pre><code>make sinon
|
||||
</code></pre>
|
||||
|
||||
<h3>To run:</h3>
|
||||
|
||||
<pre><code>cp sinon.c run.c
|
||||
</code></pre>
|
||||
|
||||
<p>Then keep running ./glock.sh or ./hecate.sh within a minute with
|
||||
slight pauses between invocations.</p>
|
||||
|
||||
<h3>Try:</h3>
|
||||
|
||||
<pre><code>cp sinon.c run.c; ./hecate.sh; ./glock.sh; sleep 3; ./glock.sh; sleep 1; ./hecate.sh
|
||||
</code></pre>
|
||||
|
||||
<h3>Selected Judges Remarks:</h3>
|
||||
|
||||
<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>Author’s comments:</h2>
|
||||
|
||||
<h3>Summary</h3>
|
||||
|
||||
<p>Sinon 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>
|
||||
|
||||
<pre><code>cp sinon.c run.c
|
||||
gcc -O0 run.c -o run && ./run | tee run.c
|
||||
gcc -O2 run.c -o run && ./run | tee run.c
|
||||
...
|
||||
</code></pre>
|
||||
|
||||
<h3>Details</h3>
|
||||
|
||||
<p>Sinon 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>Sinon 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>
|
||||
</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
|
||||
“hard” mode. It is worth trying this mode even if you have the right
|
||||
compilers.</p>
|
||||
|
||||
<h3>Compatibility</h3>
|
||||
|
||||
<p>Sinon 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>
|
||||
<li>gcc 4.8.2 on Linux.</li>
|
||||
<li>gcc 4.8.3 on Cygwin/MingW.</li>
|
||||
<li>clang 3.4-1 on Linux.</li>
|
||||
<li>clang 3.4.2 on Cygwin.</li>
|
||||
<li>gcc 4.3.5 on JS/Linux (playable but likely unwinnable, because it
|
||||
takes too long to compile).</li>
|
||||
<li>tcc 0.9.25 on JS/Linux (no optimization, so only “hard” mode is
|
||||
available).</li>
|
||||
</ul>
|
||||
|
||||
|
||||
<p>Sinon is intended to be played in a 80x25 terminal.</p>
|
||||
|
||||
<h3>Miscellaneous features</h3>
|
||||
|
||||
<p>Sinon might be the first game that uses compiler optimization level as
|
||||
a primary input.</p>
|
||||
|
||||
<p>Sinon 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>
|
||||
|
||||
<pre><code>perl sinon.c | bash
|
||||
</code></pre>
|
||||
|
||||
<p>File size and CRC32 of sinon.c are embedded in line 7.</p>
|
||||
|
||||
<p>Process for making Sinon is included in spoiler.html.</p>
|
||||
|
||||
<p>Layout of this code is based on Asada Shino, also known as “Sinon”,
|
||||
from Sword Art Online.</p>
|
||||
|
||||
<hr />
|
||||
|
||||
<TABLE><TR>
|
||||
<TD><a rel="license" href="http://creativecommons.org/licenses/by-sa/3.0/"><img alt="Creative Commons License" style="border-width:0" src="http://i.creativecommons.org/l/by-sa/3.0/88x31.png" /></a></TD>
|
||||
<TD><P>© Copyright 1984-2015,
|
||||
<A HREF="/judges.html">Leo Broukhis, Simon Cooper, Landon Curt Noll</A>
|
||||
- All rights reserved<BR>
|
||||
This work is licensed under a <a rel="license" href="http://creativecommons.org/licenses/by-sa/3.0/">Creative Commons Attribution-ShareAlike 3.0 Unported License</a>.</P></TD>
|
||||
<TD> <!--<a href="http://validator.w3.org/check?uri=referer"><img src="http://www.w3.org/Icons/valid-html401" alt="Valid HTML 4.01 Transitional" height="31" width="88"></a>--></TD>
|
||||
</TR></TABLE>
|
||||
</body>
|
||||
</html>
|
||||
@@ -1,258 +0,0 @@
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
|
||||
<html>
|
||||
<head>
|
||||
<meta name="GENERATOR" content="mkd2html 2.1.5a DL=DISCOUNT">
|
||||
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=utf-8">
|
||||
<link rel="stylesheet"
|
||||
type="text/css"
|
||||
href="../hint.css">
|
||||
<title>Most dynamic</title>
|
||||
</head>
|
||||
<body>
|
||||
<h1>Most dynamic</h1>
|
||||
|
||||
<p>Cel Skeggs<br>
|
||||
<a href="mailto:ioccc@celskeggs.com">ioccc@celskeggs.com</a><br>
|
||||
<a href="http://www.celskeggs.com">http://www.celskeggs.com</a></p>
|
||||
|
||||
<h2>Judges' comments:</h2>
|
||||
|
||||
<h3>To build:</h3>
|
||||
|
||||
<pre><code>make
|
||||
</code></pre>
|
||||
|
||||
<h3>To run:</h3>
|
||||
|
||||
<pre><code>./prog
|
||||
</code></pre>
|
||||
|
||||
<h3>Try:</h3>
|
||||
|
||||
<pre><code>./prog
|
||||
</code></pre>
|
||||
|
||||
<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>
|
||||
|
||||
<h3>Selected Judges Remarks:</h3>
|
||||
|
||||
<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 main. But how? How is main able to
|
||||
call code that was written and compiled just in time for execution?</p>
|
||||
|
||||
<h2>Author’s comments:</h2>
|
||||
|
||||
<h3>TABLE OF CONTENTS</h3>
|
||||
|
||||
<ul>
|
||||
<li>Backstory</li>
|
||||
<li>Known compiler warnings</li>
|
||||
<li>Obfuscation</li>
|
||||
<li>Troubleshooting guide (IMPORTANT!)</li>
|
||||
<li>Q&A</li>
|
||||
</ul>
|
||||
|
||||
|
||||
<h3>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>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>
|
||||
|
||||
<h3>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 iocccsize, and 3994
|
||||
according to wc -c.</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><p>(10) data argument not used by format string</p>
|
||||
|
||||
<p>This occurs because some of the fprintf invocations don’t use all their
|
||||
parameters. The program should still work fine!</p></li>
|
||||
<li><p>(1) using the result of an assignment as a condition without parentheses</p>
|
||||
|
||||
<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><p>(1) implicit declaration of function ‘time’ is invalid in C99</p>
|
||||
|
||||
<p>An <code>#include</code> statement is expensive, and I’m broke.</p></li>
|
||||
<li><p>(1) control may reach end of non-void function</p>
|
||||
|
||||
<p>Turns out that sometimes, a return 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>OBFUSCATION? WHAT OBFUSCATION? THIS IS A PERFECTLY NORMAL C PROGRAM!</h2>
|
||||
|
||||
<h1>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 dlopen, and…</p>
|
||||
|
||||
<p>Ignores the result?</p>
|
||||
|
||||
<p>That can’t be right.</p>
|
||||
|
||||
<p>Well, it is. Instead of using dlsym 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>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 #
|
||||
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 iocccsize tool, so it gets counted as smaller! :D</p>
|
||||
|
||||
<h1>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>
|
||||
|
||||
<h1>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>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>
|
||||
|
||||
<h3>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>
|
||||
|
||||
<h3>TROUBLESHOOTING GUIDE</h3>
|
||||
|
||||
<p>This program is a very easy program to cause to fail!</p>
|
||||
|
||||
<p>Some things to check</p>
|
||||
|
||||
<ul>
|
||||
<li>On line 16, where it says <code>%cinclude "prog.c"</code>, is <code>prog.c</code> the name of the
|
||||
original source code file?</li>
|
||||
<li>Do you have ncurses installed?</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>
|
||||
|
||||
<p>(I had to do this under Cygwin.)</p></li>
|
||||
<li>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 -DCC argument in
|
||||
the build script.</li>
|
||||
<li>Does your system have a vague dislike for <code>-fPIC</code>? (Like Cygwin.) You might
|
||||
need to remove it from the build script.</li>
|
||||
<li>Does your system support <code>__attribute__((constructor))</code>? It needs to.</li>
|
||||
<li>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>.</li>
|
||||
<li>Can’t run a beautifier on the source code? I’m not going to help you there.</li>
|
||||
</ul>
|
||||
|
||||
|
||||
<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 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>
|
||||
|
||||
<h3>Q&A</h3>
|
||||
|
||||
<ul>
|
||||
<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>
|
||||
<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 REMARKS file according to the iocccsize tool?</p>
|
||||
|
||||
<p><code>$ ./iocccsize -i <REMARKS.MD</code></p>
|
||||
|
||||
<p><code>5092</code></p></li>
|
||||
</ul>
|
||||
|
||||
|
||||
<hr />
|
||||
|
||||
<TABLE><TR>
|
||||
<TD><a rel="license" href="http://creativecommons.org/licenses/by-sa/3.0/"><img alt="Creative Commons License" style="border-width:0" src="http://i.creativecommons.org/l/by-sa/3.0/88x31.png" /></a></TD>
|
||||
<TD><P>© Copyright 1984-2015,
|
||||
<A HREF="/judges.html">Leo Broukhis, Simon Cooper, Landon Curt Noll</A>
|
||||
- All rights reserved<BR>
|
||||
This work is licensed under a <a rel="license" href="http://creativecommons.org/licenses/by-sa/3.0/">Creative Commons Attribution-ShareAlike 3.0 Unported License</a>.</P></TD>
|
||||
<TD> <!--<a href="http://validator.w3.org/check?uri=referer"><img src="http://www.w3.org/Icons/valid-html401" alt="Valid HTML 4.01 Transitional" height="31" width="88"></a>--></TD>
|
||||
</TR></TABLE>
|
||||
</body>
|
||||
</html>
|
||||
@@ -1,112 +0,0 @@
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
|
||||
<html>
|
||||
<head>
|
||||
<meta name="GENERATOR" content="mkd2html 2.1.5a DL=DISCOUNT">
|
||||
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=utf-8">
|
||||
<link rel="stylesheet"
|
||||
type="text/css"
|
||||
href="../hint.css">
|
||||
<title>Best handling of beeps</title>
|
||||
</head>
|
||||
<body>
|
||||
<h1>Best handling of beeps</h1>
|
||||
|
||||
<p>Daniel Vik<br>
|
||||
<a href="mailto:daniel@vik.cc">daniel@vik.cc</a><br>
|
||||
<a href="http://danielvik.com/">http://danielvik.com/</a></p>
|
||||
|
||||
<h2>Judges' comments:</h2>
|
||||
|
||||
<h3>To build:</h3>
|
||||
|
||||
<pre><code>make
|
||||
</code></pre>
|
||||
|
||||
<h3>To run:</h3>
|
||||
|
||||
<pre><code>./prog > foo.c
|
||||
</code></pre>
|
||||
|
||||
<h3>Try:</h3>
|
||||
|
||||
<pre><code>echo 'Want to hear me beep?' | ./prog > audio_file.raw
|
||||
|
||||
echo 'No. I want chocolate!' | ./prog | mplayer -demuxer rawaudio -
|
||||
</code></pre>
|
||||
|
||||
<h3>Selected Judges Remarks:</h3>
|
||||
|
||||
<p>This program sets a new tone for obfuscation. But do you understand
|
||||
what it says about obfuscation? Perhaps:</p>
|
||||
|
||||
<pre><code>./prog < prog.c > prog.raw
|
||||
</code></pre>
|
||||
|
||||
<p>might speak to your coding style? If not, then perhaps:</p>
|
||||
|
||||
<pre><code>./prog < remarks.markdown | mplayer -demuxer rawaudio -
|
||||
</code></pre>
|
||||
|
||||
<p>might help? :-)</p>
|
||||
|
||||
<h2>Author’s comments:</h2>
|
||||
|
||||
<h3>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 mplayer, you can listen to the morse audio.</p>
|
||||
|
||||
<p>Don’t forget the last ‘-’ as it makes mplayer read from stdin.)</p>
|
||||
|
||||
<h2>Convert audio file with morse signals to text</h2>
|
||||
|
||||
<pre><code>$ ./prog e < audio_file.raw
|
||||
</code></pre>
|
||||
|
||||
<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>
|
||||
|
||||
<h3>Portability</h3>
|
||||
|
||||
<p>The program is portable to most platforms. The only system dependency is that
|
||||
the program relies on writing binary data to stdout.</p>
|
||||
|
||||
<p>Microsoft compilers adds a carriage return to newlines, and to compile the
|
||||
program with this platform, the following line can be added after the main
|
||||
declaration in order for the program to run correctly:</p>
|
||||
|
||||
<pre><code>_setmode(_fileno(stdout), 0x8000);
|
||||
</code></pre>
|
||||
|
||||
<h3>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 don’t decode, you could try to pre-process the input with a
|
||||
narrow bandpass filter on the frequency of the transmission.</p>
|
||||
|
||||
<hr />
|
||||
|
||||
<TABLE><TR>
|
||||
<TD><a rel="license" href="http://creativecommons.org/licenses/by-sa/3.0/"><img alt="Creative Commons License" style="border-width:0" src="http://i.creativecommons.org/l/by-sa/3.0/88x31.png" /></a></TD>
|
||||
<TD><P>© Copyright 1984-2015,
|
||||
<A HREF="/judges.html">Leo Broukhis, Simon Cooper, Landon Curt Noll</A>
|
||||
- All rights reserved<BR>
|
||||
This work is licensed under a <a rel="license" href="http://creativecommons.org/licenses/by-sa/3.0/">Creative Commons Attribution-ShareAlike 3.0 Unported License</a>.</P></TD>
|
||||
<TD> <!--<a href="http://validator.w3.org/check?uri=referer"><img src="http://www.w3.org/Icons/valid-html401" alt="Valid HTML 4.01 Transitional" height="31" width="88"></a>--></TD>
|
||||
</TR></TABLE>
|
||||
</body>
|
||||
</html>
|
||||
@@ -1,83 +0,0 @@
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
|
||||
<html>
|
||||
<head>
|
||||
<meta name="GENERATOR" content="mkd2html 2.1.5a DL=DISCOUNT">
|
||||
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=utf-8">
|
||||
<link rel="stylesheet"
|
||||
type="text/css"
|
||||
href="../hint.css">
|
||||
<title>Most functional</title>
|
||||
</head>
|
||||
<body>
|
||||
<h1>Most functional</h1>
|
||||
|
||||
<p>Freek Wiedijk<br>
|
||||
<a href="mailto:freek@cs.ru.nl">freek@cs.ru.nl</a></p>
|
||||
|
||||
<h2>Judges' comments:</h2>
|
||||
|
||||
<h3>To build:</h3>
|
||||
|
||||
<pre><code>make wiedijk
|
||||
</code></pre>
|
||||
|
||||
<h3>To run:</h3>
|
||||
|
||||
<pre><code>./prog
|
||||
</code></pre>
|
||||
|
||||
<h3>Try:</h3>
|
||||
|
||||
<pre><code>gcc -E prog.c | indent | sed '1,/5.*prog/d'
|
||||
</code></pre>
|
||||
|
||||
<h3>Selected Judges Remarks:</h3>
|
||||
|
||||
<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>Author’s comments:</h2>
|
||||
|
||||
<h3>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>conforming ISO C</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><p>the readable implementation of <code>Y</code> is on lines 29-30:</p>
|
||||
|
||||
<p> W_f = \x.f(xx)
|
||||
Y = \f.W_f W_f</p></li>
|
||||
<li><p>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)</p></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 ultimate question of life, the universe and everything</li>
|
||||
</ul>
|
||||
|
||||
|
||||
<hr />
|
||||
|
||||
<TABLE><TR>
|
||||
<TD><a rel="license" href="http://creativecommons.org/licenses/by-sa/3.0/"><img alt="Creative Commons License" style="border-width:0" src="http://i.creativecommons.org/l/by-sa/3.0/88x31.png" /></a></TD>
|
||||
<TD><P>© Copyright 1984-2015,
|
||||
<A HREF="/judges.html">Leo Broukhis, Simon Cooper, Landon Curt Noll</A>
|
||||
- All rights reserved<BR>
|
||||
This work is licensed under a <a rel="license" href="http://creativecommons.org/licenses/by-sa/3.0/">Creative Commons Attribution-ShareAlike 3.0 Unported License</a>.</P></TD>
|
||||
<TD> <!--<a href="http://validator.w3.org/check?uri=referer"><img src="http://www.w3.org/Icons/valid-html401" alt="Valid HTML 4.01 Transitional" height="31" width="88"></a>--></TD>
|
||||
</TR></TABLE>
|
||||
</body>
|
||||
</html>
|
||||
Reference in new issue
Block a user