Add preview of 1984-2019
The 2020 winners are hinted it, but the source code is not there,
nor are the hints. Someone could look into the HTML and
see what was commented out, but that is not a problem because
WHO won is known and the name of their AWARD is known already.
Moreover a number of the winners have talked about what their
entirs do, so the commented out spoiler text is not a bit problem.
One will find HTML commented out with:
<!-- XXX remove when 2020 is ready
2020 links here
XXX remove when 2020 is ready -->
The "XXX remove when 2020 is ready" string is found at the
start and end comment blocks. Again, soneone could read
what was commented out, but that is OK since most of that
information is known or can be known. The following files
have such HTML comment blocks in them.
./winners.html
./years-spoiler.html
./years.html
In addition, ./all/summary.txt was modified to not
include the 2020 entries for the momemt.
The 2020 winner code AND write-ups are NOT part of this set.
p.s. The all/all.tar.bz2 does not contain the 2020 source code (yet?).
This commit is contained in:
1 parent
28efc67f5d
commit
c0663537cb
1683 files changed
+220064
No files matched your search
@@ -0,0 +1,117 @@
|
||||
#!/usr/bin/env make
|
||||
#
|
||||
# 2011 makefile
|
||||
#
|
||||
# Copyright (C) 2011, Landon Curt Noll, Simon Cooper, and Leonid A. Broukhis.
|
||||
#
|
||||
# Creative Commons Attribution-ShareAlike 3.0 Unported License.
|
||||
# See: http://creativecommons.org/licenses/by-sa/3.0/
|
||||
|
||||
|
||||
################
|
||||
# tool locations
|
||||
################
|
||||
#
|
||||
SHELL= /bin/bash
|
||||
CP= cp
|
||||
CPP= cpp
|
||||
GUNZIP= gunzip
|
||||
LD= ld
|
||||
MAKE= make
|
||||
RM= rm
|
||||
SED= sed
|
||||
TAR= tar
|
||||
TRUE= true
|
||||
|
||||
# optimization
|
||||
#
|
||||
# Most compiles will safely use -O2. Some can use only -O1 or -O.
|
||||
# A few compilers have broken optimizers or this entry make break
|
||||
# under those buggy optimizers and thus you may not want anything.
|
||||
#
|
||||
OPT= -O2
|
||||
|
||||
# bitness
|
||||
#
|
||||
# Some entries require 32-bitness,
|
||||
# other entries require 64-bitess.
|
||||
# By default we assume nothing.
|
||||
#
|
||||
ARCH=
|
||||
|
||||
# default flags for ANSI C compilation
|
||||
#
|
||||
CFLAGS= -Wall -W -ansi -pedantic ${ARCH} ${OPT} -lm
|
||||
|
||||
# ANSI compiler
|
||||
#
|
||||
# Set CC to the name of your ANSI compiler.
|
||||
#
|
||||
CC= cc
|
||||
|
||||
|
||||
##############################
|
||||
# Special flags for this entry
|
||||
##############################
|
||||
#
|
||||
ENTRY= hou
|
||||
DATA=
|
||||
|
||||
|
||||
#################
|
||||
# build the entry
|
||||
#################
|
||||
#
|
||||
all: ${ENTRY} ${DATA}
|
||||
@${TRUE}
|
||||
|
||||
${ENTRY}: ${ENTRY}.c
|
||||
${CC} ${CFLAGS} ${ENTRY}.c -o ${ENTRY}
|
||||
|
||||
# alternative executable
|
||||
#
|
||||
alt:
|
||||
@${TRUE}
|
||||
|
||||
|
||||
###############
|
||||
# utility rules
|
||||
###############
|
||||
#
|
||||
everything: all alt
|
||||
|
||||
clean:
|
||||
${RM} -f ${ENTRY}.o
|
||||
|
||||
clobber: clean
|
||||
${RM} -f ${ENTRY}
|
||||
|
||||
nuke: clobber
|
||||
@echo gnab gib!
|
||||
|
||||
install:
|
||||
@echo "Surely you're joking Mr. Feynman!"
|
||||
|
||||
# backwards compatibility
|
||||
#
|
||||
build: all
|
||||
|
||||
|
||||
##################
|
||||
# 133t hacker rulz
|
||||
##################
|
||||
#
|
||||
love:
|
||||
@echo 'not war?'
|
||||
|
||||
haste:
|
||||
$(MAKE) waste
|
||||
|
||||
waste:
|
||||
@echo 'waste'
|
||||
|
||||
easter_egg:
|
||||
@echo you expected to mis-understand this $${RANDOM} magic
|
||||
@echo chongo '<was here>' "/\\oo/\\"
|
||||
@echo Readers shall not be disallowed from being unable to partly misunderstand this final echo.
|
||||
@${TRUE}
|
||||
@@ -0,0 +1,145 @@
|
||||
<!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.3 DL=DISCOUNT">
|
||||
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=utf-8">
|
||||
<link rel="stylesheet"
|
||||
type="text/css"
|
||||
href="../hint.css">
|
||||
<title>Best self documenting program</title>
|
||||
</head>
|
||||
<body>
|
||||
<h1>Best self documenting program</h1>
|
||||
|
||||
<p>Hou Qiming<br>
|
||||
<a href="mailto:hqm03ster@gmail.com">hqm03ster@gmail.com</a></p>
|
||||
|
||||
<h2>Judges' comments:</h2>
|
||||
|
||||
<h3>To build:</h3>
|
||||
|
||||
<pre><code>make hou
|
||||
</code></pre>
|
||||
|
||||
<h3>To run:</h3>
|
||||
|
||||
<pre><code>./hou 'a calculator expression -- see the C Code for details'
|
||||
</code></pre>
|
||||
|
||||
<h3>Try:</h3>
|
||||
|
||||
<pre><code>./hou 11/26+222/31
|
||||
|
||||
./hou 'log((21701-19937)-(23209-21701))/log(2)'
|
||||
|
||||
./hou 'sin(1.5708)+0.04321+log(sqrt(exp(1*1*1)))+(1+2*3)-0.4-0.6+(4+6)*(2-1+2*3)-tan(0.785398)+2*10/3*6*sqrt(16/2/2)*10+10000-1000'
|
||||
</code></pre>
|
||||
|
||||
<h3>Selected Judges Remarks:</h3>
|
||||
|
||||
<p>This self-documenting scientific calculator compiles clean with no
|
||||
warnings under the most strict pedantic mode of gcc and clang.</p>
|
||||
|
||||
<p>The first example, along with the correct result appears in the
|
||||
source code. What does it mean?</p>
|
||||
|
||||
<p>The calculator obeys the precendence rules and allows parenthesis,</p>
|
||||
|
||||
<pre><code> ./hou '1+2*3'
|
||||
./hou '(1+2)*3'
|
||||
</code></pre>
|
||||
|
||||
<p>What exactly does the text formatting do?</p>
|
||||
|
||||
<p>What does this evaluate to in C?</p>
|
||||
|
||||
<pre><code> +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~+
|
||||
</code></pre>
|
||||
|
||||
<h4>Self documenting source</h4>
|
||||
|
||||
<p>Comments would almost be redundant. :-}</p>
|
||||
|
||||
<h4>The ASCII art is valid C code</h4>
|
||||
|
||||
<p>Not just fancy formatted comment removed by the C Pre-processor</p>
|
||||
|
||||
<h4>The only multi-byte strings are format strings</h4>
|
||||
|
||||
<p>The code does not contain some simple string-encoded lookup table for calculator operations.</p>
|
||||
|
||||
<h4>Example input and output in the source</h4>
|
||||
|
||||
<p>The example input and output in the C code is significant. Can you find out why?</p>
|
||||
|
||||
<h4>The button layout</h4>
|
||||
|
||||
<p>The button layout in the C code is significant … not just a nice looking layout.</p>
|
||||
|
||||
<h4>input parsing</h4>
|
||||
|
||||
<p>The parser is functionally equivalent to a normal arithmetic parser for all valid inputs.
|
||||
For another fun challenge: try to determine how it parses the command line argument.</p>
|
||||
|
||||
<h2>Author’s comments:</h2>
|
||||
|
||||
<h3>Obfuscations</h3>
|
||||
|
||||
<p>This program is designed to be self-documenting. It doesn’t just provide an
|
||||
example command line. It also provides the expected output and illustrates all
|
||||
supported functionality using embedded ASCII art.</p>
|
||||
|
||||
<ul>
|
||||
<li>A few line numbers are significant and careless beautification will break the program.</li>
|
||||
<li>The entire ASCII art is valid code. The preprocessor won’t remove any part of it.</li>
|
||||
<li>The only strings longer than 1 byte are printf/sscanf format strings, even
|
||||
after preprocessing. No string-encoded lookup table is used.</li>
|
||||
<li>The example input and its expected output are both algorithmically significant.</li>
|
||||
<li>The button layout is also significant.</li>
|
||||
<li>The actual syntax being parsed is not the obvious, despite being
|
||||
functionally equivalent for all correct inputs.</li>
|
||||
</ul>
|
||||
|
||||
|
||||
<h3>Portability</h3>
|
||||
|
||||
<ul>
|
||||
<li>This program requires “argv” to point to writable memory. It doesn’t require
|
||||
the actual argv strings to be writable, though.</li>
|
||||
<li>This program requires ASCII.</li>
|
||||
<li>This program doesn’t work with %e style numbers like “1e-4”.</li>
|
||||
<li>Some seemingly redundant code works to eliminate warnings and evade a gcc bug.</li>
|
||||
</ul>
|
||||
|
||||
|
||||
<h3>Spoilers</h3>
|
||||
|
||||
<p>The parser parses function names, substraction, and division as single-letter
|
||||
unary operators. A bitmask encoded hash table is used to check no-ops/digits
|
||||
and another hash function maps the ASCII to a function ordinal, which is then
|
||||
executed by the button panel.</p>
|
||||
|
||||
<p>Both hash functions are found using a separate search program. Another program
|
||||
is used to find a way to format one hash function as example input such that
|
||||
it produces something resembling the bitmask hash table as part of its output.</p>
|
||||
|
||||
<hr />
|
||||
|
||||
<!--
|
||||
(c) Copyright 1984-2012, [Leo Broukhis, Simon Cooper, Landon Curt Noll][judges] - All rights reserved
|
||||
This work is licensed under a [Creative Commons Attribution-ShareAlike 3.0 Unported License][cc].
|
||||
|
||||
[judges]: http://www.ioccc.org/judges.html
|
||||
[cc]: http://creativecommons.org/licenses/by-sa/3.0/
|
||||
-->
|
||||
|
||||
<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-2012,
|
||||
<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>
|
||||
@@ -0,0 +1,111 @@
|
||||
# Best self documenting program
|
||||
|
||||
Hou Qiming
|
||||
<hqm03ster@gmail.com>
|
||||
|
||||
|
||||
## Judges' comments:
|
||||
### To build:
|
||||
|
||||
make hou
|
||||
|
||||
### To run:
|
||||
|
||||
./hou 'a calculator expression -- see the C Code for details'
|
||||
|
||||
### Try:
|
||||
|
||||
./hou 11/26+222/31
|
||||
|
||||
./hou 'log((21701-19937)-(23209-21701))/log(2)'
|
||||
|
||||
./hou 'sin(1.5708)+0.04321+log(sqrt(exp(1*1*1)))+(1+2*3)-0.4-0.6+(4+6)*(2-1+2*3)-tan(0.785398)+2*10/3*6*sqrt(16/2/2)*10+10000-1000'
|
||||
|
||||
### Selected Judges Remarks:
|
||||
|
||||
This self-documenting scientific calculator compiles clean with no
|
||||
warnings under the most strict pedantic mode of gcc and clang.
|
||||
|
||||
The first example, along with the correct result appears in the
|
||||
source code. What does it mean?
|
||||
|
||||
The calculator obeys the precendence rules and allows parenthesis,
|
||||
|
||||
./hou '1+2*3'
|
||||
./hou '(1+2)*3'
|
||||
|
||||
What exactly does the text formatting do?
|
||||
|
||||
What does this evaluate to in C?
|
||||
|
||||
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~+
|
||||
|
||||
#### Self documenting source
|
||||
|
||||
Comments would almost be redundant. :-}
|
||||
|
||||
#### The ASCII art is valid C code
|
||||
|
||||
Not just fancy formatted comment removed by the C Pre-processor
|
||||
|
||||
#### The only multi-byte strings are format strings
|
||||
|
||||
The code does not contain some simple string-encoded lookup table for calculator operations.
|
||||
|
||||
#### Example input and output in the source
|
||||
|
||||
The example input and output in the C code is significant. Can you find out why?
|
||||
|
||||
#### The button layout
|
||||
|
||||
The button layout in the C code is significant ... not just a nice looking layout.
|
||||
|
||||
#### input parsing
|
||||
|
||||
The parser is functionally equivalent to a normal arithmetic parser for all valid inputs.
|
||||
For another fun challenge: try to determine how it parses the command line argument.
|
||||
|
||||
|
||||
## Author's comments:
|
||||
### Obfuscations
|
||||
|
||||
This program is designed to be self-documenting. It doesn't just provide an
|
||||
example command line. It also provides the expected output and illustrates all
|
||||
supported functionality using embedded ASCII art.
|
||||
|
||||
- A few line numbers are significant and careless beautification will break the program.
|
||||
- The entire ASCII art is valid code. The preprocessor won't remove any part of it.
|
||||
- The only strings longer than 1 byte are printf/sscanf format strings, even
|
||||
after preprocessing. No string-encoded lookup table is used.
|
||||
- The example input and its expected output are both algorithmically significant.
|
||||
- The button layout is also significant.
|
||||
- The actual syntax being parsed is not the obvious, despite being
|
||||
functionally equivalent for all correct inputs.
|
||||
|
||||
### Portability
|
||||
|
||||
- This program requires "argv" to point to writable memory. It doesn't require
|
||||
the actual argv strings to be writable, though.
|
||||
- This program requires ASCII.
|
||||
- This program doesn't work with %e style numbers like "1e-4".
|
||||
- Some seemingly redundant code works to eliminate warnings and evade a gcc bug.
|
||||
|
||||
### Spoilers
|
||||
|
||||
The parser parses function names, substraction, and division as single-letter
|
||||
unary operators. A bitmask encoded hash table is used to check no-ops/digits
|
||||
and another hash function maps the ASCII to a function ordinal, which is then
|
||||
executed by the button panel.
|
||||
|
||||
Both hash functions are found using a separate search program. Another program
|
||||
is used to find a way to format one hash function as example input such that
|
||||
it produces something resembling the bitmask hash table as part of its output.
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
<!--
|
||||
(c) Copyright 1984-2012, [Leo Broukhis, Simon Cooper, Landon Curt Noll][judges] - All rights reserved
|
||||
This work is licensed under a [Creative Commons Attribution-ShareAlike 3.0 Unported License][cc].
|
||||
|
||||
[judges]: http://www.ioccc.org/judges.html
|
||||
[cc]: http://creativecommons.org/licenses/by-sa/3.0/
|
||||
-->
|
||||
@@ -0,0 +1,34 @@
|
||||
#include <stdio.h>
|
||||
#include <math.h>
|
||||
#define clear 1;if(c>=11){c=0;sscanf(_,"%lf%c",&r,&c);while(*++_-c);}\
|
||||
else if(argc>=4&&!main(4-(*_++=='('),argv))_++;g:c+=
|
||||
#define puts(d,e) return 0;}{double a;int b;char c=(argc<4?d)&15;\
|
||||
b=(*_%__LINE__+7)%9*(3*e>>c&1);c+=
|
||||
#define I(d) (r);if(argc<4&&*#d==*_){a=r;r=usage?r*a:r+a;goto g;}c=c
|
||||
#define return if(argc==2)printf("%f\n",r);return argc>=4+
|
||||
#define usage main(4-__LINE__/26,argv)
|
||||
#define calculator *_*(int)
|
||||
#define l (r);r=--b?r:
|
||||
#define _ argv[1]
|
||||
#define x
|
||||
|
||||
double r;
|
||||
int main(int argc,char** argv){
|
||||
if(argc<2){
|
||||
puts(
|
||||
usage: calculator 11/26+222/31
|
||||
+~~~~~~~~~~~~~~~~~~~~~~~~calculator-\
|
||||
! 7.584,367 )
|
||||
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~+
|
||||
! clear ! 0 ||l -x l tan I (/) |
|
||||
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~+
|
||||
! 1 | 2 | 3 ||l 1/x l cos I (*) |
|
||||
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~+
|
||||
! 4 | 5 | 6 ||l exp l sqrt I (+) |
|
||||
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~+
|
||||
! 7 | 8 | 9 ||l sin l log I (-) |
|
||||
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~(0
|
||||
);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
Reference in new issue
Block a user