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:
Landon Curt Noll committed 2020-12-30 16:57:03 -08:00
1 parent 28efc67f5d
commit c0663537cb
1683 files changed
+220064

No files matched your search

BIN
View File
Binary file not shown.
+130
View File
@@ -0,0 +1,130 @@
2012/2012.tar.bz2
2012/MANIFEST
2012/Makefile
2012/README.html
2012/README.markdown
2012/README.text
2012/blakely/Makefile
2012/blakely/blakely.c
2012/blakely/hint.html
2012/blakely/hint.text
2012/deckmyn/MANUAL
2012/deckmyn/Makefile
2012/deckmyn/deckmyn.c
2012/deckmyn/example_beethoven
2012/deckmyn/example_greensleeves
2012/deckmyn/hint.html
2012/deckmyn/hint.text
2012/dlowe/Makefile
2012/dlowe/dead.d
2012/dlowe/dlowe.c
2012/dlowe/hint.html
2012/dlowe/hint.text
2012/dlowe/splash.d
2012/dlowe/sprites.d
2012/endoh1/Makefile
2012/endoh1/Makefile.orig
2012/endoh1/clock.txt
2012/endoh1/column.txt
2012/endoh1/column2.txt
2012/endoh1/column3.txt
2012/endoh1/corners.txt
2012/endoh1/dripping-pan.txt
2012/endoh1/endoh1.c
2012/endoh1/endoh1_color.c
2012/endoh1/endoh1_deobfuscate.c
2012/endoh1/evaporation.txt
2012/endoh1/flat.txt
2012/endoh1/fountain.txt
2012/endoh1/funnel.txt
2012/endoh1/funnel2.txt
2012/endoh1/funnel3.txt
2012/endoh1/glass-half-empty.txt
2012/endoh1/hint.html
2012/endoh1/hint.text
2012/endoh1/leidenfrost.txt
2012/endoh1/logo.txt
2012/endoh1/pour-out.txt
2012/endoh1/tanada.txt
2012/endoh2/Makefile
2012/endoh2/endoh2.c
2012/endoh2/find-font-table.rb
2012/endoh2/hint.html
2012/endoh2/hint.text
2012/grothe/Makefile
2012/grothe/cookie_piece1.dat
2012/grothe/cookie_piece2.dat
2012/grothe/cookie_piece3.dat
2012/grothe/cookie_piece4.dat
2012/grothe/cookie_recipe.txt
2012/grothe/grothe.c
2012/grothe/grothe.orig.c
2012/grothe/hint.html
2012/grothe/hint.text
2012/guidelines.txt
2012/hamano/Makefile
2012/hamano/hamano.c
2012/hamano/hamano.orig.c
2012/hamano/hint.html
2012/hamano/hint.text
2012/hint.css
2012/hou/Makefile
2012/hou/ansi.txt
2012/hou/chk.txt
2012/hou/header.htm
2012/hou/hint.html
2012/hou/hint.text
2012/hou/hou.c
2012/hou/html.txt
2012/hou/markdown.txt
2012/hou/patho.pl
2012/hou/perl-notes.txt
2012/kang/Makefile
2012/kang/hint.html
2012/kang/hint.text
2012/kang/kang.c
2012/kang/kang.orig.c
2012/konno/Makefile
2012/konno/hint.html
2012/konno/hint.text
2012/konno/konno.c
2012/konno/konno.orig.c
2012/konno/konno_deobfuscate.c
2012/omoikane/Makefile
2012/omoikane/hint.html
2012/omoikane/hint.text
2012/omoikane/nyaruko.c
2012/omoikane/spoiler.html.gz
2012/rules.txt
2012/tromp/Makefile
2012/tromp/bf.Blc
2012/tromp/deflate.Blc
2012/tromp/hilbert.Blc
2012/tromp/hint.html
2012/tromp/hint.text
2012/tromp/how13
2012/tromp/hw.bf
2012/tromp/inflate.Blc
2012/tromp/oddindices.Blc
2012/tromp/parse.Blc
2012/tromp/primes.blc
2012/tromp/primes.pl
2012/tromp/symbolic.Blc
2012/tromp/tromp.c
2012/tromp/tromp.orig.c
2012/tromp/uni.blc
2012/tromp/uni8.Blc
2012/vik/Makefile
2012/vik/chocolate.png
2012/vik/hint.html
2012/vik/hint.text
2012/vik/ioccc.png
2012/vik/vik.c
2012/whowon.html
2012/zeitak/Makefile
2012/zeitak/hint.html
2012/zeitak/hint.text
2012/zeitak/incorrect.c
2012/zeitak/zeitak.c
2012/zeitak/zeitak.orig.c
2012/zeitak/zeitak_deobfucate.c
+147
View File
@@ -0,0 +1,147 @@
#!/usr/bin/env make
#
# 2012 makefile
#
# This work by Landon Curt Noll, Simon Cooper, and Leonid A. Broukhis
# is licensed under:
#
# 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
# Set X11_LIBDIR to the directory where the X11 library resides
#
X11_LIBDIR= /usr/X11R6/lib
# Set X11_INCLUDEDIR to the directory where the X11 include files reside
#
X11_INCDIR= /usr/X11R6/include
# ANSI compiler
#
# Set CC to the name of your ANSI compiler.
#
CC= cc
###############
# IOCCC winners
###############
#
WINNERS= blakely deckmyn dlowe endoh1 endoh2 grothe hamano \
hou kang konno omoikane tromp vik zeitak
###################
# build all entries
###################
#
all:
@for i in ${WINNERS} ; do \
echo "(cd $$i && $(MAKE) ENTRY=$$i X11_LIBDIR=${X11_LIBDIR} X11_INCDIR=${X11_INCDIR} $@)"; \
(cd $$i && $(MAKE) "ENTRY=$$i" "X11_LIBDIR=${X11_LIBDIR}" "X11_INCDIR=${X11_INCDIR}" $@); \
done
# alternative executable
#
alt:
@for i in ${WINNERS} ; do \
echo "(cd $$i && $(MAKE) ENTRY=$$i X11_LIBDIR=${X11_LIBDIR} X11_INCDIR=${X11_INCDIR} $@)"; \
(cd $$i && $(MAKE) "ENTRY=$$i" "X11_LIBDIR=${X11_LIBDIR}" "X11_INCDIR=${X11_INCDIR}" $@); \
done
###############
# utility rules
###############
#
everything: all alt
clean:
@for i in ${WINNERS} ; do \
echo "(cd $$i && $(MAKE) ENTRY=$$i $@)"; \
(cd $$i && $(MAKE) "ENTRY=$$i" $@); \
done
clobber: clean
@for i in ${WINNERS} ; do \
echo "(cd $$i && $(MAKE) ENTRY=$$i $@)"; \
(cd $$i && $(MAKE) "ENTRY=$$i" $@); \
done
nuke: clobber
@for i in ${WINNERS} ; do \
echo "(cd $$i && $(MAKE) ENTRY=$$i $@)"; \
(cd $$i && $(MAKE) "ENTRY=$$i" $@); \
done
install:
@for i in ${WINNERS} ; do \
echo "(cd $$i && $(MAKE) ENTRY=$$i $@)"; \
(cd $$i && $(MAKE) "ENTRY=$$i" $@); \
done
##################
# 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 be disallowed from not being unable to partly misunderstand this partocular final echo.
@${TRUE}
# These rules are written in the sytle of "I Am the Walrus"
# and in particular John Lennon's take on deep analysis of art. :-)
#
# See also the sub-directory Makefiles for non-propaganda.
#
supernova: nuke
@-if [ -r .code_anal ]; then \
${RM} -f .code_anal_v3; \
else \
echo "You are not expected to understand this"; \
fi
@${TRUE}
deep_magic:
@-if [ -r .code_anal ]; then \
ccode_analysis --deep_magic 1c2c85c7a02c55d1add91967eca491d53c101dc1 --FNV1a_hash 256-bit -R ."; \
else \
echo "Understand different"; \
fi
@${TRUE}
magic: deep_magic
@-if [ -r .code_anal ]; then \
ccode_analysis --mode 391581 --level 216193 --FNV1a_hash 256-bit -R ."; \
else \
echo "These aren't the droids you're looking for Mr. Spock!"; \
fi
@${TRUE}
+144
View File
@@ -0,0 +1,144 @@
<!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>README</title>
</head>
<body>
<h1>2012 marked the &ldquo;The Twenty First International Obfuscated C Code Contest&rdquo;</h1>
<p>Copyright &copy; 2012, Landon Curt Noll, Simon Cooper, and Leonid A.
Broukhis. All Rights Reserved. Permission for personal, educational
or non-profit use is granted provided this copyright and notice are
included in its entirety and remains unaltered. All other uses
must receive prior permission from the contest judges.</p>
<h2>Standard IOCCC stuff</h2>
<p>The IOCCC has a web site and now has a number of international mirrors.
The primary site can be found at,</p>
<blockquote><p> <a href="http://www.ioccc.org/">http://www.ioccc.org/</a></p></blockquote>
<p>Use make to compile entries. It is possible that on non-Un*x / 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 makefile for compile/build issues. Your system may require
certain changes (add or remove a library, add or remove a #define).</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>Remarks on some of the entries</h2>
<p>We believe you will be impressed with this year&rsquo;s winners. We had
a very difficult time picking a single best from among the other winners
because the overall quality of the winners were so high.</p>
<p>This year we selected the top 4 entries for particularly high honors:</p>
<ul>
<li><p>Gold award - Balanced use of obfuscation</p>
<p>A very extremely subtle and twisted piece of source code!
Even if you start with the zeitak_deobfucate.c source,
you will still have a very challenging time to understand it!</p></li>
<li><p>Silver award - Most elementary use of C</p>
<p>A fun program that could also have won &ldquo;Best abuse of
Ghostscript&rdquo; because it managed to create some PDF files
that Ghostscript could not read.</p></li>
<li><p>Bronze award - Best use of cocoa</p>
<p>A picture within a picture is worth more than a
thousand (4 byte) words. :-)</p></li>
<li><p>Honorable mention - Most complex ASCII fluid</p>
<p>When you see this program in action, you too will
very likely say <a href="http://bit.ly/R6ALpK">wow</a> as we did!</p></li>
</ul>
<p>But don&rsquo;t ignore the other winners! There are games, utilities,
eye candy, calculators and graphical tools to explore.</p>
<p>This year, Yusuke Endoh won with two entries, one of which (endoh1)
won the special Honorable mention award. Eight of the winning entries
were from people who won in previous years.</p>
<p>This year we had a number of winners from Asia. We saw our second
winner from China and first from Korea. We are pleased to see
outstanding entries from areas of the world that have not been
active in past contests. Will we see an upswing of entries
from South America, Africa and Antarctica next year? :-)</p>
<p>Please note that judging is done completely anonymously. Please
do NOT reveal your identity in your source code. In the future we
may disqualify entries that reveal the identity of the submitter!</p>
<p>There were some outstanding entries that did not win. Unfortunately
some very good entries lost because they:</p>
<ul>
<li><p>would take years to execute</p></li>
<li><p>were way way oversize and didn&rsquo;t even attempt to justify their
excess by a clever abuse of the rules</p></li>
<li><p>obfuscate themselves by simply invoking a complex
state machine</p></li>
<li><p>depend on a single obfuscation trick</p></li>
<li><p>could only be run on a particular vendor&rsquo;s platform</p></li>
<li><p>were very similar to previous winners</p></li>
<li><p>were based on an overused theme such as yet another
fractal display program</p></li>
<li><p>didn&rsquo;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 winners. Previous winners set a very high
bar. A new winner must not only compete against other submissions
form the current year, they must also excel over similar winners
in some particularly impressive way.</p>
<h2>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>
<blockquote><p> <a href="http://www.ioccc.org/contact.html">http://www.ioccc.org/contact.html</a></p></blockquote>
<p>For news of the next contest watch:</p>
<blockquote><p> <a href="http://www.ioccc.org/">http://www.ioccc.org/</a></p></blockquote>
<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>&copy; 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>&nbsp;<!--<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>
+143
View File
@@ -0,0 +1,143 @@
2012 marked the "The Twenty First International Obfuscated C Code Contest"
========================================================================
Copyright (C) 2012, Landon Curt Noll, Simon Cooper, and Leonid A.
Broukhis. All Rights Reserved. Permission for personal, educational
or non-profit use is granted provided this copyright and notice are
included in its entirety and remains unaltered. All other uses
must receive prior permission from the contest judges.
Standard IOCCC stuff
--------------------
The IOCCC has a web site and now has a number of international mirrors.
The primary site can be found at,
> <http://www.ioccc.org/>
Use make to compile entries. It is possible that on non-Un\*x / non-Linux
systems the makefile needs to be changed. See the Makefile for details.
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.
Read over the makefile for compile/build issues. Your system may require
certain changes (add or remove a library, add or remove a #define).
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.
Remarks on some of the entries
------------------------------
We believe you will be impressed with this year's winners. We had
a very difficult time picking a single best from among the other winners
because the overall quality of the winners were so high.
This year we selected the top 4 entries for particularly high honors:
* Gold award - Balanced use of obfuscation
A very extremely subtle and twisted piece of source code!
Even if you start with the zeitak_deobfucate.c source,
you will still have a very challenging time to understand it!
* Silver award - Most elementary use of C
A fun program that could also have won "Best abuse of
Ghostscript" because it managed to create some PDF files
that Ghostscript could not read.
* Bronze award - Best use of cocoa
A picture within a picture is worth more than a
thousand (4 byte) words. :-)
* Honorable mention - Most complex ASCII fluid
When you see this program in action, you too will
very likely say [wow](http://bit.ly/R6ALpK) as we did!
But don't ignore the other winners! There are games, utilities,
eye candy, calculators and graphical tools to explore.
This year, Yusuke Endoh won with two entries, one of which (endoh1)
won the special Honorable mention award. Eight of the winning entries
were from people who won in previous years.
This year we had a number of winners from Asia. We saw our second
winner from China and first from Korea. We are pleased to see
outstanding entries from areas of the world that have not been
active in past contests. Will we see an upswing of entries
from South America, Africa and Antarctica next year? :-)
Please note that judging is done completely anonymously. Please
do NOT reveal your identity in your source code. In the future we
may disqualify entries that reveal the identity of the submitter!
There were some outstanding entries that did not win. Unfortunately
some very good entries lost because they:
+ would take years to execute
+ were way way oversize and didn't even attempt to justify their
excess by a clever abuse of the rules
+ obfuscate themselves by simply invoking a complex
state machine
+ depend on a single obfuscation trick
+ could only be run on a particular vendor's platform
+ were very similar to previous winners
+ were based on an overused theme such as yet another
fractal display program
+ didn't work as documented
We hope the authors of some of those entries will fix and re-submit
them for the next IOCCC.
There is a risk in submitting an entry that is similar to a well
used theme by previous winners. Previous winners set a very high
bar. A new winner must not only compete against other submissions
form the current year, they must also excel over similar winners
in some particularly impressive way.
Final Comments
--------------
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.
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.
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).
For the latest information on how to contact the IOCCC Judges please visit
> <http://www.ioccc.org/contact.html>
For news of the next contest watch:
> <http://www.ioccc.org/>
--------------------------------------------------------------------------------
<!--
(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/
-->
+204
View File
@@ -0,0 +1,204 @@
#!/usr/bin/env make
#
# 2012 makefile
#
# This work by Landon Curt Noll, Simon Cooper, and Leonid A. Broukhis
# is licensed under:
#
# 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
# Set X11_LIBDIR to the directory where the X11 library resides
#
X11_LIBDIR= /usr/X11R6/lib
# Set X11_INCLUDEDIR to the directory where the X11 include files reside
#
X11_INCDIR= /usr/X11R6/include
# Compiler warnings
#
#CWARN=
#CWARN= -Wall -W
CWARN= -Wall -W -pedantic -Wno-unused-parameter
# compiler standard
#
#CSTD=
CSTD= -ansi
#CSTD= -std=c99
# compiler bit architecture
#
# Some entries require 32-bitness:
# ARCH= -m32
#
# Some entries require 64-bitess:
# ARCH= -m64
#
# By default we assume nothing:
#
ARCH=
# 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=
#OPT= -O
#OPT= -O1
#OPT= -O2
OPT= -O3
# Libraries needed to build
#
LIBS= -lm
# default flags for ANSI C compilation
#
CFLAGS= ${CWARN} ${CSTD} ${ARCH} ${OPT}
# ANSI compiler
#
# Set CC to the name of your ANSI compiler.
#
# Some entries seem to need gcc. If you have gcc, set
# both CC and MAY_NEED_GCC to gcc.
#
# If you do not have gcc, set CC to the name of your ANSI compiler, and
# set MAY_NEED_GCC to either ${CC} (and hope for the best) or to just :
# to disable such programs.
#
CC= cc
#CC=clang
MAY_NEED_GCC= gcc
##############################
# Special flags for this entry
##############################
#
ENTRY= blakely
DATA=
ALT_OBJ=
ALT_ENTRY=
#################
# build the entry
#################
#
all: ${ENTRY} ${DATA}
@${TRUE}
${ENTRY}: ${ENTRY}.c
${CC} ${CFLAGS} -include stdio.h -include math.h -include stdlib.h \
$< -o $@ ${LIBS}
# alternative executable
#
alt: ${ALT_ENTRY}
@${TRUE}
# data files
#
data: ${DATA}
@${TRUE}
###############
# utility rules
###############
#
everything: all alt
clean:
${RM} -f ${ENTRY}.o ${ALT_OBJ}
clobber: clean
${RM} -f ${ENTRY} ${ALT_ENTRY}
nuke: clobber
@${TRUE}
dist_clean: nuke
@${TRUE}
install:
@echo "Surely you're joking Mr. Feynman!"
@${TRUE}
# backwards compatibility
#
build: all
@${TRUE}
##################
# 133t hacker rulz
##################
#
love:
@echo 'not war?'
@${TRUE}
haste:
$(MAKE) waste
@${TRUE}
waste:
@echo 'waste'
@${TRUE}
easter_egg:
@echo you expected to mis-understand this $${RANDOM} magic
@echo chongo '<was here>' "/\\oo/\\"
@echo Readers shall be disallowed from not being unable to partly misunderstand this partocular final echo.
# Understand the history of "I Am the Walrus" and
# and in particular John Lennon's remarks on that
# song and you might be confused about these next
# rules in a different way. :-)
#
supernova: nuke
@-if [ -r .code_anal ]; then \
${RM} -f .code_anal_v3; \
else \
echo "You are not expected to understand this"; \
fi
@${TRUE}
deep_magic:
@-if [ -r .code_anal ]; then \
ccode_analysis --deep_magic 1c2c85c7a02c55d1add91967eca491d53c101dc1 --FNV1a_hash 256-bit "${ENTRY}"; \
else \
echo "Understand different"; \
fi
@${TRUE}
magic: deep_magic
@-if [ -r .code_anal ]; then \
ccode_analysis --mode 21701 --level 23209 --FNV1a_hash 256-bit "${ENTRY}"; \
else \
echo "These aren't the droids you're looking for Mr. Spock!"; \
fi
@${TRUE}
+48
View File
@@ -0,0 +1,48 @@
#define o(a,b,c,d) a##f b##f c##f d; a##g b##g c##g d;q--
#define Z(z)if(*j==z)
#define c(z,p) Z(z){y;v p##=r;o(b,[q-1]=b,[q] p b,[q]);}
#define y q+=t;t=0
#define r w[q]
#define v w[q-1]
#define w(a,m,f) Z(a){y;r=m(r);q++;o(b,[q-1] = -b,[q-1]*f(r)+0*b,[0]);}
#define A(p,w,o) for(p=0;p<w;p++)_(o)
#define P(a) for(a=Z;a<Z;a++)
#define _ putchar
typedef double o;
typedef char z;
o A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y, E_, w[20], bf[20], bg[20],x=-1.3/8,p,d,l=0,h=4e-3,f,m;
z e[17] = "FKE<<gMAQUDIYO9\"=", *k, *j; o g(o p, o d){int q =-1,t=0;j=k;while( *j ){c(45,-);Z(100){y;q++;r=v;q[bf]=bf[q-1];q[bg]=bg[q-1];}Z(42)
{y;v*=r;o(b,[q-1]=r*b,[q-1] + v*b,[q]);}Z(44){t=0;q++;}Z(116){f=v;v=r;r=f;f=bf[q];q[bf]=bf[q-1];bf[q-1]=f;f=q[bg];bg[q]=(q-1)[bg];bg[q-1]=f;
}c(43,+);Z(47){y;v/=r; o(b,[q-1]=b,[q-1]/r-v/ (r*r)*b,[q]);}Z(121){y;q++ ;r=d; bf[ q]=0;bg[q]=1;}
Z(94){y;f=v;v=pow(v,r) ;o(b,[q-1]=r*b,[q-1]* pow(f,r-1)+0*b,[q]);}w(115 ,sin,cos);w(99,cos,sin);
Z(120){y;q++;r=p;bf[q] =1;bg[q]=0;}if(*j>=48 &&*j<58){q++;t=1;r=*j-48 ; bf[q] = 0;(q--)[bg] = 0;
}j++;}H=bf[0] ;K= bg[ 0]; return w[0];}
void s(){int e=0;X=Q*8;f=g (Y*8, L*8 )
;e=(f-X<0)?1: -1;l=0;while((l+=h)<8) {
V=Y*8+l*R;W=L* 8+l*D;X= Q*8+l*U;f=g(V,W);if((f -X)*e>0){if(V>-1&&V<1&&W>
-1&&W<1){p=V;d=W;return ;}else e/=-1;}}p=d=-10 ;}int main(int argc, z **
argv){int c, f;z b[2],Z ;S=0,C=1;k=argv[1];Z = atoi(argv[2])>>1;b[1]=Z*2
&255;b[0]=Z>> 9;J= 3.1415/Z;A(f,6,f[e]^f+1);while(--f>1)_(
(f%2)[b]);_(246);A(c,384,c/3%2?c/6<<2:0);_(_(0));_(_((_(33)
<<3)-9)/23);for(f+=5;f < c/22 ; f++) _(e[f] ^ f - 3);for(;f
> c/29;f--)_(f>15?2*f-
31:c);_(0);for(f=0;f<=
Z*2 ; f++){N = S;E_=1-
J*J/2;T=J*(1-J*J/6);
S=S*E_+C*T;C=C*E_-N*
T;A=-(C*C-S*S);P=-A*
C;E=A*S;G=S*C*2;I=-
G*S;F=G*C;_((_(e[10
]/2-1)<<3)-18);for(
c=-1;c<5;c++)_((c+1)%2?0:-2*c*c+3*c+9);_(44);A(c,9,c&4?(1-c%2
)[b]:0);_(7);for(B=-Z ; B<Z ; B++){_(Z+2);for(O=-Z;O<Z;O++){Y
= (E - P*B/Z - G*O/Z)*x;L = (I - F*B/Z - A*O/Z)*x;Q = (-C +S*
B/Z)*x;R = - Y + E; D =-L+I; U =-Q-C;s();3[w] = sqrt(R*R + D*D + U*U);m=p==-10?1:(4[w]=sqrt(H*H+K*K+1)*w[3],H/=-4[w],K/=-4[w],
fabs(H*R + K*D + U/4[w])*exp(-l*l/2) );_((z)(m * 63)*2 + ((z)((p+1)*6) % 2 + (z)((d+1)*6) % 2 == 1 ? 1 : 0));O?l:(_(128),_(B!=
Z-1 ? Z : Z+1));}_(128);}_(_(129)-129);}_(0x3b);}
+150
View File
@@ -0,0 +1,150 @@
<!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 GIFted expressions</title>
</head>
<body>
<h1>Most GIFted expressions</h1>
<p>Philip Blakely<br>
Cambridge, UK<br>
<a href="&#109;&#97;&#105;&#108;&#116;&#x6f;&#x3a;&#x70;&#x6d;&#x62;&#x6c;&#97;&#107;&#x65;&#x6c;&#121;&#64;&#103;&#109;&#97;&#105;&#108;&#x2e;&#99;&#111;&#109;">&#x70;&#109;&#x62;&#108;&#97;&#x6b;&#x65;&#108;&#x79;&#x40;&#103;&#109;&#97;&#x69;&#x6c;&#x2e;&#x63;&#x6f;&#109;</a></p>
<h2>Judges' comments:</h2>
<h3>To build:</h3>
<pre><code>make blakely
</code></pre>
<h3>To run:</h3>
<pre><code>./blakely "RPN formula" resolution &gt; output.gif
</code></pre>
<h3>Try:</h3>
<pre><code>./blakely "xx*yy*+" 64 &gt; paraboloid.gif
./blakely 9 32 &gt; empty.gif
time ./blakely 0 250 &gt; flat.gif
</code></pre>
<h3>Selected Judges Remarks:</h3>
<p>Several IOCCC themes (RPN calculator, animated GIF generator, ray tracing) in one package! Very impressive!</p>
<p>The checkerboard pattern in the output can be broken. Could you figure out how?</p>
<p>Larger GIF files confuse some image viewers.</p>
<h2>Author&rsquo;s comments:</h2>
<h2>Remarks</h2>
<p>This program renders a generic RPN expression in ray-traced animated GIF form.
The expression in spatial variables x and y is specified on the command-line with the required resolution,
and an animated GIF showing a fly-around of the resulting surface is output to stdout.</p>
<h2>Usage</h2>
<p>The program should be run as:</p>
<pre><code>./blakely xy* 32 &gt; pic.gif
</code></pre>
<p>where the first parameter is a RPN expression, and the second is the width of the required GIF, up to a maximum of 250.</p>
<p>The expressions are written in Reverse Polish Notation with the following characters recognised:</p>
<ul>
<li>+,-,*,/ - usual arithmetic operations</li>
<li>^ - Exponentiation - valid for constant exponent only</li>
<li>s - sin</li>
<li>c - cos</li>
<li>0-9 - single digit integers</li>
<li>d - duplicate number on stack</li>
<li>t - transpose top two elements on stack</li>
<li>x - x coordinate value</li>
<li>y - y coordinate value</li>
</ul>
<p>NB all arithmetic is done in double precision, so 23/ is two-thirds, rather than 0</p>
<p>The surface plotted corresponds to -1 &lt;= x,y &lt;= 1 and for best results, the generated z value should lie between -1 and 1.</p>
<p>If there is a division by zero, square-root of a negative number, or similar operation, then the results are undefined.</p>
<h2>Examples</h2>
<p>For test-runs, use a resolution of 32. For simple expressions, the GIF generation should take only
a few seconds with a modern processor and full optimization. Run-time scales as O(N<sup>3</sup>) with resolution N,
and more complex expressions take longer to compute. For example, increasing the resolution of ripple.gif
to 250 took ~35 minutes to render on an i7 processor.</p>
<pre><code>./blakely xy* 32 &gt; saddle.gif
./blakely xx*yy*1++d5*ct/ 64 &gt; ripple.gif
</code></pre>
<h2>Algorithm</h2>
<p>A generic root-finding algorithm to find the point of intersection between a ray
and the surface is done using a simple forward search from the eye.
In order to make the rendering realistic, both the value of the expression, and its derivative with respect to x and y must be tracked.
This is done using an obvious stack-based approach.</p>
<h2>Obfuscations</h2>
<p>Much of the obfuscation is achieved through the use of single-letter variables and #defines.
The characters output for the GIF format are generated in myriad and wonderful ways, making use
of XOR, return values from putchar, and odd expressions.
The layout is in the form of X Y Z.</p>
<h2>Limitations</h2>
<p>ASCII is assumed since many bytes for the GIF output are generated from characters given in the source code.
On compilation a few warnings about parentheses come up when using gcc 4.6.3, and one about no return value from main() (who uses exit codes anyway?),
but clang 3.1 emits no warnings.</p>
<h2>Questions</h2>
<ul>
<li>Apart from their appearance when computing the RPN expression, sin and cos are not used.
How do we then get the correct angles for rotation?</li>
<li>Exactly how many times will the animation repeat?</li>
<li>Why is there an upper limit of 250x250 for the resolution?</li>
<li>What is the point of b[0]?</li>
<li>Where are the words NETSCAPE and GIF hidden in the source?</li>
</ul>
<p>(Note that the author may or may not be able to answer all of the above questions.)</p>
<hr />
<!--
(c) Copyright 1984-2015, [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>&copy; 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>&nbsp;<!--<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>
+121
View File
@@ -0,0 +1,121 @@
# Most GIFted expressions
Philip Blakely
Cambridge, UK
<pmblakely@gmail.com>
## Judges' comments:
### To build:
make blakely
### To run:
./blakely "RPN formula" resolution > output.gif
### Try:
./blakely "xx*yy*+" 64 > paraboloid.gif
./blakely 9 32 > empty.gif
time ./blakely 0 250 > flat.gif
### Selected Judges Remarks:
Several IOCCC themes (RPN calculator, animated GIF generator, ray tracing) in one package! Very impressive!
The checkerboard pattern in the output can be broken. Could you figure out how?
Larger GIF files confuse some image viewers.
## Author's comments:
Remarks
-------
This program renders a generic RPN expression in ray-traced animated GIF form.
The expression in spatial variables x and y is specified on the command-line with the required resolution,
and an animated GIF showing a fly-around of the resulting surface is output to stdout.
Usage
-----
The program should be run as:
./blakely xy* 32 > pic.gif
where the first parameter is a RPN expression, and the second is the width of the required GIF, up to a maximum of 250.
The expressions are written in Reverse Polish Notation with the following characters recognised:
* +,-,\*,/ - usual arithmetic operations
* ^ - Exponentiation - valid for constant exponent only
* s - sin
* c - cos
* 0-9 - single digit integers
* d - duplicate number on stack
* t - transpose top two elements on stack
* x - x coordinate value
* y - y coordinate value
NB all arithmetic is done in double precision, so 23/ is two-thirds, rather than 0
The surface plotted corresponds to -1 <= x,y <= 1 and for best results, the generated z value should lie between -1 and 1.
If there is a division by zero, square-root of a negative number, or similar operation, then the results are undefined.
Examples
--------
For test-runs, use a resolution of 32. For simple expressions, the GIF generation should take only
a few seconds with a modern processor and full optimization. Run-time scales as O(N^3) with resolution N,
and more complex expressions take longer to compute. For example, increasing the resolution of ripple.gif
to 250 took ~35 minutes to render on an i7 processor.
./blakely xy* 32 > saddle.gif
./blakely xx*yy*1++d5*ct/ 64 > ripple.gif
Algorithm
---------
A generic root-finding algorithm to find the point of intersection between a ray
and the surface is done using a simple forward search from the eye.
In order to make the rendering realistic, both the value of the expression, and its derivative with respect to x and y must be tracked.
This is done using an obvious stack-based approach.
Obfuscations
------------
Much of the obfuscation is achieved through the use of single-letter variables and #defines.
The characters output for the GIF format are generated in myriad and wonderful ways, making use
of XOR, return values from putchar, and odd expressions.
The layout is in the form of X Y Z.
Limitations
-----------
ASCII is assumed since many bytes for the GIF output are generated from characters given in the source code.
On compilation a few warnings about parentheses come up when using gcc 4.6.3, and one about no return value from main() (who uses exit codes anyway?),
but clang 3.1 emits no warnings.
Questions
---------
* Apart from their appearance when computing the RPN expression, sin and cos are not used.
How do we then get the correct angles for rotation?
* Exactly how many times will the animation repeat?
* Why is there an upper limit of 250x250 for the resolution?
* What is the point of b[0]?
* Where are the words NETSCAPE and GIF hidden in the source?
(Note that the author may or may not be able to answer all of the above questions.)
--------------------------------------------------------------------------------
<!--
(c) Copyright 1984-2015, [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/
-->
+58
View File
@@ -0,0 +1,58 @@
USER MANUAL
===========
Calling the program
-------------------
./prog "`cat prog.c`" "`cat musicfile`" > output.pbm
display output.pbm
This minimalistic music notator expects two command line arguments. The first is the font description embedded in the source code. Notice that you don't pass the file name, but the actual content as one long character string! If you want to define your personal music font, you can of course do so. The file layout must be exactly the same as prog.c though, only the locations of space (" ") may differ.
The second argument is the actual music. Again it is one long string, not a file name. But it is possible to save your music in a file, of course.
Output should be redirected to a file. Afterwards, this file can be visualised with various viewers.
Music input
-----------
Every element in the music is given by a string of *exactly* 3 characters. Any violation of this will result in the rest of the music being interpreted in some randomly wrong way. Notice that in a file, the newline is also a character! Therefore, when preparing music in a file, care shold be taken that the last musical element of a line is only 2 characters!
1. Basic notes:
A single note is input by a letter [A-Ga-g] followed by a duration [1,2,4,8] and possibly a dot [.]. The notes cover 2 octaves, from C (lowest) to b (highest). The possible durations are 1 (whole note), 2 (half note), 4 (quaver), 8 (semi-quaver). So a dotted quaver A followed by a semi quaver G is input as "A4.G8 "
2. Rests:
A rest is given by the letter [r] followed by a duration [1,2,4,8].
3. Bar lines:
There are three possible barline types: single (": "), double (":: ") and final (":; ").
4. Accidentals:
Chromatic changes (sharp, flat, natural) are entered separately from the note that folows them! They are a three-character sequence by themselves. The first character is the chromatic change [+-=]. The second is the pitch at which it should be drawn. Thus "+G G4 " will draw a G sharp quaver. Notice that these signs do not necessarily have to be followed by a note. "+f +c +g B2 " is perfectly legal.
5. Space (formatting):
To manually change the spacing of the music, you can add space between different musical elements. This is given by a [s] followed by the amount of space."s3 " is the space taken by one note. This length is given in 1 character. However, to get a value larger than 9, you can just continue along the ASCII table. So "sz " gives you quite a lot of space on a staff. "s0 " is not only meaningless, it can cause nasty results.
6. New staff:
A token "x " signifies to start a new staff of music. A music staff may never be empty! Even if you just put some blank space ("s1 "), you should always have an entry for every staff. "x x " may give nasty results.
All staves in the output are extended to the length of the longest staff. To have nicely formatted music, though, you will probably have to add spaces manually.
7. Time signatures:
A time signature is given by [m][234][234]. For example, "m24" will give you a two fourth signature. Notice that there are only three available numbers. Especially "6" and "8" are dearly missed.
8. Clef:
The clef (G or F) can only be changed at the beginning of the music input. If the music starts with "KF ", the music will be written in a bass cleff. "K" followed by any other letter will just default to a standard G clef.
Examples
--------
Blank music paper (with G cleff):
./prog "`cat prog.c`" "sz sa x s1 x s1 x s1 x s1 x s1 "> blank.pbm
with an F cleff:
./prog "`cat prog.c`" "KF sz sa x s1 x s1 x s1 x s1 x s1 "> blank.pbm
Notice how only the first staff (or any staff) needs to have the full length.
Some files with well-known melodies are included as examples.
+203
View File
@@ -0,0 +1,203 @@
#!/usr/bin/env make
#
# 2012 makefile
#
# This work by Landon Curt Noll, Simon Cooper, and Leonid A. Broukhis
# is licensed under:
#
# 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
# Set X11_LIBDIR to the directory where the X11 library resides
#
X11_LIBDIR= /usr/X11R6/lib
# Set X11_INCLUDEDIR to the directory where the X11 include files reside
#
X11_INCDIR= /usr/X11R6/include
# Compiler warnings
#
#CWARN=
CWARN= -Wall -W
#CWARN= -Wall -W -pedantic
# compiler standard
#
#CSTD=
#CSTD= -ansi
CSTD= -std=c99
# compiler bit architecture
#
# Some entries require 32-bitness:
# ARCH= -m32
#
# Some entries require 64-bitess:
# ARCH= -m64
#
# By default we assume nothing:
#
ARCH=
# 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=
#OPT= -O
#OPT= -O1
OPT= -O2
#OPT= -O3
# Libraries needed to build
#
LIBS=
# default flags for ANSI C compilation
#
CFLAGS= ${CWARN} ${CSTD} ${ARCH} ${OPT} ${LIBS}
# ANSI compiler
#
# Set CC to the name of your ANSI compiler.
#
# Some entries seem to need gcc. If you have gcc, set
# both CC and MAY_NEED_GCC to gcc.
#
# If you do not have gcc, set CC to the name of your ANSI compiler, and
# set MAY_NEED_GCC to either ${CC} (and hope for the best) or to just :
# to disable such programs.
#
CC= cc
#CC=clang
MAY_NEED_GCC= gcc
##############################
# Special flags for this entry
##############################
#
ENTRY= deckmyn
DATA= MANUAL example_beethoven example_greensleeves
ALT_OBJ=
ALT_ENTRY=
#################
# build the entry
#################
#
all: ${ENTRY} ${DATA}
@${TRUE}
${ENTRY}: ${ENTRY}.c
${CC} ${CFLAGS} $< -o $@
# alternative executable
#
alt: ${ALT_ENTRY}
@${TRUE}
# data files
#
data: ${DATA}
@${TRUE}
###############
# utility rules
###############
#
everything: all alt
clean:
${RM} -f ${ENTRY}.o ${ALT_OBJ}
clobber: clean
${RM} -f ${ENTRY} ${ALT_ENTRY}
nuke: clobber
@${TRUE}
dist_clean: nuke
@${TRUE}
install:
@echo "Surely you're joking Mr. Feynman!"
@${TRUE}
# backwards compatibility
#
build: all
@${TRUE}
##################
# 133t hacker rulz
##################
#
love:
@echo 'not war?'
@${TRUE}
haste:
$(MAKE) waste
@${TRUE}
waste:
@echo 'waste'
@${TRUE}
easter_egg:
@echo you expected to mis-understand this $${RANDOM} magic
@echo chongo '<was here>' "/\\oo/\\"
@echo Readers shall be disallowed from not being unable to partly misunderstand this partocular final echo.
# Understand the history of "I Am the Walrus" and
# and in particular John Lennon's remarks on that
# song and you might be confused about these next
# rules in a different way. :-)
#
supernova: nuke
@-if [ -r .code_anal ]; then \
${RM} -f .code_anal_v3; \
else \
echo "You are not expected to understand this"; \
fi
@${TRUE}
deep_magic:
@-if [ -r .code_anal ]; then \
ccode_analysis --deep_magic 1c2c85c7a02c55d1add91967eca491d53c101dc1 --FNV1a_hash 256-bit "${ENTRY}"; \
else \
echo "Understand different"; \
fi
@${TRUE}
magic: deep_magic
@-if [ -r .code_anal ]; then \
ccode_analysis --mode 21701 --level 23209 --FNV1a_hash 256-bit "${ENTRY}"; \
else \
echo "These aren't the droids you're looking for Mr. Spock!"; \
fi
@${TRUE}
+97
View File
@@ -0,0 +1,97 @@
#include<stdio.h>
#define c(C) printf("%c",C)
#define C(c) ((int*)(C[1]+6))[c]
main(int c,char
*C[]) {(C[c]=C[
1]+2 )[0]= c(52*c(\
'C'+ '4'/4) );for(c
=0; c<491;++ c)for(*
*C= C[1]['c' +c] =
0;* C[0]<8;( ** C
)++ )C[1][c+ 'c']=
*(C[ 1]+c+'c')+ C[1][
99+ c]+(C[1 ][**C
+8*c +99]==32 ); (
*C)[4]=*C[2]== 75 ?
*((C[2]+=3)-2 )==70?
1:0:0;C(0)=C( 1)=c=0
;while(*C[2]? C[2][1]
?*(C[2]+2)?1 :0:0:0)
{if( *C [2 ]>'w'){
C(1)=0;C[1] [2]++;*C
[2]=0;}else C(1)+=*C[
2]==58?2+( C[2][3]&&
*(C[2]+3)< 'x'):*C[2]
=='s'?(C[ 2][1]-=48):
*C[2]>=65 ?3-(*C[2]==\
'm'?1:0) :1;C(0)=C(1)>
C(0)?C(1 ):C(0);c+=3;*
(C+2)+=3;}printf(" %d\
%d\n", 56+8*C( 0),80**(C[3] ++))
;*C[2]=0 ;C[2] -=c;*C[3] =0;
while(C[3] [1,- 1]--){; for( **
C=0 ;* *C< 80;(** C)++) {C
[2] -=3 ** C[3]; *C[3] ++
=0; *C[ 3] =**C>= 51||* *C<
18 ||* *C %8!=2?0 :255 ;c(1
-1 );c (*C [3]);for( (*C)[
1] =0;( *C)[ 1]<3;(*C)[1] ++)c(*C
[3 ]|(( *C)[ 4]?**C>18&&* *C<42 ?C[1][
42 +*(* C+1) +3***C]:0: **C>= 11&&*
*C <64? ~C[1 ][ 7***C+97 +(*C)[ 1]]:
0) );c( *C[3 ]++) ;for(C (1)=0; (C(
2) =C(1 ))<C (0);) {(*C) [2]=C [2][
1] -49; c=(* C[2]<= 63); c=(* C)[0]
-4 *(C[ 3][0 ]=105- C[2][ c] -7*(*(C
[2]+c)< 'c') -18*( C[2][c ]<77)+2*(
*C)[4 ]-7* (C[2] [c]<'C' ))-6;for(C(
3)=0;
C(3)< (*C[2]?*C[2
]>'r' ?C[ 2][1]:(1
+2*(*C [2]> 64) +(2-!C[2 ][3])
*(58 == (*(C +2))[0])-
(C[2] [0 ]=='m' ) ):C(2)?C(0 )-C(
2):0 );C(3)++) C(1)+=c(C [1][4]|(* C[2]&&
*C[2 ]<'s'?*C[2] ==58?C(3) ==1?**C >17&&**C
<51 ?C[ 2] [1] ==59?39: C[2][1 ]==58?9:1:
0:0 :63 >* C[2 ]?(c<7&& c>-9?C[1 ][(*C[2]<
45? 'c' *5 +2* '%':*C[ 2]< 61?570 :571)+
3*c ]: 0) :*C [2]>'o' ?**C>26&&**C<29 &&!
(*C )[ 2] ||( *C)[2] ==1&&(&*C[0]) [0]
<34 && 31 <** C?C(3) <2?15+225*C(3 ):0:(
*C)[ 2] == 3?C (3)<2 &&**C>22&&**C <45&&C
(3)< 2? C[ 1][7* *(*C)+151+C (3)]:0:
7==( *C )[2 ]&&* *C>26&&**C <42&&C(3
)<2?C [1 ][7 ***C +135+C(3)] :0:*C[2]
<'k'? (c >-5 && c<5?C(3
)<2?C [1][( (*C) [2]<3?
207:205)+7* c+C(3 )]:C[
2][2]==46 && (c==-2|| c==-
1- 2*(*C[3]%2 ))?
96 :0:0)|((*C)[2
]?
C( 3 ) ?C(3)< 2
&& *C[3]> 7 &&
c< 1&&c >-24 ?8:0:* C
[3 ]<8&&c >1 &&c<24 ? ' '
:0 :0) |(C(3) <2 &&( ** C
==66 && *C[3 ]>14 ||* C[ 3
]>12 && 58 ==**C|| *
C[3 ]< 2 &&**C==10 ) ?
5* 51: 0)|(7== (
*C)[ 2]?*C[3] <
8?c>13&& c<23&&C(3)<2?C
[1][144+ 7*c+C(3)]:0:C(
3) && c< -14&&c>- 24?C[
1] [7 *c +400+C(3 )]:0:
0) :! C (3)?**C> 21&&C
[0 ][ 0] <32
?C [ 1 ] [(
* C ) [2 ] +323
+7 ** *C ]:36
+ 1 < ** C&& '0'>
* *C ? C[1][
C[ 2] [2]+162
+ 7* **C]:0:0:0));C[1
][ 3] ++;C[2]+=3;}c(0)
;C [3 ]-=2;}*C[3]=0;}}
+4
View File
@@ -0,0 +1,4 @@
m44e2 f4 g4 : g4 f4 e4 d4 : c4 c4 d4 e4 : e4.d8 d2 :
e2 f4 g4 : g4 f4 e4 d4 : x c4 c4 d4 e4 : d4.c8 c2 ::
d2 e4 c4 : d4 e8 f8 e4 c4 : d4 e8 f8 e4 d4 : x c4 d4 G2 :
e4 e4 f4 g4 : g4 f4 e4 d4 : c4 c4 d4 e4 : d4.c8 c2 :;
+8
View File
@@ -0,0 +1,8 @@
m34A4 : c2 d4 : e4.+f f8 e4 : d2 B4 : G4.A8 B4 :
c2 A4 : A4.G8 A4 : B2 G4 : E2 A4 : x
c2 s1 d4 : e4.+f f8 e4 : d2 s1 B4 : G4.A8 B4 : c4.B8 A4 :
+G G4.+F F8 G4 : s2 A2.s2 : s2 A2.s1 :: x
g2.s2 : g4.+f f8 e4 : d2 s2 B4 : G4.A8 B4 : c2 s3 A4 :
A4.s1 G8 s1 A4 : B2 s1 G4 : s2 E2.s2 : x
g2.s2 : g4.+f f8 e4 : d2 s2 B4 : G4.A8 B4 : c4.B8 A4 :
+G G4.+F F8 G4 : s2 A2.s2 : s2 A2.s2 :;
+122
View File
@@ -0,0 +1,122 @@
<!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 notable and best tool</title>
</head>
<body>
<h1>Most notable and best tool</h1>
<p>Alex Deckmyn<br>
<a href="&#109;&#97;&#105;&#108;&#116;&#x6f;&#x3a;&#x61;&#x6c;&#x65;&#x78;&#46;&#100;&#x65;&#x63;&#107;&#109;&#121;&#110;&#64;&#103;&#109;&#x61;&#105;&#108;&#46;&#x63;&#111;&#x6d;">&#97;&#108;&#x65;&#x78;&#46;&#x64;&#x65;&#99;&#107;&#109;&#x79;&#x6e;&#x40;&#x67;&#x6d;&#97;&#x69;&#x6c;&#46;&#x63;&#x6f;&#109;</a></p>
<h2>Judges' comments:</h2>
<h3>To build:</h3>
<pre><code>make deckmyn
</code></pre>
<h3>To run:</h3>
<pre><code># A shell interpreter with proper backtick interpolation is required
./deckmyn "`cat deckmyn.c`" "`cat musicfile.txt`" &gt; sheetmusic.pbm
</code></pre>
<h3>Try:</h3>
<pre><code>./deckmyn "`cat deckmyn.c`" "`cat example_greensleeves`" &gt; greensleeves.pbm
</code></pre>
<h3>Selected Judges Remarks:</h3>
<p>The C of this entry is definitely sharp. The program cleverly uses its own
source at runtime to define the notes, time signature and accidental bitmaps.</p>
<p>In addition to sheet music, this program is also able, given the right input,
to generate an image of a 10-pin DIP chip (a sound processor?).</p>
<p>Ironically, the way this entry is called from the command line is an abuse of C Shell.
Please use Bourne-family shells to run this entry.</p>
<h2>Author&rsquo;s comments:</h2>
<h1>Example use</h1>
<p>You need the source code and example input (either one of the example files, or manual input as below) ready. And a program capable of showing .pbm bitmap format.</p>
<pre><code>./deckmyn "`cat deckmyn.c`" "`cat example_greensleeves`" &gt; greensleeves.pbm
display greensleeves.pbm
./deckmyn "`cat deckmyn.c`" "KF m44c4 c4 g4 g4 : a4 a4 g2 :; " &gt; short_bass.pbm
display short_bass.pbm
</code></pre>
<h1>Description</h1>
<p>Every major C competition should have an entry capable of producing C major.
This is a music notation program. It produces bitmaps (.pbm) of music based on ASCII input. A full manual is added as a separate file. Some musical examples are also included.</p>
<p>The program is capable of printing notes, rests, (double) bar lines and accidentals on a single melodic line (multiple staves). No chords, polyphony etc.</p>
<p>The program expects <em>two command line arguments</em>. The first is a (very long) string that contains the complete music font. Note that it should <em>not</em> be given as a file name! The default music font is encoded in the (whitespace of the) source code deckmyn.c itself. Therefore, the first argument should be &ldquo;<code>cat deckmyn.c</code>&rdquo;.</p>
<p>The second command line argument is the music itself. This is, again, a string, not a file name. All music signs are entered as tokens of exactly 3 characters. The code is very sensitive to bad spacing! So for instance, if you use a file to write the music (e.g. example_greensleeves), you should keep in mind that newline is also a character!</p>
<h1>Internals</h1>
<p>To minimise the memory footprint, this program has <em>no variable declarations at all</em>, except for the arguments to main(). The only available memory space is from the command line arguments and count (argv and argc). Parts of argv are cast as integer when values under 0 or beyond 127 are expected.</p>
<p>The &ldquo;music font&rdquo; is defined by the source code itself. The first few lines are not part of the font definition, as this memory space will modified by the program. (So as required by the rules, it is only a (memory) copy of the source code that is modified.)</p>
<p>As there is no memory available, output is directly to stdout, byte by byte, from the top left to the bottom right pixel.</p>
<h1>LIMITATIONS</h1>
<p>The memory locations of argv are used for various purposes. Therefore, the program name (default &ldquo;deckmyn&rdquo;) must be <em>at least 4 characters long</em>, including possibly the path. This, along with the ending &lsquo;\0&rsquo;, gives minimum 5 bytes of useful memory space. Otherwise, the program may attempt to write outside the string.</p>
<p>The code is quite sensitive. Errors in the input can lead to strange results. The code does not read beyond the end of the music input, but that is about the only error checking available. Any input that is not according to the rules in the MANUAL, may cause errors.</p>
<p>The program has no special hardware limitations or requirements, other than 8bit char (signed or unsigned) and two&rsquo;s complement negatives.</p>
<p>The limitations of using char as counters for e.g. the number of music staves are minor. 127 staves to a page is rather a lot.</p>
<h1>Obfuscations</h1>
<p>The code has no declared variables other than the command line variables. Not even pointers (we all know how messy code can get with too many pointers!). As more than one variable needs values beyond 127, parts of the command line memory are cast as integer using a macro.</p>
<ul>
<li>The formatting of the code is in fact necessary, as this is the definition of the music font. It is therefore not an obfuscation.</li>
<li>The use of only argv/argc as memory locations is a matter of reducing the memory footprint. Again, it is not an obfuscation.</li>
<li>Calling the only remaining variables, and the two defined macros, c and C, is merely a matter of conforming to the standard WYSIWYG paradigm common in commercial notation programs (What You C is What You Get). So once again it is not an obfuscation. Anyway, it&rsquo;s a C coding contest, right?</li>
<li>Randomly using the numerical (ASCII) value for characters is compensated for by replacing some numbers by a character representation. On average, therefore, it is not an obfuscation.</li>
<li>Randomly changing the way the elements of argv are addressed is a matter of maintaining a diversified code base. It is therefore not&hellip; Oh allright.</li>
<li>The actual output of the music is done by one print command including a 800+ character nested conditional expression.</li>
<li>printf is also used for its return value.</li>
</ul>
<hr />
<!--
(c) Copyright 1984-2015, [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>&copy; 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>&nbsp;<!--<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>
+101
View File
@@ -0,0 +1,101 @@
# Most notable and best tool
Alex Deckmyn
<alex.deckmyn@gmail.com>
## Judges' comments:
### To build:
make deckmyn
### To run:
# A shell interpreter with proper backtick interpolation is required
./deckmyn "`cat deckmyn.c`" "`cat musicfile.txt`" > sheetmusic.pbm
### Try:
./deckmyn "`cat deckmyn.c`" "`cat example_greensleeves`" > greensleeves.pbm
### Selected Judges Remarks:
The C of this entry is definitely sharp. The program cleverly uses its own
source at runtime to define the notes, time signature and accidental bitmaps.
In addition to sheet music, this program is also able, given the right input,
to generate an image of a 10-pin DIP chip (a sound processor?).
Ironically, the way this entry is called from the command line is an abuse of C Shell.
Please use Bourne-family shells to run this entry.
## Author's comments:
Example use
===========
You need the source code and example input (either one of the example files, or manual input as below) ready. And a program capable of showing .pbm bitmap format.
./deckmyn "`cat deckmyn.c`" "`cat example_greensleeves`" > greensleeves.pbm
display greensleeves.pbm
./deckmyn "`cat deckmyn.c`" "KF m44c4 c4 g4 g4 : a4 a4 g2 :; " > short_bass.pbm
display short_bass.pbm
Description
===========
Every major C competition should have an entry capable of producing C major.
This is a music notation program. It produces bitmaps (.pbm) of music based on ASCII input. A full manual is added as a separate file. Some musical examples are also included.
The program is capable of printing notes, rests, (double) bar lines and accidentals on a single melodic line (multiple staves). No chords, polyphony etc.
The program expects *two command line arguments*. The first is a (very long) string that contains the complete music font. Note that it should *not* be given as a file name! The default music font is encoded in the (whitespace of the) source code deckmyn.c itself. Therefore, the first argument should be "`cat deckmyn.c`".
The second command line argument is the music itself. This is, again, a string, not a file name. All music signs are entered as tokens of exactly 3 characters. The code is very sensitive to bad spacing! So for instance, if you use a file to write the music (e.g. example\_greensleeves), you should keep in mind that newline is also a character!
Internals
=========
To minimise the memory footprint, this program has *no variable declarations at all*, except for the arguments to main(). The only available memory space is from the command line arguments and count (argv and argc). Parts of argv are cast as integer when values under 0 or beyond 127 are expected.
The "music font" is defined by the source code itself. The first few lines are not part of the font definition, as this memory space will modified by the program. (So as required by the rules, it is only a (memory) copy of the source code that is modified.)
As there is no memory available, output is directly to stdout, byte by byte, from the top left to the bottom right pixel.
LIMITATIONS
===========
The memory locations of argv are used for various purposes. Therefore, the program name (default "deckmyn") must be *at least 4 characters long*, including possibly the path. This, along with the ending '\0', gives minimum 5 bytes of useful memory space. Otherwise, the program may attempt to write outside the string.
The code is quite sensitive. Errors in the input can lead to strange results. The code does not read beyond the end of the music input, but that is about the only error checking available. Any input that is not according to the rules in the MANUAL, may cause errors.
The program has no special hardware limitations or requirements, other than 8bit char (signed or unsigned) and two's complement negatives.
The limitations of using char as counters for e.g. the number of music staves are minor. 127 staves to a page is rather a lot.
Obfuscations
============
The code has no declared variables other than the command line variables. Not even pointers (we all know how messy code can get with too many pointers!). As more than one variable needs values beyond 127, parts of the command line memory are cast as integer using a macro.
- The formatting of the code is in fact necessary, as this is the definition of the music font. It is therefore not an obfuscation.
- The use of only argv/argc as memory locations is a matter of reducing the memory footprint. Again, it is not an obfuscation.
- Calling the only remaining variables, and the two defined macros, c and C, is merely a matter of conforming to the standard WYSIWYG paradigm common in commercial notation programs (What You C is What You Get). So once again it is not an obfuscation. Anyway, it's a C coding contest, right?
- Randomly using the numerical (ASCII) value for characters is compensated for by replacing some numbers by a character representation. On average, therefore, it is not an obfuscation.
- Randomly changing the way the elements of argv are addressed is a matter of maintaining a diversified code base. It is therefore not... Oh allright.
- The actual output of the music is done by one print command including a 800+ character nested conditional expression.
- printf is also used for its return value.
--------------------------------------------------------------------------------
<!--
(c) Copyright 1984-2015, [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/
-->
+203
View File
@@ -0,0 +1,203 @@
#!/usr/bin/env make
#
# 2012 makefile
#
# This work by Landon Curt Noll, Simon Cooper, and Leonid A. Broukhis
# is licensed under:
#
# 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
# Set X11_LIBDIR to the directory where the X11 library resides
#
X11_LIBDIR= /usr/X11R6/lib
# Set X11_INCLUDEDIR to the directory where the X11 include files reside
#
X11_INCDIR= /usr/X11R6/include
# Compiler warnings
#
#CWARN=
CWARN= -Wall -W
#CWARN= -Wall -W -pedantic
# compiler standard
#
#CSTD=
#CSTD= -ansi
CSTD= -std=c99
# compiler bit architecture
#
# Some entries require 32-bitness:
# ARCH= -m32
#
# Some entries require 64-bitess:
# ARCH= -m64
#
# By default we assume nothing:
#
ARCH=
# 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=
#OPT= -O
#OPT= -O1
OPT= -O2
#OPT= -O3
# Libraries needed to build
#
LIBS= -L${X11_LIBDIR} -lX11
# default flags for ANSI C compilation
#
CFLAGS= ${CWARN} ${CSTD} ${ARCH} ${OPT}
# ANSI compiler
#
# Set CC to the name of your ANSI compiler.
#
# Some entries seem to need gcc. If you have gcc, set
# both CC and MAY_NEED_GCC to gcc.
#
# If you do not have gcc, set CC to the name of your ANSI compiler, and
# set MAY_NEED_GCC to either ${CC} (and hope for the best) or to just :
# to disable such programs.
#
CC= cc
#CC=clang
MAY_NEED_GCC= gcc
##############################
# Special flags for this entry
##############################
#
ENTRY= dlowe
DATA=
ALT_OBJ=
ALT_ENTRY=
#################
# build the entry
#################
#
all: ${ENTRY} ${DATA}
@${TRUE}
${ENTRY}: ${ENTRY}.c
${CC} ${CFLAGS} -I${X11_INCDIR} -D_BSD_SOURCE $< -o $@ ${LIBS}
# alternative executable
#
alt: ${ALT_ENTRY}
@${TRUE}
# data files
#
data: ${DATA}
@${TRUE}
###############
# utility rules
###############
#
everything: all alt
clean:
${RM} -f ${ENTRY}.o ${ALT_OBJ}
clobber: clean
${RM} -f ${ENTRY} ${ALT_ENTRY}
nuke: clobber
@${TRUE}
dist_clean: nuke
@${TRUE}
install:
@echo "Surely you're joking Mr. Feynman!"
@${TRUE}
# backwards compatibility
#
build: all
@${TRUE}
##################
# 133t hacker rulz
##################
#
love:
@echo 'not war?'
@${TRUE}
haste:
$(MAKE) waste
@${TRUE}
waste:
@echo 'waste'
@${TRUE}
easter_egg:
@echo you expected to mis-understand this $${RANDOM} magic
@echo chongo '<was here>' "/\\oo/\\"
@echo Readers shall be disallowed from not being unable to partly misunderstand this partocular final echo.
# Understand the history of "I Am the Walrus" and
# and in particular John Lennon's remarks on that
# song and you might be confused about these next
# rules in a different way. :-)
#
supernova: nuke
@-if [ -r .code_anal ]; then \
${RM} -f .code_anal_v3; \
else \
echo "You are not expected to understand this"; \
fi
@${TRUE}
deep_magic:
@-if [ -r .code_anal ]; then \
ccode_analysis --deep_magic 1c2c85c7a02c55d1add91967eca491d53c101dc1 --FNV1a_hash 256-bit "${ENTRY}"; \
else \
echo "Understand different"; \
fi
@${TRUE}
magic: deep_magic
@-if [ -r .code_anal ]; then \
ccode_analysis --mode 21701 --level 23209 --FNV1a_hash 256-bit "${ENTRY}"; \
else \
echo "These aren't the droids you're looking for Mr. Spock!"; \
fi
@${TRUE}
BIN
View File
Binary file not shown.
+63
View File
@@ -0,0 +1,63 @@
#include <X11/Xlib.h>
#include <X11/keysym.h>
#include <stdlib.h>
#include <unistd.h>
#include <time.h>
#include <stdio.h>
#define B(x, y)(x *48+y)
#define L for( d=0; d<48 ; ++d)for(e=0; e<48; ++e)
#define C(x , y ) ( 1 << B ((x) , (y) ) % 8 )
#define A(x,y )((c.c.c[B ((x),(y))/8]&C(x,y))?1:0)
#define R(d ) freopen ( d , "r" , stdin ) ; f\
read ( & c . c , 288 , 1 , stdin ) ;
#define S( b ) ( b ) ? ( c.d.c [ B( d , e) / 8 ]|\
=C ( d , e ) ) : ( c.d.c [B(d,e)/ 8]&= ~(C (d,e)))
int a,b,d,e,f,s; struct{ struct{ char c[288]; } c,
d; int f, g, a, b ; } c; void h(int a,int b){ if(!
(a==(f=b)||(a%2&&b%2))){ if(b==2){ R("splash.d") }
else if ( b == 4 ) { R ( "dead.d" )} else{ L S(0);
c.c=c.d; } c.f=1000; c.b =240; c.g =1; c.a =0; } }
int main (){ Display *i= XOpenDisplay(0); Window q
= XCreateSimpleWindow(i, RootWindow ( i , s =
DefaultScreen(i)),40,40, 640,480,3,0,0); Pixmap u=
XCreatePixmap (i,q ,640, 480,a=DefaultDepth(i,s)),
p=XCreatePixmap (i,q,20, 100,a); GC g=DefaultGC(i,
s ) ; XGCValues W, B ; XEvent v ; long k ;
XSelectInput ( i , q , KeyPressMask|KeyReleaseM\
ask ); XMapWindow (i,q); W.foreground = WhitePixel
(i, s) ; B. foreground = BlackPixel ( i, s ) ; R (
"sprites.d") L{ XChangeGC (i,g,GCForeground,A(d,e)?
&B:&W); if(e<20) if(d<20) XDrawPoint(i, p,g, d,e );
else if ( d < 25 ) XFillRectangle(i,p,g,4*(d
-20) ,20 + 4*e, 4, 4 ); } srand( time(0 )); h(0,2);
while(usleep (16666), f){ while ( XPending ( i) ) {
XNextEvent (i,&v); h(f,v. type == KeyPress ? (( k =
XLookupKeysym(& v.xkey,0) )==XK_q?0:(k==XK_Up?(f==4
?f:3):(k== XK_Down?(f==4?
f:5):(f==2?1:( f==4?2:f))
))):( v.type==KeyRelease?
(( k = XLookupKeysym( &v.
xkey,0))== XK_Up?(f==3?1:
f): (f==5?1:f)):f)); } if
(!c.g){ L{ for(k=0, a=-1;
a<2; ++a)if(d+a>=0&&d+a< 48)for(b=-1; b<2; ++b)if( e+b>=0&&e+b< 48)k+=(a||b)
&&A(d+a,e+b); S(A(d,e)?k ==2||k==3:k==3); } c.c=c. d; } c.g= ++c.g% (f%2?30:
120); c.f +=2; c.a+=f%2? c.f/1000:0; c.b+=f==3?-2: (f==5?2:0); a=c.a>159?-8:
0; b=c.b>399?-8:(c.b<81? 8:0); c.a=a?0:c.a; c.b=b? 240:c.b; L S(((d-a>=0)&&(
d-a<48)&&(e-b>=0)&&(e-b< 48))?A(d-a,e-b):((rand()% 8 ) == 1 )) ; c.c = c.d ;
XFillRectangle(i,u,g,0,0 ,640, 480); L{ if A( d,e) XCopyArea(i,p,u,g,0,0,20,
20,d*20-c.a,e*20-c.b); } if( f%2){ for(d=c.a+ 100; d<c.a+120; ++d)for(e=c.b+
248 ; e < c.b +268; ++e)
if A (d/20, e/ 20) h( f,
4 ); XCopyArea( i, p, u,
g, 0,20 *(c .g /8+1),20,
20 , 100 , 248 ) ; }
XCopyArea( i,u, q,g,0,0,
640, 480, 0, 0 ) ; } }
+153
View File
@@ -0,0 +1,153 @@
<!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 way to lose a life</title>
</head>
<body>
<h1>Best way to lose a life</h1>
<ol type="a">
<li>David Lowe<br>
434 Tenney Drive<br>
Rogue River, OR<br>
97537<br>
<a href="&#109;&#97;&#105;&#108;&#116;&#x6f;&#x3a;&#x6a;&#x2e;&#x64;&#x61;&#118;&#105;&#x64;&#x2e;&#108;&#111;&#119;&#101;&#64;&#103;&#109;&#x61;&#105;&#108;&#46;&#x63;&#111;&#x6d;">&#106;&#46;&#x64;&#x61;&#118;&#x69;&#x64;&#46;&#108;&#111;&#x77;&#x65;&#x40;&#x67;&#x6d;&#97;&#x69;&#x6c;&#46;&#x63;&#x6f;&#109;</a><br>
<a href="http://www.pootpoot.net/">http://www.pootpoot.net/</a></li>
</ol>
<h2>Judges' comments:</h2>
<h3>To build:</h3>
<pre><code>make dlowe
</code></pre>
<h3>To run:</h3>
<pre><code>./dlowe
</code></pre>
<h3>Try:</h3>
<pre><code>./dlowe
# Watch for a while if you like, then press a key within the window
# Use up and down keys to escape death
</code></pre>
<h3>Selected Judges Remarks:</h3>
<p>The judges lose playing this game. This entry wins!</p>
<p>OS X users running Mountain Lion and later will need to download and install:</p>
<pre><code>http://xquartz.macosforge.org/landing/
</code></pre>
<p>Q: How did we get past the variadic macro problem on a Mac?</p>
<p>A: Don&rsquo;t use -pedantic-errors in the Makefile.</p>
<h2>Author&rsquo;s comments:</h2>
<h1>Conway&rsquo;s Game of DEATH</h1>
<p>This is a challenging, fast-paced arcade game, based on the famous Game of
Life.</p>
<h2>Story</h2>
<p>In the game, you are Mr.C, a lightweight spaceship making a futile dash for
escape from the rigid rules and predictability of life in the B3/S23 universe.</p>
<p>Use the up and down arrow keys to steer: collisions are fatal for Mr.C! Learn
to spot incoming gliders, skim the surfaces of beehives and blocks, and give
blinkers plenty of space. Things get crazier as Mr.C picks up speed&hellip; can he
escape?</p>
<p>No. There is no winning. Sadly for Mr.C, this universe goes on forever. Just
see how far you can make it!</p>
<p>Press &lsquo;q&rsquo; any time to quit.</p>
<h2>Features</h2>
<ul>
<li>casual gameplay</li>
<li>infinite, procedurally generated universe</li>
<li>progressive difficulty</li>
<li>animated splash screens</li>
</ul>
<h2>Limitations</h2>
<ul>
<li>Flicker, especially at high speeds, and in spite of &ldquo;double-buffering&rdquo; (X11
doesn&rsquo;t make it possible to lock drawing to the display refresh rate.)</li>
<li>Cannot be run outside of the directory containing the data files (splash.d,
dead.d and sprites.d).</li>
<li>Cannot build or run without X11 (or an X11 compatibility layer).</li>
</ul>
<h2>Wish List</h2>
<ul>
<li>Score keeping</li>
<li>Color</li>
<li>In-game instructions</li>
<li>Sound</li>
</ul>
<h2>Hosts Tested</h2>
<ul>
<li>Darwin 10.8.0 i386 (clang 1.6 and gcc 4.2.1)</li>
<li>Linux 2.6.32 i686 (clang 1.1 and gcc 4.4.3)</li>
<li>Linux 3.2.0 x86_64 (clang 3.0 and gcc 4.6.3)</li>
</ul>
<h2>Obfuscations</h2>
<p>The code is formatted into a 14-cell shape which will evolve into a glider in
19 generations.</p>
<p>Lots of globals, including a global struct whose members have the same names
as global variables.</p>
<p>Global variables getting reused in different contexts.</p>
<p>Huge and convoluted expressions, abusing ternary operators and operator
precedence.</p>
<p>Lots of magic numbers, abuse of the relationships between magic numbers, and
abuse of the arithmetic properties of magic numbers.</p>
<hr />
<!--
(c) Copyright 1984-2015, [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>&copy; 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>&nbsp;<!--<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>
+111
View File
@@ -0,0 +1,111 @@
# Best way to lose a life
J. David Lowe
434 Tenney Drive
Rogue River, OR
97537
<j.david.lowe@gmail.com>
<http://www.pootpoot.net/>
## Judges' comments:
### To build:
make dlowe
### To run:
./dlowe
### Try:
./dlowe
# Watch for a while if you like, then press a key within the window
# Use up and down keys to escape death
### Selected Judges Remarks:
The judges lose playing this game. This entry wins!
OS X users running Mountain Lion and later will need to download and install:
http://xquartz.macosforge.org/landing/
Q: How did we get past the variadic macro problem on a Mac?
A: Don't use -pedantic-errors in the Makefile.
## Author's comments:
# Conway's Game of DEATH
This is a challenging, fast-paced arcade game, based on the famous Game of
Life.
## Story
In the game, you are Mr.C, a lightweight spaceship making a futile dash for
escape from the rigid rules and predictability of life in the B3/S23 universe.
Use the up and down arrow keys to steer: collisions are fatal for Mr.C! Learn
to spot incoming gliders, skim the surfaces of beehives and blocks, and give
blinkers plenty of space. Things get crazier as Mr.C picks up speed... can he
escape?
No. There is no winning. Sadly for Mr.C, this universe goes on forever. Just
see how far you can make it!
Press 'q' any time to quit.
## Features
* casual gameplay
* infinite, procedurally generated universe
* progressive difficulty
* animated splash screens
## Limitations
* Flicker, especially at high speeds, and in spite of "double-buffering" (X11
doesn't make it possible to lock drawing to the display refresh rate.)
* Cannot be run outside of the directory containing the data files (splash.d,
dead.d and sprites.d).
* Cannot build or run without X11 (or an X11 compatibility layer).
## Wish List
* Score keeping
* Color
* In-game instructions
* Sound
## Hosts Tested
* Darwin 10.8.0 i386 (clang 1.6 and gcc 4.2.1)
* Linux 2.6.32 i686 (clang 1.1 and gcc 4.4.3)
* Linux 3.2.0 x86\_64 (clang 3.0 and gcc 4.6.3)
## Obfuscations
The code is formatted into a 14-cell shape which will evolve into a glider in
19 generations.
Lots of globals, including a global struct whose members have the same names
as global variables.
Global variables getting reused in different contexts.
Huge and convoluted expressions, abusing ternary operators and operator
precedence.
Lots of magic numbers, abuse of the relationships between magic numbers, and
abuse of the arithmetic properties of magic numbers.
--------------------------------------------------------------------------------
<!--
(c) Copyright 1984-2015, [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/
-->
Binary file not shown.
Binary file not shown.
+222
View File
@@ -0,0 +1,222 @@
#!/usr/bin/env make
#
# 2012 makefile
#
# This work by Landon Curt Noll, Simon Cooper, and Leonid A. Broukhis
# is licensed under:
#
# 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
# Set X11_LIBDIR to the directory where the X11 library resides
#
X11_LIBDIR= /usr/X11R6/lib
# Set X11_INCLUDEDIR to the directory where the X11 include files reside
#
X11_INCDIR= /usr/X11R6/include
# Compiler warnings
#
#CWARN=
#CWARN= -Wall -W
CWARN= -Wall -W -pedantic
# compiler standard
#
#CSTD=
#CSTD= -ansi
CSTD= -std=c99
# compiler bit architecture
#
# Some entries require 32-bitness:
# ARCH= -m32
#
# Some entries require 64-bitess:
# ARCH= -m64
#
# By default we assume nothing:
#
ARCH=
# 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=
#OPT= -O
#OPT= -O1
OPT= -O2
#OPT= -O3
# Libraries needed to build
#
LIBS= -lm
# default flags for ANSI C compilation
#
CFLAGS= ${CWARN} ${CSTD} ${ARCH} ${OPT}
# ANSI compiler
#
# Set CC to the name of your ANSI compiler.
#
# Some entries seem to need gcc. If you have gcc, set
# both CC and MAY_NEED_GCC to gcc.
#
# If you do not have gcc, set CC to the name of your ANSI compiler, and
# set MAY_NEED_GCC to either ${CC} (and hope for the best) or to just :
# to disable such programs.
#
CC= cc
#CC=clang
MAY_NEED_GCC= gcc
##############################
# Special flags for this entry
##############################
#
ENTRY= endoh1
DATA= column.txt column2.txt column3.txt corners.txt dripping-pan.txt \
evaporation.txt flat.txt fountain.txt funnel.txt funnel2.txt \
funnel3.txt leidenfrost.txt logo.txt pour-out.txt tanada.txt
ALT_OBJ= endoh1_color.o
ALT_ENTRY= endoh1_color
# The factor of gravity
#
G=1
# The factor of pressure
#
P=4
# The factor of viscosity
#
V=8
#################
# build the entry
#################
#
all: ${ENTRY} ${DATA}
@${TRUE}
${ENTRY}: ${ENTRY}.c
${CC} ${CFLAGS} -DG=$G -DP=$P -DV=$P $< -o $@ ${LIBS}
# alternative executable
#
alt: ${ALT_ENTRY}
@${TRUE}
endoh1_deobfuscate: endoh1_deobfuscate.c
${CC} ${CFLAGS} -DG=$G -DP=$P -DV=$P $< -o $@ ${LIBS}
endoh1_color: endoh1_color.c
${CC} ${CFLAGS} -DG=$G -DP=$P -DV=$P $< -o $@ ${LIBS}
# data files
#
data: ${DATA}
@${TRUE}
###############
# utility rules
###############
#
everything: all alt
clean:
${RM} -f ${ENTRY}.o ${ALT_OBJ}
clobber: clean
${RM} -f ${ENTRY} ${ALT_ENTRY}
nuke: clobber
@${TRUE}
dist_clean: nuke
@${TRUE}
install:
@echo "Surely you're joking Mr. Feynman!"
@${TRUE}
# backwards compatibility
#
build: all
@${TRUE}
##################
# 133t hacker rulz
##################
#
love:
@echo 'not war?'
@${TRUE}
haste:
$(MAKE) waste
@${TRUE}
waste:
@echo 'waste'
@${TRUE}
easter_egg:
@echo you expected to mis-understand this $${RANDOM} magic
@echo chongo '<was here>' "/\\oo/\\"
@echo Readers shall be disallowed from not being unable to partly misunderstand this partocular final echo.
# Understand the history of "I Am the Walrus" and
# and in particular John Lennon's remarks on that
# song and you might be confused about these next
# rules in a different way. :-)
#
supernova: nuke
@-if [ -r .code_anal ]; then \
${RM} -f .code_anal_v3; \
else \
echo "You are not expected to understand this"; \
fi
@${TRUE}
deep_magic:
@-if [ -r .code_anal ]; then \
ccode_analysis --deep_magic 1c2c85c7a02c55d1add91967eca491d53c101dc1 --FNV1a_hash 256-bit "${ENTRY}"; \
else \
echo "Understand different"; \
fi
@${TRUE}
magic: deep_magic
@-if [ -r .code_anal ]; then \
ccode_analysis --mode 21701 --level 23209 --FNV1a_hash 256-bit "${ENTRY}"; \
else \
echo "These aren't the droids you're looking for Mr. Spock!"; \
fi
@${TRUE}
+22
View File
@@ -0,0 +1,22 @@
# the factor of gravity
G=1
# the factor of pressure
P=4
# the factor of viscosity
V=8
RM= rm
TRUE= true
CWARN= -Wall -W -Wextra -pedantic
CSTD= -std=c99 -D_BSD_SOURCE
CFLAGS= ${CWARN} ${CSTD} ${ARCH} ${OPT}
CC= gcc
ENTRY= prog
all: ${ENTRY}
@${TRUE}
${ENTRY}: ${ENTRY}.c
${CC} ${CFLAGS} -DG=$G -DP=$P -DV=$P ${ENTRY}.c -o $@ -lm
clean:
$(RM) -f ${ENTRY}
+24
View File
@@ -0,0 +1,24 @@
########################
##xxxxxxxxxxxxxxxxxxxx##
##xxxxxxxxxxxxxxxxxxxx##
##xxxxxxxxxxxxxxxxxxxx##
##xxxxxxxxxxxxxxxxxxxx##
##xxxxxxxxxxxxxxxxxxxx##
###xxxxxxxxxxxxxxxxxx###
###xxxxxxxxxxxxxxxx###
###xxxxxxxxxxxx###
### ###
### ###
### ###
### ###
### ###
### ###
### ###
### ###
## ##
## ##
## ##
## ##
## ##
########################
+23
View File
@@ -0,0 +1,23 @@
### ............... ###
### ................. ###
### ................. ###
### ................. ###
### ................. ###
### ................. ###
### ................. ###
### ................. ###
### ................. ###
### ................. ###
### ................. ###
### ................. ###
### ................. ###
### ................. ###
### ................. ###
### ............... ###
##########################################################################
########################################################################
+22
View File
@@ -0,0 +1,22 @@
### .......... ###
### ........... ###
### ........... ###
### ........... ###
### ........... ###
### ........... ###
### ...........
### ...........
### ...........
### ........... ###
### ........... ###
### ........... ###
### ........... ###
### ........... ###
### ........... # ###
### .......... ### ###
##############################################################################
############################################################################
+22
View File
@@ -0,0 +1,22 @@
### .......... ###
### .................................................................###
### ........... ###
### ........... ###
### ........... ###
### ........... ###
### ...........
### ...........
### ...........
### ........... ###
### ........... ###
### ........... ###
### ........... ###
### ........... ###
### ........... # ###
### .......... ### ###
##############################################################################
############################################################################
+23
View File
@@ -0,0 +1,23 @@
# #
# #
# #
#@ @#
###############################################################################
+23
View File
@@ -0,0 +1,23 @@
# #
# #
# @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ #
#@ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @#
##################################### #######################################
+23
View File
@@ -0,0 +1,23 @@
# include<stdio.h>// .IOCCC Fluid- #
# include <unistd.h> //2012 _Sim!_ #
# include<complex.h> //|||| ,____. IOCCC- #
# define h for( x=011; 2012/* #
# */-1>x ++;)b[ x]//-' winner #
# define f(p,e) for(/* #
# */p=a; e,p<r; p+=5)// #
# define z(e,i) f(p,p/* #
## */[i]=e)f(q,w=cabs (d=*p- *q)/2- 1)if(0 <(x=1- w))p[i]+=w*/// ##
double complex a [ 97687] ,*p,*q ,*r=a, w=0,d; int x,y;char b/* ##
## */[6856]="\x1b[2J" "\x1b" "[1;1H ", *o= b, *t; int main (){/** ##
## */for( ;0<(x= getc ( stdin) );)w=x >10?32< x?4[/* ##
## */*r++ =w,r]= w+1,*r =r[5]= x==35, r+=9:0 ,w-I/* ##
## */:(x= w+2);; for(;; puts(o ),o=b+ 4){z(p [1]*/* ##
## */9,2) w;z(G, 3)(d*( 3-p[2] -q[2]) *P+p[4 ]*V-/* ##
## */q[4] *V)/p[ 2];h=0 ;f(p,( t=b+10 +(x=*p *I)+/* ##
## */80*( y=*p/2 ),*p+=p [4]+=p [3]/10 *!p[1]) )x=0/* ##
## */ <=x &&x<79 &&0<=y&&y<23?1[1 [*t|=8 ,t]|=4,t+=80]=1/* ##
## */, *t |=2:0; h=" '`-.|//,\\" "|\\_" "\\/\x23\n"[x/** ##
## */%80- 9?x[b] :16];;usleep( 12321) ;}return 0;}/* ##
#### ####
###############################################################################
**###########################################################################*/
+30
View File
@@ -0,0 +1,30 @@
# include<stdio.h>// .IOCCC Fluid- #
# include <unistd.h> //2012 _Sim!_ #
# include<complex.h> //|||| ,____. |||||| #
# define c y+=( x=ctanh( -cabs/* #
# */(4[t ]-=20) /2+9)* 3+3)*// #
# define f(p,e) for(p/* #
# */=a;e ,p<r;p +=5)/// #
# define z(e,i) f(p,p/* #
## */[i]=e)f(q,w=cabs (d=*p- *q)/2- 1)if(0 <(x=1- w))p[i]+=w*/// ##
double complex a [ 97687] ,*p,*q ,*r=a, w=0,d; char b[97687]=/* ##
## */"GO\x1b[2J\x1b[" "1;1H" ,*o=b, *t;int x,y,j; void h(int e){/** ##
## */for( t=b;b+ 24045> (t+=12 );c 6, sprintf (t,/** ##
## */"%c" "[48%" "c5;%" "03dm" "%c",3 *9,e,c 36,e/* ##
## */?(t- b)%960 ?(15-t [11])[ "\x23" "/\\_" "\\"/* ##
## */"||" ",//|" ".-`' "]:10: 0)) y= 0020,c 01;}/* ##
## */void g( int i){7[t +=i]|= x/=2;* t+=y=p [2];/* ##
## */}int main() {for(;( x=getc (stdin ))>0;)w =10</* ##
## */x?32 <x?4[* r++=w,r]=w+1,*r= r[5]=x ==35,r+=9:0,w-I/* ##
## */:(x= w+02); for(;;puts(o),o =b+6){ z(p[1]*9,2)w;z/* ##
## */(G,3 )(d*(3 -p[2]-q[2])*P +p[4]* V-q[4]*V )/p/* ##
#### ####
###############################################################################
**###########################################################################*/
[2];h(0 );f(p,* p+= p[4]+=p [3]/10*!p
[1] )(t =b+ 16+ (x= *p* I)* 12+ 960
*(y =*p /2) ,x= 0<= x&& 79> x&&
0<= y&& 23> y?x =16 ,g( 0),g(12),
g(+ 948 ),g (12 ),0 :0) ;h( 59) ;;;
usleep( 12321); }return 0;} /*IOCCC '12 **/
+31
View File
@@ -0,0 +1,31 @@
#include <stdio.h>// .IOCCC Fluid- #
#include <unistd.h> //2012 _Sim!_ #
#include <complex.h> //|||| ,____. IOCCC- #
double complex a[97687], *p, *q, *r = a, w = 0, d;
int x , y;
char b [6856] = "\x1b[2J" "\x1b" "[1;1H ", *o = b, *t;
int
main()
{
for (; 0 < (x = getc(stdin));)
w = x > 10 ? 32 < x ? 4[*r++ = w, r] = w + 1, *r = r[5] = x == 35, r += 9 : 0, w - I : (x = w + 2);;
for (;; puts(o), o = b + 4) {
for (p = a; p[2] = p[1] * 9, p < r; p += 5)
for (q = a; w = cabs(d = *p - *q) / 2 - 1, q < r; q += 5)
if (0 < (x = 1 - w))
p[2] += w * w;
for (p = a; p[3] = G, p < r; p += 5)
for (q = a; w = cabs(d = *p - *q) / 2 - 1, q < r; q += 5)
if (0 < (x = 1 - w))
p[3] += w * (d * (3 - p[2] - q[2]) * P + p[4] * V - q[4] * V) / p[2];
for (x = 011; 2012 - 1 > x++;)
b[x] = 0;
for (p = a; (t = b + 10 + (x = *p * I) + 80 * (y = *p / 2), *p += p[4] += p[3] / 10 * !p[1]), p < r; p += 5)
x = 0 <= x && x < 79 && 0 <= y && y < 23 ? 1[1[*t |= 8, t] |= 4, t += 80] = 1, *t |= 2 : 0;
for (x = 011; 2012 - 1 > x++;)
b[x] = " '`-.|//,\\" "|\\_" "\\/\x23\n"[x % 80 - 9 ? x[b] : 16];;
usleep(12321);
} return 0;
}
+23
View File
@@ -0,0 +1,23 @@
@
# #
# #
# #
# #
###############################################################################
+23
View File
@@ -0,0 +1,23 @@
# #
# #
# #
#@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@#
###############################################################################
+23
View File
@@ -0,0 +1,23 @@
x
x
x
x
x
x
x
x
x
x
x
x
x
x
x
x
x
x
### x ###
### x ###
### x ###
#############
+23
View File
@@ -0,0 +1,23 @@
# #
#xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx#
#xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx#
#xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx#
#xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx#
#xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx#
#xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx#
#xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx#
#xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx#
#xxxxxxxxxxxxxxxxxxxxxxxxxxxx#
#xxxxxxxxxxxxxxxxxxxxxxxxxx#
#xxxxxxxxxxxxxxxxxxxxxxxx#
#xxxxxxxxxxxxxxxxxxxxxx#
#xxxxxxxxxxxxxxxxxxxx#
#xxxxxxxxxxxxxxxxxx#
#xxxxxxxxxxxxxxxx#
#xxxxxxxxxxxxxx#
#xxxxxxxxxxxx#
#xxxxxxxxxx#
#xxxxxxxx#
#xxxxxx#
#xxxx#
####
+23
View File
@@ -0,0 +1,23 @@
## ##
##xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx##
##xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx##
##xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx##
##xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx##
##xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx##
##xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx##
##xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx##
##xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx##
##xxxxxxxxxxxxxxxxxxxxxxxxxxxx##
##xxxxxxxxxxxxxxxxxxxxxxxxxx##
##xxxxxxxxxxxxxxxxxxxxxxxx##
##xxxxxxxxxxxxxxxxxxxxxx##
##xxxxxxxxxxxxxxxxxxxx##
##xxxxxxxxxxxxxxxxxx##
##xxxxxxxxxxxxxxxx##
##xxxxxxxxxxxxxx##
##xxxxxxxxxxxx##
##xxxxxxxxxx##
##xxxxxxxx##
##xxxxxx##
##xxxx##
######
+24
View File
@@ -0,0 +1,24 @@
### ###
###xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx###
###xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx###
###xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx###
###xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx###
###xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx###
###xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx###
###xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx###
###xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx###
###xxxxxxxxxxxxxxxxxxxxxxxxxxxx###
###xxxxxxxxxxxxxxxxxxxxxxxxxx###
###xxxxxxxxxxxxxxxxxxxxxxxx###
###xxxxxxxxxxxxxxxxxxxxxx###
###xxxxxxxxxxxxxxxxxxxx###
###xxxxxxxxxxxxxxxxxx###
###xxxxxxxxxxxxxxxx###
###xxxxxxxxxxxxxx###
###xxxxxxxxxxxx###
###xxxxxxxxxx###
###xxxxxxxx###
###xxxxxx###
###xxxx###
########
########
+22
View File
@@ -0,0 +1,22 @@
###.......................###
###.......................###
###.......................###
###.......................###
###.......................###
###.......................###
###.......................###
###.......................###
### ###
### ###
### ###
### ###
### ###
### ###
### ###
### ###
### ###
#############################
#############################
+211
View File
@@ -0,0 +1,211 @@
<!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 complex ASCII fluid - Honorable mention</title>
</head>
<body>
<h1>Most complex ASCII fluid - Honorable mention</h1>
<p>Yusuke Endoh<br>
<a href="&#109;&#97;&#105;&#108;&#116;&#x6f;&#x3a;&#x6d;&#x61;&#x6d;&#x65;&#64;&#114;&#x75;&#x62;&#121;&#45;&#108;&#97;&#110;&#103;&#46;&#x6f;&#114;&#103;">&#109;&#x61;&#109;&#x65;&#64;&#114;&#x75;&#x62;&#121;&#x2d;&#x6c;&#97;&#110;&#103;&#x2e;&#x6f;&#x72;&#x67;</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 endoh1
</code></pre>
<h3>To run:</h3>
<pre><code>./endoh1 &lt; configuration.txt
</code></pre>
<h3>Try:</h3>
<pre><code>./endoh1 &lt; endoh1.c
./endoh1 &lt; pour-out.txt
./endoh1 &lt; fountain.txt
</code></pre>
<h3>Selected Judges Remarks:</h3>
<p>Let&rsquo;s play Jeopardy!</p>
<ul>
<li>A: An obfuscated program that deals with complex numbers and produces animated ASCII graphics.</li>
<li>Q: What is a Mandelbrot simulator?</li>
</ul>
<p>Bzzzt!</p>
<p>Such heavily squeezed fluid simulation (this is parsed uniquely
as fluids are not squeezable) has a few quirks that the judges were
happy to experiment with.</p>
<p>One configuration file was inspired by an <a href="http://whatif.xkcd.com/6/">XKCD what if? entry</a>.</p>
<h2>Author&rsquo;s comments:</h2>
<h3>Synopsis</h3>
<p><strong>DO NOT FORGET &ldquo;-DG=1 -DP=4 -DV=8&rdquo;</strong> and make your terminal window larger
than 80 x 25.</p>
<pre><code>gcc endoh1.c -DG=1 -DP=4 -DV=8 -D_BSD_SOURCE -o endoh1 -lm
./endoh1 &lt; endoh1.c
./endoh1 &lt; logo.txt
./endoh1 &lt; column.txt
./endoh1 &lt; pour-out.txt
./endoh1 &lt; tanada.txt
</code></pre>
<h3>What it is</h3>
<pre><code>,___. ,. ,. ,. ,___. ,. ,. ,.
|/--' || `' || |/--' `' || |\_.
|\__. || ,. ,. ,. ,__/| |\__. ,. ,____. ,. ,. || ,_. |/-' ,_. ,__.
|/--' || || || || |/-\| `--\| || |/\/\| || || || ,/-\. || ,/-\. |/-\.
|| || `\_/| || |\_/| ,__/| || |||||| `\_/| || `\_/\.`\_. `\_/' || `'
`' `' `--' `' `---' `---' `' `'`'`' `--' `' `-'`' `-' `-' `'
,.,. ,.,.
,/\/\. ,. ,. ,. ,/\/\. ,. ,. ,__.
|||#/' || `' ,_.|| |||#/' `',_.,__. || ||\\. ,.
|||#\. || ,. ,. ,.,/#||| |\//\. ,.|#||##| ,. ,. || ,.,. |\/-' ,.,. ,.|\.
|\/--' ||,/\.|| |||#/\/| `\#||| |||#||/\|,/\.|| ||,/'`\.|#| ,/'`\.|\/-\.
`\| ||`\#||| |||#||\| ,//\/| ||`\|||||`\#||| ||`\.,/\/\|,.`\.,/'`\| `'
`' `' `-'`' `'`-'`-' `-'`-' `' `'`'`' `-'`' `' `'`--'`'`' `'`' `'
,_.,_. ,. ,. ,. ,_.,_. ,. ,. ,.
|#||#| || `' || |#||#| `' || ||,_.
||\/#| ||,. ,. ,.,_.,/| |\||#| ,.,_.,__.,. ,. || ,.,. |||#| ,.,. ,.,_.
|||##| |||| || |||#||#| |#||#| |||#||##||| || ||,/||\.||`-',/||\.|||#\.
||`--' ||`\_.|| |||\||#| |#||#| ||||'||\|`\_.|| ||`\||#|`\.,.`\||/'||`--'
`' `' |#||| `'|#||#| |#||#| `'`' `'`' |#||| `' |||/' |||| |||| `'
`-'`' `-'`-' `-'`-' `-'`' `'`' `'`' `'`'
</code></pre>
<p>This program is a fluid simulator using &ldquo;Smoothed-particle hydrodynamics (SPH)&rdquo;
method.</p>
<p><a href="http://en.wikipedia.org/wiki/Smoothed-particle_hydrodynamics">http://en.wikipedia.org/wiki/Smoothed-particle_hydrodynamics</a></p>
<p>The SPH particles represent the fluid flow. Particles have information about
the position, density, and velocity. In every simulation step, they are
changed by pressure force, viscosity force, and external force (i.e., gravity).</p>
<p>This program reads a text from standard input, and uses it as an initial
configuration of the particles. The character <code>#</code> represents &ldquo;wall particle&rdquo; (a
particle with fixed position), and any other non-space characters represent
free particles.</p>
<p>The compilation options <code>-DG=1 -DP=4 -DV=8</code> represent, respectively, the factor
of gravity, pressure, and viscosity. By changing their values, you can see
different fluid behavior.</p>
<p>&ldquo;Marching square&rdquo;-like algorithm is used to render the particles.</p>
<p><a href="http://en.wikipedia.org/wiki/Marching_squares">http://en.wikipedia.org/wiki/Marching_squares</a></p>
<h3>Portability</h3>
<p>The program requires a C99 compiler; it uses <code>complex</code> types and one-line
comments. It also uses <code>usleep</code>, which may require <code>-D_BSD_SOURCE</code> or somewhat
to build with no warning. Under these conditions, it should be portable.
At least, recent compilers with <code>-std=c99 -Wall -W -Wextra -pedantic</code> says
nothing.</p>
<pre><code>gcc -DG=1 -DP=4 -DV=8 -D_BSD_SOURCE -std=c99 -Wall -W -Wextra -pedantic endoh1.c
clang -DG=1 -DP=4 -DV=8 -D_BSD_SOURCE -std=c99 -Wall -W -Wextra -pedantic endoh1.c
</code></pre>
<p>I expect it to work in any Unix-like environment. VTxxx/ANSI sequences are
used to clear screen and move cursor to home.</p>
<p>I&rsquo;ve tested with gcc-4.6.3 and clang-3.0 on Linux (Ubuntu 12.04)
and gcc-4.5.3 and clang-3.1 on Cygwin. On Cygwin, gcc and clang complain about
a usage of <code>I</code> (complex&rsquo;s imaginary unit), but I bet this is cygwin&rsquo;s issue;
it is surely a C99 feature.</p>
<h3>Obfuscation w/ Spoiler</h3>
<p>First of all, the source code itself serves as an initial configuration.
Preprocessing directives (such as <code>#include</code>)&rsquo;s <code>#</code> serve as walls.</p>
<p>This program uses <code>double complex</code> to represent any 2D vector. But, note that
x-axis and y-axis is swapped (real axis = y-axis, imaginary axis = x-axis).
The purpose of swapping is not only obfuscation, but also short coding: for
example, to add gravity to total force, <code>force += G</code> suffices, rather than
<code>force += G*I</code>.
(Incidentally, you can exert horizontal gravity by using, such as, <code>-DG=I</code>)</p>
<p>Every five entries of <code>double complex a[]</code> contain information of one particle:
position, wall-flag, density, force, and velocity, in turn.</p>
<p>You can use <code>G</code>, <code>P</code>, and <code>V</code> as a guide to find the calculation code of
gravity, pressure, and viscosity forces.</p>
<p>Though some assignments may look meaningless, it is actually meaningful; it
extracts &ldquo;integer part of real part&rdquo; from a complex value by assigning (and
casting) it to an integer-type variable.</p>
<h3>Notes about Additional Files</h3>
<p>&ldquo;logo.txt&rdquo; is a source of the logo in this remark file.</p>
<p>&ldquo;column.txt&rdquo; is a water column collapse, which is a popular demo of SPH.</p>
<p>&ldquo;pour-out.txt&rdquo; pours you a cup of tea.</p>
<p>&ldquo;tanada.txt&rdquo; simulates &ldquo;Terrace farming&rdquo;. (&ldquo;Tanada&rdquo; means a &ldquo;terraced rice
fields&rdquo; in Japanese.)</p>
<p>&ldquo;clock.txt&rdquo; is a &ldquo;water&rdquo; clock created by HAMANO Tsukasa.</p>
<p>Other *.txt files are due to the judges.</p>
<p>&ldquo;endoh1_color.c&rdquo; is a variant that shows the density by using terminal 256
colors.</p>
<h3>Acknowledgment</h3>
<p>I would like to thank my wife @hirekoke for her teaching me the SPH method.</p>
<p>The judges <strike>ordered</strike> suggested creating a color version
after the judgment.</p>
<p>The judges and HAMANO Tsukasa (The silver medalist at this IOCCC) kindly
provided many configuration files.</p>
<hr />
<!--
(c) Copyright 1984-2015, [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>&copy; 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>&nbsp;<!--<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>
+185
View File
@@ -0,0 +1,185 @@
# Most complex ASCII fluid - Honorable mention
Yusuke Endoh
<mame@ruby-lang.org>
<https://github.com/mame/>
## Judges' comments:
### To build:
make endoh1
### To run:
./endoh1 < configuration.txt
### Try:
./endoh1 < endoh1.c
./endoh1 < pour-out.txt
./endoh1 < fountain.txt
### Selected Judges Remarks:
Let's play Jeopardy!
* A: An obfuscated program that deals with complex numbers and produces animated ASCII graphics.
* Q: What is a Mandelbrot simulator?
Bzzzt!
Such heavily squeezed fluid simulation (this is parsed uniquely
as fluids are not squeezable) has a few quirks that the judges were
happy to experiment with.
One configuration file was inspired by an [XKCD what if? entry](http://whatif.xkcd.com/6/).
## Author's comments:
### Synopsis
**DO NOT FORGET "-DG=1 -DP=4 -DV=8"** and make your terminal window larger
than 80 x 25.
gcc endoh1.c -DG=1 -DP=4 -DV=8 -D_BSD_SOURCE -o endoh1 -lm
./endoh1 < endoh1.c
./endoh1 < logo.txt
./endoh1 < column.txt
./endoh1 < pour-out.txt
./endoh1 < tanada.txt
### What it is
,___. ,. ,. ,. ,___. ,. ,. ,.
|/--' || `' || |/--' `' || |\_.
|\__. || ,. ,. ,. ,__/| |\__. ,. ,____. ,. ,. || ,_. |/-' ,_. ,__.
|/--' || || || || |/-\| `--\| || |/\/\| || || || ,/-\. || ,/-\. |/-\.
|| || `\_/| || |\_/| ,__/| || |||||| `\_/| || `\_/\.`\_. `\_/' || `'
`' `' `--' `' `---' `---' `' `'`'`' `--' `' `-'`' `-' `-' `'
,.,. ,.,.
,/\/\. ,. ,. ,. ,/\/\. ,. ,. ,__.
|||#/' || `' ,_.|| |||#/' `',_.,__. || ||\\. ,.
|||#\. || ,. ,. ,.,/#||| |\//\. ,.|#||##| ,. ,. || ,.,. |\/-' ,.,. ,.|\.
|\/--' ||,/\.|| |||#/\/| `\#||| |||#||/\|,/\.|| ||,/'`\.|#| ,/'`\.|\/-\.
`\| ||`\#||| |||#||\| ,//\/| ||`\|||||`\#||| ||`\.,/\/\|,.`\.,/'`\| `'
`' `' `-'`' `'`-'`-' `-'`-' `' `'`'`' `-'`' `' `'`--'`'`' `'`' `'
,_.,_. ,. ,. ,. ,_.,_. ,. ,. ,.
|#||#| || `' || |#||#| `' || ||,_.
||\/#| ||,. ,. ,.,_.,/| |\||#| ,.,_.,__.,. ,. || ,.,. |||#| ,.,. ,.,_.
|||##| |||| || |||#||#| |#||#| |||#||##||| || ||,/||\.||`-',/||\.|||#\.
||`--' ||`\_.|| |||\||#| |#||#| ||||'||\|`\_.|| ||`\||#|`\.,.`\||/'||`--'
`' `' |#||| `'|#||#| |#||#| `'`' `'`' |#||| `' |||/' |||| |||| `'
`-'`' `-'`-' `-'`-' `-'`' `'`' `'`' `'`'
This program is a fluid simulator using "Smoothed-particle hydrodynamics (SPH)"
method.
<http://en.wikipedia.org/wiki/Smoothed-particle_hydrodynamics>
The SPH particles represent the fluid flow. Particles have information about
the position, density, and velocity. In every simulation step, they are
changed by pressure force, viscosity force, and external force (i.e., gravity).
This program reads a text from standard input, and uses it as an initial
configuration of the particles. The character `#` represents "wall particle" (a
particle with fixed position), and any other non-space characters represent
free particles.
The compilation options `-DG=1 -DP=4 -DV=8` represent, respectively, the factor
of gravity, pressure, and viscosity. By changing their values, you can see
different fluid behavior.
"Marching square"-like algorithm is used to render the particles.
<http://en.wikipedia.org/wiki/Marching_squares>
### Portability
The program requires a C99 compiler; it uses `complex` types and one-line
comments. It also uses `usleep`, which may require `-D_BSD_SOURCE` or somewhat
to build with no warning. Under these conditions, it should be portable.
At least, recent compilers with `-std=c99 -Wall -W -Wextra -pedantic` says
nothing.
gcc -DG=1 -DP=4 -DV=8 -D_BSD_SOURCE -std=c99 -Wall -W -Wextra -pedantic endoh1.c
clang -DG=1 -DP=4 -DV=8 -D_BSD_SOURCE -std=c99 -Wall -W -Wextra -pedantic endoh1.c
I expect it to work in any Unix-like environment. VTxxx/ANSI sequences are
used to clear screen and move cursor to home.
I've tested with gcc-4.6.3 and clang-3.0 on Linux (Ubuntu 12.04)
and gcc-4.5.3 and clang-3.1 on Cygwin. On Cygwin, gcc and clang complain about
a usage of `I` (complex's imaginary unit), but I bet this is cygwin's issue;
it is surely a C99 feature.
### Obfuscation w/ Spoiler
First of all, the source code itself serves as an initial configuration.
Preprocessing directives (such as `#include`)'s `#` serve as walls.
This program uses `double complex` to represent any 2D vector. But, note that
x-axis and y-axis is swapped (real axis = y-axis, imaginary axis = x-axis).
The purpose of swapping is not only obfuscation, but also short coding: for
example, to add gravity to total force, `force += G` suffices, rather than
`force += G*I`.
(Incidentally, you can exert horizontal gravity by using, such as, `-DG=I`)
Every five entries of `double complex a[]` contain information of one particle:
position, wall-flag, density, force, and velocity, in turn.
You can use `G`, `P`, and `V` as a guide to find the calculation code of
gravity, pressure, and viscosity forces.
Though some assignments may look meaningless, it is actually meaningful; it
extracts "integer part of real part" from a complex value by assigning (and
casting) it to an integer-type variable.
### Notes about Additional Files
"logo.txt" is a source of the logo in this remark file.
"column.txt" is a water column collapse, which is a popular demo of SPH.
"pour-out.txt" pours you a cup of tea.
"tanada.txt" simulates "Terrace farming". ("Tanada" means a "terraced rice
fields" in Japanese.)
"clock.txt" is a "water" clock created by HAMANO Tsukasa.
Other \*.txt files are due to the judges.
"endoh1\_color.c" is a variant that shows the density by using terminal 256
colors.
### Acknowledgment
I would like to thank my wife @hirekoke for her teaching me the SPH method.
The judges <strike>ordered</strike> suggested creating a color version
after the judgment.
The judges and HAMANO Tsukasa (The silver medalist at this IOCCC) kindly
provided many configuration files.
--------------------------------------------------------------------------------
<!--
(c) Copyright 1984-2015, [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/
-->
+23
View File
@@ -0,0 +1,23 @@
# #
# #
# #
# @ #
###############################################################################
+19
View File
@@ -0,0 +1,19 @@
@@@@ @ @ @ @@@@ @ @ @
@ @ @ @ @ @@@
@@@@ @ @ @ @ @@@@ @@@@ @ @@@@@ @ @ @ @@ @ @@ @@@
@ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @
@ @ @@@ @ @@@@ @@@@ @ @ @ @ @@@ @ @@ @ @@ @@ @
# #
##### #####
###### ######
####### #######
######## ########
######### #########
########## ##########
## ##
+19
View File
@@ -0,0 +1,19 @@
### . . . . . . . . . . . ###
###.......................###
### . . . . . . . . . . . ###
###.......................###
### . . . . . . . . . . . ###
###.......................###
### . . . . . . . . . . . ###
###.......................###
### . . . . . . . . . . . ###
###.......................###
### . . . . . . . . . . . ###
###.......................##
### . . . . . . . . . . . ##
###....................... ###
################################# ## ##
############################### ## ##
## ##
###########
+19
View File
@@ -0,0 +1,19 @@
##
##. . . . . . . .
##..................
##. . . . . . . . . . ..
##.......................
##. . . . . . . . . . . ..
##........................##
##. . . . . . . . . . . ..##
############################ ##
## ##
############ ##
## ##
############ ##
## ##
############ ##
## ##
############
+351
View File
@@ -0,0 +1,351 @@
#!/usr/bin/env make
#
# 2012 makefile
#
# This work by Landon Curt Noll, Simon Cooper, and Leonid A. Broukhis
# is licensed under:
#
# 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
# Set X11_LIBDIR to the directory where the X11 library resides
#
X11_LIBDIR= /usr/X11R6/lib
# Set X11_INCLUDEDIR to the directory where the X11 include files reside
#
X11_INCDIR= /usr/X11R6/include
# Compiler warnings
#
#CWARN=
#CWARN= -Wall -W
CWARN= -Wall -W -pedantic
# compiler standard
#
#CSTD=
#CSTD= -ansi
CSTD= -std=c99
# compiler bit architecture
#
# Some entries require 32-bitness:
# ARCH= -m32
#
# Some entries require 64-bitess:
# ARCH= -m64
#
# By default we assume nothing:
#
ARCH=
# 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=
#OPT= -O
#OPT= -O1
OPT= -O2
#OPT= -O3
# Libraries needed to build
#
LIBS=
# default flags for ANSI C compilation
#
CFLAGS= ${CWARN} ${CSTD} ${ARCH} ${OPT} ${LIBS}
# ANSI compiler
#
# Set CC to the name of your ANSI compiler.
#
# Some entries seem to need gcc. If you have gcc, set
# both CC and MAY_NEED_GCC to gcc.
#
# If you do not have gcc, set CC to the name of your ANSI compiler, and
# set MAY_NEED_GCC to either ${CC} (and hope for the best) or to just :
# to disable such programs.
#
CC= cc
#CC=clang
MAY_NEED_GCC= gcc
##############################
# Special flags for this entry
##############################
#
ENTRY= endoh2
DATA=
ALT_C= pi.c 314.c 3141.c 31415.c 314159.c 3141592.c \
31415926.c 314159265.c 3141592653.c 31415926535.c \
e.c 271.c 2718.c 27182.c 271828.c 2718281.c \
27182818.c 271828182.c 2718281828.c 27182818284.c
ALT_ENTRY= pi 314 3141 31415 314159 \
3141592 31415926 314159265 3141592653 31415926535 \
e 271 2718 27182 271828 \
2718281 27182818 271828182 2718281828 27182818284
ALT_OBJ= pi.o 314.o 3141.o 31415.o 314159.o 3141592.o \
31415926.o 314159265.o 3141592653.o 31415926535.o \
e.o 271.o 2718.o 27182.o 271828.o 2718281.o \
27182818.o 271828182.o 2718281828.o 27182818284.o
ALT_ENTRY= pi 314 3141 31415 314159 3141592 \
31415926 314159265 3141592653 31415926535 \
e 271 2718 27182 271828 2718281 \
27182818 271828182 2718281828 27182818284
#################
# build the entry
#################
#
all: ${ENTRY} ${DATA}
@${TRUE}
${ENTRY}: ${ENTRY}.c
${CC} ${CFLAGS} $< -o $@
pi.c: ${ENTRY}
./$< > $@
pi: pi.c
${CC} ${CFLAGS} $< -o $@
314.c: pi
./$< > $@
314: 314.c
${CC} ${CFLAGS} $< -o $@
3141.c: 314
./$< > $@
3141: 3141.c
${CC} ${CFLAGS} $< -o $@
31415.c: 3141
./$< > $@
31415: 31415.c
${CC} ${CFLAGS} $< -o $@
314159.c: 31415
./$< > $@
314159: 314159.c
${CC} ${CFLAGS} $< -o $@
3141592.c: 314159
./$< > $@
3141592: 3141592.c
${CC} ${CFLAGS} $< -o $@
31415926.c: 3141592
./$< > $@
31415926: 31415926.c
${CC} ${CFLAGS} $< -o $@
314159265.c: 31415926
./$< > $@
314159265: 314159265.c
${CC} ${CFLAGS} $< -o $@
3141592653.c: 314159265
./$< > $@
3141592653: 3141592653.c
${CC} ${CFLAGS} $< -o $@
31415926535.c: 3141592653
./$< > $@
31415926535: 31415926535.c
${CC} ${CFLAGS} $< -o $@
# you get the transcendental idea ... :-)
e.c: ${ENTRY}
./$< e > $@
e: e.c
${CC} ${CFLAGS} $< -o $@
271.c: e
./$< > $@
271: 271.c
${CC} ${CFLAGS} $< -o $@
2718.c: 271
./$< > $@
2718: 2718.c
${CC} ${CFLAGS} $< -o $@
27182.c: 2718
./$< > $@
27182: 27182.c
${CC} ${CFLAGS} $< -o $@
271828.c: 27182
./$< > $@
271828: 271828.c
${CC} ${CFLAGS} $< -o $@
2718281.c: 271828
./$< > $@
2718281: 2718281.c
${CC} ${CFLAGS} $< -o $@
27182818.c: 2718281
./$< > $@
27182818: 27182818.c
${CC} ${CFLAGS} $< -o $@
271828182.c: 27182818
./$< > $@
271828182: 271828182.c
${CC} ${CFLAGS} $< -o $@
2718281828.c: 271828182
./$< > $@
2718281828: 2718281828.c
${CC} ${CFLAGS} $< -o $@
27182818284.c: 2718281828
./$< > $@
27182818284: 27182818284.c
${CC} ${CFLAGS} $< -o $@
271828182845.c: 27182818284
./$< > $@
271828182845: 271828182845.c
${CC} ${CFLAGS} $< -o $@
# etc. ... :-)
# alternative executable
#
alt: ${ALT_ENTRY}
@${TRUE}
# data files
#
data: ${DATA}
@${TRUE}
###############
# utility rules
###############
#
everything: all alt
clean:
${RM} -f ${ENTRY}.o ${ALT_OBJ}
clobber: clean
${RM} -f ${ENTRY} ${ALT_ENTRY} ${ALT_C}
nuke: clobber
@${TRUE}
dist_clean: nuke
@${TRUE}
install:
@echo "Surely you're joking Mr. Feynman!"
@${TRUE}
# backwards compatibility
#
build: all
@${TRUE}
##################
# 133t hacker rulz
##################
#
love:
@echo 'not war?'
@${TRUE}
haste:
$(MAKE) waste
@${TRUE}
waste:
@echo 'waste'
@${TRUE}
easter_egg:
@echo you expected to mis-understand this $${RANDOM} magic
@echo chongo '<was here>' "/\\oo/\\"
@echo Readers shall be disallowed from not being unable to partly misunderstand this partocular final echo.
# Understand the history of "I Am the Walrus" and
# and in particular John Lennon's remarks on that
# song and you might be confused about these next
# rules in a different way. :-)
#
supernova: nuke
@-if [ -r .code_anal ]; then \
${RM} -f .code_anal_v3; \
else \
echo "You are not expected to understand this"; \
fi
@${TRUE}
deep_magic:
@-if [ -r .code_anal ]; then \
ccode_analysis --deep_magic 1c2c85c7a02c55d1add91967eca491d53c101dc1 --FNV1a_hash 256-bit "${ENTRY}"; \
else \
echo "Understand different"; \
fi
@${TRUE}
magic: deep_magic
@-if [ -r .code_anal ]; then \
ccode_analysis --mode 21701 --level 23209 --FNV1a_hash 256-bit "${ENTRY}"; \
else \
echo "These aren't the droids you're looking for Mr. Spock!"; \
fi
@${TRUE}
+25
View File
@@ -0,0 +1,25 @@
#include<stdio.h> /******** SpigotQuine -- usage: ./spigot [pi or e] ********/
char*s="G1%%xJ{;Q7wunmuGuu%%uu#include<stdio.h>/*Spigot_Quine*/#include<stdli"
"b.h>/*_IOCCC2012_*/int*e," "i,j,k,n" ";char*q" ",*a,*d,*z,*p=%s%c;"
"int" "%cmain(){a=calloc(" "1,1e4+n*2);;for(*"
"a=\0@3,z=d=a+n+1,j=n*8-7;" "k=0,j-1" ";j-=2){" "for(a[1]+=2;--z-a;"
"*z=k%%10,k/=10)k+=j/2**z;;for(;k=k%%j*" "10+*++z,z<d;*z=k/j" ");;\0@2,z="
"d=a+n*2,*z=1,j=0;++j<n;){for(;k=k%%" "j*10+*z,a-z;*z" "--=k/j)a+"
"+;for(k=0;z-d;*a--=k%%10,k/=10)k+" "=*++z+*a\0" "@;}d+=spr"
"intf(q=d-20,p,p,34,32,n+1)+2;;;;" "for(n=n*2" "0-400;k<n"
";++k%%n?j=+puts(" "d)<0:(d++"
"[j]=47,d[j-2" "]=42),k%%"
"20<1?puts(d" "-1),a++:0"
"){for(i=-1" ";i++<32;!"
"*z?q[662]" "=0,z=q+207:" "*z+z[1]<6" "5?z+=11:*"
"z==34?p=0" ":0)d[i]=((k/2" "0-1?275*q[" "*a+10]-8*"
"q[*a+0]-8" ":128)>>(i/11+k/" "4%%5*3))&1?k" "/3*!j&&p?"
"j=34:(j=" "i+1,*z++):32;k/3*" "j--&&p?d[z--,j]=3" "4:0;}}int"
"*y,n=%d;/*..~",*f="nnLa5~z23~|22t$q(s82r&q(s82q'q(s8;q(s8;q(s8:" "r(s8:r(s8:"
"q)s89r)sLr#t+" "sLx,uJw-yGu/wnnnU",*g="nnLa<z::t$u88t(u67t*u57s,t56t,t56~v56"
"tF6tF6tF8t1p" "Nu/qOv+rS}Xxnng";int main(int m,char**v){char a[2012],b[2012
],*p=a,*r=m>1 &&*v[1]=='e'?g:f,*q=b,*t=r;;sprintf(a,"%s%s%s",s,r==g?s+281:
s+168,s+386); sprintf(b,a+22,a,34,32,24);for(sprintf(a,"%.33s/*%.28s*/%.3"
"3s/*%.28s*/%" ".33s\"%s*/",b,b+66,b+33,b+76,b+66,b+99);*r;r++){;for(m=0;m++
<(*r-34)%77;*q++=*r>111?32:*p++)(q-b)%66<1?*q++=10:0;*r-110&&*r-126&&r-t<(t-g?
62:45)?*q++=34,((q-b)%66<1?*q++=10,*q++=34:0):0;}*q=0;puts(b+1);}/*IOCCC2012*/
+95
View File
@@ -0,0 +1,95 @@
# This script finds table for 3x5 decimal fonts.
fonts = <<END
### .#. ### ### #.# ### ### ### ### ###
#.# ##. ..# ..# #.# #.. #.. #.# #.# #.#
#.# .#. ### ### ### ### ### ..# ### ###
#.# .#. #.. ..# ..# ..# #.# .#. #.# ..#
### ### ### ### ..# ### ### .#. ### ###
END
fonts = fonts.lines.map {|l| l.scan(/\S{3}/) }.transpose
fonts = fonts.join.scan(/.{15}/).map {|l| l.tr(".#", "01").reverse.to_i(2) }
def printable?(x)
35 <= x && x != 92 && x <= 126
end
# Given integers d, e, and f, finds (x, y) s.t. x*d - y*e = f, where x and y
# are both printable.
def solve_identity(d, e, f)
# First we solve Bezout's identity by using the extended gcd algorithm.
# See the wikipedia entry in detail.
g = d.gcd(e)
return if f % g != 0 # No solution
d, e, f = d / g, e / g, f / g
a, b = d, -e
x0, x1 = 1, 0
y0, y1 = 0, 1
while b != 0
q = a / b
a, b = b, a % b
x0, x1 = x1, x0 - x1 * q
y0, y1 = y1, y0 - y1 * q
end
# Now we have solution candidates.
# x = -f * x0 - e * t
# y = -f * y0 - d * t
# where t is a free parameter.
# Then, we consider another constraint: x and y is both printable.
# We must satisfy: 35 <= x <= 126
# -> ceil((35+f*x0) / e) <= -t <= floor((126+f*x0) / e)
# -> ceil((35+f*x0) / e) * d - f*y0 <= y <= floor((126+f*x0) / e) * d - f*y0
ymin = ( 35+f*x0+e+1) / e * d - f*y0
ymax = (126+f*x0 ) / e * d - f*y0
return if ymax < ymin || ymax < 33 || ymin > 126 # No solution.
((ymax + f*y0) / -d).upto((ymin + f*y0) / -d) do |t|
x = -f * x0 - e * t
y = -f * y0 - d * t
return [x, y] if printable?(x) && printable?(y) # Solution found.
end
return # No solution.
end
# Given integers f0, f1, ..., f9, by brute force, finds (u, v, d) s.t. there is
# some xi and yi:
# x0 * u - y0 * v = f0 + d
# x1 * u - y1 * v = f1 + d
# ...
# x9 * u - y9 * v = f9 + d
# where both xi and yi are printable.
def find_params(fonts)
1.upto(9) do |d|
2.times do
1.upto(999) do |u|
1.upto(999) do |v|
if fonts.all? {|f| solve_identity(u, v, f + d) }
table = fonts.map do |f|
solve_identity(u, v, f + d).reverse
end.transpose.flatten.map {|c| c.chr }.join
return u, v, d, table
end
end
end
d = -d
end
end
puts "Not found."
exit
end
puts "Searching..."
u, v, d, s = find_params(fonts)
puts "Found."
puts
puts "Let s = %p." % s
puts "You can get the font data of dicimal character 'n' (0--9):"
puts " %d * s[n+10] - %d * s[n] - %d" % [u, v, d]
+174
View File
@@ -0,0 +1,174 @@
<!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>PiE in the sky award</title>
</head>
<body>
<h1>PiE in the sky award</h1>
<p>Yusuke Endoh<br>
<a href="&#109;&#97;&#105;&#108;&#116;&#x6f;&#x3a;&#x6d;&#x61;&#x6d;&#x65;&#64;&#114;&#x75;&#x62;&#121;&#45;&#108;&#97;&#110;&#103;&#46;&#x6f;&#114;&#103;">&#109;&#x61;&#109;&#x65;&#64;&#114;&#x75;&#x62;&#121;&#x2d;&#x6c;&#97;&#110;&#103;&#x2e;&#x6f;&#x72;&#x67;</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 endoh2
</code></pre>
<h3>To run:</h3>
<pre><code>./endoh2 &gt; pi.c
gcc -o pi pi.c
./pi &gt; 314.c
...
./endoh2 e &gt; e.c
gcc -o e e.c
./e &gt; 271.c
...
</code></pre>
<h3>Try:</h3>
<pre><code>make pi
make e
make everything
</code></pre>
<h3>Selected Judges Remarks:</h3>
<p>A pi/e printing quasi-quine in ASCII art with a compressed font in it;
what else to wish for in this program? Virtual machine emulation?</p>
<h2>Author&rsquo;s comments:</h2>
<p>Yeah, &ldquo;Again&rdquo;. Sorry. But I don&rsquo;t feel guilty or uncomfortable.</p>
<p>This entry is based on &lsquo;over-used themes&rsquo; such as self reproducing
program and pi or e computation. I know you&rsquo;re tired of them.</p>
<p>But have you ever seen <strong>all-in-one</strong>?</p>
<h3>What it is</h3>
<p>This program generates a new program in the shape of the Greek letter
<code>pi</code>. Then, the generated program:</p>
<ul>
<li>computes 3 digits of pi and prints it as a ASCII-art program that:</li>
<li>computes 4 digits of pi and prints it as a ASCII-art program that:</li>
<li>computes 5 digits of pi and prints it as a ASCII-art program that:</li>
<li>computes 6 digits of pi and prints it as a ASCII-art program that:</li>
<li>etc.</li>
</ul>
<p>One more thing&hellip; When you give a command line option &ldquo;e&rdquo; to the
first program, the generated one will compute Napier&rsquo;s constant
rather than pi.</p>
<h3>Obfuscation</h3>
<p>This program itself is in the shape of a spigot. This is derived
from analogy with &ldquo;spigot algorithm&rdquo; which infinitely computes the
value of a mathematical constant such as <code>pi</code> or <code>e</code>.</p>
<p><a href="http://en.wikipedia.org/wiki/Spigot_algorithm">http://en.wikipedia.org/wiki/Spigot_algorithm</a></p>
<p>The two sets of programs, 314*.c and 271*.c, are almost the same
except its shape and constant computation part. I tailored the
common part to parse in both shapes (&ldquo;3.14&hellip;&rdquo; and &ldquo;2.71&hellip;&rdquo;), by
tweaking the computation order and adding meaningless code fragment.</p>
<p>On the other hand, to make it fit inside one screen (80 x 25), my
program is shortened properly, more than it looks. (As you may
know, Quine needs to make its program size doubled.)
For example, this program involves 3x5 bitmap font data of ten
characters (&lsquo;0&rsquo; &ndash; &lsquo;9&rsquo;), as just 20 bytes: &ldquo;G1%xJ{;Q7wunmuGuu%uu&rdquo;.
We can decode character n as <code>275*s[n+10] - 8*s[n] - 8</code>. I solved the
system of Bezout&rsquo;s identities to find the magic string, with the
aid of a brute force. See <code>find-font-table.rb</code> in detail.</p>
<p><a href="http://en.wikipedia.org/wiki/B%C3%A9zout's_identity">http://en.wikipedia.org/wiki/B%C3%A9zout's_identity</a></p>
<p>I used many other tricks for short coding.</p>
<p>I&rsquo;m sorry that many ASCII-art-style winning entries of IOCCCs
ignore preprocessor directives. In my program, #include is a part
of ASCII-art with comment padded.</p>
<p>These design requirements made my program well-obfuscated
willy-nilly.</p>
<h3>Portability</h3>
<p>I expect it to work in any major environment and C compiler.
To build with no warning, it requires two C99 features: string
literal more than 509 characters and omissible return in main
function. In fact, recent compilers with &ldquo;-std=c99 -Wall -W
-Wextra -pedantic&rdquo; would say nothing.</p>
<pre><code>gcc -std=c99 -Wall -W -Wextra -pedantic spigot.c
clang -std=c99 -Wall -W -Wextra -pedantic spigot.c
</code></pre>
<p>I&rsquo;ve tested with gcc-4.6.3 and clang-3.0 on Linux (Ubuntu 12.04)
and gcc-4.5.3 and clang-3.1 on Cygwin.</p>
<h3>Synopsis</h3>
<pre><code>gcc endoh2.c -o endoh2
./endoh2 &gt; pi.c
cat pi.c
gcc pi.c -o pi ; ./pi &gt; 314.c ; cat 314.c
gcc 314.c -o 314 ; ./314 &gt; 3141.c ; cat 3141.c
gcc 3141.c -o 3141 ; ./3141 &gt; 31415.c ; cat 31415.c
gcc 31415.c -o 31415 ; ./31415 &gt; 314159.c ; cat 314159.c
gcc 314159.c -o 314159 ; ./314159 &gt; 3141592.c ; cat 3141592.c
etc...
./endoh2 e &gt; e.c
cat e.c
gcc e.c -o e ; ./e &gt; 271.c ; cat 271.c
gcc 271.c -o 271 ; ./271 &gt; 2718.c ; cat 2718.c
gcc 2718.c -o 2718 ; ./2718 &gt; 27182.c ; cat 27182.c
gcc 27182.c -o 27182 ; ./27182 &gt; 271828.c ; cat 271828.c
gcc 271828.c -o 271828 ; ./271828 &gt; 2718281.c ; cat 2718281.c
etc...
</code></pre>
<p>You can do <code>make everything</code> for the process (with no <code>cat</code>).</p>
<p>Note: The executable may return a failure (non-zero) exit status
unless -std=c99 option is given.</p>
<hr />
<!--
(c) Copyright 1984-2015, [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>&copy; 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>&nbsp;<!--<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>
+147
View File
@@ -0,0 +1,147 @@
# PiE in the sky award
Yusuke Endoh
<mame@ruby-lang.org>
<https://github.com/mame/>
## Judges' comments:
### To build:
make endoh2
### To run:
./endoh2 > pi.c
gcc -o pi pi.c
./pi > 314.c
...
./endoh2 e > e.c
gcc -o e e.c
./e > 271.c
...
### Try:
make pi
make e
make everything
### Selected Judges Remarks:
A pi/e printing quasi-quine in ASCII art with a compressed font in it;
what else to wish for in this program? Virtual machine emulation?
## Author's comments:
Yeah, "Again". Sorry. But I don't feel guilty or uncomfortable.
This entry is based on 'over-used themes' such as self reproducing
program and pi or e computation. I know you're tired of them.
But have you ever seen **all-in-one**?
### What it is
This program generates a new program in the shape of the Greek letter
`pi`. Then, the generated program:
- computes 3 digits of pi and prints it as a ASCII-art program that:
- computes 4 digits of pi and prints it as a ASCII-art program that:
- computes 5 digits of pi and prints it as a ASCII-art program that:
- computes 6 digits of pi and prints it as a ASCII-art program that:
- etc.
One more thing... When you give a command line option "e" to the
first program, the generated one will compute Napier's constant
rather than pi.
### Obfuscation
This program itself is in the shape of a spigot. This is derived
from analogy with "spigot algorithm" which infinitely computes the
value of a mathematical constant such as `pi` or `e`.
<http://en.wikipedia.org/wiki/Spigot_algorithm>
The two sets of programs, 314\*.c and 271\*.c, are almost the same
except its shape and constant computation part. I tailored the
common part to parse in both shapes ("3.14..." and "2.71..."), by
tweaking the computation order and adding meaningless code fragment.
On the other hand, to make it fit inside one screen (80 x 25), my
program is shortened properly, more than it looks. (As you may
know, Quine needs to make its program size doubled.)
For example, this program involves 3x5 bitmap font data of ten
characters ('0' -- '9'), as just 20 bytes: "G1%xJ{;Q7wunmuGuu%uu".
We can decode character n as `275*s[n+10] - 8*s[n] - 8`. I solved the
system of Bezout's identities to find the magic string, with the
aid of a brute force. See `find-font-table.rb` in detail.
<http://en.wikipedia.org/wiki/B%C3%A9zout's_identity>
I used many other tricks for short coding.
I'm sorry that many ASCII-art-style winning entries of IOCCCs
ignore preprocessor directives. In my program, #include is a part
of ASCII-art with comment padded.
These design requirements made my program well-obfuscated
willy-nilly.
### Portability
I expect it to work in any major environment and C compiler.
To build with no warning, it requires two C99 features: string
literal more than 509 characters and omissible return in main
function. In fact, recent compilers with "-std=c99 -Wall -W
-Wextra -pedantic" would say nothing.
gcc -std=c99 -Wall -W -Wextra -pedantic spigot.c
clang -std=c99 -Wall -W -Wextra -pedantic spigot.c
I've tested with gcc-4.6.3 and clang-3.0 on Linux (Ubuntu 12.04)
and gcc-4.5.3 and clang-3.1 on Cygwin.
### Synopsis
gcc endoh2.c -o endoh2
./endoh2 > pi.c
cat pi.c
gcc pi.c -o pi ; ./pi > 314.c ; cat 314.c
gcc 314.c -o 314 ; ./314 > 3141.c ; cat 3141.c
gcc 3141.c -o 3141 ; ./3141 > 31415.c ; cat 31415.c
gcc 31415.c -o 31415 ; ./31415 > 314159.c ; cat 314159.c
gcc 314159.c -o 314159 ; ./314159 > 3141592.c ; cat 3141592.c
etc...
./endoh2 e > e.c
cat e.c
gcc e.c -o e ; ./e > 271.c ; cat 271.c
gcc 271.c -o 271 ; ./271 > 2718.c ; cat 2718.c
gcc 2718.c -o 2718 ; ./2718 > 27182.c ; cat 27182.c
gcc 27182.c -o 27182 ; ./27182 > 271828.c ; cat 271828.c
gcc 271828.c -o 271828 ; ./271828 > 2718281.c ; cat 2718281.c
etc...
You can do `make everything` for the process (with no `cat`).
Note: The executable may return a failure (non-zero) exit status
unless -std=c99 option is given.
--------------------------------------------------------------------------------
<!--
(c) Copyright 1984-2015, [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/
-->
+207
View File
@@ -0,0 +1,207 @@
#!/usr/bin/env make
#
# 2012 makefile
#
# This work by Landon Curt Noll, Simon Cooper, and Leonid A. Broukhis
# is licensed under:
#
# 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
# Set X11_LIBDIR to the directory where the X11 library resides
#
X11_LIBDIR= /usr/X11R6/lib
# Set X11_INCLUDEDIR to the directory where the X11 include files reside
#
X11_INCDIR= /usr/X11R6/include
# Compiler warnings
#
#CWARN=
CWARN= -Wall -W
#CWARN= -Wall -W -pedantic
# compiler standard
#
#CSTD=
#CSTD= -ansi
CSTD= -std=c99
# compiler bit architecture
#
# Some entries require 32-bitness:
# ARCH= -m32
#
# Some entries require 64-bitess:
# ARCH= -m64
#
# By default we assume nothing:
#
ARCH=
# 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=
#OPT= -O
#OPT= -O1
OPT= -O2
#OPT= -O3
# Libraries needed to build
#
LIBS=
# default flags for ANSI C compilation
#
CFLAGS= ${CWARN} ${CSTD} ${ARCH} ${OPT} ${LIBS}
# ANSI compiler
#
# Set CC to the name of your ANSI compiler.
#
# Some entries seem to need gcc. If you have gcc, set
# both CC and MAY_NEED_GCC to gcc.
#
# If you do not have gcc, set CC to the name of your ANSI compiler, and
# set MAY_NEED_GCC to either ${CC} (and hope for the best) or to just :
# to disable such programs.
#
CC= cc
#CC=clang
MAY_NEED_GCC= gcc
##############################
# Special flags for this entry
##############################
#
ENTRY= grothe
DATA= cookie_piece1.dat cookie_piece2.dat cookie_piece3.dat \
cookie_piece4.dat cookie_recipe.txt
ALT_OBJ= grothe.orig.o
ALT_ENTRY= grothe.orig
#################
# build the entry
#################
#
all: ${ENTRY} ${DATA}
@${TRUE}
${ENTRY}: ${ENTRY}.c
${CC} ${CFLAGS} -DBC='break;case' $< -o $@
# alternative executable
#
alt: ${ALT_ENTRY}
@${TRUE}
grothe.orig: grothe.orig.c
${CC} ${CFLAGS} -DBC='break;case' $< -o $@
# data files
#
data: ${DATA}
@${TRUE}
###############
# utility rules
###############
#
everything: all alt
clean:
${RM} -f ${ENTRY}.o ${ALT_OBJ}
clobber: clean
${RM} -f ${ENTRY} ${ALT_ENTRY}
nuke: clobber
@${TRUE}
dist_clean: nuke
@${TRUE}
install:
@echo "Surely you're joking Mr. Feynman!"
@${TRUE}
# backwards compatibility
#
build: all
@${TRUE}
##################
# 133t hacker rulz
##################
#
love:
@echo 'not war?'
@${TRUE}
haste:
$(MAKE) waste
@${TRUE}
waste:
@echo 'waste'
@${TRUE}
easter_egg:
@echo you expected to mis-understand this $${RANDOM} magic
@echo chongo '<was here>' "/\\oo/\\"
@echo Readers shall be disallowed from not being unable to partly misunderstand this partocular final echo.
# Understand the history of "I Am the Walrus" and
# and in particular John Lennon's remarks on that
# song and you might be confused about these next
# rules in a different way. :-)
#
supernova: nuke
@-if [ -r .code_anal ]; then \
${RM} -f .code_anal_v3; \
else \
echo "You are not expected to understand this"; \
fi
@${TRUE}
deep_magic:
@-if [ -r .code_anal ]; then \
ccode_analysis --deep_magic 1c2c85c7a02c55d1add91967eca491d53c101dc1 --FNV1a_hash 256-bit "${ENTRY}"; \
else \
echo "Understand different"; \
fi
@${TRUE}
magic: deep_magic
@-if [ -r .code_anal ]; then \
ccode_analysis --mode 21701 --level 23209 --FNV1a_hash 256-bit "${ENTRY}"; \
else \
echo "These aren't the droids you're looking for Mr. Spock!"; \
fi
@${TRUE}
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
+33
View File
@@ -0,0 +1,33 @@
This is based on the Urban Legend about Neiman Marcus charging $25,000 for
their cookie recipe. No one knows the source, but the recipe does make good
cookies and a LOT of them. Recipe is in Public Domain.
From Steve's Recipe Database http://recipes.stevex.net/
Title: $25,000 Cookies
Yield: 112 Servings
Ingredients:
2 c Butter
1 ts Salt
2 c Sugar
2 ts Baking Powder
2 c Brown sugar
2 ts Baking Soda
4 Eggs
4 oz Chocolate Chips
2 ts Vanilla
1 8-Oz Hershey Bar, grated
4 c Flour
3 c Chopped nuts
5 c Blended Oatmeal *
*Blended Oatmeal: Measure and blend in a blender to a fine powder.
Cream butter and both sugars. Add eggs and vanilla.
Mix together with flour, oatmeal, salt, baking powder, and baking soda.
Add chips, candy and nuts.
Roll into balls and place two (2) inches apart on a cookie sheet.
Bake for six (6) minutes at 375 degrees.
Makes 112 cookies, but recipe can be halved.
+27
View File
@@ -0,0 +1,27 @@
#include<stdio.h>
#include<stdlib.h>
#include<ctype.h>
int u,z,q[0400],O[0x101],o[0401],I[257],w[258][0403],W[0x100],Z[0x103],c[0403],k
,i,j,n,l,p,m;const char*J[0416],*M[0400];FILE*K[280],*s[0x102];void f(char*n,int
a){char*e=n;while(*e!='\0'){if(tolower((int)*e)!=*e)fputc(040,stderr);fputc((*e)
-a,stderr);e+=1;}(void)fputc('\n',stderr);}int y(int a,int b);int t(int i,int j)
{int k=i&j,l=i^j,n,m=1;for(n=1;k>=n;n<<=1)if(k&n)m=y(m,1<<n|1<<(n-1));return m>1
?y(m,1<<l):1<<l;}int y(int a,int b){int n,i=0x0,j;if((n=w[a][b]))return n;for(;a
>>i;++i)for(j=0x0;b>>j;j++)if(((a>>i)&1)&&((b>>j)&1))n^=t(i,j);return w[a][b]=w[
b][a]=n;}void a(void){for(i=0;i<z;i++){n=0;if(!i[I]){for(j=0;j<u;++j)if(i[O]==q[
j])n=Z[j];}else for(j=0;j<u;j++)n^=w[Z[j]][w[I[i]][W[w[o[j]][O[i]^q[j]]]]];c[i]=
n;}}void X(int v,int u){char*y=0;v-=1;switch(v){case(0x2):y ="HckngfVqQrgpKprwv"
"Hkng"; BC(4):y="JempihXsStirMrtyxJmpi"; BC(0):y="PointValueTooLarge"; BC 0x1:y=
"EvqmjdbufJoqvuQpjou";BC(6):y="TuOtv{zLorky";BC(3):y="WrrPdq|RxwsxwSrlqwv";BC(5)
:y="GfiFwlzrjsyX~syf}"; BC(07):y="UvV|{w|{Mpslz";}if(u)exit(0); f(y,v);exit(1);}
int main(int t,const char*T[]){for(i=00;i<0x100;++i)for(j=0;j<=i;++j)if(1==y(i,j
))W[i]=j,W[j]=i;for(k=0x1;k<t;k++){p=0;for(l=0;(T[k][l]>=toupper('0'))&&(T[k][l]
<=tolower('9'));l++){p=p*10+(T[k][l]-'0');if(p>=256)X(1,0);}if(T[k][l]=='-'){for
(m=0;m<u;m++)if(q[m]==p)X(2,0);q[u]=p;J[u]=T[k]+l+1;K[u]=fopen(J[u],"r");if(!u[K
])X(3,0);u++;}else if(T[k][l]=='+'){if(z>=256)X(4,0); O[z]=p;M[z]=T[k]+l+1;s[z]=
fopen(M[z],"w");if(!s[z])X(5,0);z++;}else X(6,0);}if(!(u!=0))X(7,0);if(!(z!= 0))
X(8,0);for(i=0;i<u;i++){n=1;for(j=0;j<u; j+=1)if(j!=i)n=w[n][q[i]^q[j]];o[i]=n;}
for(i=0;i<z;i++){n=1;for(j=0;j<u;j++)n=w[n][O[i]^q[j]];I[i]=n;}while(!(0)){for(k
=0;k<u;k++){int n;n=getc(K[k]); if(n==EOF)X(42,1); Z[k]=n;}a();for(k=0;k<z;k++)(
void)putc(c[k],s[k]);}X(11,1);}
+32
View File
@@ -0,0 +1,32 @@
#include<stdio.h>
#include<stdlib.h>
#include<ctype.h>
static const int x[010][8]={{01,02,04,0x8,020,32,0x40,128,},{02,03,0x8,12,32,48,
128,192,},{04,0x8,06,11,64,128,96,176,},{0x8,12,11,13,128,192,176,208,},{020,32,
64,128,24,44,75,141,},{32,48,128,192,44,52,141,198,},{64,128,96,0260,75,141,103,
185,},{0200,192,176,208,0x8D,0306,0271,0xDE,},};static int u,z,q[0400],O[0x101],
o[0401],I[257],w[258][0403],W[0x100],Z[0x103],c[0403],k,i,j,n,l,p,m;static const
char*J[0416],*M[0400];static FILE *K[280],*s[0x102];static void f(char *n,int a)
{char *e=n;while(*e!='\0'){if(tolower((int)*e)!=*e)(void)fputc(040,stderr);fputc
((*e)-a,stderr);e+=1;}(void)fputc('\n',stderr);}static int y(int a,int b){int n=
0,i=0x0,j;for(;a>>i;++i)for(j=0x0;b>>j;j++)if(((a>>i)&1)&&((b>>j)&1))n^=x[i][j];
return n;}static void a(void){for(i=0;i<z;i++){n=0;if(!i[I]){for(j=0;j<u;++j)if(
i[O]==q[j])n=Z[j];}else for(j=0;j<u;j++)n^=w[Z[j]][w[I[i]][W[w[o[j]][O[i]^q[j]]]
]];c[i]=n;}}static void X(int v,int u){char*y;v-=_STDIO_H;switch(v){case(0x2):y=
"H""c""k""ngfVqQrgpKprwvHkng";break;case(4):y="J""e""m""p""ih""XsStirMrtyxJmpi";
break;case(EXIT_SUCCESS):y="P""o""i""ntValueTooLarge";break;case 0x1:y="E""v""q"
"m""j""d""b""u""f""J""o""q""v""u""Q""p""j""o""u";break;case(6):y="T""u""O""t""v"
"{""z""L""o""r""k""y";break;case(3):y="WrrPdq|Rx""w""sx" "wSrlqwv";break;case(5)
:y="GfiFwlzrjsyX~syf}";break;case(07):y="U""v""V""|""{""w""|""{""M""p""s""l""z";
}if(u)exit(EXIT_SUCCESS);f(y,v);exit(EXIT_FAILURE);}int main(int t,const char*T[
]){for(i=00;i<0x100;++i)for(j=0;j<=0xff;++j)w[i][j]=y(i,j);W[0]=0;for(i=1;i<256;
i+=1){for(j=1;w[i][j]!=1;j+=1);i[W]=j;}for(k=0x1;k<t;k++){p=0;for(l=0;(T[k][l]>=
toupper('0'))&&(T[k][l]<=tolower('9'));l++){p=p*10+(T[k][l]-'0');if(p>=256)X(1,0
);}if(T[k][l]=='-'){for(m=0;m<u;m++)if(q[m]==p)X(2,0);q[u]=p;J[u]=T[k]+l+1;K[u]=
fopen(J[u],"r");if(!u[K])X(3,0);u++;}else if(T[k][l]=='+'){if(z>=256)X(4,0);O[z]
=p;M[z]=T[k]+l+1;s[z]=fopen(M[z],"w");if(!s[z])X(5,0);z++;}else X(6,0);}if(!(u!=
0))X(7,0);if(!(z!=0))X(8,0);for(i=0;i<u;i++){n=1;for(j=0;j<u;j+=1)if(j!=i)n=w[n]
[q[i]^q[j]];o[i]=n;}for(i=0;i<z;i++){n=1;for(j=0;j<u;j++)n=w[n][O[i]^q[j]];I[i]=
n;}while(!(0)){for(k=0;k<u;k++){int n;n=getc(K[k]);if(n==EOF)X(42,1);Z[k]=n;}a()
;for(k=0;k<z;k++)(void)putc(c[k],s[k]);}X(11,1);}
+160
View File
@@ -0,0 +1,160 @@
<!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 conspiratorial</title>
</head>
<body>
<h1>Most conspiratorial</h1>
<p>Aaron Grothe<br>
2205 South 51st Street<br>
Omaha, NE 68106<br>
US<br>
<a href="&#109;&#97;&#105;&#108;&#116;&#x6f;&#x3a;&#x61;&#x6a;&#x67;&#x72;&#111;&#116;&#x68;&#x65;&#64;&#121;&#97;&#104;&#111;&#111;&#46;&#x63;&#111;&#109;">&#97;&#x6a;&#103;&#x72;&#111;&#116;&#x68;&#x65;&#64;&#x79;&#x61;&#104;&#111;&#111;&#x2e;&#x63;&#x6f;&#x6d;</a></p>
<p>David Madore<br>
<a href="http://www.madore.org/~david/">http://www.madore.org/~david/</a></p>
<h2>Judges' comments:</h2>
<h3>To build:</h3>
<pre><code>make grothe
</code></pre>
<h3>To run:</h3>
<pre><code># To create a shared secret shared among M people with N+1 needed to reconstruct
./grothe -secret 1-/dev/urandom 2-/dev/urandom ... N-/dev/urandom \
1+shared1 2+shared2 ... M+sharedM
# To reconstruct the original (an arbitrary combination of N+1 or
# more shared files with their proper numbers)
./grothe I-sharedI J-sharedJ K-sharedK ... +reconstructed
</code></pre>
<h3>Try:</h3>
<pre><code>./grothe -grothe.c 1+grothe.c.1 2+grothe.c.2
./grothe -cookie_recipe.txt 1-/dev/urandom 2-/dev/urandom \
1+cookie_piece1.dat 2+cookie_piece2.dat 3+cookie_piece3.dat 4+cookie_piece4.dat
./grothe 1-cookie_piece1.dat 2-cookie_piece2.dat 4-cookie_piece4.dat
+cookie_recipe_restore.txt
</code></pre>
<h3>Selected Judges Remarks:</h3>
<p>Also known as Best abuse of the judging process.</p>
<p>The IOCCC 2012 submission page didn&rsquo;t enforce the 2048 meaningful
character limit. This entry, as submitted, weighed in at 2222 chars
but was, luckily for it, extremely easy to bring down below the
limit. There were a number of strings that when concatenated allowed
the program to slide under the limit.</p>
<p>It was clear to the judges that the extra size was an entry
beautification step. Had it not, this entry would have been
rejected in round 0.</p>
<p>The judges also took some liberty obfuscating this entry a litte more.</p>
<p>How does this entry work? The only place multiplication is used is
to perform the atoi conversion.</p>
<h2>Author&rsquo;s comments:</h2>
<p><strong>Description</strong></p>
<p>This program implements a version of Shamir&rsquo;s Secret Sharing. Shamir&rsquo;s Secret
Sharing allows you to encrypt a file into N parts where it will take M parts to
recreate the original file. E.g. you can split the secret recipe for Crystal Pepsi
into 3 parts and require two of them be available to extract the original recipe.</p>
<p>Actually surprisingly useful for an IOCCC entry :-)</p>
<p><strong>Usage</strong></p>
<p>To share a secret</p>
<p>E.g.</p>
<p>file to be shared - cookie_recipe.txt
number of pieces - 2 + file to be shared
total number of pieces created by program 4
pieces needed to reassemble recipe 3 or greater</p>
<p><strong>example usage</strong></p>
<p># to share secret into 4 pieces of which at least 3 will be needed to get back the recipe</p>
<pre><code>./grothe \
-cookie_recipe.txt
1-/dev/urandom 2-/dev/urandom
1+cookie_piece1.dat 2+cookie_piece2.dat 3+cookie_piece3.dat 4+cookie_piece4.dat
</code></pre>
<p># put recipe back together using 1, 2 and 4th piece</p>
<pre><code>./grothe \
1-cookie_piece1.dat 2-cookie_piece2.dat 4-cookie_piece4.dat
+cookie_recipe_restore.txt
</code></pre>
<p><strong>Limitations</strong></p>
<ul>
<li>program is limited to 256 input and output files and will slow down dramatically when you get past 20-50 inputs and outputs</li>
</ul>
<p><strong>Obfuscations</strong></p>
<ul>
<li>nothing is done consistently throughout the program E.g i+=1, i=i+1, i++ and ++i are all used in the program. The mark of true code buggery. - &ldquo;A foolish consistency is the hobgoblin of little minds&rdquo; - Ralph Waldo Emerson</li>
<li>uses the most powerful obfuscation of all &ldquo;Math&rdquo;. &ldquo;Any sufficiently advanced cryptography is indistinguasble from magic&rdquo; - Apologies to Arthur C. Clarke</li>
<li>shadows variables by using brackets in main program to create local copies of variables that are the same as global scope variables. -Wshadow should probably be a part of -Wall in gcc</li>
<li>uses array_index[array_name] instead of array_name[array_index] in several places. Still don&rsquo;t know why C continues to allow this
( error strings are encoded with offsets that are also used to select them in the case statement. All strings are located in one function for easy localization</li>
<li>liberal use of octal numbers, hexadecimal numbers and regular decimal numbers throughout program</li>
<li>variables and function names are semi-random and upper and lower case characters are used</li>
<li>use of #defines from stdio.h, stdlib.h for values _STDIO_H and EXIT_SUCCESS used to represent 1 and 0 respectively in the program</li>
<li>arrays only need to be 256x256 most are set to greater values than they need to be so trying to figure it out can be a bit tough</li>
</ul>
<p><strong>References</strong></p>
<ul>
<li>Shamir&rsquo;s Secret Sharing - <a href="http://en.wikipedia.org/wiki/Shamir%27s_Secret_Sharing">http://en.wikipedia.org/wiki/Shamir%27s_Secret_Sharing</a></li>
<li>David Madore&rsquo;s implementation of Shamir&rsquo;s Secret Sharing - <a href="http://www.madore.org/~david/programs/programs-1.36.html">http://www.madore.org/~david/programs/programs-1.36.html</a></li>
<li>Steve&rsquo;s Recipe Database - source for the $25k Cookie Recipe - <a href="http://recipes.stevex.net/">http://recipes.stevex.net/</a></li>
</ul>
<hr />
<!--
(c) Copyright 1984-2015, [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>&copy; 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>&nbsp;<!--<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>
+123
View File
@@ -0,0 +1,123 @@
# Most conspiratorial
Aaron Grothe
2205 South 51st Street
Omaha, NE 68106
US
<ajgrothe@yahoo.com>
David Madore
<http://www.madore.org/~david/>
## Judges' comments:
### To build:
make grothe
### To run:
# To create a shared secret shared among M people with N+1 needed to reconstruct
./grothe -secret 1-/dev/urandom 2-/dev/urandom ... N-/dev/urandom \
1+shared1 2+shared2 ... M+sharedM
# To reconstruct the original (an arbitrary combination of N+1 or
# more shared files with their proper numbers)
./grothe I-sharedI J-sharedJ K-sharedK ... +reconstructed
### Try:
./grothe -grothe.c 1+grothe.c.1 2+grothe.c.2
./grothe -cookie_recipe.txt 1-/dev/urandom 2-/dev/urandom \
1+cookie_piece1.dat 2+cookie_piece2.dat 3+cookie_piece3.dat 4+cookie_piece4.dat
./grothe 1-cookie_piece1.dat 2-cookie_piece2.dat 4-cookie_piece4.dat
+cookie_recipe_restore.txt
### Selected Judges Remarks:
Also known as Best abuse of the judging process.
The IOCCC 2012 submission page didn't enforce the 2048 meaningful
character limit. This entry, as submitted, weighed in at 2222 chars
but was, luckily for it, extremely easy to bring down below the
limit. There were a number of strings that when concatenated allowed
the program to slide under the limit.
It was clear to the judges that the extra size was an entry
beautification step. Had it not, this entry would have been
rejected in round 0.
The judges also took some liberty obfuscating this entry a litte more.
How does this entry work? The only place multiplication is used is
to perform the atoi conversion.
## Author's comments:
**Description**
This program implements a version of Shamir's Secret Sharing. Shamir's Secret
Sharing allows you to encrypt a file into N parts where it will take M parts to
recreate the original file. E.g. you can split the secret recipe for Crystal Pepsi
into 3 parts and require two of them be available to extract the original recipe.
Actually surprisingly useful for an IOCCC entry :-)
**Usage**
To share a secret
E.g.
file to be shared - cookie\_recipe.txt
number of pieces - 2 + file to be shared
total number of pieces created by program 4
pieces needed to reassemble recipe 3 or greater
**example usage**
\# to share secret into 4 pieces of which at least 3 will be needed to get back the recipe
./grothe \
-cookie_recipe.txt
1-/dev/urandom 2-/dev/urandom
1+cookie_piece1.dat 2+cookie_piece2.dat 3+cookie_piece3.dat 4+cookie_piece4.dat
\# put recipe back together using 1, 2 and 4th piece
./grothe \
1-cookie_piece1.dat 2-cookie_piece2.dat 4-cookie_piece4.dat
+cookie_recipe_restore.txt
**Limitations**
* program is limited to 256 input and output files and will slow down dramatically when you get past 20-50 inputs and outputs
**Obfuscations**
* nothing is done consistently throughout the program E.g i+=1, i=i+1, i++ and ++i are all used in the program. The mark of true code buggery. - "A foolish consistency is the hobgoblin of little minds" - Ralph Waldo Emerson
* uses the most powerful obfuscation of all "Math". "Any sufficiently advanced cryptography is indistinguasble from magic" - Apologies to Arthur C. Clarke
* shadows variables by using brackets in main program to create local copies of variables that are the same as global scope variables. -Wshadow should probably be a part of -Wall in gcc
* uses array\_index[array\_name] instead of array\_name[array\_index] in several places. Still don't know why C continues to allow this
( error strings are encoded with offsets that are also used to select them in the case statement. All strings are located in one function for easy localization
* liberal use of octal numbers, hexadecimal numbers and regular decimal numbers throughout program
* variables and function names are semi-random and upper and lower case characters are used
* use of #defines from stdio.h, stdlib.h for values \_STDIO\_H and EXIT\_SUCCESS used to represent 1 and 0 respectively in the program
* arrays only need to be 256x256 most are set to greater values than they need to be so trying to figure it out can be a bit tough
**References**
* Shamir's Secret Sharing - <a href="http://en.wikipedia.org/wiki/Shamir%27s_Secret_Sharing">http://en.wikipedia.org/wiki/Shamir%27s_Secret_Sharing</a>
* David Madore's implementation of Shamir's Secret Sharing - <a href="http://www.madore.org/~david/programs/programs-1.36.html">http://www.madore.org/~david/programs/programs-1.36.html</a>
* Steve's Recipe Database - source for the $25k Cookie Recipe - <a href="http://recipes.stevex.net/">http://recipes.stevex.net/</a>
--------------------------------------------------------------------------------
<!--
(c) Copyright 1984-2015, [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/
-->
+695
View File
@@ -0,0 +1,695 @@
21st International Obfuscated C Code Contest Official Guidelines, Hints and Comments
Copyright (C) 2006-2012 Leonid A. Broukhis, Simon Cooper, Landon Curt Noll.
All Rights Reserved. Permission for personal, education or non-profit use is
granted provided this this copyright and notice are included in its entirety
and remains unaltered. All other uses must receive prior permission in
writing from the contest judges.
This guideline file is version 2012-08-15.
ABOUT THIS FILE:
This file contains guidelines intended to help people who wish to
submit entries to the International Obfuscated C Code Contest (IOCCC
for short).
This is not the IOCCC rules, though it does contain comments about
them. The guidelines should be viewed as hints and suggestions.
Entries that violate the guidelines but remain within the rules are
allowed. Even so, you are safer if you remain within the guidelines.
You should read the current IOCCC rules, prior to submitting entries.
The rules are typically sent out with these guidelines.
| We recommend that you follow the twitter handle:
|
| @IOCCC
|
| to learn about IOCCC news, important IOCCC related alerts, IOCCC
| reminders, and changes to the rules and these guidelines. While we
| try to post use news at:
|
| http://www.ioccc.org/index.html#news
|
| such postings may be delayed or obscured by slow to respond mirrors.
|
| Hint to non-twitter users. You do not have to be a twitter user
| to follow the postings of the @IOCCC handle. Simple visit the URL:
|
| https://twitter.com/ioccc
|
| and reload that page every once in a while.
| WHAT'S NEW IN 2012:
| The contest runs from 2012-Aug-15 3:14:15 UTC to 2012-Sep-14 9:26:53 UTC.
Only online submissions will be accepted this year.
See the following for details,
https://submit.ioccc.org/
| (The above URL will be active by 2012-Aug-15)
| Most of the changes in the rules and guidelines for this year have been
| marked with a "|" character on the left hand side.
HINTS AND SUGGESTIONS:
You are encouraged to examine the winners of previous contests. See
FOR MORE INFORMATION for details on how to get previous winners.
Keep in mind that rules change from year to year, so some winning entries
may not be valid entries this year. What was unique and novel one year
might be 'old' the next year.
An entry is usually examined in a number of ways. We typically apply
a number of tests to an entry:
* look at the original source
* convert ANSI tri-graphs to ASCII
* C pre-process the source ignoring '#include' lines
* C pre-process the source ignoring '#define' and '#include' lines
* run it through a C beautifier
* examine the algorithm
* compile it (with flags to enable all warnings)
* execute it
You should consider how your entry looks in each of the above tests.
You should ask yourself if your entry remains obscure after it has been
'cleaned up' by the C pre-processor and a C beautifier.
Your entry need not pass all of the above tests. In certain
cases, a test is not important. Entries that compete for the
'strangest/most creative source layout' need not do as well as
others in terms of their algorithm. On the other hand, given
two such entries, we are more inclined to pick the entry that
does something interesting when you run it.
We try to avoid limiting creativity in our rules. As such, we leave
the contest open for creative rule interpretation. As in real life
programming, interpreting a requirements document or a customer request
is important. For this reason, we often award 'worst abuse of the
rules' to an entry that illustrates this point in an ironic way.
We do realize that there are holes in the rules, and invite entries
to attempt to exploit them. We will award 'worst abuse of the rules'
and then plug the hole next year. Even so, we will attempt to use
the smallest plug needed, if not smaller. :-)
| There are 17 reasons why these guidelines are obfuscated.
Check out your program and be sure that it works. We sometimes make
the effort to debug an entry that has a slight problem, particularly
in or near the final round. On the other hand, we have seen some
of the best entries fall down because they didn't work.
We tend to look down on a prime number printer that claims that
16 is a prime number. If you do have a bug, you are better off
documenting it. Noting "this entry sometimes prints the 4th power
of a prime by mistake" would save the above entry. And sometimes,
a strange bug/feature can even help the entry! Of course, a correctly
working entry is best. Clever people will note that 16 might be prime
| under certain conditions. Wise people, when submitting something clever
| will fully explain such cleverness in their entry's remarks file.
People who are considering to just use some complex mathematical
function or state machine to spell out something such as "hello,
| world!" really really, and we do mean really, do need to be more creative.
| Ultra-obfuscated programs are, in some cases, easier to
deobfuscate than subtly-obfuscated programs. Consider using
misleading or subtle tricks layered on top of or under an
| appropriate level of obfuscation. A clean looking program with
| misleading comments and variable names might be a good start.
Programs that use VTxxx/ANSI sequences that are NOT limited to a
specific terminal brand and that can also work in a standard xterm
are considered more portable.
OUR LIKES AND DISLIKES:
Doing masses of #defines to obscure the source has become 'old'. We
tend to 'see thru' masses of #defines due to our pre-processor tests
that we apply. Simply abusing #defines or -Dfoo=bar won't go as far
as a program that is more well rounded in confusion.
Many C compilers dislike the following code, and so do we:
#define d define
#d foo <-- don't expect this to turn into #define foo
When declaring local or global variables, you should declare the type:
int this_is_ok;
this_is_not; <-- don't use such implicit type declarations
| We suggest that you compile your entry with an ISO/IEC 9899-1999
| ("ISO C99") C compiler or at least an ANSI C compiler.
| DO NOT assume that we will use gcc to compile your program.
| We will first try to compile your program using Clang.
| It is much better to not use any given obscure compiler flags if
| you can help it. We want to discourage the use of obscure compiler
| flags that would make the program less portable.
| One side effect of the above is that you cannot assume the use
| of nested functions such as:
main() {
| void do_not_do_this() { printf("blah\n"); }
| do_not_do_this();
}
| This is because such nested functions often requires one to compile with
| a flag such as -fnested-functions that is not found on some compilers.
| On 2012 July 20, the judges rescinded the encouragement of
| nested functions. Such constructions, while interesting and sometimes
| amusing, will have to wait until they required by a C standard that are
| actually implemented in commonly used C compilers. Sorry!
If your entry uses functions that have a variable number of
arguments, be careful. Systems implement va_list as a wide variety
of ways. Because of this, a number of operations using va_list are
not portable and must not be used:
* assigning a non-va_list variable to/from a va_list variable
* casting a non-va_list variable into/from a va_list variable
* passing a va_list variable to a function expecting a non-va_list arg
* passing a non-va_list variable to a function expecting a va_list arg
* performing arithmetic on va_list variables
* using va_list as a structure or union
In particular, do not treat va_list variables as if they were a char **'s.
Avoid using <varargs.h>. Use <stdarg.h> instead.
On 28 January 2007, the Judges rescinded the requirement that the
'#" in a C preprocessor directive must be the first non-whitespace character.
The exit() function returns void. On some broken systems have exit()
return int. Your entry should assume that exit() returns a void.
Small programs are best when they are short, obscure and concise.
While such programs are not as complex as other winners, they do
serve a useful purpose. They are often the only program that people
attempt to completely understand. For this reason, we look for
programs that are compact, and are instructional.
One line programs should be short one line programs, say around 80
bytes long. Getting close to 160 bytes is a bit too long in our opinion.
We tend to dislike programs that:
* are very hardware specific
* are very OS version specific
(index/strchr differences are ok, but socket/streams specific
code is likely not to be)
* dump core or have compiler warnings
(it is ok only if you warn us in the 'remark' header item)
* won't compile or run under a POSIX P1003.1/P1003.2 like systems
* depend on a utility or application not normally found on most
most POSIX P1003.1/P1003.2 like systems
* abuse the build file to get around the size limit
* obfuscate by excessive use of ANSI tri-graphs
* are longer than they need to be
* are similar to previous winners
* are identical to previous losers :-)
Unless you are cramped for space, or unless you are entering the
'best one liner' category, we suggest that you format your program
in a more creative way than simply forming excessively long lines.
| At least one judge prefers to maintain the use of the leap-second
| as part of the world's time standard.
| The "how to build" make process should not be used to try and get
| around the size limit. It is one thing to make use of a several -D's
| on the compile like to help out, but it is quite another to use many
| bytes of -D's in order to try and squeeze the source under the size limit.
You should try to restrict commands used on the build file to
POSIX-like or common Un*x-like commands. You can also compile
and use your own programs. If you do, try to build and execute
from the current directory. This restriction is not a hard and
absolute one. The intent is to ensure that the building if your
program is reasonably portable.
Don't forget that the building of your program should be done
***without human intervention***. So don't do:
| prog: prog.c
| #echo this line assumes input from standard input
cat > prog.c
| ${CC} prog.c -o prog
However, you can do something cute such as making your program
do something dumb (or cute) when build 'automatically'. However
when it is run with a human involved, do something more clever.
For example, one could use the build instructions:
| prog: prog.c
| ${CC} prog.c -DNON_HUMAN_COMPILE -o prog
@echo "See remarks section about alternate ways to compile"
and then include special notes in the program "remarks" for
alternate / human intervention based building.
We want to get away from source that is simply a compact blob of
characters. To help, we give a break to source that contains
whitespace, and in certain cases ; { or } characters. While the
number of characters excluding whitespace (tab, space, newline),
and excluding any ; { or } followed immediately by either whitespace
or end of file, must be <= 2048, the total size may be less than 4096
bytes. This means that one may use "free of charge" up to 2048
bytes of whitespace, or ; { or } followed by either whitespace
or end of file.
Please do not use things like gzip to get around the size limit.
| Be more creative.
| We really dislike entries that make blatant use of including
| large data files to get around the source code size limit.
| Did we remember to indicate that programs that blatantly use
| some complex state machine to do something simple are boring?
| We think we did. :-)
Given two versions of the same program, one that is a compact blob
of code, and the other that is formatted more like a typical C
program, we tend to favor the second version. Of course, a third
version of the same program that is formatted in an interesting
and/or obfuscated way, would definitely win over the first two!
We suggest that you avoid trying for the 'smallest self-replicating'
source. The smallest, a zero byte entry, won in 1994.
We do not like writable strings. That is, we don't want stuff like:
char *T = "So many primes, so little time!";
...
T[14] = ';';
Please don't make use of this feature, even if your system allows it.
However, initialized char arrays are OK to write over. This is OK:
char b[] = "Is this Ok";
b[9] = 'K';
X client entries should be as portable as possible. Entries that
adapt to a wide collection of environments will be favored. For
| example, don't depend on a particular type or size of display.
| Don't assume the use of a particular browser. Instead assume a
| generic browser that forms to a widely used W3C standard.
| Don't assume a particular sound sub-system or video driver is installed
| in the OS. Instead, make use of a well known and widely available open
| source program (one that actually works) to display audio/visual data.
X client entries should avoid using X related libraries and
software that is not in wide spread use.
| We don't like entries that use proprietary toolkits such as the M*tif,
| Xv*ew, or OpenL*ok toolkits, since not everyone has them. Use of an
| open source toolkit that is widely and freely available instead.
You should avoid depending on a particular window manager.
X client entries should not to depend on particular items on
.Xdefaults. If you must do so, be sure to note the required lines
in the program "remarks".
| Try to avoid entries that play silent sound segments or play the
| Happy Birthday song some people believe is copyrighted even if such
| copyrights appear to be bogus and blatant abuses of the copyright system.
While we recognize that UN*X is not a universal operating system, the
contest does have a bias towards such systems. In an effort to expand
the scope of the contest, we phrase our bias in terms of POSIX P1003.1
and P1003.2 standards. This will allow certain non-UN*X OS users to
submit entries. On the other hand, this is a guideline and not a rule.
We will not reject an entry based on some POSIX technicality.
When dealing with OS and application environments, we suggest that you
be reasonable with a nod towards vanilla UN*X-like systems. POSIX will
| evolve but not as much as the contest.
You might not be prohibited from failing to not partly misunderstand
| this particular guideline. You are not required to determine that this
| or the previous sentence is false and misleading: but it might not hurt
| to not consider to fail to try to do so.
We like programs that:
* are as concise and small as they need to be
* do something at least quasi-interesting
* are portable
* are unique or novel in their obfuscation style
* MAKE USE OF A NUMBER OF DIFFERENT TYPES OF OBFUSCATION <== HINT!!
| * make us laugh and/or throw up :-) (humor really helps!)
| Some types of programs can't excel (anti-tm) in some areas. Your
program doesn't have to excel in all areas, but doing well in several
areas really does help.
You are better off explaining what your entry does in the program
"remarks" section rather than leaving it obscure for the judges
as we might miss something and/or be too tired to notice.
| Avoid this specific individual, individual guideline, if you can.
We freely admit that interesting, creative or humorous comments in
the program "remarks" help your chances of winning. If you had to
read so many twisted entries, you too would enjoy a good laugh or two.
We think the readers of the contest winners do as well. We do read
the program "remarks" during the judging process, so it is worth your
while to write remarkable program "remarks".
We dislike C code with trailing control-M's (\r or \015) that results
in compilation failures. Some non-Un*x/non-Linux tools such as
MS Visual C and MS Visual C++ leave trailing control-M's on lines.
Users of such tools should strip off such control-M's before submitting
their entries. In some cases tools have a "Save As" option that will
prevent such trailing control-M's being added.
We dislike entries that depend on non-portable libcurses features such
as halfdelay(). One should restrict libcurses to portable features
found on BSD or Linux curses.
The rules disallow source that contains unescaped octets with values
between 128 and 255. You must use \octal or \hex escapes instead:
/* 123456789 123456789 123456789 123456 */
char *foo = "This string is 36 octets in length \263";
/* This octet requires 4 octets of source ^^^^ */
if (strlen(foo) == 36) printf("foo is 36 octets plus a final NUL\n");
| else printf("This code should not print this message\n");
It is a very good idea to, in your remarks file, tell us why you
think your entry is obfuscated. This is particularly true if
your entry is has some very subtle obfuscations that we might
| otherwise overlook. <<-- Hint!
Anyone can format their code into a dense blob. A really clever
author will try format their entry using a "normal" formatting style
such that at first glance (if you squint and don't look at the details)
the code might pass for non-obfuscated C. Deceptive comments,
and mis-leading formatting, in some cases, may be a plus. On the
other hand, a misleading code style requires more source bytes.
If you do elect to use misleading formatting and comments, we
suggest you remark on this point in your remarks where you talk
about why you think your entry is obfuscated. On the other hand,
if you are pushing up against the size limits, you may be forced
into creating a dense blob. Such are the trade offs that obfuscators face!
| We prefer code that can run on either a 64-bit or 32-bit
| processor. However, it is unwise to assume it will be an i386 or x86
| architecture.
| While programs that only run in a specific bit width are okay, if you have
| to pick a width, pick 64-bit.
| If we are feeling ornery we might choose to compile your program
| for running on an Arduino or a PDP-11. Heck, should we ever find
| an emulator of 60-bit CDC Cyber CPU running a POSIX-like OS, we
| might just try your entry on that emulator as well| :-)
| If your entry MUST run only in 32-bit mode on an Intel processor, add the
| following compiler flag:
|
| -arch i386
|
| to your "how to build" make compile line. For example:
|
| prog: prog.c
| ${CC} prog.c -arch i386 -o prog
| Be even more creative!
ABUSING THE RULES:
Legal abuse of the rules is somewhat encouraged. Legal rule abuse may
involve, but is not limited to, doing things that are technically
allowed by the rules and yet do not fit the spirit of what we intended
to be submitted.
Legal rule abuse is encouraged to help promote creativity. Rule abuse
entries, regardless of if they receive an award, result in changes to
the next year's rules and guidelines.
Legal abuse of the rules is NOT an invitation to violate the rules.
An entry that violates the rules in the opinion of the judges, WILL be
disqualified. RULE ABUSE CARRIES A CERTAIN LEVEL OF RISK! If you
have an entry that might otherwise be interesting, you might want to
submit two versions; one that does not abuse the rules and one that
does.
If you intend to abuse the rules, indicate so in the program
"remarks". You must try to justify why you consider your rule abuse
to be allowed under the rules. That is, you must plead your case as
to why your entry is valid. Humor and/or creativity help plead a
case.
Abusing the web submission procedure tends to annoy us more
than amuse us. Spend your creative energy on content of your
entry rather than on the submission process itself.
We are often asked why the contest rules and guidelines seem too
strange or contain mistakes, flaws or grammatical errors. One reason
is that we sometimes make genuine mistakes. But in many cases such
problems, flaws or areas of confusion are deliberate. Changes to
rules and guidelines in response to rule abuses, are done in a minimal
fashion. Often we will deliberately leave behind holes (or introduce
| new ones) so that future rule abuse may continue. A cleaver author
| should be able to read them and "drive a truck through the holes" in
| the rules and guidelines.
At the risk of stating the obvious, this contest is a parody of the
software development process. The rules and guidelines are only a
small part of the overall contest. Even so, one may think the contest
rules and guideline process as a parody of the sometimes tragic
mismatch between what a customer (or marketing) wants and what
| engineering delivers. Real programmers must face obfuscated
| and sometimes conflicting specifications and requirements from marketing,
| sales, product management an even from customers themselves on a
| all to regular basis. This is one of the reasons why the rules and
| guidelines are written in obfuscated form.
JUDGING PROCESS:
Entries are judged by Leonid A. Broukhis, Simon Cooper, Landon Curt Noll.
Each entry submitted is given an id number and subdirectory. The
| entry files including, but not limited to prog.c, Makefile (that we
| form from around your "how to build" information), as well as any
| data files that you submit are all places under their own directory.
| stored and judged from this directory.
| Any information about the authors is not read bu the judges until
the judging process is complete, and then only from entries that have
won an award.
| Because we do not read this information for entries that do not win,
| do not know who did not win.
The above process helps keep us biased for/against any one particular
individual. Therefore you MUST refrain from putting any information
| that reveals your identity in your entry.
| Now some people point out that coding style might reveal the information
| about the others. However we consider this to be simply circumstantial
| and outside the scope of the above paragraph.
| Some people, in the past, have attempted to obfuscate their identity by
| including comments of famous Internet personalities such as Peter Honeyman
| (http://www.citi.umich.edu/u/honey/). The judges are on to this
| trick and therefore consider any obfuscated source or data file
| claiming to be from Honeyman to not be form Honeyman. This of course
| creates an interesting paradox known as the "obfuscated Peter Honeyman
| paradox". Should Peter Honeyman actually submit an obfuscated entry,
| he alone is excluded from above mentioned refrain as we believe
| it just another attempt at confusion. This guideline is known
| as the "Peter Honeyman is exempt" guideline.
| BTW: None of the entries claiming to be from Peter Honeyman have ever
| won an award. So it is theoretically possible that Peter Honeyman
| did submit an entry in the past. In the past, Peter had denied
| submitting anything to the IOCCC. Perhaps those entries were
| submitted by one of his students?
| We seemed to have digressed here ... :-) Returning to the judging process:
| We prefer to be kept in the dark as much as you are until the final
| awards are given. We enjoy the surprise of finding out in the end,
| who won and where they were from.
We attempt to keep all entries anonymous, unless they win an award.
Because the main 'prize' of winning is being announced, we make all
attempts to send non-winners into oblivion. We remove all non-winning
files, and shred all related paper. By tradition, we do not even
| reveal the number of entries that we received.
After the initial announcement, we attempt to send EMail to the
authors of the winning entries. One reason we do this is to give
the authors a chance to comment on the way we have presented their
entry. They are given the chance to correct mistakes and typos. We
often accept their suggestions/comments about our remarks as well.
This is done prior to posting the winners to the wide world.
Judging consists of a number of elimination rounds. During a round,
the collection of entries are divided into two roughly equal piles;
the pile that advances on to the next round, and the pile that does
not. We also re-examine the entries that were eliminated in the
previous round. Thus, an entry gets at least two readings.
A reading consists of a number of actions:
| * reading the "how to build" information and forming a Makefile
| * reading prog.c, the C source
| * reviewing the "remarks" information
| * briefly looking any any supplied data files
* passing the source thru the C pre-processor
skipping over any #include files
* performing a number of C beautify/cleanup edits on the source
* passing the beautified source thru the C pre-processor
skipping over any #include files
| * compiling/building the source
| * running the program
| * Doing other things that only IOCCC judges know about :-)
In later rounds, other actions are performed including performing
miscellaneous tests on the source and binary.
Until we reduce the stack of entries down to about 25 entries, entries
are judged on an individual basis. An entry is set aside because it
does not, in our opinion, meet the standard established by the round.
When the number of entries thins to about 25 entries, we begin to form
award categories. Entries begin to compete with each other for awards.
An entry will often compete in several categories.
The actual award category list will vary depending on the types of entries
we receive. A typical category list might be:
* best small one line program
* best small program
* strangest/most creative source layout
* most useful obfuscated program
* best game that is obfuscated
* most creatively obfuscated program
| * most deceptive C code (code with deceptive comments and source code)
* best X client (see OUR LIKES AND DISLIKES)
* best abuse of ISO/IEC 9899-1999 ("ISO C99") C or ANSI C
| * best abuse of the C preprocessor
* worst abuse of the rules
* (anything else so strange that it deserves an award)
We do not limit ourselves to this list. For example, a few entries are so
good/bad that they are declared winners at the start of the final round.
We will invent awards categories for them, if necessary.
In the final round process, we perform the difficult tasks of
reducing the remaining entries (typically about 25) down to 8 or 10
winners. Often we are confident that the entries that make it into
the final round are definitely better than the ones that do not
make it. The selection of the winners out of the final round, is
less clear cut.
Sometimes a final round entry is good enough to win, but is beat out
by a similar, but slightly better entry. For this reason, it is
sometimes worthwhile to re-enter an improved version of an entry
that failed to win in a previous year. This assumes, of course,
that the entry is worth improving in the first place!
| More than one IOCCC judge has been known to bribe another IOCCC judge
| into voting for a winning entry by offering a bit high quality chocolate.
| This technique is highly discouraged for use by non-IOCCC judges.
More often than not, we select a small entry (usually one line), a
strange/creative layout entry. We sometimes also select an
| entry that abuses the contest guidelines in an interesting way,
| or that stretches the content rules that while legal, is
| nevertheless goes against the intent of the rules.
In the end, we traditionally pick one entry as 'best'. Sometimes such
an entry simply far exceeds any of the other entries. More often, the
'best' is picked because it does well in a number of categories.
ANNOUNCEMENT OF WINNERS:
| The judges will tweet initial announcement of who won, the name
| of their award, and a very brief description of the winning entry
| from the @IOCCC twitter handle.
The judges will then post an initial announcement of who won, the name
of their award, and a very brief description of the winning entry
on the IOCCC web site:
http://www.ioccc.org/whowon.html
We will also attempt to submit a brief announcement story to /.:
http://slashdot.org
that, depending on the willingness of the /. editors, may be posted
to their site at the same time.
Note that initial announcement will NOT contain source. This is because
the winning authors are given a chance to review the judges comments,
and test our Makefile. This review process typically takes a few weeks.
Sometime after the initial announcement, and once the the review
by the winners has been completed, the winning source will be
posted to the IOCCC web site:
http://www.ioccc.org/years.html
NOTE: previous winners are available at that URL
We will submit a story announcing the availability of the winners
to /. at the same time.
| Don't ask us how many non-winning entries we receive.
Often, winning entries are published in selected magazines from around
the world. Winners have appeared in books ("The New Hackers Dictionary")
| and on T-Shirts. More than one winner has been turned in a tattoo!
Last, but not least, winners receive international fame and flames! :-)
FOR MORE INFORMATION:
You may contact the judges by sending EMail to the following address:
| q.2012@ioccc.org (do not submit entries to this address)
| You must include the words 'ioccc 2012 question' in the subject of your
EMail message when sending EMail to the judges.
Questions and comments about the contest are welcome. Comments about
confusing rules and guidelines are also welcome.
The rules and the guidelines may (and often do) change from year to
year. You should be sure you have the current rules and guidelines
prior to submitting entries.
Check out the IOCCC Web page:
http://www.ioccc.org
It has rules, guidelines and winners of previous contests (1984 to date).
Leonid A. Broukhis
Simon Cooper
chongo (Landon Curt Noll) /\cc/\
+206
View File
@@ -0,0 +1,206 @@
#!/usr/bin/env make
#
# 2012 makefile
#
# This work by Landon Curt Noll, Simon Cooper, and Leonid A. Broukhis
# is licensed under:
#
# 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
# Set X11_LIBDIR to the directory where the X11 library resides
#
X11_LIBDIR= /usr/X11R6/lib
# Set X11_INCLUDEDIR to the directory where the X11 include files reside
#
X11_INCDIR= /usr/X11R6/include
# Compiler warnings
#
#CWARN=
CWARN= -Wall -W
#CWARN= -Wall -W -pedantic
# compiler standard
#
#CSTD=
#CSTD= -ansi
CSTD= -std=c99
# compiler bit architecture
#
# Some entries require 32-bitness:
# ARCH= -m32
#
# Some entries require 64-bitess:
# ARCH= -m64
#
# By default we assume nothing:
#
ARCH=
# 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=
#OPT= -O
#OPT= -O1
OPT= -O2
#OPT= -O3
# Libraries needed to build
#
LIBS=
# default flags for ANSI C compilation
#
CFLAGS= ${CWARN} ${CSTD} ${ARCH} ${OPT} ${LIBS}
# ANSI compiler
#
# Set CC to the name of your ANSI compiler.
#
# Some entries seem to need gcc. If you have gcc, set
# both CC and MAY_NEED_GCC to gcc.
#
# If you do not have gcc, set CC to the name of your ANSI compiler, and
# set MAY_NEED_GCC to either ${CC} (and hope for the best) or to just :
# to disable such programs.
#
CC= cc
#CC=clang
MAY_NEED_GCC= gcc
##############################
# Special flags for this entry
##############################
#
ENTRY= hamano
DATA=
ALT_OBJ=
ALT_ENTRY= hamano.orig
#################
# build the entry
#################
#
all: ${ENTRY} ${DATA}
@${TRUE}
${ENTRY}: ${ENTRY}.c
${CC} ${CFLAGS} $< -o $@
${ALT_ENTRY}: ${ALT_ENTRY}.c
${CC} ${CFLAGS} $< -o $@
# alternative executable
#
alt: ${ALT_ENTRY}
@${TRUE}
# data files
#
data: ${DATA}
@${TRUE}
###############
# utility rules
###############
#
everything: all alt
clean:
${RM} -f ${ENTRY}.o ${ALT_OBJ}
clobber: clean
${RM} -f ${ENTRY} ${ALT_ENTRY}
nuke: clobber
@${TRUE}
dist_clean: nuke
@${TRUE}
install:
@echo "Surely you're joking Mr. Feynman!"
@${TRUE}
# backwards compatibility
#
build: all
@${TRUE}
##################
# 133t hacker rulz
##################
#
love:
@echo 'not war?'
@${TRUE}
haste:
$(MAKE) waste
@${TRUE}
waste:
@echo 'waste'
@${TRUE}
easter_egg:
@echo you expected to mis-understand this $${RANDOM} magic
@echo chongo '<was here>' "/\\oo/\\"
@echo Readers shall be disallowed from not being unable to partly misunderstand this partocular final echo.
# Understand the history of "I Am the Walrus" and
# and in particular John Lennon's remarks on that
# song and you might be confused about these next
# rules in a different way. :-)
#
supernova: nuke
@-if [ -r .code_anal ]; then \
${RM} -f .code_anal_v3; \
else \
echo "You are not expected to understand this"; \
fi
@${TRUE}
deep_magic:
@-if [ -r .code_anal ]; then \
ccode_analysis --deep_magic 1c2c85c7a02c55d1add91967eca491d53c101dc1 --FNV1a_hash 256-bit "${ENTRY}"; \
else \
echo "Understand different"; \
fi
@${TRUE}
magic: deep_magic
@-if [ -r .code_anal ]; then \
ccode_analysis --mode 21701 --level 23209 --FNV1a_hash 256-bit "${ENTRY}"; \
else \
echo "These aren't the droids you're looking for Mr. Spock!"; \
fi
@${TRUE}
+57
View File
@@ -0,0 +1,57 @@
#define \
D(s)"<<"#s">>"
#define q(s)p(#s)
#define S " endobj "
#define Y "endstream"S
#include <stdio.h>
#define o(s) b[s]=_;\
p("%u 0 obj",s);
#define E for (c=d;c < 123;c++)
#define DANCE "trailer "D\
(/Root 3 0 R /Size %d) "\nstartxref %u %%%%EOF\n*/"
#define p(s, ...) _+=printf(s, ##__VA_ARGS__)
#define C "<</Type/Page /Parent %d %d R /Resources <<\
/ProcSet[ /PDF/Text]/Font <</U"D(/Subtype/Type1/BaseFont\
/Courier) " /T<</Subtype/Type3 /FontBBox[0 0 10 10]/FontMatrix[\
%f 0 0 %f 0 0]/FirstChar %d/LastChar %d/Encoding<</Differences[%d"
typedef int N;typedef char*Nyan;typedef char A;N a,b[64],d=65,_,v
[32]={84,0,64,282,90,74,330,85,93,173,167,176,80,208,81,13,7,87
,160,346,32,128,170,218,16,26}; Nyan w[]={"+*-(,&-&","+*,&-&"
,"+*.&/&","+*/*/+","+*())'('" ,"+**&)&","+*(&'&","+*'*'+",
"","+,./","+,-,./","+--,+*" ,"","+,(/","+,),(/","+-),+*"
,"10 0 d0 ","8 7 2 2 re " ,"+*+.'`'@'mi +/+/(mi"};Nyan
nyan(Nyan _,N y,A n){
N g=v[~-y%32];Nyan
s=w[g>>n&3|n*2];
for(a=0;*_=*s++;
a++,_++,*_++=32)
{*_+=*_-32?10:0;
if(a%2&&*_/16==3
){if(g>>8)*_=105-*_;
_++;*_++=32;*_=~-a&&a-13
?108:109;}}return n?n-9?nyan
(_,y,n-2):_:nyan(_+=~y&' '?sprintf
(_,17[w]):0,y,9);}N main(N c){A e[256];
p("/*%%PDF-1.3%%*/")-2;q(#include<stdio.h>\n);
q(#define o *_++&& *_-41\n#define);p(" endstream ");q
(main(){for(;*_++; *_-40?:putchar(o?*_:o?10:41));\n)
;q(#define endobj return 0;}\n);q(typedef int ET;/)
;q(*);o(1)*b=~(p(D (/Length 2 0 R)"stream\n"))
;for(p("BT 12 818" " Td/%c 12 Tf 12 TL%%%c/"
"static char*_=\"" " \\\n",7[v],*v/2);c=
getchar(),~c;c-10? p("/%c 12 Tf(\\%o)"
"Tj",v[~-c%' '<25[ v]&&!~-(~-c/'@')?0
:7],c):(p("()'"))) ;p("%%\";\nET ");*
b-=~_;p(Y"/*");E{a =nyan(e+sprintf(e,
16[w]),c,6)-e;o(c- 59)p(D(/Length %d)
"stream\n%s"Y,a,e) ;}o(2)p(" %u"S,*b);
o(3)p(D(/Pages 4 0 R)S);o(4)p(D(/Count
1/MediaBox[0 0 595 842]/Kids[5 0 R])S)
;o(5)p(C,4,0,6e-2, 6e-2f,d,122,d);E p(
"/%c",~-c/6+~14?c: d);q(]>>/CharProcs<<)
;E if(~-c/6+~14)p( "/%c %d 0 R",c,c+~58);
for(q(>>/Widths[), c=59;--c;p(" 10"));a=p
("]>>>>>>/Contents 1 0 R>>"S);for(p("xref\
0 %d ",--d);c<d;p("%010u\
%05d n ",*(c+++b),NULL));
return!(p(DANCE,d,a));}
+57
View File
@@ -0,0 +1,57 @@
#define \
D(s)"<<"#s">>"
#define q(s)p(#s)
#define S " endobj "
#define Y "endstream"S
#include <stdio.h>
#define o(s) b[s]=_;\
p("%u 0 obj",s);
#define E for (c=d;c < 123;c++)
#define DANCE "trailer "D\
(/Root 3 0 R /Size %d) "\nstartxref %u %%%%EOF\n*/"
#define p(s, ...) _+=printf(s, ##__VA_ARGS__)
#define C "<</Type/Page /Parent %d %d R /Resources <<\
/ProcSet[ /PDF/Text]/Font <</U"D(/Subtype/Type1/BaseFont\
/Courier) " /T<</Subtype/Type3 /FontBBox[0 0 10 10]/FontMatrix[\
%f 0 0 %f 0 0]/FirstChar %d/LastChar %d/Encoding<</Differences[%d"
typedef int N;typedef char*Nyan;typedef char A;N a,b[64],d=65,_,v
[32]={84,0,64,282,90,74,330,85,93,173,167,176,80,208,81,13,7,87
,160,346,32,128,170,218,16,26}; Nyan w[]={"+*-(,&-&","+*,&-&"
,"+*.&/&","+*/*/+","+*())'('" ,"+**&)&","+*(&'&","+*'*'+",
"","+,./","+,-,./","+--,+*" ,"","+,(/","+,),(/","+-),+*"
,"10 0 d0 ","8 7 2 2 re " ,"+*+.'`'@'mi +/+/(mi"};Nyan
nyan(Nyan _,N y,A n){
N g=v[~-y%32];Nyan
s=w[g>>n&3|n*2];
for(a=0;*_=*s++;
a++,_++,*_++=32)
{*_+=*_-32?10:0;
if(a%2&&*_/16==3
){if(g>>8)*_=105-*_;
_++;*_++=32;*_=~-a&&a-13
?108:109;}}return n?n-9?nyan
(_,y,n-2):_:nyan(_+=~y&' '?sprintf
(_,17[w]):0,y,9);}N main(N c){A e[256];
p("/*%%PDF-1.3%%*/")-2;q(#include<stdio.h>\n);
q(#define o *_++&& *_-41\n#define);p(" endstream ");q
(main(){for(;*_++; *_-40?:putchar(o?*_:o?10:41));\n)
;q(#define endobj return 0;}\n);q(typedef int ET;/)
;q(*);o(1)*b=~(p(D (/Length 2 0 R)"stream\n"))
;for(p("BT 12 818" " Td/%c 12 Tf 12 TL%%%c/"
"static char*_=\"" " \\\n",7[v],*v/2);c=
getchar(),~c;c-10? p("/%c 12 Tf(\\%o)"
"Tj",v[~-c%' '<25[ v]&&!~-(~-c/'@')?0
:7],c):(p("()'"))) ;p("%%\";\nET ");*
b-=~_;p(Y"/*");E{a =nyan(e+sprintf(e,
16[w]),c,6)-e;o(c- 59)p(D(/Length %d)
"stream\n%s"Y,a,e) ;}o(2)p(" %u"S,*b);
o(3)p(D(/Pages 4 0 R)S);o(4)p(D(/Count
1/MediaBox[0 0 595 842]/Kids[5 0 R])S)
;o(5)p(C,4,0,6e-2, 6e-2f,d,122,d);E p(
"/%c",~-c/6+~14?c: d);q(]>>/CharProcs<<)
;E if(~-c/6+~14)p( "/%c %d 0 R",c,c+~58);
for(q(>>/Widths[), c=';';--c;p(" 10"));*b
=q(]>>>>>>/Contents 1 0 R>>);for(p("xref 0 "
"%d ",--d);c<d;)p("%010"
"u %05d n ",*(c+++b),0);
return!(p(DANCE,d,*b));}
+122
View File
@@ -0,0 +1,122 @@
<!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 elementary use of C - Silver award</title>
</head>
<body>
<h1>Most elementary use of C - Silver award</h1>
<p>Tsukasa Hamano<br>
<a href="&#109;&#97;&#105;&#108;&#116;&#x6f;&#x3a;&#x68;&#x61;&#x6d;&#x61;&#110;&#111;&#x40;&#x63;&#117;&#115;&#112;&#121;&#46;&#111;&#114;&#x67;">&#104;&#97;&#109;&#x61;&#110;&#x6f;&#64;&#99;&#x75;&#x73;&#112;&#x79;&#x2e;&#111;&#114;&#103;</a></p>
<h2>Judges' comments:</h2>
<h3>To build:</h3>
<pre><code>make hamano
</code></pre>
<h3>To run:</h3>
<pre><code>./hamano &lt; textfile &gt; output.pdf
</code></pre>
<h3>Try:</h3>
<pre><code>./hamano &lt; hint.text &gt; hint.pdf
# You can read output.pdf with PDF reader
acroread hint.pdf
# or
evince hint.pdf
# deobfuscate
gcc -xc hint.pdf -o hint
./hint
# Of course, You can obfuscate c code
echo 'void main(){puts("Hello World!");}' | ./hamano &gt; hello.pdf
gcc -xc hello.pdf -o hello2
./hello2 | gcc -xc - -o ./hello3
./hello3
</code></pre>
<h3>Selected Judges Remarks:</h3>
<p>This entry treads into a new territory for IOCCC - generating PDF files.</p>
<p>The originally submitted entry could have been thought of as a &ldquo;Best abuse of
Ghostscript&rdquo; winner. :-)</p>
<p>The source code and rendered pages are obfuscated for humans (where
is the font?), and the submitted entry created PDF files that left Ghostscript
confused.</p>
<p>The results can be viewed with Acrobat Reader,
<a href="http://en.wikipedia.org/wiki/Evince">evince</a> and Apple&rsquo;s Preview.</p>
<p>The updated version can also be viewed using Ghostscript.</p>
<p>There is something strange about the little flags in the output.
A search of English literature will provide a hint. The conclusion
you might draw is too elementary. :-)</p>
<p>So what do those flags really mean?</p>
<p>The [Dancing men algorithm][1] might be useful.</p>
<p>Don&rsquo;t forget to take a look at the generated PDF, perhaps you might even want
to compile the output with a C compiler. When you run it, what does it
output?</p>
<h2>Author&rsquo;s comments:</h2>
<p>This program obfuscate text file into PDF file with Dancing men
algorithm.</p>
<p><a href="http://en.wikipedia.org/wiki/The_Adventure_of_the_Dancing_Men">http://en.wikipedia.org/wiki/The_Adventure_of_the_Dancing_Men</a></p>
<p>Probably, the output PDF file is compliant with PDF 1.3. And also
available to compile as C code.</p>
<p>I&rsquo;ve been tested with GCC 4.7 and Clang 3.0 on Linux, and following
PDF Reader:</p>
<ul>
<li>Adobe Acrobat Reader</li>
<li>Evince</li>
<li>Ghostscript</li>
<li>Xpdf</li>
</ul>
<h3>Obfuscations</h3>
<p>This program is obfuscated by using classical methods.
But can you find out the embedded font from fragmented glyph?</p>
<hr />
<!--
(c) Copyright 1984-2015, [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>&copy; 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>&nbsp;<!--<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>
+92
View File
@@ -0,0 +1,92 @@
# Most elementary use of C - Silver award
Tsukasa Hamano
<hamano@cuspy.org>
## Judges' comments:
### To build:
make hamano
### To run:
./hamano < textfile > output.pdf
### Try:
./hamano < hint.text > hint.pdf
# You can read output.pdf with PDF reader
acroread hint.pdf
# or
evince hint.pdf
# deobfuscate
gcc -xc hint.pdf -o hint
./hint
# Of course, You can obfuscate c code
echo 'void main(){puts("Hello World!");}' | ./hamano > hello.pdf
gcc -xc hello.pdf -o hello2
./hello2 | gcc -xc - -o ./hello3
./hello3
### Selected Judges Remarks:
This entry treads into a new territory for IOCCC - generating PDF files.
The originally submitted entry could have been thought of as a "Best abuse of
Ghostscript" winner. :-)
The source code and rendered pages are obfuscated for humans (where
is the font?), and the submitted entry created PDF files that left Ghostscript
confused.
The results can be viewed with Acrobat Reader,
[evince](http://en.wikipedia.org/wiki/Evince) and Apple's Preview.
The updated version can also be viewed using Ghostscript.
There is something strange about the little flags in the output.
A search of English literature will provide a hint. The conclusion
you might draw is too elementary. :-)
So what do those flags really mean?
The [Dancing men algorithm][1] might be useful.
Don't forget to take a look at the generated PDF, perhaps you might even want
to compile the output with a C compiler. When you run it, what does it
output?
## Author's comments:
This program obfuscate text file into PDF file with Dancing men
algorithm.
<http://en.wikipedia.org/wiki/The_Adventure_of_the_Dancing_Men>
Probably, the output PDF file is compliant with PDF 1.3. And also
available to compile as C code.
I've been tested with GCC 4.7 and Clang 3.0 on Linux, and following
PDF Reader:
* Adobe Acrobat Reader
* Evince
* Ghostscript
* Xpdf
### Obfuscations
This program is obfuscated by using classical methods.
But can you find out the embedded font from fragmented glyph?
--------------------------------------------------------------------------------
<!--
(c) Copyright 1984-2015, [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/
-->
+77
View File
@@ -0,0 +1,77 @@
* {
font-family: Helvetica Neue, Helvetica, Arial, sans-serif;
}
body {
max-width: 50em;
margin: 0 auto;
color: #111;
}
pre, code {
font-family: Monaco, Courier New, monospace;
font-size: 12px;
}
h1 {
font-size: 40px;
font-weight: bold;
letter-spacing: -1px;
margin-bottom: -5px;
}
h1 code {
font-size: 40px;
}
h2 {
color: rgb(43,105,145);
font-weight: bold;
margin-bottom: -5px;
}
h2 code {
font-size: 22px;
}
h3 {
/* color: rgb(43,105,145); */
font-weight: bold;
margin-bottom: -5px;
}
h3 code {
font-size: 16px;
}
a {
color: blue;
text-decoration: underline;
}
a:visited {
color: navy;
}
a:hover {
text-decoration: underline;
}
pre {
border-radius: 10px;
-webkit-border-radius: 10px;
-moz-border-radius: 10px;
box-shadow: 0px 2px 8px rgba(0, 0, 0, 0.3);
-webkit-box-shadow: 0px 2px 8px rgba(0, 0, 0, 0.3);
-moz-box-shadow: 0px 2px 8px rgba(0, 0, 0, 0.3);
border-width: 1px;
border-color: rgb(16,48,0);
border-style: solid;
padding: 0.6em;
padding-left: 1em;
margin-left: 5%;
margin-right: 8%;
background-color: rgb(16,48,0);
overflow: auto;
color: rgb(75,224,0);
}
p, li {
font-size: 14px;
line-height: 18px;
}
+203
View File
@@ -0,0 +1,203 @@
#!/usr/bin/env make
#
# 2012 makefile
#
# This work by Landon Curt Noll, Simon Cooper, and Leonid A. Broukhis
# is licensed under:
#
# 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
# Set X11_LIBDIR to the directory where the X11 library resides
#
X11_LIBDIR= /usr/X11R6/lib
# Set X11_INCLUDEDIR to the directory where the X11 include files reside
#
X11_INCDIR= /usr/X11R6/include
# Compiler warnings
#
CWARN=
#CWARN= -Wall -W
#CWARN= -Wall -W -pedantic
# compiler standard
#
#CSTD=
CSTD= -ansi
#CSTD= -std=c99
# compiler bit architecture
#
# Some entries require 32-bitness:
# ARCH= -m32
#
# Some entries require 64-bitess:
# ARCH= -m64
#
# By default we assume nothing:
#
ARCH=
# 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=
#OPT= -O
#OPT= -O1
OPT= -O2
#OPT= -O3
# Libraries needed to build
#
LIBS=
# default flags for ANSI C compilation
#
CFLAGS= ${CWARN} ${CSTD} ${ARCH} ${OPT} ${LIBS}
# ANSI compiler
#
# Set CC to the name of your ANSI compiler.
#
# Some entries seem to need gcc. If you have gcc, set
# both CC and MAY_NEED_GCC to gcc.
#
# If you do not have gcc, set CC to the name of your ANSI compiler, and
# set MAY_NEED_GCC to either ${CC} (and hope for the best) or to just :
# to disable such programs.
#
CC= cc
#CC=clang
MAY_NEED_GCC= gcc
##############################
# Special flags for this entry
##############################
#
ENTRY= hou
DATA= ansi.txt chk.txt html.txt markdown.txt patho.pl perl-notes.txt
ALT_OBJ=
ALT_ENTRY=
#################
# build the entry
#################
#
all: ${ENTRY} ${DATA}
@${TRUE}
${ENTRY}: ${ENTRY}.c
${CC} ${CFLAGS} $< -o $@
# alternative executable
#
alt: ${ALT_ENTRY}
@${TRUE}
# data files
#
data: ${DATA}
@${TRUE}
###############
# utility rules
###############
#
everything: all alt
clean:
${RM} -f ${ENTRY}.o ${ALT_OBJ}
clobber: clean
${RM} -f ${ENTRY} ${ALT_ENTRY}
nuke: clobber
@${TRUE}
dist_clean: nuke
@${TRUE}
install:
@echo "Surely you're joking Mr. Feynman!"
@${TRUE}
# backwards compatibility
#
build: all
@${TRUE}
##################
# 133t hacker rulz
##################
#
love:
@echo 'not war?'
@${TRUE}
haste:
$(MAKE) waste
@${TRUE}
waste:
@echo 'waste'
@${TRUE}
easter_egg:
@echo you expected to mis-understand this $${RANDOM} magic
@echo chongo '<was here>' "/\\oo/\\"
@echo Readers shall be disallowed from not being unable to partly misunderstand this partocular final echo.
# Understand the history of "I Am the Walrus" and
# and in particular John Lennon's remarks on that
# song and you might be confused about these next
# rules in a different way. :-)
#
supernova: nuke
@-if [ -r .code_anal ]; then \
${RM} -f .code_anal_v3; \
else \
echo "You are not expected to understand this"; \
fi
@${TRUE}
deep_magic:
@-if [ -r .code_anal ]; then \
ccode_analysis --deep_magic 1c2c85c7a02c55d1add91967eca491d53c101dc1 --FNV1a_hash 256-bit "${ENTRY}"; \
else \
echo "Understand different"; \
fi
@${TRUE}
magic: deep_magic
@-if [ -r .code_anal ]; then \
ccode_analysis --mode 21701 --level 23209 --FNV1a_hash 256-bit "${ENTRY}"; \
else \
echo "These aren't the droids you're looking for Mr. Spock!"; \
fi
@${TRUE}
+7
View File
@@ -0,0 +1,7 @@
#[ -~]*\n %s
"/*".*"*/" %s
("return"|"if"|"int"|"char"|"for"|"do"|"while"|"long"|"short"|"signed"|"typedef"|"unsigned"|"struct"|"break") %s
[a-zA-Z_][0-9a-zA-Z_]* %s
'[^']*' %s
\"([^"\\]|(\\.))*\" %s
@?@?@?@?@?@?@?@?@?@?@?@?@?@?@?@?@?@?@?@?@?@?@?@?@?@?@?@?@?@?@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 
+9
View File
@@ -0,0 +1,9 @@
"} "
"{ "
"; "
"}"\n
"{"\n
";"\n
" "
\n
" "
+1
View File
@@ -0,0 +1 @@
<font face="Courier New,Monospace" color="#cccccc">
+132
View File
@@ -0,0 +1,132 @@
<!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 useful obfuscation</title>
</head>
<body>
<h1>Most useful obfuscation</h1>
<p>Qiming Hou<br>
<a href="&#109;&#97;&#105;&#108;&#116;&#x6f;&#x3a;&#x68;&#x71;&#x6d;&#x30;&#51;&#115;&#x74;&#x65;&#114;&#64;&#103;&#109;&#97;&#105;&#108;&#x2e;&#99;&#111;&#109;">&#x68;&#113;&#x6d;&#48;&#51;&#x73;&#x74;&#101;&#x72;&#x40;&#103;&#109;&#97;&#x69;&#x6c;&#x2e;&#x63;&#x6f;&#109;</a><br>
<a href="http://www.houqiming.net">http://www.houqiming.net</a></p>
<h2>Judges' comments:</h2>
<h3>To build:</h3>
<pre><code>make hou
</code></pre>
<h3>To run:</h3>
<pre><code>./hou syntax-file file-to-process
</code></pre>
<h3>Try (Unix):</h3>
<p>The results are best viewed in a 80x25 console with ANSI colors.</p>
<pre><code>less hou.c
./hou ansi.txt hou.c | less -r
./hou chk.txt hou.c | wc
./hou markdown.txt remarks.markdown &gt; remarks.htm
your-browser remarks.htm
</code></pre>
<h3>Try (Windows):</h3>
<pre><code>copy header.htm hou.htm /y
hou html.txt hou.c &gt;&gt; hou.htm
start hou.htm
</code></pre>
<h3>Selected Judges Remarks:</h3>
<p>What a versatile entry! It can be used to check the size of IOCCC entries <em>and</em> to publish them as HTML.</p>
<p>For extra credit: what is the meaning of the number 2321237?</p>
<h2>Author&rsquo;s comments:</h2>
<h3>Disclaimer</h3>
<p>The reviewer may have already noticed that the 2nd page of this program is a dense blob, which is discouraged by the contest rules. We wish to point out that a majority of state-of-art programming editors support syntax highlighting, which should be enabled when reading this entry. Anticipating that the reviewer&rsquo;s preferred color setting may produce a suboptimal visual effect, a few syntax files are provided to highlight the source code under an author-provided setting, using the submitted program itself. Syntax highlighting would also visually improve the 3rd page.</p>
<p>The code may throw a few warnings due to formating constraints. The author did try to remove warnings under gcc and Visual Studio, though.</p>
<p>The author does not own the original anime series where the embedded ASCII arts come from. For comparison, original non-ASCII art depictions of the relevant characters and objects can be found by googling the embedded text messages.</p>
<h3>Syntax files</h3>
<p>The syntax file consists of a number of rewriting rules. Each rule consists of a regular expression, a space, a format string, and a newline. All text matching the regular expression would be replaced by the format string. In case of a conflict, rules appearing earlier would take precedence. One can refer to the original text in the format string using &ldquo;%s&rdquo;. Other &ldquo;%&rdquo; characters in the format string must be escaped with another &ldquo;%&rdquo;. The space character can be used in the regular expression by escaping it with [] or &ldquo;&rdquo;.</p>
<p>The following regular expression operators are supported:</p>
<pre><code>() [] * + ? | ""
</code></pre>
<p>For example, one can use the following expression to match a certain declaration statement in hou.c:</p>
<pre><code>"char"[ *]*[a-zA-Z_][0-9a-zA-Z_]*[ ]*((=[0-9a-zA-Z_ ]+)|(\[[0-9a-zA-Z_ ]*\]))?[ ]*(,[ *]*[a-zA-Z_][0-9a-zA-Z_]*[ ]*((=[0-9a-zA-Z_ ]+)|(\[[0-9a-zA-Z_ ]*\]))?[ ]*)*;
</code></pre>
<p>The regex engine is also algorithmically efficient. To illustrate the point, ansi.txt contains a pathological expression [2] that guarantees a hang for the competing Perl engine while matching itself. Try to compare these two engines:</p>
<pre><code>./hou ansi.txt ansi.txt
perl patho.pl &lt; ansi.txt
</code></pre>
<p>Finally, there are a few limitations&hellip;</p>
<ul>
<li>The only escape sequence supported is \n and it doesn&rsquo;t work in [].</li>
<li>The maximum file/rule size is a linear function of the hard-coded constant M.</li>
<li>Single-character matches at the end of file may be missed.</li>
<li>The operator | doesn&rsquo;t obey precedence rules and some extra ()s may be required.</li>
<li>Incorrect syntax files are not tolerated.</li>
<li>The program relies on ASCII.</li>
</ul>
<h3>Why obfuscated</h3>
<p>The first layer of obfuscation comes from the challenge of embedding a large ASCII art in a dense blob. The entire art is composed using only keywords, strings and character constants. That results in a number of otherwise useless defines and quite a number of unconventionally written constants. While the preprocessor may remove the former, the later would remain regardless of beautification and preprocessing.</p>
<p>The second layer of obfuscation comes from the need to squeeze a reasonably powerful regex engine into the remaining area that isn&rsquo;t occupied by excessive keywords and useless constants. To achieve this, the regex compiler is written using the same threaded virtual machine [1] that parses the regex. Due to compiler limitations, the generated VM code also ends up obscured by a large amount of spaghetti branches and virtual thread creations. Finally, the VM in [1] is extended to track multiple expression matches for the actual formating.</p>
<p>As an extra tweak, the text message actually does something useful. Remove the &ldquo;Make a contract with me&rdquo; catch line and the program would cease to function.</p>
<h3>References</h3>
<p>[1] <a href="http://swtch.com/~rsc/regexp/regexp2.html">Russ Cox, Regular Expression Matching: the Virtual Machine Approach</a></p>
<p>[2] <a href="http://swtch.com/~rsc/regexp/regexp1.html">Regular Expression Matching Can Be Simple And Fast (but is slow in Java, Perl, PHP, Python, Ruby, &hellip;)</a></p>
<hr />
<!--
(c) Copyright 1984-2015, [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>&copy; 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>&nbsp;<!--<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>
+102
View File
@@ -0,0 +1,102 @@
# Most useful obfuscation
Qiming Hou
<hqm03ster@gmail.com>
<http://www.houqiming.net>
## Judges' comments:
### To build:
make hou
### To run:
./hou syntax-file file-to-process
### Try (Unix):
The results are best viewed in a 80x25 console with ANSI colors.
less hou.c
./hou ansi.txt hou.c | less -r
./hou chk.txt hou.c | wc
./hou markdown.txt remarks.markdown > remarks.htm
your-browser remarks.htm
### Try (Windows):
copy header.htm hou.htm /y
hou html.txt hou.c >> hou.htm
start hou.htm
### Selected Judges Remarks:
What a versatile entry! It can be used to check the size of IOCCC entries *and* to publish them as HTML.
For extra credit: what is the meaning of the number 2321237?
## Author's comments:
### Disclaimer
The reviewer may have already noticed that the 2nd page of this program is a dense blob, which is discouraged by the contest rules. We wish to point out that a majority of state-of-art programming editors support syntax highlighting, which should be enabled when reading this entry. Anticipating that the reviewer's preferred color setting may produce a suboptimal visual effect, a few syntax files are provided to highlight the source code under an author-provided setting, using the submitted program itself. Syntax highlighting would also visually improve the 3rd page.
The code may throw a few warnings due to formating constraints. The author did try to remove warnings under gcc and Visual Studio, though.
The author does not own the original anime series where the embedded ASCII arts come from. For comparison, original non-ASCII art depictions of the relevant characters and objects can be found by googling the embedded text messages.
### Syntax files
The syntax file consists of a number of rewriting rules. Each rule consists of a regular expression, a space, a format string, and a newline. All text matching the regular expression would be replaced by the format string. In case of a conflict, rules appearing earlier would take precedence. One can refer to the original text in the format string using "%s". Other "%" characters in the format string must be escaped with another "%". The space character can be used in the regular expression by escaping it with [] or "".
The following regular expression operators are supported:
() [] * + ? | ""
For example, one can use the following expression to match a certain declaration statement in hou.c:
"char"[ *]*[a-zA-Z_][0-9a-zA-Z_]*[ ]*((=[0-9a-zA-Z_ ]+)|(\[[0-9a-zA-Z_ ]*\]))?[ ]*(,[ *]*[a-zA-Z_][0-9a-zA-Z_]*[ ]*((=[0-9a-zA-Z_ ]+)|(\[[0-9a-zA-Z_ ]*\]))?[ ]*)*;
The regex engine is also algorithmically efficient. To illustrate the point, ansi.txt contains a pathological expression [2] that guarantees a hang for the competing Perl engine while matching itself. Try to compare these two engines:
./hou ansi.txt ansi.txt
perl patho.pl < ansi.txt
Finally, there are a few limitations...
- The only escape sequence supported is \n and it doesn't work in [].
- The maximum file/rule size is a linear function of the hard-coded constant M.
- Single-character matches at the end of file may be missed.
- The operator | doesn't obey precedence rules and some extra ()s may be required.
- Incorrect syntax files are not tolerated.
- The program relies on ASCII.
### Why obfuscated
The first layer of obfuscation comes from the challenge of embedding a large ASCII art in a dense blob. The entire art is composed using only keywords, strings and character constants. That results in a number of otherwise useless defines and quite a number of unconventionally written constants. While the preprocessor may remove the former, the later would remain regardless of beautification and preprocessing.
The second layer of obfuscation comes from the need to squeeze a reasonably powerful regex engine into the remaining area that isn't occupied by excessive keywords and useless constants. To achieve this, the regex compiler is written using the same threaded virtual machine [1] that parses the regex. Due to compiler limitations, the generated VM code also ends up obscured by a large amount of spaghetti branches and virtual thread creations. Finally, the VM in [1] is extended to track multiple expression matches for the actual formating.
As an extra tweak, the text message actually does something useful. Remove the "Make a contract with me" catch line and the program would cease to function.
### References
[1] [Russ Cox, Regular Expression Matching: the Virtual Machine Approach](http://swtch.com/~rsc/regexp/regexp2.html)
[2] [Regular Expression Matching Can Be Simple And Fast (but is slow in Java, Perl, PHP, Python, Ruby, ...)](http://swtch.com/~rsc/regexp/regexp1.html)
--------------------------------------------------------------------------------
<!--
(c) Copyright 1984-2015, [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/
-->
+72
View File
@@ -0,0 +1,72 @@
#include <stdio.h>
#include <string.h>
#define Q(B,q,b) s=j[B]; e=*s; *s=0; printf(q,b,b,b); *s=e; H=s;
#define W(a,b) r[O].c=a,r[O].f=b,O++
#define X(B) { int y=A; B; A=y; }
#define R return
#define M 1<<18
#define If char
#define fi "%s"
#define IF for
#define FI "r"
#define long
#define do
typedef struct { int c,(*f)(); If*t,*h; } T; T*a,*r; int I[M],c[M]={'\0'} ,n
,N,i do,p ; char*s,*H,*z[M],f[M],o[M ],*_ [M ],**l =_ ,e ; int O=6,A='\5',x=5
,y='\0',g=2;k(p){a[p+2].h=H; R p+2; } S(p){ a[I[n++]=a[p].c>>8].h=H; return ~
p-'\1';}J(p){R~a[p].c>>8;}C(){ A=O; W(O+1<<8,J); } B(p){ c[g+'\1']=O;C(do);c[
g+='\2']='\0';R 1;}h(p){ Z(p); r[O-3].c+=256; R 1; } V(){ *I=n='\1'; for(; *a
->t; do ){do a->t=a[1].h=s; IF(i=N=0; i<n; i++){ p=I[i]; H=a[p ]do.h;for(; p>
0&&a[do p].t-s;){a[p].h&&a[p].h-H>0&&(H=a[p].h);e=a[p].c;a[p].t=s;p=do e&&e-*
s?p+'\1':~a[p].f(p);}p<0&&(I[N++]=~p);}n=N;s++;}}U(p){X(D(p)); c[g+='\2']=O ;
return Z(p); } d(p){ C(); W(0,k); W(0,J); R 1 ; } q (p ){ C (); X (for(;*++s
!='\"'; )F(p); ); return 1; } Z(p){ r[A].c =O +1 <<'\10'; r [A ].f =do J ;
{ int y=A; W(O+*"\2void"<<8 ,J ); C (); W (y*1 + "signed" [ 6 ] +1 <<'\10',S
do )do ; } return '\1';} F(p){ R*s?C(),*s==*"\\&" long&&*++do s do ==
'n'&&(*do s =*"\nextern"),W (*s ,k ),W ( (4+5)["volatile*"],J),'\1' :'\0';
} E(p){ int V =*"\0float"; C (); X(s++;V=(*s++==*"^double");c[g+=long 2]long=
0;s-=!V;for(; *s!="]int"[0];s++){e=*s;s+=2*(s[1]==*"-for" ); s=s;for(;e<=do*s
; e++){long C(); V?W(e,J):(W(e,k),W(0,J),U(p)); } } d(p); V||(W('\0',J)); D(p
); ); return 1; } j(p){ If*r=z[a[p].c>>8],**D=l; IF(; l-_&&l [-*"\2$"]-H>=0&&
(l [-*"\1do"]!=s||l[-2]!=H||r-l[-3]<=0); )l -=3 ; l ==_ ||l [-*"\1if("] -H <=
0 * !"\0auto"?*l++=r,*l++=H,*l++=s,l:(l=D); R 0; } L(p){ W(A +*"\1for"<<8,S);
R 1+*"\0while"; } Y (p ){ z [y ]do=++do s do; s=strchr (s ,*"\nshort");W(y++
<< *"\btypedef",j); r [x ].c =O long<<'\10'; r [x ].f =S ; do x =O do ; C (
); return '\1'; } D (p ){ r [c [g ]].c =O <<8 ; c [g ]='\0';A=c[--do g]; --
g; return *"\1switch"; } T b [ 12 + (M) + 321 ]={ {'\0','\0',"-"},{'*',Z } ,
{ '+',L},{ '\"',q} ,{ '['long ,E } ,{ 70-94+ do '@'do ,B } ,{ ')',D } do,{124
,U},
{46,d}
,{32
,Y},
{63,h},{
0,F},{0,0, "Make a contract with me"
},{'('*32,S}
,{'\0',k},{0,J, "and become a magical girl! "
},{'@'*4,J},{0,J
},{'@',0} };main
( int B,If**j){ a
=b;if(B>=3){s=f;r=
b+'\14'; f[fread(f,1,
M,fopen(j[1],FI))]=0;
V(); W(0,J); IF(i=0;
i<y;i++){*strchr(z[i
],10)=0;}o[fread(s
=o,1,M,fopen(j[2
],FI))]=0; a=r
;V(); H=o;
IF( j=_;j!=l; j+=3 ){Q
(1,fi,H);Q(2,*j,j[1]);
}printf(fi,H);}R 0;}
+10
View File
@@ -0,0 +1,10 @@
#\ *[0-9A-Za-z]* <font color="#800080">%s</font>
"/*".*"*/" <font color="#004000">%s</font>
("return"|"if"|"int"|"char"|"for"|"do"|"while"|"long"|"short"|"signed"|"typedef"|"unsigned"|"struct"|"break") <font color="#cc0000">%s</font>
[a-zA-Z_][0-9a-zA-Z_]* %s
'[^']*' <font color="#ff0000">%s</font>
\"([^"\\]|(\\.))*\" <font color="#ff0000">%s</font>
" " &nbsp;
"<" &lt;
">" &gt;
\n <br>%s
+10
View File
@@ -0,0 +1,10 @@
###[^#]([ -~]+\n)+\n <h3>%s</h3>
##[^#]([ -~]+\n)+\n <h2>%s</h2>
#[^#]([ -~]+\n)+\n <html><head><title>%s</title><link rel="stylesheet" type="text/css" href="http://www.ioccc.org/2011/hint.css"><body><h1>%s</h1>
\n"- "[ -~]* <li>%s</li>
(" "[!-~][ -~]*\n)+\n <pre><code>%s</code></pre>
([ -~]+\n)+\n <p>%s</p>
" " &nbsp;
"<" &lt;
">" &gt;
"http://"[!-~]+ <a %s>%s</a>
+5
View File
@@ -0,0 +1,5 @@
$a="";
while (<STDIN>){
$a=$a . $_;
}
print $a =~ m/@?@?@?@?@?@?@?@?@?@?@?@?@?@?@?@?@?@?@?@?@?@?@?@?@?@?@?@?@?@?@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@/;
+18
View File
@@ -0,0 +1,18 @@
time perl patho.pl < ansi.txt
1
real 1m50.970s
user 1m50.767s
sys 0m0.049s
time ./prog ansi.txt ansi.txt
#[ -~]*\n %s
"/*".*"*/" %s
("return"|"if"|"int"|"char"|"for"|"do"|"while"|"long"|"short"|"signed"|"typedef"|"unsigned"|"struct"|"break") %s
[a-zA-Z_][0-9a-zA-Z_]* %s
'[^']*' %s
\"([^"\\]|(\\.))*\" %s
@?@?@?@?@?@?@?@?@?@?@?@?@?@?@?@?@?@?@?@?@?@?@?@?@?@?@?@?@?@?
real 0m0.027s
user 0m0.006s
sys 0m0.002s
+206
View File
@@ -0,0 +1,206 @@
#!/usr/bin/env make
#
# 2012 makefile
#
# This work by Landon Curt Noll, Simon Cooper, and Leonid A. Broukhis
# is licensed under:
#
# 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
# Set X11_LIBDIR to the directory where the X11 library resides
#
X11_LIBDIR= /usr/X11R6/lib
# Set X11_INCLUDEDIR to the directory where the X11 include files reside
#
X11_INCDIR= /usr/X11R6/include
# Compiler warnings
#
#CWARN=
CWARN= -Wall -W
#CWARN= -Wall -W -pedantic
# compiler standard
#
#CSTD=
#CSTD= -ansi
CSTD= -std=c99
# compiler bit architecture
#
# Some entries require 32-bitness:
# ARCH= -m32
#
# Some entries require 64-bitess:
# ARCH= -m64
#
# By default we assume nothing:
#
ARCH=
# 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=
#OPT= -O
#OPT= -O1
OPT= -O2
#OPT= -O3
# Libraries needed to build
#
LIBS=
# default flags for ANSI C compilation
#
CFLAGS= ${CWARN} ${CSTD} ${ARCH} ${OPT} ${LIBS}
# ANSI compiler
#
# Set CC to the name of your ANSI compiler.
#
# Some entries seem to need gcc. If you have gcc, set
# both CC and MAY_NEED_GCC to gcc.
#
# If you do not have gcc, set CC to the name of your ANSI compiler, and
# set MAY_NEED_GCC to either ${CC} (and hope for the best) or to just :
# to disable such programs.
#
CC= cc
#CC=clang
MAY_NEED_GCC= gcc
##############################
# Special flags for this entry
##############################
#
ENTRY= kang
DATA=
ALT_OBJ= kang.orig.o
ALT_ENTRY= kang.orig
#################
# build the entry
#################
#
all: ${ENTRY} ${DATA}
@${TRUE}
${ENTRY}: ${ENTRY}.c
${CC} ${CFLAGS} $< -o $@
# alternative executable
#
alt: ${ALT_ENTRY}
@${TRUE}
kang.orig: kang.orig.c
${CC} ${CFLAGS} $< -o $@
# data files
#
data: ${DATA}
@${TRUE}
###############
# utility rules
###############
#
everything: all alt
clean:
${RM} -f ${ENTRY}.o ${ALT_OBJ}
clobber: clean
${RM} -f ${ENTRY} ${ALT_ENTRY}
nuke: clobber
@${TRUE}
dist_clean: nuke
@${TRUE}
install:
@echo "Surely you're joking Mr. Feynman!"
@${TRUE}
# backwards compatibility
#
build: all
@${TRUE}
##################
# 133t hacker rulz
##################
#
love:
@echo 'not war?'
@${TRUE}
haste:
$(MAKE) waste
@${TRUE}
waste:
@echo 'waste'
@${TRUE}
easter_egg:
@echo you expected to mis-understand this $${RANDOM} magic
@echo chongo '<was here>' "/\\oo/\\"
@echo Readers shall be disallowed from not being unable to partly misunderstand this partocular final echo.
# Understand the history of "I Am the Walrus" and
# and in particular John Lennon's remarks on that
# song and you might be confused about these next
# rules in a different way. :-)
#
supernova: nuke
@-if [ -r .code_anal ]; then \
${RM} -f .code_anal_v3; \
else \
echo "You are not expected to understand this"; \
fi
@${TRUE}
deep_magic:
@-if [ -r .code_anal ]; then \
ccode_analysis --deep_magic 1c2c85c7a02c55d1add91967eca491d53c101dc1 --FNV1a_hash 256-bit "${ENTRY}"; \
else \
echo "Understand different"; \
fi
@${TRUE}
magic: deep_magic
@-if [ -r .code_anal ]; then \
ccode_analysis --mode 21701 --level 23209 --FNV1a_hash 256-bit "${ENTRY}"; \
else \
echo "These aren't the droids you're looking for Mr. Spock!"; \
fi
@${TRUE}
+201
View File
@@ -0,0 +1,201 @@
<!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 short program</title>
</head>
<body>
<h1>Best short program</h1>
<p>Seonghoon Kang<br>
<a href="&#109;&#97;&#105;&#108;&#116;&#x6f;&#x3a;&#x6b;&#x61;&#x6e;&#x67;&#46;&#115;&#x65;&#x6f;&#110;&#103;&#104;&#111;&#111;&#110;&#64;&#x6d;&#101;&#97;&#114;&#x69;&#101;&#x2e;&#111;&#114;&#x67;">&#x6b;&#97;&#x6e;&#x67;&#46;&#115;&#101;&#x6f;&#x6e;&#x67;&#x68;&#x6f;&#111;&#x6e;&#x40;&#109;&#x65;&#x61;&#114;&#105;&#101;&#x2e;&#111;&#114;&#x67;</a></p>
<h2>Judges' comments:</h2>
<h3>To build:</h3>
<pre><code>make kang
</code></pre>
<h3>To run:</h3>
<pre><code>echo "full spelling of an English cardinal numeral less than a quadrillion" | ./kang
</code></pre>
<h3>Try:</h3>
<pre><code>echo Nineteen hundred and eighty-four | ./kang
echo uno | ./kang
echo trois | ./kang
echo fier | ./kang
echo "shest'" | ./kang
</code></pre>
<h3>Selected Judges Remarks:</h3>
<p>The judges were able to appreciate the Indo-European language family
relation by making this entry successfully recognize <em>some</em> French,
German, Italian, Russian, and Spanish numerals.</p>
<p>Also worth mentioning is this entry&rsquo;s ability to understand the
colloquial year numbers of the last millennium.</p>
<p>We&rsquo;ve added a linefeed to the print format for convenience.</p>
<h2>Author&rsquo;s comments:</h2>
<h2>Synopsis</h2>
<p>This short program reads a spelt number (e.g. <code>forty-two</code>) and writes a
corresponding decimal number (e.g. <code>42</code>). Too long for one-liners, alas,
but it still qualifies as a <em>short</em> program as it has less than 0x100 bytes.</p>
<p>It accepts a variety of spelt numbers:</p>
<ul>
<li>It correctly handles <code>zero</code>.</li>
<li>Hyphen does not make a difference: <code>forty-two</code> and <code>forty two</code> are same.
So does period or comma.</li>
<li>Cases do not make a difference either: <code>TWO</code>, <code>Two</code>, <code>two</code> are same.</li>
<li><code>one</code> and <code>a</code> are interchangeable: <code>one hundred</code> and <code>a hundred</code> are same.</li>
<li><code>and</code> is optional: <code>one hundred twenty-three</code> and <code>one hundred and twenty-three</code>
are same.</li>
<li>It supports every non-negative integer less than 10<sup>15</sup>-1. It uses
the small scale (i.e. American): <code>billion</code> is 10<sup>9</sup> and <code>trillion</code> is
10<sup>12</sup>.</li>
</ul>
<p>It does <em>not</em> accept some spelt numbers, which I found mostly irrelevant:</p>
<ul>
<li>A bare <code>hundred</code>, <code>thousand</code> etc. do not work.</li>
<li><code>one million million</code> does not work. Get used to <code>one trillion</code>!</li>
</ul>
<h2>Requirements</h2>
<p>This program is quite portable, only requiring the following:</p>
<ul>
<li>The signature <code>int main(int, int)</code> should be accepted by the linker.</li>
<li><code>char</code> should be at least 8 bits long (as dictated by the standard), <code>int</code>
should be at least 32 bits long, <code>long long</code> should be at least 64 bits long.</li>
<li>Both the compiler and execution environment should use an ASCII-compatible
character set and two&rsquo;s complement representation.</li>
<li>Overflow and underflow on <code>char</code> should wrap around, if your <code>char</code> is unsigned.</li>
<li><a href="http://cm.bell-labs.com/who/ken/trust.html">A trustworthy compiler</a>.</li>
</ul>
<p>The design of the program explicitly allows for <code>EOF</code> which does not equal to -1
(it has to be negative per the standard) and both signed and unsigned <code>char</code>,
for example. Furthermore it is endian-independent.</p>
<h2>Obfuscations</h2>
<p>Many obfuscations used are typical for standard IOCCC entries:</p>
<ul>
<li>Two arguments from <code>main</code> function are reused as normal variables.</li>
<li>Every conditional has been replaced with <code>?:</code> ternary operator and <code>||</code>
short-circuiting operator.</li>
<li>It has exactly three nested <code>for</code> loops and nothing else.</li>
<li>Common two&rsquo;s complement tricks: <code>~-a</code> instead of <code>a-1</code>,
<code>~a?...:...</code> instead of <code>a!=-1?...:...</code>, etc.</li>
<li>Comma operators (<code>,</code>) for multiple statements. The number of them is
minimized, however, as it is too easy to (ab)use them.</li>
<li>It lacks most parentheses around bitwise and arithmetic operators. It was
originally written for shortness so parentheses were <strong>EVIL</strong>.</li>
<li><code>n["string"]</code> instead of <code>"string"[n]</code>. Both are fine for this program but
I went to the former just for fun.</li>
<li>Utter lack of any kind of layouts. (Oh, except for the first column.)</li>
</ul>
<p>Other obfuscations are more subtle:</p>
<ul>
<li>The string <code>"1+DIY/.K430x9G(kC["</code> is 18 bytes long, but actually 19 bytes
including the final null character are used.</li>
<li>It internally represents numbers as hexadecimal. When the input is <code>two
hundred and three</code>, it actually writes 0x203 as hexadecimal.</li>
<li>Some variables (notably, <code>n</code>) have dual uses.</li>
<li>The magic number <a href="http://en.wikipedia.org/wiki/Answer_to_The_Ultimate_Question_of_Life,_the_Universe,_and_Everything">42</a> makes an appearance.</li>
<li>It has a long long numb-<code>main</code>-er within it!</li>
</ul>
<p>But the most important obfuscation is the clever construction of lookup table.
The program uses 11 different characters required for recognizing 22 lexemes:</p>
<pre><code>zero one tw- th(i)r- fo(u)r- fi- six-
seven- eigh- nin- ten eleven twelve
hundred(s) thousand(s) million(s) billion(s) trillion(s)
a and -teen -ty
</code></pre>
<p>So that they are internally represented as like:</p>
<pre><code>r n tw- tr- fr- f- s-
sn- g- nn- tn ln twl
nr(s) tsan(s) lln(s) blln(s) trlln(s)
a an -tn -ty
</code></pre>
<p>The stemmer recognizes the longest matching prefix, so every lexeme can be
recognized by at most three characters (e.g. <code>trl</code> instead of <code>trlln</code>). This is
also handy for ignoring plurals. But that would make that the table does not fit
in the printable byte&mdash;11<sup>2</sup> is already almost 2<sup>7</sup>!</p>
<p>The trick is to use octal; three characters (<code>a</code>, <code>b</code> and <code>g</code>) are interpreted
as sequences of two characters (<code>ny</code>, <code>nn</code> and <code>nw</code> respectively). Asides from
a smaller lookup table, it has many good consequences:</p>
<ul>
<li>Both <code>a</code> and <code>and</code> share the common prefix, <code>ny</code>, and can be discarded
altogether. Note that <code>ny</code> itself does not appear from other entries.</li>
<li><code>thousand</code> is interpreted as <code>tsan</code>, which is equivalent to <code>tfyn</code> in the
octal scheme. As it is the only entry with <code>tf</code> prefix, it can be shorten by
one character.</li>
</ul>
<p>Having said this important trick, other details should be relatively easier to
follow. The order of lookup table, for example, is very important,
and the biggest constant 6177 is not arbitrarily chosen.</p>
<h2>Acknowledgement</h2>
<p>[Removed for proper judgement: I&rsquo;ll fill this section if I do win.]</p>
<p>[Note: If you think you&rsquo;ve seen this program elsewhere, you are probably right;
I&rsquo;m submitting a program I have published years ago (and I have written myself,
of course). Neither rules nor guidelines disallow such a resubmission, so I guess
it&rsquo;s fine.]</p>
<hr />
<!--
(c) Copyright 1984-2015, [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>&copy; 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>&nbsp;<!--<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>
+160
View File
@@ -0,0 +1,160 @@
# Best short program
Seonghoon Kang
<kang.seonghoon@mearie.org>
## Judges' comments:
### To build:
make kang
### To run:
echo "full spelling of an English cardinal numeral less than a quadrillion" | ./kang
### Try:
echo Nineteen hundred and eighty-four | ./kang
echo uno | ./kang
echo trois | ./kang
echo fier | ./kang
echo "shest'" | ./kang
### Selected Judges Remarks:
The judges were able to appreciate the Indo-European language family
relation by making this entry successfully recognize *some* French,
German, Italian, Russian, and Spanish numerals.
Also worth mentioning is this entry's ability to understand the
colloquial year numbers of the last millennium.
We've added a linefeed to the print format for convenience.
## Author's comments:
## Synopsis
This short program reads a spelt number (e.g. `forty-two`) and writes a
corresponding decimal number (e.g. `42`). Too long for one-liners, alas,
but it still qualifies as a *short* program as it has less than 0x100 bytes.
It accepts a variety of spelt numbers:
* It correctly handles `zero`.
* Hyphen does not make a difference: `forty-two` and `forty two` are same.
So does period or comma.
* Cases do not make a difference either: `TWO`, `Two`, `two` are same.
* `one` and `a` are interchangeable: `one hundred` and `a hundred` are same.
* `and` is optional: `one hundred twenty-three` and `one hundred and twenty-three`
are same.
* It supports every non-negative integer less than 10<sup>15</sup>-1. It uses
the small scale (i.e. American): `billion` is 10<sup>9</sup> and `trillion` is
10<sup>12</sup>.
It does *not* accept some spelt numbers, which I found mostly irrelevant:
* A bare `hundred`, `thousand` etc. do not work.
* `one million million` does not work. Get used to `one trillion`!
## Requirements
This program is quite portable, only requiring the following:
* The signature `int main(int, int)` should be accepted by the linker.
* `char` should be at least 8 bits long (as dictated by the standard), `int`
should be at least 32 bits long, `long long` should be at least 64 bits long.
* Both the compiler and execution environment should use an ASCII-compatible
character set and two's complement representation.
* Overflow and underflow on `char` should wrap around, if your `char` is unsigned.
* [A trustworthy compiler][trustingtrust].
[trustingtrust]: http://cm.bell-labs.com/who/ken/trust.html
The design of the program explicitly allows for `EOF` which does not equal to -1
(it has to be negative per the standard) and both signed and unsigned `char`,
for example. Furthermore it is endian-independent.
## Obfuscations
Many obfuscations used are typical for standard IOCCC entries:
* Two arguments from `main` function are reused as normal variables.
* Every conditional has been replaced with `?:` ternary operator and `||`
short-circuiting operator.
* It has exactly three nested `for` loops and nothing else.
* Common two's complement tricks: `~-a` instead of `a-1`,
`~a?...:...` instead of `a!=-1?...:...`, etc.
* Comma operators (`,`) for multiple statements. The number of them is
minimized, however, as it is too easy to (ab)use them.
* It lacks most parentheses around bitwise and arithmetic operators. It was
originally written for shortness so parentheses were **EVIL**.
* `n["string"]` instead of `"string"[n]`. Both are fine for this program but
I went to the former just for fun.
* Utter lack of any kind of layouts. (Oh, except for the first column.)
Other obfuscations are more subtle:
* The string `"1+DIY/.K430x9G(kC["` is 18 bytes long, but actually 19 bytes
including the final null character are used.
* It internally represents numbers as hexadecimal. When the input is `two
hundred and three`, it actually writes 0x203 as hexadecimal.
* Some variables (notably, `n`) have dual uses.
* The magic number [42][hhgg] makes an appearance.
* It has a long long numb-`main`-er within it!
[hhgg]: http://en.wikipedia.org/wiki/Answer_to_The_Ultimate_Question_of_Life,_the_Universe,_and_Everything
But the most important obfuscation is the clever construction of lookup table.
The program uses 11 different characters required for recognizing 22 lexemes:
zero one tw- th(i)r- fo(u)r- fi- six-
seven- eigh- nin- ten eleven twelve
hundred(s) thousand(s) million(s) billion(s) trillion(s)
a and -teen -ty
So that they are internally represented as like:
r n tw- tr- fr- f- s-
sn- g- nn- tn ln twl
nr(s) tsan(s) lln(s) blln(s) trlln(s)
a an -tn -ty
The stemmer recognizes the longest matching prefix, so every lexeme can be
recognized by at most three characters (e.g. `trl` instead of `trlln`). This is
also handy for ignoring plurals. But that would make that the table does not fit
in the printable byte---11<sup>2</sup> is already almost 2<sup>7</sup>!
The trick is to use octal; three characters (`a`, `b` and `g`) are interpreted
as sequences of two characters (`ny`, `nn` and `nw` respectively). Asides from
a smaller lookup table, it has many good consequences:
* Both `a` and `and` share the common prefix, `ny`, and can be discarded
altogether. Note that `ny` itself does not appear from other entries.
* `thousand` is interpreted as `tsan`, which is equivalent to `tfyn` in the
octal scheme. As it is the only entry with `tf` prefix, it can be shorten by
one character.
Having said this important trick, other details should be relatively easier to
follow. The order of lookup table, for example, is very important,
and the biggest constant 6177 is not arbitrarily chosen.
## Acknowledgement
[Removed for proper judgement: I'll fill this section if I do win.]
[Note: If you think you've seen this program elsewhere, you are probably right;
I'm submitting a program I have published years ago (and I have written myself,
of course). Neither rules nor guidelines disallow such a resubmission, so I guess
it's fine.]
--------------------------------------------------------------------------------
<!--
(c) Copyright 1984-2015, [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/
-->
+5
View File
@@ -0,0 +1,5 @@
long long n,u,m,b;main(e,r)char **r;{f\
or(;n++||(e=getchar()|32)>=0;b="ynwtsflrabg"[n%=11]-e?b:b*8+
n)for(r=b%64-25;e<47&&b;b/=8)for(n=19;n;n["1+DIY/.K430x9\
G(kC["]-42&255^b||(m+=n>15?n:n>9?m%u*~-u:~(int)r?n+
!(int)r*16:n*16,b=0))u=1ll<<6177%n--*4;printf("%llx\n",m);}
+5
View File
@@ -0,0 +1,5 @@
long long n,u,m,b;main(e,r){f\
or(;n++||(e=getchar()|32)>=0;b="ynwtsflrabg"[n%=11]-e?b:b*8+
n)for(r=b%64-25;e<47&&b;b/=8)for(n=19;n;n["1+DIY/.K430x9\
G(kC["]-42&255^b||(m+=n>15?n:n>9?m%u*~-u:~r?n+
!r*16:n*16,b=0))u=1ll<<6177%n--*4;printf("%llx",m);}
+209
View File
@@ -0,0 +1,209 @@
#!/usr/bin/env make
#
# 2012 makefile
#
# This work by Landon Curt Noll, Simon Cooper, and Leonid A. Broukhis
# is licensed under:
#
# 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
# Set X11_LIBDIR to the directory where the X11 library resides
#
X11_LIBDIR= /usr/X11R6/lib
# Set X11_INCLUDEDIR to the directory where the X11 include files reside
#
X11_INCDIR= /usr/X11R6/include
# Compiler warnings
#
#CWARN=
CWARN= -Wall -W
#CWARN= -Wall -W -pedantic
# compiler standard
#
#CSTD=
#CSTD= -ansi
CSTD= -std=c99
# compiler bit architecture
#
# Some entries require 32-bitness:
# ARCH= -m32
#
# Some entries require 64-bitess:
# ARCH= -m64
#
# By default we assume nothing:
#
ARCH=
# 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=
#OPT= -O
#OPT= -O1
OPT= -O2
#OPT= -O3
# Libraries needed to build
#
LIBS=
# default flags for ANSI C compilation
#
CFLAGS= ${CWARN} ${CSTD} ${ARCH} ${OPT} ${LIBS}
# ANSI compiler
#
# Set CC to the name of your ANSI compiler.
#
# Some entries seem to need gcc. If you have gcc, set
# both CC and MAY_NEED_GCC to gcc.
#
# If you do not have gcc, set CC to the name of your ANSI compiler, and
# set MAY_NEED_GCC to either ${CC} (and hope for the best) or to just :
# to disable such programs.
#
CC= cc
#CC=clang
MAY_NEED_GCC= gcc
##############################
# Special flags for this entry
##############################
#
ENTRY= konno
DATA=
ALT_OBJ= konno_deobfuscate.o konno.orig.o
ALT_ENTRY= konno_deobfuscate konno.orig
#################
# build the entry
#################
#
all: ${ENTRY} ${DATA}
@${TRUE}
${ENTRY}: ${ENTRY}.c
${CC} ${CFLAGS} $< -o $@
# alternative executable
#
alt: ${ALT_ENTRY}
@${TRUE}
konno.orig: ${ENTRY}.orig.c
${CC} ${CFLAGS} $< -o $@
konno_deobfuscate: konno_deobfuscate.c
${CC} ${CFLAGS} $< -o $@
# data files
#
data: ${DATA}
@${TRUE}
###############
# utility rules
###############
#
everything: all alt
clean:
${RM} -f ${ENTRY}.o ${ALT_OBJ}
clobber: clean
${RM} -f ${ENTRY} ${ALT_ENTRY}
nuke: clobber
@${TRUE}
dist_clean: nuke
@${TRUE}
install:
@echo "Surely you're joking Mr. Feynman!"
@${TRUE}
# backwards compatibility
#
build: all
@${TRUE}
##################
# 133t hacker rulz
##################
#
love:
@echo 'not war?'
@${TRUE}
haste:
$(MAKE) waste
@${TRUE}
waste:
@echo 'waste'
@${TRUE}
easter_egg:
@echo you expected to mis-understand this $${RANDOM} magic
@echo chongo '<was here>' "/\\oo/\\"
@echo Readers shall be disallowed from not being unable to partly misunderstand this partocular final echo.
# Understand the history of "I Am the Walrus" and
# and in particular John Lennon's remarks on that
# song and you might be confused about these next
# rules in a different way. :-)
#
supernova: nuke
@-if [ -r .code_anal ]; then \
${RM} -f .code_anal_v3; \
else \
echo "You are not expected to understand this"; \
fi
@${TRUE}
deep_magic:
@-if [ -r .code_anal ]; then \
ccode_analysis --deep_magic 1c2c85c7a02c55d1add91967eca491d53c101dc1 --FNV1a_hash 256-bit "${ENTRY}"; \
else \
echo "Understand different"; \
fi
@${TRUE}
magic: deep_magic
@-if [ -r .code_anal ]; then \
ccode_analysis --mode 21701 --level 23209 --FNV1a_hash 256-bit "${ENTRY}"; \
else \
echo "These aren't the droids you're looking for Mr. Spock!"; \
fi
@${TRUE}
+97
View File
@@ -0,0 +1,97 @@
<!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 one liner</title>
</head>
<body>
<h1>Best one liner</h1>
<p>Taketo Konno<br>
Tokyo, Japan<br>
<a href="&#109;&#97;&#105;&#108;&#116;&#x6f;&#x3a;&#x69;&#x6e;&#x61;&#x6e;&#105;&#119;&#x61;&#x33;&#64;&#103;&#109;&#97;&#105;&#108;&#46;&#x63;&#111;&#109;">&#105;&#x6e;&#97;&#x6e;&#105;&#119;&#x61;&#x33;&#64;&#x67;&#x6d;&#97;&#105;&#108;&#x2e;&#x63;&#x6f;&#x6d;</a></p>
<h2>Judges' comments:</h2>
<h3>To build:</h3>
<pre><code>make konno
</code></pre>
<h3>To run:</h3>
<pre><code>./konno N
# where N is 0 to 255
</code></pre>
<h3>Try:</h3>
<pre><code>./konno 30
</code></pre>
<h3>Selected Judges Remarks:</h3>
<p>This entry is a good one-liner to analyze completely.</p>
<p>For extra credit, what are the minimal changes to convert it to
64-bit integers so that it could print 32 lines?</p>
<h2>Author&rsquo;s comments:</h2>
<h3>Remarks</h3>
<p>This program outputs <a href="http://mathworld.wolfram.com/ElementaryCellularAutomaton.html">elementary cellular automaton</a> patterns.</p>
<p>Try:</p>
<pre><code>./konno 30
./konno 90
./konno 102
./konno 109
./konno 165
</code></pre>
<p>There are 256 (from 0 to 255) possible rules.</p>
<h3>Obfuscation</h3>
<p>This program uses bit operations. I think</p>
<pre><code>7&amp;O&lt;&lt;!o&gt;&gt;!o+29
</code></pre>
<p>is an intersting operation. This isn&rsquo;t equal to</p>
<pre><code>7&amp;O&gt;&gt;29
</code></pre>
<p>operation. What is the operation doing?</p>
<h3>Limitation</h3>
<p>This program assumes that the size of int is 4.</p>
<hr />
<!--
(c) Copyright 1984-2015, [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>&copy; 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>&nbsp;<!--<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>
+67
View File
@@ -0,0 +1,67 @@
# Best one liner
Taketo Konno
Tokyo, Japan
<inaniwa3@gmail.com>
## Judges' comments:
### To build:
make konno
### To run:
./konno N
# where N is 0 to 255
### Try:
./konno 30
### Selected Judges Remarks:
This entry is a good one-liner to analyze completely.
For extra credit, what are the minimal changes to convert it to
64-bit integers so that it could print 32 lines?
## Author's comments:
### Remarks
This program outputs [elementary cellular automaton](http://mathworld.wolfram.com/ElementaryCellularAutomaton.html) patterns.
Try:
./konno 30
./konno 90
./konno 102
./konno 109
./konno 165
There are 256 (from 0 to 255) possible rules.
### Obfuscation
This program uses bit operations. I think
7&O<<!o>>!o+29
is an intersting operation. This isn't equal to
7&O>>29
operation. What is the operation doing?
### Limitation
This program assumes that the size of int is 4.
--------------------------------------------------------------------------------
<!--
(c) Copyright 1984-2015, [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/
-->
+1
View File
@@ -0,0 +1 @@
int _;main(O,l,o)char**l,**o;{_++>>9||main(1&(o?(int)o:O)|O*2,l,putchar(_%32?atoi(1[l])>>(7&O<<!o>>!o+29)&32<_|_==16?35:32:10)%10);}
+1
View File
@@ -0,0 +1 @@
int _;main(O,l,o)char**l;{_++>>9||main(1&(o?o:O)|O*2,l,putchar(_%32?atoi(1[l])>>(7&O<<!o>>!o+29)&32<_|_==16?35:32:10)%10);}
+8
View File
@@ -0,0 +1,8 @@
int count;
main(argc, argv, env)
char **argv, **env;
{
if (count++ < 512) {
main(1 & (env ? (int) env : argc) | argc * 2, argv, putchar(count % 32 ? atoi(1[argv]) >> (7 & argc << !env >> !env + 29) & 32 < count | count == 16 ? '#' : ' ' : '\n') % 10);
}
}
+203
View File
@@ -0,0 +1,203 @@
#!/usr/bin/env make
#
# 2012 makefile
#
# This work by Landon Curt Noll, Simon Cooper, and Leonid A. Broukhis
# is licensed under:
#
# 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
# Set X11_LIBDIR to the directory where the X11 library resides
#
X11_LIBDIR= /usr/X11R6/lib
# Set X11_INCLUDEDIR to the directory where the X11 include files reside
#
X11_INCDIR= /usr/X11R6/include
# Compiler warnings
#
#CWARN=
CWARN= -Wall -W
#CWARN= -Wall -W -pedantic
# compiler standard
#
#CSTD=
#CSTD= -ansi
CSTD= -std=c99
# compiler bit architecture
#
# Some entries require 32-bitness:
# ARCH= -m32
#
# Some entries require 64-bitess:
# ARCH= -m64
#
# By default we assume nothing:
#
ARCH=
# 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=
#OPT= -O
#OPT= -O1
OPT= -O2
#OPT= -O3
# Libraries needed to build
#
LIBS=
# default flags for ANSI C compilation
#
CFLAGS= ${CWARN} ${CSTD} ${ARCH} ${OPT} ${LIBS}
# ANSI compiler
#
# Set CC to the name of your ANSI compiler.
#
# Some entries seem to need gcc. If you have gcc, set
# both CC and MAY_NEED_GCC to gcc.
#
# If you do not have gcc, set CC to the name of your ANSI compiler, and
# set MAY_NEED_GCC to either ${CC} (and hope for the best) or to just :
# to disable such programs.
#
CC= cc
#CC=clang
MAY_NEED_GCC= gcc
##############################
# Special flags for this entry
##############################
#
ENTRY= nyaruko
DATA= spoiler.html.gz
ALT_OBJ=
ALT_ENTRY=
#################
# build the entry
#################
#
all: ${ENTRY} ${DATA}
@${TRUE}
${ENTRY}: ${ENTRY}.c
${CC} ${CFLAGS} $< -o $@
# alternative executable
#
alt: ${ALT_ENTRY}
@${TRUE}
# data files
#
data: ${DATA}
@${TRUE}
###############
# utility rules
###############
#
everything: all alt
clean:
${RM} -f ${ENTRY}.o ${ALT_OBJ}
clobber: clean
${RM} -f ${ENTRY} ${ALT_ENTRY}
nuke: clobber
@${TRUE}
dist_clean: nuke
@${TRUE}
install:
@echo "Surely you're joking Mr. Feynman!"
@${TRUE}
# backwards compatibility
#
build: all
@${TRUE}
##################
# 133t hacker rulz
##################
#
love:
@echo 'not war?'
@${TRUE}
haste:
$(MAKE) waste
@${TRUE}
waste:
@echo 'waste'
@${TRUE}
easter_egg:
@echo you expected to mis-understand this $${RANDOM} magic
@echo chongo '<was here>' "/\\oo/\\"
@echo Readers shall be disallowed from not being unable to partly misunderstand this partocular final echo.
# Understand the history of "I Am the Walrus" and
# and in particular John Lennon's remarks on that
# song and you might be confused about these next
# rules in a different way. :-)
#
supernova: nuke
@-if [ -r .code_anal ]; then \
${RM} -f .code_anal_v3; \
else \
echo "You are not expected to understand this"; \
fi
@${TRUE}
deep_magic:
@-if [ -r .code_anal ]; then \
ccode_analysis --deep_magic 1c2c85c7a02c55d1add91967eca491d53c101dc1 --FNV1a_hash 256-bit "${ENTRY}"; \
else \
echo "Understand different"; \
fi
@${TRUE}
magic: deep_magic
@-if [ -r .code_anal ]; then \
ccode_analysis --mode 21701 --level 23209 --FNV1a_hash 256-bit "${ENTRY}"; \
else \
echo "These aren't the droids you're looking for Mr. Spock!"; \
fi
@${TRUE}
+184
View File
@@ -0,0 +1,184 @@
<!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 surreptitious</title>
</head>
<body>
<h1>Most surreptitious</h1>
<p>Don Yang<br>
<a href="&#109;&#97;&#105;&#108;&#116;&#x6f;&#x3a;&#x6f;&#x6d;&#x6f;&#x69;&#107;&#97;&#x6e;&#x65;&#64;&#117;&#103;&#117;&#117;&#46;&#111;&#x72;&#103;">&#111;&#109;&#x6f;&#105;&#x6b;&#97;&#110;&#x65;&#x40;&#117;&#x67;&#x75;&#117;&#46;&#111;&#x72;&#x67;</a><br>
<a href="http://uguu.org/">http://uguu.org/</a></p>
<h2>Judges' comments:</h2>
<h3>To build:</h3>
<pre><code>make nyaruko
</code></pre>
<h3>To run:</h3>
<pre><code>./nyaruko [seed.txt] &lt; original.bin &gt; output.c
bash output.c &gt; key.c
perl output.c &gt; data.c
cat key.c data.c &gt; output.c
gcc output.c -o output
./output &gt; regenerated.bin
</code></pre>
<h3>Try:</h3>
<pre><code>echo "A quick brown fox jumps over the lazy dog" | ./nyaruko &gt; output.c
perl output.c &gt; data.c
gcc -o data data.c
./data
gcc -o output output.c
./output
</code></pre>
<h3>Selected Judges Remarks:</h3>
<p>The judges have nothing to add that has not already been written
about in the spoiler.html.gz file! :-)</p>
<h2>Author&rsquo;s comments:</h2>
<h1>Usage</h1>
<p>Nyaruko is a binary to text filter. Given some input on stdin,
Nyaruko will produce C code that reproduces this input on stdout:</p>
<pre><code>./nyaruko &lt; original.bin &gt; output.c
gcc output.c -o output
./output &gt; regenerated.bin
</code></pre>
<p>Output is encrypted, but both key and data are included in the output.
To separate the key from the data, run these commands:</p>
<pre><code>bash output.c &gt; key.c
perl output.c &gt; data.c
</code></pre>
<p>The key-less data.c still compiles, but produces a different message
on stdout instead of the original input. This message is a hint to
why the code is formatted the way it is.</p>
<p>To combine the key and data, concatenate them together in either
order:</p>
<pre><code>cat key.c data.c &gt; output.c
cat data.c key.c &gt; output.c
</code></pre>
<p>By default, Nyaruko generates a unique random key for every message,
using /dev/urandom as the seed. If given an extra command line
argument, Nyaruko will seed using that file instead of /dev/urandom:</p>
<pre><code>./nyaruko seed.txt &lt; input.bin &gt; output.c
</code></pre>
<p>This makes the output key deterministic, allowing the same key to be
shared across different files. On operating systems that do not have
/dev/urandom, users should always specify this extra seed argument to
avoid deterministic keys.</p>
<h1>Features</h1>
<p>Implementation details that makes Nyaruko more obfuscated than usual
programs:</p>
<ul>
<li> Nyaruko recycles variables and buffers to reduce internal state.
The variable names are also carefully chosen for mixed-case
madness.</li>
<li> Nyaruko employs some preprocessor magic to share much of the same
code and state between the encoder and decoder, and to increase
occurrences of smileys ;)</li>
</ul>
<p>Output code has these features:</p>
<ul>
<li> Fits nicely under 80 columns, and does not contain any trigraphs.</li>
<li> Uses a fairly efficient encoding scheme, better than uuencode for
files larger than ~13K, and better than base64 for files larger
than 20K.</li>
<li> Encryption with ISAAC, a cryptographically secure pseudorandom
number generator.</li>
<li> Trivial 3 language polyglot.</li>
</ul>
<p>Code layout is meant to resemble Nyaruko, also known as Nyarlathotep,
the Crawling Chaos. The most obvious thing to do with chaos is to
make a random number generator, and the most obvious thing to do with
a random number generator is to make one-time-pads for encryption.</p>
<h1>Compatibility</h1>
<p>Nyaruko has these environment dependencies:</p>
<ul>
<li> Requires ASCII character set.</li>
<li> Assumes sizeof(unsigned int) == 4.</li>
<li> Best viewed with tab stops set to 8 spaces.</li>
</ul>
<p>Output code has the same dependencies, with the additional
requirement that the compiler must support arbitrarily long string
literals. Maximum input size that can be encoded while still
producing standard-compliant output is ~276 bytes for C89, and ~3168
bytes for C99.</p>
<p>Nyaruko has been to verified to work with these compiler/OS
combinations:</p>
<ul>
<li> gcc 4.4.5 on Linux (32bit and 64bit)</li>
<li> clang 3.1 on Windows (Cygwin)</li>
<li> gcc 4.5.3 on Windows (Cygwin)</li>
<li> gcc 4.5.3 on Windows (MingW)</li>
<li> gcc 4.3.5 on JSLinux</li>
<li> tcc 0.9.25 on JSLinux</li>
</ul>
<p>Note that on MingW, stdin and stdout are not opened in binary mode by
default, this means Nyaruko may not faithfully encode files on MingW.</p>
<h1>Extra files</h1>
<p>spoiler.html.gz - Contains full recording of how the code went from
blank state to an obfuscated program, gzipped to fit under 1MB.</p>
<hr />
<!--
(c) Copyright 1984-2015, [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>&copy; 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>&nbsp;<!--<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>
+146
View File
@@ -0,0 +1,146 @@
# Most surreptitious
Don Yang
<omoikane@uguu.org>
<http://uguu.org/>
## Judges' comments:
### To build:
make nyaruko
### To run:
./nyaruko [seed.txt] < original.bin > output.c
bash output.c > key.c
perl output.c > data.c
cat key.c data.c > output.c
gcc output.c -o output
./output > regenerated.bin
### Try:
echo "A quick brown fox jumps over the lazy dog" | ./nyaruko > output.c
perl output.c > data.c
gcc -o data data.c
./data
gcc -o output output.c
./output
### Selected Judges Remarks:
The judges have nothing to add that has not already been written
about in the spoiler.html.gz file! :-)
## Author's comments:
Usage
=====
Nyaruko is a binary to text filter. Given some input on stdin,
Nyaruko will produce C code that reproduces this input on stdout:
./nyaruko < original.bin > output.c
gcc output.c -o output
./output > regenerated.bin
Output is encrypted, but both key and data are included in the output.
To separate the key from the data, run these commands:
bash output.c > key.c
perl output.c > data.c
The key-less data.c still compiles, but produces a different message
on stdout instead of the original input. This message is a hint to
why the code is formatted the way it is.
To combine the key and data, concatenate them together in either
order:
cat key.c data.c > output.c
cat data.c key.c > output.c
By default, Nyaruko generates a unique random key for every message,
using /dev/urandom as the seed. If given an extra command line
argument, Nyaruko will seed using that file instead of /dev/urandom:
./nyaruko seed.txt < input.bin > output.c
This makes the output key deterministic, allowing the same key to be
shared across different files. On operating systems that do not have
/dev/urandom, users should always specify this extra seed argument to
avoid deterministic keys.
Features
========
Implementation details that makes Nyaruko more obfuscated than usual
programs:
* Nyaruko recycles variables and buffers to reduce internal state.
The variable names are also carefully chosen for mixed-case
madness.
* Nyaruko employs some preprocessor magic to share much of the same
code and state between the encoder and decoder, and to increase
occurrences of smileys ;)
Output code has these features:
* Fits nicely under 80 columns, and does not contain any trigraphs.
* Uses a fairly efficient encoding scheme, better than uuencode for
files larger than ~13K, and better than base64 for files larger
than 20K.
* Encryption with ISAAC, a cryptographically secure pseudorandom
number generator.
* Trivial 3 language polyglot.
Code layout is meant to resemble Nyaruko, also known as Nyarlathotep,
the Crawling Chaos. The most obvious thing to do with chaos is to
make a random number generator, and the most obvious thing to do with
a random number generator is to make one-time-pads for encryption.
Compatibility
=============
Nyaruko has these environment dependencies:
* Requires ASCII character set.
* Assumes sizeof(unsigned int) == 4.
* Best viewed with tab stops set to 8 spaces.
Output code has the same dependencies, with the additional
requirement that the compiler must support arbitrarily long string
literals. Maximum input size that can be encoded while still
producing standard-compliant output is ~276 bytes for C89, and ~3168
bytes for C99.
Nyaruko has been to verified to work with these compiler/OS
combinations:
* gcc 4.4.5 on Linux (32bit and 64bit)
* clang 3.1 on Windows (Cygwin)
* gcc 4.5.3 on Windows (Cygwin)
* gcc 4.5.3 on Windows (MingW)
* gcc 4.3.5 on JSLinux
* tcc 0.9.25 on JSLinux
Note that on MingW, stdin and stdout are not opened in binary mode by
default, this means Nyaruko may not faithfully encode files on MingW.
Extra files
===========
spoiler.html.gz - Contains full recording of how the code went from
blank state to an obfuscated program, gzipped to fit under 1MB.
--------------------------------------------------------------------------------
<!--
(c) Copyright 1984-2015, [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/
-->
+46
View File
@@ -0,0 +1,46 @@
#include<stdio.h>
typedef unsigned int _;_ d,b,
#define i(I1,Il,lI)if(Il){lI;}else{I1;}
I[256], n,y,a,r,u,k,o
,L,l[ 256],O,K[
/**/ #define\
q(g) g char\
*C, *Q,c[\
]= "KfW"\
"" "Ww|"\
/* 'UU!\
% NYA!\
*/ "Z}"\
";fRo?JtJaV<x4@*?R?&JV1" ".s"\
"{Fyj2_;khB1xQ5oxm~mS@B|(pa>oRU" "Ro"\
"nB}h@o?)d.X)NSTIUCz7@%",*s[]={c,"#en" "di"\
"f/*}||1;\n__DATA__\40*/\n\n#ifndef\40q\n#d" "ef"\
"ine\x20q\n#include<stdio.h>\ntypedef\40unsign" "e"\
"d\x20int\x20_;_\x20K[]={\n#include\40__FILE__\n#u" "n"\
"def q","0},L,O,l[256],I[256],n,y,a,r,u,k,o;"#g"char" "*"\
"S,s[]=\"",c,c,"\";int main(){X();for(S=s+*K;*S>37;){for" "(o"\
"=0;o<5;o++)r=r*85+(83+*S++)%89;r","^=*x();for(o=0;o<4;o++" ")"\
"{s[O++]=r&255;r>>=8;}}return!fwrite(s,O-*S%5,1,stdout);}\n" "#"\
"endif",c},S[256]="#ifdef/*\n'true'\40or\40q{\nexec\40head\40" "-"\
"8\40$0\n};for(open$O,$0;<$O>;print\40if$f){$f|=/^$/;}q{*/q",/* */z;
256];q(_*x(){if(!L--){y+=++a;for(o=0;o<256;y=l[o++]=I[255&(k>>10 )]+u
){n^=(o&1)?n>>(( o& 2)?16:6):n<<((o&2)?2:13);u=I[o];k=I[o]=I[255& (u>>
2)]+(n+=I[(o+128) & 255]) +y;}L=255;}return&l[L];}_*X(){for(O=0 ;256
>O;I[O++]=0);for(O = 0; sizeof(K)/sizeof( _)> O;O++)I[O&255] ^=K[
O];for(n=y=a=L=O=0 ;O<1<<24;++ O)x( );r=O=0x0; return&O;})int/*^^*/ main
(int p,char**P){FILE* Z=fopen(p> (+ 1)?P[01 ] :"/dev/urandom", "rb"
);i(;,Z,O=fread(K,256 ,4,Z);/*P */ fclose(Z))X();for(p=b=d =O=
0;O<256;K[O++]=0)*K=+ 86;for(O =1;12> O;K[O++]=*x());X(); for
(C=Q=S;r-8;){i(*C++=34, (r-4&&r -5)||C- S ,;)z=Q[p++];i(;,z !=
32||r-3,i(i(C+=sprintf(( C), "%uU" ",",K[b++]);i(d=1;C =S
;i(d=02,b-12,;),b%6,;),r-1 ,i(b= fread(c,1,4,stdin);i (p
=O=0,b,for(d=O=0;O<04;O++)d +=(c[O]&255)<<(8*O);d ^=
*x();for(p=5;p;c[--p]=O<32?O+ 95:O+6){O=d%85;d/=85;} O=
5)i(d=0,b<4,c[O++]=b?b-1?b-2?36: 37:33:35 ;d=2)c[O]=0,r-4,i(i (d= 2
|d,C!=S+6,*C++=(*x()%34)+93;p--),r -5,*s= C;d|=2) )),z ,i(*C++ =92 ,
z-63||C [-1]-63||C>S+76,;)*C++=z))i( ;,d>1,d= d-2 ;Q=s[r] ;i( ;
,r<3|| r>5,d=1;i(;,r-1, *C=0)C=S) i(;, r-4, p=0)++ r) i(*(C++ )=
34,r <4||r>5|| C<S+ 78,;)i (*C++=0;d=1; C=S ,r<3 || r>
5 ||C<S+ 79,; )i(;,d, puts (
S); d=0 )} return
0;}
Binary file not shown.
+196
View File
@@ -0,0 +1,196 @@
21st International Obfuscated C Code Contest Official Rules
Copyright (C) 2006-2012 Leonid A. Broukhis, Simon Cooper, Landon Curt Noll
All Rights Reserved. Permission for personal, education or non-profit use is
granted provided this this copyright and notice are included in its entirety
and remains unaltered. All other uses must receive prior permission in
writing from the contest judges.
Obfuscate: tr.v. -cated, -cating, -cates. 1. a. To render obscure.
b. To darken. 2. To confuse: his emotions obfuscated his
judgment. [LLat. obfuscare, to darken : ob(intensive) +
Lat. fuscare, to darken < fuscus, dark.] -obfuscation n.
obfuscatory adj.
This rules file is version 2012-08-15.
GOALS OF THE CONTEST:
* To write the most Obscure/Obfuscated C program under the rules below.
* To show the importance of programming style, in an ironic way.
* To stress C compilers with unusual code.
* To illustrate some of the subtleties of the C language.
* To provide a safe forum for poor C code. :-)
The 21st IOCCC contest window is:
| 2012-Aug-15 3:14:15 UTC to 2012-Sep-14 9:26:53 UTC
RULES:
| Lines marked with a "|" indicate changes to the rules.
| Please note: These rules are preliminary. Any modifications will be
| announced before the submission server goes live.
To help us with the volume of entries, we ask that you follow these rules:
1) Your entry must be a complete program.
2) The size of your program source must be <= 4096 bytes in length.
The number of characters excluding whitespace (tab, space,
newline, formfeed, return), and excluding any ; { or } immediately
followed by whitespace or end of file, must be <= 2048.
3) Submissions should be performed using the instructions outlined at,
https://submit.ioccc.org/
| (The above URL will be active by 2012-Aug-15)
4) If your entry is selected as a winner, it will be modified as follows:
| Your 'build' instructions will be incorporated into a makefile.
|
| Your source code will be renamed from prog.c to a name
| of our choice (usually related to your family name or
| anonymous) followed by a optional digit if there are conflicting
| winning entries. The resulting binary will be renamed from prog to a
| equivalent of our choice.
|
| If needed, indicate in your remarks file how your entry
| must be changed to accommodate the above.
| 5) Your entry must not modify the content or filename of any part of your
| original entry including, but not limited to prog.c, the Makefile
| (we create from your how to build instructions), as well as any data
| files you submit.
|
| If you entry wishes to modify such content, it must first copy the
| file to a new filename and then modify that copy.
| 6) There is NO rule 6! OK, there is a rule 6, but we intend to ignore it.
| 7) The obfuscated C program must be an original work that you own.
|
| You (the authors) must own the contents of your submission OR
| you must have permission from the owners to submit their content
| under the Creative Commons Attribution-ShareAlike 3.0 Unported
| (CC BY-SA 3.0) license (see rule 18).
|
| If you submit any content that is owned by others, you MUST
| detail that ownership (i.e., who owns what) and document the
| permission you obtained.
| 8) Entries must be received prior to 2012-Sep-14 9:26:53 UTC.
| A confirmation of submission will be sent to the submitter's
| email address before the close of the contest.
9) Each person may submit up to 8 entries per contest year. Each entry
must be submitted separately.
10) Entries requiring human interaction to be built are not permitted.
11) Programs that require special privileges (setuid, setgid, super-user,
special owner or group) are highly discouraged.
12) Legal abuse of the rules is somewhat encouraged. An entry that, in
the opinion of the judges, violates the rules will be disqualified.
Entries that attempt to abuse the rules must try to justify why
| their rule abuse is legal in the remarks file.
| 13) Any C source that needs to be compiled may not contain unescaped
| octets with the high bit set (i.e., octet values >= 128).
|
| This rule applies only to compiled C source. Your optional data files
| and your remarks file may contain octets with the high bit set.
| 14) Any C source that fails to compile because of lines with trailing
| control-M's (i.e., lines with a tailing octet 015) will be rejected.
|
| Please do not put trailing control-M's in your remarks file.
15) When you submit your entry you must have a valid email address
that can both send and receive email. The online submission
method is a two phase process that requires the use of an
approval code. This code will be emailed to you as part of
phase 1.
Entries submitted without a working or valid email address will
be disqualified.
The judges are not responsible for delays in email, please plan
enough time for one automated exchange of email as part of your
submission.
16) You are STRONGLY encouraged to submit an original entry.
Submissions that are similar to previous entries are discouraged.
17) The total size of your submission: the sum of the size of the program,
hints, comments, build and info files MUST be less than one megabyte
in size.
| 18) The entirety of your entry must be submitted under the Creative Commons
| Attribution-ShareAlike 3.0 Unported (CC BY-SA 3.0):
|
| http://creativecommons.org/licenses/by-sa/3.0/
|
| You must not submit anything that cannot be submitted under that license.
| 19) The remarks file must be written in markdown format. See
|
| http://daringfireball.net/projects/markdown/basics
|
| for more information.
| 20) The how to build instructions must be in make form.
|
| The target of the make file must be called prog. The original
| C source file must be called prog.c.
|
| To invoke the C compiler, use ${CC}.
| To invoke the C preprocessor use ${CPP}.
|
| Do not assume that . (the current working directory) is in the $PATH.
|
| Use a shell command syntax that is compatible with bash.
|
| Assume that commands commonly found in POSIX-like / Linux-line systems
| are available in the search path.
|
| Do not assume any particular given value of ${CFLAGS} or other
| commonly used make variables.
| 21) Your entry must not create nor modify files above the current directory
| with the exception of the /tmp and the /var/tmp directories. Your entry
| may create subdirectories below the current directory provided that
| the name of such directories do not start with the "." character.
FOR MORE INFORMATION:
The judging will be done by Leonid A. Broukhis, Simon Cooper, Landon
Curt Noll.
Please send questions or comments about the contest, to:
| q.2012@ioccc.org (for questions only!)
| You must include the words ``ioccc 2012 question'' in the subject of
your EMail message when sending EMail to the judges.
The rules and the guidelines may (and often do) change from year to
year. You should be sure you have the current rules and guidelines
prior to submitting entries. To obtain them, visit the IOCCC web page:
http://www.ioccc.org
It has rules, guidelines and winners of previous contests (1984 to date).
Leonid A. Broukhis
Simon Cooper
chongo (Landon Curt Noll) /\cc/\
+207
View File
@@ -0,0 +1,207 @@
#!/usr/bin/env make
#
# 2012 makefile
#
# This work by Landon Curt Noll, Simon Cooper, and Leonid A. Broukhis
# is licensed under:
#
# 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
# Set X11_LIBDIR to the directory where the X11 library resides
#
X11_LIBDIR= /usr/X11R6/lib
# Set X11_INCLUDEDIR to the directory where the X11 include files reside
#
X11_INCDIR= /usr/X11R6/include
# Compiler warnings
#
#CWARN=
CWARN= -Wall -W
#CWARN= -Wall -W -pedantic
# compiler standard
#
#CSTD=
#CSTD= -ansi
CSTD= -std=c99
# compiler bit architecture
#
# Some entries require 32-bitness:
# ARCH= -m32
#
# Some entries require 64-bitess:
# ARCH= -m64
#
# By default we assume nothing:
#
ARCH=
# 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=
#OPT= -O
#OPT= -O1
OPT= -O2
#OPT= -O3
# Libraries needed to build
#
LIBS=
# default flags for ANSI C compilation
#
CFLAGS= ${CWARN} ${CSTD} ${ARCH} ${OPT} ${LIBS}
# ANSI compiler
#
# Set CC to the name of your ANSI compiler.
#
# Some entries seem to need gcc. If you have gcc, set
# both CC and MAY_NEED_GCC to gcc.
#
# If you do not have gcc, set CC to the name of your ANSI compiler, and
# set MAY_NEED_GCC to either ${CC} (and hope for the best) or to just :
# to disable such programs.
#
CC= cc
#CC=clang
MAY_NEED_GCC= gcc
##############################
# Special flags for this entry
##############################
#
ENTRY= tromp
DATA= how13 primes.blc uni.blc uni8.Blc bf.Blc hw.bf deflate.Blc inflate.Blc \
parse.Blc symbolic.Blc primes.pl
ALT_OBJ=
ALT_ENTRY=
#################
# build the entry
#################
#
all: ${ENTRY} ${ENTRY}64 ${DATA}
@${TRUE}
${ENTRY}: ${ENTRY}.c
${CC} ${CFLAGS} -m32 -DInt=int -DX=4 -DA=500000 $< -o $@
${ENTRY}64: ${ENTRY}.c
${CC} ${CFLAGS} -m64 -DInt=long -DX=8 -DA=500000 $< -o $@
# alternative executable
#
alt: ${ALT_ENTRY}
@${TRUE}
# data files
#
data: ${DATA}
@${TRUE}
###############
# utility rules
###############
#
everything: all alt
clean:
${RM} -f ${ENTRY}.o ${ENTRY}64.o ${ALT_OBJ}
clobber: clean
${RM} -f ${ENTRY} ${ENTRY}64 ${ALT_ENTRY}
nuke: clobber
@${TRUE}
dist_clean: nuke
@${TRUE}
install:
@echo "Surely you're joking Mr. Feynman!"
@${TRUE}
# backwards compatibility
#
build: all
@${TRUE}
##################
# 133t hacker rulz
##################
#
love:
@echo 'not war?'
@${TRUE}
haste:
$(MAKE) waste
@${TRUE}
waste:
@echo 'waste'
@${TRUE}
easter_egg:
@echo you expected to mis-understand this $${RANDOM} magic
@echo chongo '<was here>' "/\\oo/\\"
@echo Readers shall be disallowed from not being unable to partly misunderstand this partocular final echo.
# Understand the history of "I Am the Walrus" and
# and in particular John Lennon's remarks on that
# song and you might be confused about these next
# rules in a different way. :-)
#
supernova: nuke
@-if [ -r .code_anal ]; then \
${RM} -f .code_anal_v3; \
else \
echo "You are not expected to understand this"; \
fi
@${TRUE}
deep_magic:
@-if [ -r .code_anal ]; then \
ccode_analysis --deep_magic 1c2c85c7a02c55d1add91967eca491d53c101dc1 --FNV1a_hash 256-bit "${ENTRY}"; \
else \
echo "Understand different"; \
fi
@${TRUE}
magic: deep_magic
@-if [ -r .code_anal ]; then \
ccode_analysis --mode 21701 --level 23209 --FNV1a_hash 256-bit "${ENTRY}"; \
else \
echo "These aren't the droids you're looking for Mr. Spock!"; \
fi
@${TRUE}
BIN
View File
Binary file not shown.
Binary file not shown.
Loaded 100 of 1683 files, more files were not shown because too many files have changed in this diff. Show more