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.
+118
View File
@@ -0,0 +1,118 @@
#!/usr/bin/env make
#
# 2011 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= akari blakely borsanyi dlowe eastman fredriksson goren hou \
konno hamaji richards toledo vik zucker
###################
# 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 not be disallowed from being unable to partly misunderstand this final echo.
@${TRUE}
+79
View File
@@ -0,0 +1,79 @@
2011 marked the "The Twentieth 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 submitters.
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
------------------------------
There were some outstanding entries that did not win. Unfortunately
some very good entries lost because they:
+ did not follow the "one program - one file" rule;
+ depended too much on 32 bit architectures;
+ were more of the "obfuscated math" kind rather than the "obfuscated C" kind.
We hope the authors of some of those entries will fix and re-submit
them for the next IOCCC.
We believe you will be impressed with this year's winners. The Best
of Show is a fine example of character stitching. But don't ignore the other
winners! There are games, puzzle solvers, utilities, eye candy, calculators and graphical and audio tools.
This year all winners are different, and there is a winner from a new country -
China! Many winners won for the first time. (Please note that judging is done
completely anonymously. Be warned that we may disqualify entries that reveal
the identity of the submitter).
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/>
+153
View File
@@ -0,0 +1,153 @@
#!/usr/bin/env make
#
# 2011 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
# Compiler warnings
#
CWARN= -Wall -W -pedantic
# compiler standard
#
CSTD= -std=c99
CSTD2= -ansi
# compiler bit architecture
#
# Some entries require 32-bitness,
# other entries require 64-bitess.
# 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= -O2
# default flags for ANSI C compilation
#
CFLAGS= ${CWARN} ${CSTD} ${ARCH} ${OPT}
CFLAGS2= ${CSTD2} ${ARCH} ${OPT}
# ANSI compiler
#
# Set CC to the name of your ANSI compiler.
#
CC= cc
##############################
# Special flags for this entry
##############################
#
ENTRY= akari
DATA= example.ppm
#################
# build the entry
#################
#
all: ${ENTRY} ${DATA}
@${TRUE}
everything: ${ENTRY} \
${ENTRY}2.c ${ENTRY}2 \
${ENTRY}3.c ${ENTRY}3 \
${ENTRY}4.c ${ENTRY}4
@${TRUE}
${ENTRY}: ${ENTRY}.c
${CC} ${CFLAGS} ${ENTRY}.c -o ${ENTRY}
${ENTRY}2.c: ${ENTRY}
./${ENTRY} ${ENTRY}.c $@
${ENTRY}2: ${ENTRY}2.c
${CC} ${CFLAGS} ${ENTRY}2.c -o $@
${ENTRY}3.c: ${ENTRY} ${ENTRY}.c
./${ENTRY} < ${ENTRY}.c | ./${ENTRY} > $@
${ENTRY}3: ${ENTRY}3.c
${CC} ${CFLAGS2} ${ENTRY}3.c -o $@
${ENTRY}4.c: ${ENTRY} ${ENTRY}.c
./${ENTRY} < ${ENTRY}.c | ./${ENTRY} | ./${ENTRY} > $@
${ENTRY}4: ${ENTRY}4.c
${CC} ${CFLAGS2} ${ENTRY}4.c -o $@
# alternative executable
#
alt:
@${TRUE}
###############
# utility rules
###############
#
everything: all alt
clean:
${RM} -f ${ENTRY}.o ${ENTRY}2.c ${ENTRY}3.c ${ENTRY}4.c
clobber: clean
${RM} -f ${ENTRY} ${ENTRY}2 ${ENTRY}3 ${ENTRY}4
nuke: clobber
@echo gnab gib!
install:
@echo "Surely you're joking Mr. Feynman!"
# backwards compatibility
#
build: all
##################
# 133t hacker rulz
##################
#
love:
@echo 'not war?'
haste:
$(MAKE) waste
waste:
@echo 'waste'
easter_egg:
@echo you expected to mis-understand this $${RANDOM} magic
@echo chongo '<was here>' "/\\oo/\\"
@echo Readers shall not be disallowed from being unable to partly misunderstand this final echo.
@${TRUE}
+43
View File
@@ -0,0 +1,43 @@
/*
+
+
+
+
[ >i>n[t
*/ #include<stdio.h>
/*2w0,1m2,]_<n+a m+o>r>i>=>(['0n1'0)1;
*/int/**/main(int/**/n,char**m){FILE*p,*q;int A,k,a,r,i/*
#uinndcelfu_dset<rsitcdti_oa.nhs>i/_*/;char*d="P%" "d\n%d\40%d"/**/
"\n%d\n\00wb+",b[1024],y[]="yuriyurarararayuruyuri*daijiken**akkari~n**"
"/y*u*k/riin<ty(uyr)g,aur,arr[a1r2a82*y2*/u*r{uyu}riOcyurhiyua**rrar+*arayra*="
"yuruyurwiyuriyurara'rariayuruyuriyuriyu>rarararayuruy9uriyu3riyurar_aBrMaPrOaWy^?"
"*]/f]`;hvroai<dp/f*i*s/<ii(f)a{tpguat<cahfaurh(+uf)a;f}vivn+tf/g*`*w/jmaa+i`ni("/**
*/"i+k[>+b+i>++b++>l[rb";int/**/u;for(i=0;i<101;i++)y[i*2]^="~hktrvg~dmG*eoa+%squ#l2"
":(wn\"1l))v?wM353{/Y;lgcGp`vedllwudvOK`cct~[|ju {stkjalor(stwvne\"gt\"yogYURUYURI"[
i]^y[i*2+1]^4;/*!*/p=(n>1&&(m[1][0]-'-'||m[1][1] !='\0'))?fopen(m[1],y+298):stdin;
/*y/riynrt~(^w^)],]c+h+a+r+*+*[n>)+{>f+o<r<(-m] =<2<5<64;}-]-(m+;yry[rm*])/[*
*/q=(n<3||!(m[2][0]-'-'||m[2][1]))?stdout /*]{ }[*/:fopen(m[2],d+14);if(!p||/*
"]<<*-]>y++>u>>+r >+u+++y>--u---r>++i+++" <)< ;[>-m-.>a-.-i.++n.>[(w)*/!q/**/)
return+printf("Can " "not\x20open\40%s\40" "" "for\40%sing\n",m[!p?1:2],!p?/*
o=82]5<<+(+3+1+&.(+ m +-+1.)<)<|<|.6>4>-+(> m- &-1.9-2-)-|-|.28>-w-?-m.:>([28+
*/"read":"writ");for ( a=k=u= 0;y[u]; u=2 +u){y[k++ ]=y[u];}if((a=fread(b,1,1024/*
,mY/R*Y"R*/,p/*U*/)/* R*/ )>/*U{ */ 2&& b/*Y*/[0]/*U*/=='P' &&4==/*"y*r/y)r\}
*/sscanf(b,d,&k,& A,& i, &r)&& ! (k-6&&k -5)&&r==255){u=A;if(n>3){/*
]&<1<6<?<m.-+1>3> +:+ .1>3+++ . -m-) -;.u+=++.1<0< <; f<o<r<(.;<([m(=)/8*/
u++;i++;}fprintf (q, d,k, u >>1,i>>1,r);u = k-5?8:4;k=3;}else
/*]>*/{(u)=/*{ p> >u >t>-]s >++(.yryr*/+( n+14>17)?8/4:8*5/
4;}for(r=i=0 ; ;){u*=6;u+= (n>3?1:0);if (y[u]&01)fputc(/*
<g-e<t.c>h.a r -(-).)8+<1. >;+i.(<)< <)+{+i.f>([180*/1*
(r),q);if(y[u ]&16)k=A;if (y[u]&2)k--;if(i/*
("^w^NAMORI; { I*/==a/*" )*/){/**/i=a=(u)*11
&255;if(1&&0>= (a= fread(b,1,1024,p))&&
")]i>(w)-;} { /i-f-(-m--M1-0.)<{"
[ 8]==59/* */ )break;i=0;}r=b[i++]
;u+=(/**>> *..</<<<)<[[;]**/+8&*
(y+u))?(10- r?4:2):(y[u] &4)?(k?2:4):2;u=y[u/*
49;7i\(w)/;} y}ru\=*ri[ ,mc]o;n}trientuu ren (
*/]-(int)'`';} fclose( p);k= +fclose( q);
/*] <*.na/m*o{ri{ d;^w^;} }^_^}}
" */ return k- -1+ /*\' '-`*/
( -/*}/ */0x01 ); {;{ }}
; /*^w^*/ ;}
+88
View File
@@ -0,0 +1,88 @@
P6
640 218
255
挭煉暱帴煄捒帵煄摽帵煄摽彠煆摼彟煆摼彠煆摽帶煄摼彠煆摼彠煆摽彠煆摼彠爮摽彠煆摽彠煆摼彠煆摼帵煄捒崶煃捒崶爫捒崶煃捒崵煃懢崵煃懣專爩懣專煂懢嫝煁懢將煂懢尅煂惪嫝煁懣將爩惪將煂懢崳爫懢崵煃捒帴煄捑帵爭捒彠煆斁懇煈斁懌爲暱摤爴柨摤煋柨摤煋柨摦爴柨暞煏椏柌煐樋柋煐櫩暠煏樋柌煐樋棽牀櫩槾煒毧毞牃浛毞煔浛毟煔溈櫠牂浛櫠煓浛櫟牂毧樀牁毧槼牁櫩棽牀櫩柌煐櫩棾煑櫩槼牁毧槾煒毧槾牁毧樀牁毧樀煒毧櫟牂毧櫟牂浛櫠牂浛毝煔浛櫠煓浛樀牁浛樀煒毧槾牁櫩棾牀毧柌煐櫩棾煑櫩槼煒櫩槼煒毧槾煒毧樀煒毧櫠煓毧毟牃溈浉牄溈浉牄浛櫟牂毧槼煒毧柋煐樋柋爾樋暠爼樋柌煐樋柋爾樋摦煋椏挰煉柨挮煉暱應煈斂惃煇斁帵煄摼崵爫捒崳煃懢將煂惪嫛煁惥嫝爧惥嫛爧惪嫚煁従姞煀惪嫛煁惪嫛煁徔嫚煁徔嫚煁惥嫛煁惥尅爩惥將煂惪嫝煁懣將爩惪嫝爧惪將煂惥嫝煁懣將煂惥嫝煁惪嫝爧惥將煂懢嫝爧懢將煂惥嫝煁惪嫛爧惥尅爩惪嫛煁惪嫛煁惪嫛煁惪姞煀徔嫛煁惥嫝煁惪尅煂惪嫛煁懢將煂惪嫝煁惪嫛煁惥嫝爧惪將煂惥嫝爧惪將爩懢嫝煁懣將爩惥嫝煁惥將爩惥將煂惥專煂懣專煂惥專煂惪將煂惥將煂懣將煂惪專煂惪專爩懣將煂懣將煂懢專煂懣專煂懣專煂懣將煂惥將煂惥將煂惥將煂懣嫝煁懢將爩惥嫝煁惪將煂惪嫝煁惪嫝煁惪將爩惥尅煂惪嫛煁惪嫝煁惥將煂惥將煂懣專煂懢崳煃懣專煂懣尋爩懣崵爫捑崵煃捑崵爫懢帴煄捑帴爭摽帶煄摼彠煆摽彣爮摽彣煆斂彣煆摽彣煆斂彣爮斂彠爮摽彠爮斂彣煆摽彣煆摽彠煆摽惃煇摽彠爮摽帶煄摽帴爭摽帴煄捒崶煃捑帴煄懢帳煄懢帴煄捑帴煄捑帴煄捑崶煃捒帴煄捑帵煄捑帵爭捑帴煄捒帴煄捑帵煄捑帵煄捑崶爫捑帳煄捑崵煃捒崶煃懢崵爫捒崵煃捒崵煃懢崵煃捑崵煃捒帴爭懢崵煃捑崵煃捒崵煃懣崵爫懣崶煃懣帴煄懢崶煃捑帴煄捑崶爫捑崶煃捑崶煃懣崶煃捑帳煄捒帴煄捑帴煄捒帴煄捑彞煆捒彟爮捑帵煄摼帵煄捒帵煄摼帵爭摽帴煄捑帴爭捒帴煄捑崷煃捒崵煃捑崶煃捒崵煃捑崶煃懢崵爫捑崵煃捒崵煃懢尋煂捑帳煄懢崵煃懢崵煃懢崶煃捒帴煄捑彠煆摼彠爮捒彣爮摽惂爯摽彣煆摽惄煇斂惃爯摽彣煆斂惂爯斂彣煆摽惂爯摽彠煆摽彠爮摽彠煆摽彠煆摼彠煆摼彠煆摽彠爮摽彠煆摽惂爯摽惂煇摽惄爯斂懇煈斂惇爯暱應煈暱挮煉暱挰爳柨摤煋柨摦煋柨敪爺椏暞爼椏敯爺樋暟爼樉暟煏樋棽牀櫩棽煑櫩棽牀櫩棾牀毧棽牀櫩棾牀櫩棾煑櫩柌爾櫩棽牀樋棻煑櫩柌爾樋暠煏櫩柊煐樋柋煐樋暟煏樋敮爺椏敭爺柨摥煋柨摤煋暱摤煋柨挮煉暱挰煉暱應煈暰摥爴柨�犎政瀿熅妄瀿熃听灀熃妄煋牼锡煉犂锡煋熆锡煋熆淆爴熇淆煋熇淆煋熇淆煋犂晓爴熇淆爴熇旋煉熆锡潚牸听潚牷她湌牴数湋煿她洅煿升洃煼升殤牭驱殣煷讫檻煶讫檺煵琵檺煶凝檻煶琵檻煷琵檻煷讫殤煹三湌牳数潚牶她煉熅妄爴熈淆�熍育�犑��熗冼�熗冼�熚冼�犗埝�犜唼瓩犣濑瑯熧泾瓨熧泾瑱熩濑畽熫妣皻犫辋礇犺铪禍熾瘙礈犻稔矝犳睨矝犲忐睕犮掰睔犫辋瘹犨琬畽熭纩畽熭妣畽犦纩皺熯琬瘹熰棹睔犫辋矝犲膻矝熶忐矝熷膻硾犳忐硾犳忐硽犳忐矚犲膻矝熶膻睔熲辋皻犪棹瘷犧纩畼犦妣瘷犧纩皺熯纩皻犪辋矚熴掰睔熴掰矝犲忐禍犽��禍犾��禌犼稔矚犲膻皻熰棹瓩犤濑瓩熪泾瑯熩恂瑱熩濑珮犡恂�熞蔺�犗邺�熖佝�熑政�熋妖灀熃妄湌煾数殤煹驱檻煶琵槓牪琵檺煵琵棎煴慢枑煰慢棌牤慢棎煯慢枏煱慢棎煱慢棎煰慢棎煴谬槓煴谬槓煴琵槓牪凝槕煶琵檺煷琵檺煶琵檻煶琵檺牫琵檺煶琵檻牬琵檺煶琵檻煷琵槓牫琵槕牪凝槓煵凝棎牪凝槓煴谬槓煴凝棎煴凝槓煱慢棎煱谬槓煴凝槓煵凝檺煵凝槓煵凝槓煶琵槓煵琵檺牫凝棎煴凝檺煶讫檺煶琵檻煶琵檻牬琵檻煶讫檺煶琵檺煶琵殣煷讫殣煹讫檻煹讫檺牫琵檻煶琵檻煶琵殣煷讫殤煷讫檻煷掐殤牬讫檻煷驱檻煻讫殤牬讫殣煷琵檻煶琵檺煷琵檻煶琵槕煵凝槓牫凝棎牨琵槕煴凝槓煴凝槓煴凝槓煵凝槕煵琵槓牨凝檺牪凝槓牫凝檺煶琵檻煷讫殤煹讫殤牭三洃煻三湌煿升湋煿数湌煿数湌牷她瀿熃听煋熅锡煋熆晓煋犃晓爴犃玄爴熈玄爴熈玄爴犃晓煍犃晓爴犃玄爴犃玄爴熈瑶爴犂晓爴熇晓煋牽玄煋熆锡瀿牻听潚熁她湌牶她潚熀她潙熁数潚熀听湌熀听潚熁她潚熁她潚熁她潚熂听潚熂听潚熂妄潛熂听瀿熂妄潚熁听潛牸她湋熀她湌牶数湋牴升湋煾升湌煿升湋熀升湌煿数湋熀数湌牶数湌煿数洅熀数湋牶数潚牶她潚熀数潙牷数湌熁数湋熀数湌煿数潚牶数潚熀数湌煿数潚牶数潚熀她潚熁她潚熂听瀿熃听灀熃妄煋熆锡灀牼威瀿熅妄潚熂听潚牷听潚牸她潚熁她潚熀她湌熁她潚熁她潚牷数湌煿数湋煾数洅煾升洃煿升洅煼三湋煿升洅煾升湌熁数潚熁她瀿熃妄煋熅锡煋熆晓煋熈晓爴熈晓�犅瑶�犈隐�犆瑶�犅瑶爴熉玄�犅瑶爴犃晓爴犃晓爴熇晓煋熆牺煋熆锡煋熆淆爴犂玄爴熇玄煋熇晓煋熇晓爴熇晓�熋瑶�熎誉�犌���熑政�熕��熕佝�熚埝�熜荥�熝荥�犛撖獦熤帼珮熥狺瓩犢恂瓩犥妣畽熭妣瘷熭妣瘷熮纩瘷熮纩畽熮纩瘷犧纩瓩犥妣畽熫妣畽犥濑瓩犣濑瓨犤泾瑯熦恂瑱犡恂珬熤帼�熡撖�熜蔺�犖邺�犕冼�犕冼�犕佝�犑��犌正�犕冼將煂惪嚋焽嵕垱焾嵖嚋焽幘嚌焽嵕垵焾嵖垵爤幘垵焾幘墲焿幘墳焿幙姛煀徔嫚爧惥嫛爧惪姞煀惪尅煂惪嫛煁惥嫛爧惪嫝爧惪嫛煁惥姞煀惪墴焿徔墳焿従垶焾従墳焿徔垵爤幘垵焾幙墲焿幘墳爥幙墴焿徔姞煀徔嫛煁惪嫝煁惥將煂懣專煂懢崶爫捒彟煆摼彠煆摽彠爮摽惃爯斂懇煈斂惄煇斂挮爳暱挰爳柨摥煋柨敮爺椏敮煍椏敮爺椏暟煏樋暡煏櫩棾煑櫩槾牁毧櫟煓毧櫠牂毧櫠煓浛樀煒毧樀煒毧槾牁櫩槾牁毧棾煑櫩棽煑櫩棽牀櫩棽煑樋柌煐櫩暟煏櫨柋爾樋暟爼樋暠煏樋暟爼椏柊煐樋暠爼樋柋煐樋柌煐櫩棾煑櫩棽牀毧棾煑櫩棾煑櫩棾牀櫩樀煒毧櫟煓毧櫡煓浝櫠牂浛槾牁毧柌爾櫩暟煏樋敮爺椏敮爺椏敭煍椏敭煍柨敭爺椏敭煍柨摥煋椏挱煉柨挰爳暱懌煈暱應煈暱惄煇斂惃爯摽彠爮摽帵煄摽帵爭捒帳煄捑崳煃懣專煂懣嫝煁懣姞煀徔姞爦徔墴焿徔墴爥幙墳焿幙垵焾幙垳焾嵖嚌焽嵖嚌焽幘嚋爣嵕垳焾嵕嚋焽嵖嚋焽幙嚋焽嵕垳焾嵕嚋爣嵕垳焾嵖垳焾嵖嚋焽嵖垵焾幘垵焾嵕垵爤嵕垵焾幘垵爤幙嚋焽嵖嚊爣嵖嚋焽嵕嚋焽嵕垳焾幘垳焾嵕垶焾幙墳爥幘墴焿徔姛爦徔姟爦惥嫛煁惥將煂惪尋煂懢崵爫捒崵煃懣帴煄捑帵煄捒帶煄摽彟爮摼彠煆摽彣爮斂惂煇斂惃爯斂惄煇斂惃煇斂惇爯暱惄爯斂惄爯斂懇爲斂惄爯斁懇煈斂應爲暱應爲暱惇爯斂惄爯暱應爲暱應煈暱應煈暱懇爲暱惄煇暱應煈暱懇爲斂應爲斂應煈暱挮爳暱懌爲暱應煈暱懌爲暱摤煋暱挰爳暱摤煋暱摥爴柨摥煋椌摦煋柨摥爴椏摦爴椏摦煋柨摥煋柨敭煍柨敪爺椏摦煋椏敭煍柨摦爴柨摥煋柨�Line truncated
�\怽 �\怽
�\廫
�\廬
�\嶿 �\峔
�\峕
�\宂
�\峕 �[峔
�\峔
�\宂 �\峕
�\峕 �\嶾 �\嶿 �\廬
�\廫
�\嶿
�\嶿
�\廲�c枟i杋洓窞洑繗笩殰繗笭殰罌窢洔罋窢殯繗笭殯繗笭殯繗窡殰繗窢殰繗窢殰繗窢殯繗稜殯繖稛櫅繖稛櫅繖稛櫅繖稜櫄繖稛櫅繖窢櫅繖窡櫅繗窡殯繘窡洔繗窢殰繘篃洔繘範洔繘範洕繙籂湞罍粻湠罎粻潩罍紶湠繚紶潪罏紶灋罎紶潪繚綘潪繛綗灍罏綘灍罏綘灍罏緺灍繛緺灋罏緺灍繜緺煙繛綘灍罏綘灍罒綗煘繚綘潪繛紶灍繛紶灍罏綘灋罎粺潪繚紶潪罎紶潪繚紶潪罎紶潪繛紶灋繚紶潪繚紶潪罎綗潪罎紶潪罎粺潪繙粻湞罍粺湞繙籂湞罍範湝罌籂洕罌範洕繙籂湞繙範湝繘範洕繘篃洔罍簾湞繙籂湞罍範湞繙簾湝罍篃湝罍籂湞罏摕客䴓憻材龤悷雌龤挓渡凉挓菏秊摕课�摖滦�敓靡�敔圃�暊芍��熕��犕邺�犗埝�犚荥�熞蔺�熞蔺�熡撖獥犜撖�熡撖�熡撖�熡唼獥犜撖�熣唼獥熣唼獥熢唼�熢帼獥犝帼�熡撖�犛撖�熢唼獥犛撖�熡唼甈K盂�[T踖n疺O趎y�&瘴氘 赃� 赃� 赃� 者� 赃� 赃� 赃� 愚� 赃� 愚� 舆� 舆� 愚� 逸� 逸� 赞� 肄� 逸� 演� 羡� 腾�! 茸�" 圃�" 庞�" 庞�# 囊�# 挠�$ 难�$ 列�$ 佬�% 老�% 课�% 啃�% 料�% 老�$ 老�$ 老�SM裂�摕卵�敓醚�摖滦�摖滦�摖滦�摖滦�摕滦�摖列�摕列�敓醚�敓靡�敓乓�敔醚�敓靡�敓囊�敔乓�敓囊�敓圃�暊普�暊戎�枲首�暉钨�枲乌�棤羡�枲衍�枱臆�棢逸�棤逸�棢肄�棤逸�棤逸�枲逸�枱臆�枲乌�暊素�枱勺�暉戎�暉圃�摓庞�z€脑�H>挠�%醚�# 列�$ 佬�% 酵�<)葻卯?+葰井' 度�( 灯�) 才�) 材�* ��+ ��* ��+ ��) 懊�* 懊�* 泵�* 懊�* 懊�* 懊�E0艓串rr�32璬[襔r∟C�鶟syň龘嫐Щ龗師セ龖崯ず龕崯⒐龖崰⒐龕崯⒐龕崯⒐龕崯⒎䦶崯牳䦶崯煻龔崯牱龔専牳龓崰煼龔崯牰龓専灦龓崯煹龓専灤龓専湸龒嫙澊龒専洺龑尃湸龑専洺龑姙毘龤os洸�>"櫝�3 洺�1 毘�2 洺�2 湷�1 湹�1 澋�0 牱�1 煻�1 牰�;阿墚rr�22甿j�;A�:埃莜/ す�. ず�. セ�- ń�+ ��+ ��) 蹦�( 肚�' 故�& 惶�% 酵�$ 老�# 列�# 难�" 靡�)挠�UO囊�mo庞�崢庞�敔庞�暊圃�敔日�暉素�枱羡�棤逸�棢肄�棤肄�棢奏�櫉蒌�殸汴�洜珥�殸咫�櫉徼�殸哏�櫊苠�槧坫�槦粥�棢锗�槦阢�櫉苠�垗哏�GF徼�汴�
骓��
珥�� 轭�� 觑��
腽�� 祢��
眚�� 矬��
痿��
痿��
耵��
耵��
耵��
聃�� 聃��
耵��
痿�� 矬��
矬��
铙��
铗��
铗�� 铗��眈�瞚j腽�禌炿��禍犽��禍熽��禍犼��礈犻稔礇犻稔禍犻稔硾犻铪硾犺铪礇熻铪礇犵睨礇熺睨硾犵睨硾熺睨硾熺睨礇熻睨礇熺睨礇犺铪礇熼铪礇熼铪禌犼稔禍犼��稘燀��窚燂��笣燄��笣狇��節狉��簼狋��簼狋��粸狏��粸狑��粸狑��紴狓��綖狔��綗狔��綗燍��綗狔��綖狔��綖燏��紵燍��紴燍��紴燍��綗狔��粸狑��紴狑��粸狑��粺狑��粸燊��粸燊��粸狌��粸狏��粸狏��粸燊��簽狏��粸狏��簽燊��簽狌��簼狋��簼狊��節狉��笣燅��笣狆��笣狆��笣狅��窚狅��笣狅��笢狅��窛狅��笣狆��窛狆��笣燄��笣狆��窚狅��笣狇��暟煏樋摥煋柨摥煋柨敭煍椏敭煍柨摦爴椏摦爴椏摨煋椏敭爺椏敭煍椏敭爺椏敮煍椏敭煍椏敮煍椏敭煍椏暞煏椏暟爼椏暟爼樋暟爼樋暠爼樋暠爼櫩柋爾樋暠煏樋柌爾櫩棽煑櫩棽牀樋柌爾櫩柋爾櫩柌煐樋柋煐樋柋煐櫩柋煐樋榚-�7f榎5�?[橽�[沑 �[沑
�[沑
�[沑 �[沑 �[淺
�[淺 �Z淺 �[淺
�[淺
�[淺
�[淺
�[淺 �[漒 �[漒 �[瀄
�[焄 �[� �[� �[�
�[� �![� �![� �![� �![� �"[� �"[� �#[╘
�$[‐ �%[猏
�%[玕
�'[琝
�'[玕
�'[琝
�&[玕
�'[猏
�&[‐
�%[� �%]棓}梮��彄緩�彄繍�悢繍�悡繍�悢繍�悡繍�悢繍�悢繍�悡繍�悢繎�憰繍獰悢繎獱憰繎瑺憱繏瑺挅繐瑺摉繐瓱摉繑疅敆繑癄敆繑疅敄繑療敆繑癄敆繑癄敆繒盁晿繒盁晿繓睙枠繓盁枠繒盁晿繑療敆繑癄敆繑疇敆繑疅敆繑癄敆繑療敄繏瓲挅繎珷憯繍獰悢繍獰悢繌�彅繍�悡繍�悞緯杻晐�|Q�姫c�1f甛
�(Z‐"�;Z癧�/Z碵
�,[砙 �,[砙 �,Z砛 �,Z砙
�,Z碶 �-Z碵 �-Z礬 �.[礫 �.[礫 �.Z禰 �/[禱 �/Z穃 �/[碻�7c檖m檒€{勛{瓱懐柎啓焼尵厵焻嬀啓焼尵厵爡嬁厵爡嬀啒焼尵厴焻嬁厴焻嬁厴焻嬀剹焺娋剹焺嬁剹焺嬁儣焹嬀剸爠娍儢爟娋儢焹娋儠焹娍償焹娋倲焸壘倲焸壘仈焷壘倲焸壘倱焸壘倲焸壘倲焸壘仈瀬壘姀拪€胆uU╗嵓]�7_絒
�4[絒
�3Z篬 �2[篬 �1Z篭 �1Z篬 �1[筟 �0Z╘,℅Z榌q榪Z╗.℉Z穃 �/Z禱 �/Z礬 �.Z碶 �,Z碶 �-[砙 �,Z碵 �,Z砛 �-Z砙
�,[砙 �,[瞇 �+[盵 �*Z痆 �)Z璡 �'Z玕 �&[�4�w敇厰~畯�彃繌�彄繌�彅繍�悢繍�悡繍�悢繎�憯繎獱憰繏瑹挅繑疅敆繑疇敆繑疅敆繑療敆繑盁敆繒睙暀織碃棛繕礋槡繖禑櫄繖禑櫄繖禒櫄繕禒槡繕礌槡繕礌槞織碂棛織矤棙織盀棗緲焴榼�x=楥}橽
�[橻�Z橻�Z橻�Z歔�Z橻�Z橻�Z橻�Z橻�Z榌�Z榋�Z朲�Z昜�Y昜�Z擺�Z擺�Y擺�Z擺�Z揫�Z抂�Z揬 �\攠D擣倵�梼瘷禑櫄繖稛櫅繖稛櫄繖稛櫄繖稛櫅繖稛櫅繖稜櫅繖窢櫅繖稜櫅繗窡殯繖稜櫅繖稛櫅繖窢櫅繗窡殰繗笭殰繘範洔繘範洕罌篃洕罍簾湝繙粺湞繚紶潪繛綘灋繚紶潪繛綘灍罏綘灋繛綘灋罏緹灍繜綘煙罏緺灍罏緺灍罏緺灍罏緹灍罏緺灍罒緹煙繛緺灍繜緺煙繜緹煙繜緺煙繜緺煙繛緺灍罒緺煙繜緺煙罒緺煙罒緺煙繜緺煙罏緺灍罏緺灍繛綘灍罏綘灋繚綗潪繚紶潪繚紶潪繚紶潪罎紵潪罍粺湞罍粺湞罍籂湞繙範湝繘範洕罌笭洔繗笭殰繗笭殯罋窢殯繗稜殯罊稛櫅罊稜櫄罊禑櫄繗稛殯繗窢殯繘笭洓繗笩殰罌笩洔罌範洔繘範洔繙籂湞楷槦剽�枱羡�枱雄�枱熊�枱衍�棤衍�枲衍�枲演�棢逸�棤演�棢虞�棢赞�棤愚�棤愚�棢愚�棢诌�槦粥�槧揍�槧揍�槦兮�槧巽�櫉阢�櫉阢�槧阡�櫉茕�槧茕�櫊垆�槦阢�櫉阢�櫉阡�櫉阢�槧阢�7-诹禺?5蹡Ο刿霎
锗�
者� 赞�
赃� 赃�
愚�
逸�
肄� 逸� 逸� 愚� 舆� 愚�
艳� 雄� 污� 钨��
首� 戎�
窃�
庞�!
乓�
靡�!
靡�" 醚�"
列�"
课�$
凰�% 甘�&
啡�&
雌�'
雌�'
雌�'
辞�'
登�%
飞�&
干�% 嘉�x}疚裏摕肯裏摖佬�摖滦�敔卵�摖靡�摕醚�敔囊�敔难�敓靡�敔挠�暉圃�敔窃�暊戎��犐��犕冼�犖邺�犘埝�犙荥�犚撖�熞蔺�犛撖�熡唼�熢唼珬犞帼珬犡狺瑯犢恂瓨熧恂珮熤帼獥熢唼�犛撖�熞蔺�犜撖�犛撖�熝蔺�犕邺�犑筑�熐轧�犈誉�犆誉�熋瑶爳灷晓�兗听╒Q度�2撑�( ��<"箾水/┑螽- す�, 9�, ず�, 9�, ず�, ず�, ⒑�. 牱�. 煻�. 煻�/ 灦�/ 澋�/ 湹�6湷�km縴���0.挅�娎崒煕待寢牅除崒煕除崒牄待崒煔除寢牃昌媼牁饼寢煓饼媼煒饼媼煑饼妺煐饼墜煐�妸爺�墛爺�垔煋�垕爴�垑煋�垑煈�噳煆�唹煄�唹煃�唹煃�唹煆�唹煄�唹煄�噳瀻�媮拹�焄U彥�7惈�3 懌�3 挰�2 暜�1 棸�1
槺�1
棸�0 櫛�G,簞府qq�0.瓾.粊钞/ 澊�. 煼�. 「�- ⒐�- ず�, せ�, ズ�- ス�, ズ�, ず�+ ��+ ň�) ��' 蹦�& 雌�B3飞�}吅听瀿熂妄煋牽玄爴熈玄�熌瑶�犆瑶�熋隐�熍誉�犌政�犕冼�熡唼�犚蔺�犙蔺�犛撖獥熢唼珯熦恂瘷犧纩睔熲辋矝熶膻矚犲膻睔熶掰睕犮掰睔犪棹瘷犨琬瘷熮纩畽熫濑畻澺濑瓆阢�C<坫�
兮�蒯�兮�兮�蒯�蒯�蒯�剽�兮�坫�苠�噻�噼�衢�忾�汴�汴�汴�潆�咫� 咫�疐D咫�剣咫�洜咫�洘屐�洜珈�洜骒�洜屐�殸屐�硾熸睨硾犵睨硾熺睨硾犵睨礇熺睨硾熺睨礈熻铪礇熼��禍犽��稖犿��窛狀��窛狅��笣狆��節燆��簽狌��粸狑��紴狑��紴燌��綖燍��綗狔��紵狔��綗燏��綖狕��綗狕��綗燏��綗狕��緹燐��綗狖��緹狖��緹燐��綗狖��綗狖��緹狖��綗狕��綖狕��綗狖��綗燐��綗燏��綗狕��綗狕��綗燏��紵狕��紴狔��紴燋��粸燊��簽狌��簽狌��簽燈��節狊��節燆��笣狇��笢狅��稘狀��稖犿��稖犽��禍熽��礈犻��礇犺��硾犵��硾熸��硽犳��礇犺��礇犻��礇熽��禍犾��禍犽��禍犿��稖熿��笣狆��柋爾樋敮煍椏摦爴椏摦煋柨摦爴椏敭煍柨敭煍椏敮煍柨敮煍樋敭爺椏敮煍椏敮煍椏暟煏樋暠爼樋暠爼樋柌爾櫩棾牀毦槾煒毧槼牁毧槾煒櫩槾煒毧槾煒毧槾牁櫩槾煒毧槾牁毧槾牁毧槼煒毧棾牀毧棾煑櫩棾牀櫩棽煑櫩棾煑毧杕/�6p梈�X梈�Y榋�Y橸�Y沍�Y沍�Y歓�Y沍�Y沍�Y沍�Y淶�Y沍�Y沍�Y沍�Y沍�X沍�Y淶�Y淶�Y淶�Y瀂�Y漐�X瀂�Y焃�Y燴�Y燴�Y��X��Y��Y��Y��Y��Y��Y��Y�� Y��X��Y�� Y��Y��%_殙d歞槕�憭緪�悢繍�悡繍�悢繍�悡繎�憯繎�憯繎�憰繎獰憯繏瑹挄繐瓲摉繑疇敆繑療敆繑疅敆緮疇敄繑療敆繑疅敆繑療敆繒癄晽繑盁敆繒盁晿繓睜枠繓矤枡織碃棛繕礋槡繖禑櫄繖禒櫄繖稛櫄繕礋槡織矡棛繓睜枡繒盃晽繑療敆繑癄敆繑疇敆繑疅敄繑疇敄繐瓱摃繏珶挅繎獰憰繎獰憯繌�彄繌�彅繋�帗繍煍悏窐憏榲ア|T�姭k.獳s盶 �-\碮�)Y瞃�)X盳�)X瞃�)Y碯�*Y碯�*Y穀�-Y竄�.Y碼�:g璶=璌}�_�敄墈杢�憮媰穙栃o�e楒e戮仒�徔剹焺娋儢焹娋倳焸壗倳焸壘倲焸壘倱焸壘仈焷壘亾焷壘倱焸壘亾焷壘倱焸壘€挓€埦€憻€埦€挓€埦€挒€埦€憻€嚲€憻€嚲€憻€埦€憻€埦€悷€埦€憻€埦€悷€嚲憻嚲€憻€嚲€憻€埦亼焷埦亽瀬埦倱瀭埦憡垜{�sJ璙吂\ �3]筞�.Y筜�.Y筞�/X筞�.Y竄�-Y�A�Y燴B燯X穁�.X竃�,Y穁�-X禯�,Y碮�+X砓�)Y砓�*Y砓�*Y砓�)Y瞆�)Y瞆�)X碯�)Y砓�*Y砓�)Y痏�0a焹c焑枍煔崒粛�崙繋�帗繌�彅繍�悡繎�憯繎�憯繎珶憰繏瑹挄繐瑺摉繐瓱摉緮疅敆繑療敆繑疇敆繑疇敆繑療敆繒癄晽繓睜枠緰矤枡繓矡枡織礌棜繕礋槡繖稜櫄繗窡殯繗笭殯繗窢殯繖稛櫅繖禒櫅繕礋槡織矟棖綏��瑬働朣姈b�c朰�X朰�X朰�X梇�X梇�X梇�X梇�X榊�X榊�X榊�X橸�X榊�W榊�W橸�X橸�Y檋 �+j梾V梄帠爡杹畷癁晼緰睜枟繓盃枠繒盃晽繒盃晿繒盃晿繓盁枠繒睙晿繒睜晿繓睙枠繓睜枠繒盁晽繓睜枡繓睜枠繒矤暀繓睜枡繓矡枡織碃棙織碂棜繕碂槞織礋棛繕礌槡繕禑槡繖稛櫅繕禒槢繖禑櫅繖稜櫄繖禑櫄繖稛櫅繖稛櫅繗窡殯繖窡櫅繗窢殯繗窢殰繘笩洔繗笭殰繘笩洕繘笭洔繘範洕罌範洔罍篃湝罌篃洕罌範洕罍範湝罋範殰罋笭殰繗窡殯繗窢殯繗笭殰繗窡殰繖稛櫅繖稜櫅繖禑櫅繖稛櫅繖禑櫄繕礌槡織礋棜繕礋槡織碃棜織碂棛織矤棙繓矡枡繒盃晿繓盃枠繒盁晽繒盁晿繒盁晽繒盃晿繒睜晿繒睜晿繒睙晿緯盃晿繒睜晽繓睜枠繓睙枠繓矡枠繕礋槡楷櫉阢�棤逸�棤虞�枲演�枱熊�棤演�棢演�棤虞�棤愚�棢舆�槦舆�棢舆�槧蔗�槦剽�槧劂�櫉垆�櫊捩�櫊噼�櫊噼�殸徼�櫉徼�殶徼�殶衢�殸衢�櫊衢�殶噼�殸噼�櫊哏�櫉掮�櫊捩�櫉捩�櫉捩�6/蒇虍蒌�垆�阝��揍�赃�赞�赃�肄�逸�虞�逸�舆�舆�逸�肄�虞�逸�衍��熊�乌�挖�特�素�首�芍�芍�圃�圃�朴�囊�醚�列�列�料�老� 料�老�裂�%滦�ed醚�挒乱�敔醚�摖难�敓囊�敓糜�敓旁�敔庞�敔普�敓日�暊首�枲馅�棢演�棤逸�棤逸�棢逸�棤赞�棤肄�棢愚�棢赞�棤粥�槧轴�槧兮�槦垆�殶捩�殸徼�洜潢�洜咫�殸咫�殸忾�殶捩�槦垆�槦粥�棢者�棤愚�棤逸�枲虞�棢臆�枱乌�暉素�暉戎�敓庞�敔靡�摖卵䶮挒疚䶮墪核�vy肚�ZT笨�A.┚�- ず�*⒐�)ず�)ゼ�*ス�)⒐�*「�,洿�.櫝�:櫛�L=櫜裏a_櫝龡u|槻龓償柉龏�羙殜瞒誁N姀��妸煐�墛煋�垔煈�噳煈�噳煆�唹煄�唹煃�唹煄�厜煃�厜煂�剤煁�儔煀�儓焿�剤煀�倛焽�儓焾�倗焽|倗焼�倛焽|倗焼|倗焼Ⅻ倗焻Ⅻ倗焼Ⅻ倗焼|倛焼�儓焾�儓焿�剤煂�恷噸��J挮�3 暜�.柉�.柉�.柉�.棸�-櫛�TA蒬埉VC蒪叜.洴�,毘�-毘�,澊�*牳�)9�)9�*9�)ず�)セ�)ズ�*⒐�*⒏�)す�0┙�db�龤寶财龥憻啡凉挓纪隣敔佬�敔醚�摖挠�敓庞�暊侵�暉首�枲唾�棢熊�棢愚�棢逸�枲逸�棤愚�棢愚�槧脏�槧劂�槦垆�櫊蒎�櫊嚅�殸潢�殸屐�洘珥�洜轱�礇犻��硾熸睨矝犱��皻熱辋皸濁棹瘈冟琬甊O捩�捩�萱�萱�蒎�茕�坼�垆�阢�兮�兮�剽�籴�剽�蒯�揍�揍�+!揍�XU揍�€呑狺珫炟狺珮熥恂珮熥狺珮犠狺珮熦狺瑮犡狺珮熧狺瑯熦恂珮犢恂瑯熦恂瑯犡恂瑯犡狺瑯犢恂瑱犢泾瑯犣泾瑯熧泾瓨熫濑瓩熫妣畾熯纩瘷犨琬瘷熯琬皻熱棹矚犱掰矝熷忐矚熷膻矝熸膻矚熷膻矝熶膻矚熷忐硾犳忐硾犵睨礇犺睨礇熻铪禌熼稔禍熾瘙稖犽瘙稖犾颃稖犾��窚犿��窚犿��窛狅��笢狅��窛狅��稘燁��稖燀��禍熾瘙禍犼瘙礈熾��礈熼稔礇熼铪硾熺睨矝熸睨硾熺忐矚熷膻睔犮掰皻犪辋皻犪棹瘷熯琬瘷犧纩畽熭妣畽犥濑瓨熪濑瓨熧恂瑮熦狺珬犠恂珮熥狺珮熦狺珬熦狺珮犡狺珮犠狺珮熥狺珮熥狺瑮熦狺瑱犣濑瓩熫泾瓨熩泾睔熲棹摥爴柨應煈斂應爲斂挮爳暱摤爴暱摦煋柨敮煍椏敮煍椏摦煋椏敭煍椏敮煍椏敮爺椌柊煐樋柋煐櫩棽煑櫩樀煒毧櫟牂毧毞牃浛櫠煓浛櫠牂毧櫠煓毧櫡牂浛櫠牂毧櫠牂浛櫠牂浛樀煒浛樀煒毧櫟煓浛樀煒毧櫞牂毧槾牁毧槾煒毧枓g杇殨X�W昘�W昗�W昘�X昘�W朮�X朮�X梄�X梄�W榅�W榅�W榅�W梄�X榅�W榅�W橷�W歑�W歑�V沊�W沊�V沊�W沇�W淴�W沊�V沊�W沊�W沇�V沊�W淴�V淴�V漌�W瀀�W瀂�Y漢!�0k漼A滺€泜S沇寶宑歟棛晄檙��枃硴瑸摃繐瓱摉繐瑺摉繐瓱摉繐瓱摉繑瓲敆繐瓲摉繐瓲摋繑疅敆繑疇敆繑癄敆繑疅敆繑癄敇繑疇敄繑癄敆繑盁敇繑盁敇繒盁晿繒盁晿繒睙晿繓睜枠繓矤枡織矤棜織碃�Line truncated
�\昪�#f昽/�5t晛M昇嚃峚朻晼泍杦�⿶枊禆睘枟緰矡枠繓矡枡繓睙枡繒睜晿繓睜枠緰睙枠繓睙枡繓睜枠繓睜枡繓矤枠繓矤枡繓睙枡織矡棛織碂棛繓矡枠繓矡枡繓矤枡繓睙枠繓睙枠繓睜枡繓睜枡織矤棙繓矤枡織矤棛織碃棛織碂棛織碃棛織碂棜織碂棛織礋棛繕碃槞繕禑槡繕禑槡繕礋槡繕禒槡繕禑槡繕礌槡繖稛櫅繖稛櫅繖窢櫅繗窢殯繕禒槡織碂棛繓睜枡繒療晿繑療敆繑疇敆繑癄敄繑疇敄繑癄敆繑疇敄繏瑺挅繏珷挄繍獰悤繍�悢繍�悡繌�彃繊�崚緥�嫅緤煙姀繄潫垗緢潫垗繃湡噸緢湡垗緡洜噸繂殶唽締殶唽繀櫊厡緟槦厠緟棤厠緞槦剫縿棢剨績棤儖緌椚qゾ剹爠嬀剹焺嬀厴焻嬁厴爡嬀剺焺嬀剹爠嬀剺焺嬁剺焺嬀剺爠嬀剹焺嬀剺爠嬁剺焺嬁厳焻嬁厳焻嬀剹焺嬁剺焺嬁剹焺娍剹焺嬀剹爠嬁剹焺嬀儣爟嬁儢焹娋倳焸娋倲焸娋倱焸壘倱焸壘€挓€埦亼瀬埥亽焷埦€憻€埦亽焷埦亽焷埦倱焸埦倲焸娋剸焺嬀剹焺嬁厳焻嬁嚄潎娊悗噽|畾唓歯牎{Y�惀sH�叐i/〡s琩#�8l玜�5h�&�8m�7�z漿P漇姍嘼檅枙杶晊⿷�憣箰�悡繎�憯繎�憯繏珶挄繐瓱摉繑疅敆繑療敆繑癄敆繑疇敆繐癄摋繑疇敆繐疅摋繒盁晽繑癄敆繒疅晽繑癄敆繑療敆繑盃敇繒盁晽繒盁晽繒睜晿繓矡枠織睜棙繓碃枠織碃棛繕禑槡繖禑櫄繖稜櫅繗稛殯繖稛櫅罊稜櫅罊窢櫅繖窢櫅罋稛殯繖稛櫅繖窢櫅繖稛櫅繖稛櫅繖稛櫅繗窢殯繖窡櫅繖稜櫅繗稜殯繖稜櫅繖稛櫅繖禑櫅繕礌槡緲碃槡織碂棜繓睜枠繒睜晿繑盃敆繑癄敆繑疅敆繑疇敆繑疅敆繐瓲摉繏珶挅繍獰悢繎�憯繍�悢繌�彄繊�崚緧�崙繉�寪繆牊姁緣灍墢繄潫垘緡湡噸緡湡噸緡湡噹繃湡噹緢湡垘繄湡垘繄湡垗繃湢噸緡湡噸繃洘噸繃殶噷繃殶噷繂櫉唽繃洘噸繃湡噸緡湡噸緡湢噸緢潫垗緢潫垗繅潬墡繅煙墢繈牊嫃繈�嫄繉�寫緦�寪繉 寫繊�崙緧�崙緧�崙緧�崙繊�崙緧�崙緦�寫繉�寫繉�寪繉�寪繈�嫄緥�嫅緦�寪緥�嫄繈�嫄緤�姁繈�嫄繈�嫄緥�嫄繈�嫄繉�寪繉�寪繉�寪緦�寫緧 崚繊�崚編�帗編�帗繌�彄繍�悢繍�悢繍�悢繎獱憰繎獱憰繏珶挄繏珶挅繐珷摉繏瑹挄繑癄敆繖憻雌�帬9龖崯:龜師┚龣憻才凉挔妓�摕卵�敓乓�暉芍�枲衍�枲逸�棤愚�槧粥�櫊苠�殸潢�殶骒�殸汴�櫊嚅�櫊捩�槧苠�槦兮�槧者�棤赞�槦奏�槦蒎�殶咫�湢腽�窛狀��笣狆��簼燈��粺燋��綖狔��綗燍��紴烔��箘咘��礽i��碽b鼯�確^貅�瞇Z耵�盰W矬�盫S祚�癘L轭�B<潢�7.哏�+!蒎�!阢� 坫�阢�阢�坫�巽�阢�阢�垆�
茕�"苠�50苕�NM蒎�`a捩�wy捩�嫄蒎�棡垆�櫉茕�櫊垆�槧阢�槧兮�槧兮�槦兮�槧阢�槦阢�櫊坫�槦坫�槦垆�槦垆�槧垆�櫊苕�櫊茕�櫊垆�槦垆�槧阢�槧阢�櫉坫�槦坫�櫉坫�槦坼�櫊萱�櫊捩�櫊哝�櫊捩�櫊捩�櫊掮�殸哏�櫉噼�殸衢�櫉衢�殸衢�殸忾�殶怅�殸汴�洜潆�洜骒�洜桀�洜轭�洜潆�櫉掮�櫉阢�槦粥�棤愚�棢愚�棢逸�棤逸�棤愚�枱衍�枲唾�暊戎�敔圃�敓囊�敓靡䶮挔课䴗挓故龢悷蹦龝彑�龗帬�龗崯セ龖崯:龕崯⒐龕専⒎龓崯煹龒尃湹龓専湸龑専毑龏嫙棸龐嫙櫛龏嫙棻龏嫚柈鼕ト箊珛嫚柉鼖嫙槹龏嫙棸龐嫙槺龑嫙槺龐嫙棻龐嫙櫛龑嫙槺龐嫙棻龐嫚棻龐嫙槺龐嫙柊龏嫚槺龐嫙棸龐嫙槹龐嫚棸龏嫙棸龏嫙棸龐嫚柋龏嫙柉龎姛敭龍姛挰鼑姛懍鼏墴彧鼑墴帺鼌垷崸鼊墴嫤鼊垷墻鼉垷垿鼉垷墺鼉垷墺鼊垶嫥鼌垷帹鼑墴惇鼕嫙柉龐嫚槺龐嫙棸龒姖櫚麛{嚊待渕q煼�]Y:�PHズ�?/セ�8#⒑�5Щ�7%��C8雌�RP继�bc佬�y~醚�寲难�摕乓�敓庞�暉仍�暉俗�枱污�棤肄�棤愚�棤赞�棢逸�棢肄�棢演�枲逸�棤赃�棢愚�棢愚�棢愚�棤赞�棤赃�槦锗�槧揍�櫊剽�櫉阢�櫉垆�櫊蒎�櫊哞�殸汴�洘潆�洘骒�洜珥�洜轫�硾犺��礇犺��礇犵��礇犵睨硾熺睨硾犳睨硾熸睨硾犳睨硾熸睨硾熸睨硾熸睨硾熸睨矝犳睨硾犳睨矝犲忐矝熶膻皻犫辋皻熱棹畽熭纩瓨熩泾珮熥狺獥犜帼獥犛撖�熞蔺�犚蔺�犚蔺�犘埝�熖佝�熐政�熍誉�犇瑶煋牽晓潚熀她殤煻驱檺煵凝枏煬笼搹牗烬拵煡糊悕煟过憤煠糊憤煡糊憤煠糊拲煠积憤煠糊憤牓糊悕煝过憥煟过弽煛庚弽煚洱帉牊洱弻煘洱悕煛俘憤煟过憤牑过憥牑糊憤煠糊憥煡糊搹煩烬晱牜例棌煯笼槓煵凝殤煷驱殣煹讫殤煻驱洃煼升洅煼升洃煼三殤煼三洅煼叁洅煾升檻煹讫檻牭讫殣煹琵槓煶琵檻煶讫槓煶讫檺煵琵槓煵凝棎煴凝槓煴谬棎煱凝槓煱凝棎煱谬棎煱谬槕煴凝檺牫琵殤煷讫殤牭讫洃煼升湌熀她潛熃妄煋熆牺爴犃晓爴犃瑶�熌誉�犈誉�熑政�熒筑�熕��熕��熕��犓佝獥犝撖嫝爧惪嚊焽嵕嚊焽嵖垳焾嵖墴焿従嫛煁惪尋爩捒彟爮捒彣煆摽惄煇斂挮煉暱摥爴柨暞煏椏敮爺椏暞爼椏柋爾樋槼煒毧櫟牂浛櫠煓浛槼牁毦棿煑櫩棽牀櫩柋煐樋暠煏樋柌煐櫩柌煐櫩棽牀櫩槾煒毧櫠煓浛毞牃浛毠牃溊浐牄溈浐煕溊浌牄澘満煖澙満牅溈満牅澙浐牄澘浐煕溊浌煕澙浌煕澙満煖澘満煖澘満牅溈満牅溈浌煕溊浉煕溊浂潧櫧毘槡暬櫛枡摳櫙挋彾櫘摍惙槷棙捁柉殩摷柋煐椏暟煏樋暞煏樋暟煏椏暟煏椏暟煏樋暟煏椏暟爼樋暟煏椏暠爼樋柋爾樋暠爼樋柌煐樋柋爾樋柌爾櫩柋爾樋暟爼樋暞煏樋暞煏樋暞爼椏暟爼椏暞煏椏暞爼椏暞煏椏敮煍樋敭煍椏敮煍椏敯煍椏暞爼椏暠煏樋暟煏椏柋煐樋柌爾櫩棽煑櫩柌爾櫩棾牀櫩棾煑櫩棾牀櫩棾煑毦槾煒毧樀煒毧櫟煓毧毝牃浛毞牃浛毞煔溈毞煔浛櫡牂浛櫠牂毧樀煒毧棿煑櫩柌爾櫩柋爾樋暠爼樋暟爼樋敮煍椏敮煍椏敭煍椏摦煋柨敮爺椏敮煍椏敮煍椏敭爺柨挮煉柨應爲暱懇煈暱惄煇暱惄煇斂惃爯摽彟爮捒帴煄捑崵煃懣專爩懣將煂惥將煂惥嫛煁惪姞煀従墴焿徔墴焿従墴焿幘垶焾幘垵焾従劃瑒柧垳焾嵖垳焾嵕嚊爣嵕嚊爣嵕嚊焽嵖啗焼尵啗焼嵕啔焼尶啔焼尵啔爢尶厷焻尶厵爡尶厵焻嬁厴焻嬀厵焻尵厴焻嬀厴焻尵剹焺嬀厳焻嬁剺焺嬁剺爠嬁厴焻尵厴焻嬀剺爠嬀剺焺嬀厴焻嬁剹焺嬀剺焺嬀剹焺嬀剹焺嬀剺焺嬀剹焺嬁剹爠嬁剺焺嬁厴焻嬁厴焻嬁厴焻尶厵焻尶嚉焽嵕嚋爣幙垳焾幘垵焾幙嚋焽幙嚋焽嵖垵焾幙姞煀惪專爩懢崶煃捑彠煆斂惃煇摽惃煇摽懇爲斂惇煇斂挮煉柨敪爺椏暞煏樋敭煍椏敭煍椏敭煍椏摨爴椏敮爺椏敮爺椏暟爼樋暞爼椏暟爼樋暟爼椏暟爼椏暟煏樋敮煍樋敭爺椏敮煍椏敮爺椏敮爺椏敮爺椏暞煏椏暞爼樋暞爼樋敯爺樋暞爼樋敮煍樋暟煏樋暟爼樋暟爼樋暞爼椏敯爺椏暞煏椏敯爺椏敮爺椏暞爼椏暞煏樋暞煏樋暟煏樉暟爼樋暟煏樋暠煏樋暟爼樋暟煏樋暟煏樋暟煏樋暞煏椏敮煍椏敭煍柨敮煍椏敭煍椏挱煉柨挮煉暱應煈暱惇爯暱惄爯斂惄煇斂惃爯斂彠爮斂彟煆摼崶煃懣專煂懢嫝煁惥嫛煁惪姛煀徔墴焿従垶焾従墳焿幙垳焾幘垵焾嵖垳焾嵕垳焾幙垳焾幙嚌焽嵕垳焾嵕垳焾嵖垱焾嵖垳焾嵕嚋焽嵖嚋爣嵖垳爤嵖嚋焽幙垳焾幙嚋焽幙垵爤幘垳焾嵕垳焾幙嚋焽嵖嚋焽幘嚋焽幙嚊焽嵕嚊爣尵嚊焽嵖啗爢嵖啗焼嵖嚊焽嵕啔焼尶啔焼尵啓焼尶啓焼尵啒焼尶厵焻尶厷焻尶啓焼尵啓爢尵啔爢尶厵焻尶厵焻尶厵爡尵厵焻尶厵焻尵厵爡尵啔焼尵啔焼尶啔焼尵啔爢尶啔焼尵嚉焽尶啔焼尶嚋焽嵖垵焾幘墲焿幙墳焿幘墳焿徔墳焿幘墴焿従姛煀従姛爦徔姞爦従姞煀従帴煄捒檺牫毗悕煝庚悕煟庚拲煠糊晱煫魁槓煵凝洅煼升瀿牻威爺犃玄�熌隐�熓��犖邺�犛撖�犛撖�熣唼瓨熧恂瘷熰辋矝犲忐硽犳忐睔犪棹瘷犨琬畼熮妣瓨犤泾瓨犢恂瓩熪濑畽熫濑畽熭妣皺犩棹矚熷忐禍犻��稖犾��窚狅��窛燂��窚狆��笢燄��笢狇��笣燄��笣狆��笣狅��窛狅��笣狅��窛狅��窚狅��窛狅��窚燂��窚狀��稖燀��稒濎��禃橁��磼栭稔硱撶睨矏撳膻皰栣棹當氒妣珬熦恂獥犞帼獥犞唼獦熤狺珬熤帼獥犞帼獥熤狺珮熥帼珮熥帼瑯犡狺瑯熧恂瑯犢恂瓨犣泾瓩熩泾瑯熩泾瑯熩恂瑮熦狺珮熥帼獦熣唼珬熤唼獥熣唼�犜唼獦熢唼獥熢撖獦熢唼獥犝撖珮熣唼獥熣唼獥犞唼珮犠狺瑮犡恂瓨犣泾瓨熪濑畽熫妣畽犦妣畽犦琬瘷犧纩畽犧纩瘹熮琬皺熰棹睔熲辋矝熷忐礇熻睨禌熼��禌熼铪礇犺铪硾犳铪硽熷膻睔犮掰瘹熯琬畽熪濑瓩熩泾瑱犡恂獦熤帼�犜撖�犛唼�熞蔺�熞荥�熡蔺�熡唼�犛撖�熜埝�犑佝�犌���熎轧�熍誉�熌隐爴熉瑶煋犂晓潚牷她洅煾升殤煻驱殤牬讫槓煶讫棎煱谬枏煯笼晱煫魁攷煪魁攷煪君搸煣烬搹牗稽憱�╀拵牑糊憤煟糊悕煝庚弻煛庚悕煛庚弽煚俘弽煚俘弻煙洱帉煙洱帉煗谍帉煘谍崒煖待媽煓昌寢煓饼寢牃除媼煓昌媼煒饼媼煒褒媼煒褒妺煑褒媼煒昌媼煒昌媼煓昌媼煑褒媽煑饼媼牀饼媽煒饼媼牁褒媼煐褒妺煑褒媼煑褒妺牁饼媼牁饼媼牁饼寢煔昌寢煔饼崒煔昌崒煖除悓煛庚憤煠过憤煡积憤煡糊悕煝糊悕煝庚搸煢箭枏煯笼殤煷讫潚熀她爺犃玄�犆瑶�犇隐�熍誉�熐轧�熓��犙荥獥熡撖�熞蔺�熞蔺�犚蔺�熡唼�熡撖獦犜帼獦熣帼獦熣帼獦熣帼獦犞帼獦犝帼獥犞唼獥熢唼�熢撖�熡撖�熡撖獦犜唼�熢唼獦犝唼獥熣唼獥熣唼獥熣帼珮熤帼獦犝帼珮熤帼珬犞帼獦熣帼獦熣唼獥熣帼獥熣帼獦犜唼獦犝唼獦犝唼珮犞帼珮犞狺珮犞帼珮犠狺珬犠狺瑯熦恂瑯犠狺瑯熥狺珮熥帼獥犝帼�犜唼�熡撖�熞撖�犚撖〇熞撖�熚邺�熓��熐政�熎政�熍誉�犆誉�熋瑶爴熇Line truncated
+167
View File
@@ -0,0 +1,167 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta name="GENERATOR" content="mkd2html 2.1.3 DL=DISCOUNT">
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=utf-8">
<link rel="stylesheet"
type="text/css"
href="../hint.css">
<title>Best of Show - Most Shrinkable</title>
</head>
<body>
<h1>Best of Show - Most Shrinkable</h1>
<p>Don Yang<br>
<a href="&#x6d;&#x61;&#105;&#108;&#116;&#111;&#58;&#111;&#109;&#111;&#x69;&#107;&#97;&#110;&#x65;&#64;&#x75;&#103;&#117;&#117;&#46;&#111;&#x72;&#103;">&#111;&#109;&#111;&#105;&#x6b;&#97;&#110;&#101;&#x40;&#117;&#103;&#x75;&#117;&#x2e;&#x6f;&#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 akari
</code></pre>
<h3>To run:</h3>
<pre><code>./akari [input_file_or_- [output_file_or_- [even]]]
</code></pre>
<h3>Try:</h3>
<pre><code>./akari &lt; example.ppm &gt; odd_output.ppm
./akari - - even &lt; example.ppm &gt; even_output.ppm
./akari example.ppm odd_output.ppm
make akari2.c
cat akari2.c
make akari2
./akari2 &lt; akari2.c
./akari2 rot13 &lt; akari2.c
make akari3.c
cat akari3.c
make akari3
./akari3
make akari4.c
cat akari4.c
./akari4
</code></pre>
<h3>Selected Judges Remarks:</h3>
<p>Akari is an image downsampling utility that accepts 3 inout formats:</p>
<pre><code>* PGM (netpbm grayscale image). Akari only accept PGM files with this
header: P5 &lt;width&gt; &lt;height&gt; 255. Images with extra comments such as
the ones produced by GIMP will not be parsed properly.
* PPM (netpbm RGB image). Only PPM files with this header are
accepted: P6 &lt;width&gt; &lt;height&gt; 255.
* ASCII art (with end of lines in LF bytes only, not CR-LF)
</code></pre>
<p>Anything that is not parseable as PGM or PPM will be downsampled as ASCII art.</p>
<h2>Author&rsquo;s comments:</h2>
<p>Akari is an image downsampling utility. She accepts up to 3 arguments:</p>
<p>First argument is the input image. If it&rsquo;s &ldquo;-&rdquo; or unspecified, Akari
will read from stdin.</p>
<p>Second argument is the output image. If it&rsquo;s &ldquo;-&rdquo; or unspecified,
Akari will write to stdout.</p>
<p>Third argument, if specified, causes Akari to keep even pixels on even
scanlines. By default Akari will keep odd pixels on odd scanlines.</p>
<p>Examples:</p>
<pre><code>gcc akari.c -o akari
./akari &lt; example.ppm &gt; odd_output.ppm
./akari - - even &lt; example.ppm &gt; even_output.ppm
./akari example.ppm odd_output.ppm
</code></pre>
<p>Akari accepts 3 input formats:
* PGM (netpbm grayscale image). Akari only accept PGM files with this
header: P5 <width> <height> 255. Images with extra comments such as
the ones produced by GIMP will not be parsed properly.
* PPM (netpbm RGB image). Only PPM files with this header are
accepted: P6 <width> <height> 255.
* ASCII art (with end of lines in LF bytes only, not CR-LF)</p>
<p>This is useful for decoding some curiously interlaced images, such as
the included example.ppm</p>
<p>Anything that is not parseable as PGM or PPM will be downsampled as
ASCII art. Since the source code is formatted as ASCII art, it&rsquo;s only
natural to try:</p>
<pre><code>./akari akari.c akari2.c
</code></pre>
<p>akari2.c is also a valid C program, and accepts up to 1 argument.
By default, this second program reads text from stdin and writes
expanded output to stdout. If the extra argument is specified, the
output text will also pass through a rot13 filter.</p>
<pre><code>gcc akari2.c -o akari2
./akari2 &lt; input.txt &gt; expanded_output.txt
./akari2 rot13 &lt; input.txt &gt; expanded_and_rot13_output.txt
</code></pre>
<p>You can combine the two programs together to have just a regular rot13
filter:</p>
<pre><code>./akari2 rot13 &lt; input.txt | ./akari &gt; rot13.txt
</code></pre>
<p>Of course, we wouldn&rsquo;t stop with just 2 programs, you can downsample
the source <em>again</em> and get yet another C program:</p>
<pre><code>./akari &lt; akari.c | ./akari &gt; akari3.c
</code></pre>
<p>We must go deeper:</p>
<pre><code>./akari &lt; akari.c | ./akari | ./akari &gt; akari4.c
</code></pre>
<p>akari3.c and akari4.c are still (mostly valid) C programs.
&ldquo;gcc -Wall&rdquo; will output a few warnings, but still produce output
executables. The output executables each print a message to stdout.</p>
<p>It takes quite a bit of skill and obfuscation to interleave a
C program 4 levels deep, it&rsquo;s much easier to interleave something like
a brainf#$% program in a C program, for example. For comparison, a
brainf#$% program is embedded inside akari.c</p>
<hr />
<!--
(c) Copyright 1984-2012, [Leo Broukhis, Simon Cooper, Landon Curt Noll][judges] - All rights reserved
This work is licensed under a [Creative Commons Attribution-ShareAlike 3.0 Unported License][cc].
[judges]: http://www.ioccc.org/judges.html
[cc]: http://creativecommons.org/licenses/by-sa/3.0/
-->
<TABLE><TR>
<TD><a rel="license" href="http://creativecommons.org/licenses/by-sa/3.0/"><img alt="Creative Commons License" style="border-width:0" src="http://i.creativecommons.org/l/by-sa/3.0/88x31.png" /></a></TD>
<TD><P>&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>
+133
View File
@@ -0,0 +1,133 @@
# Best of Show - Most Shrinkable
Don Yang
<omoikane@uguu.org>
<http://uguu.org/>
## Judges' comments:
### To build:
make akari
### To run:
./akari [input_file_or_- [output_file_or_- [even]]]
### Try:
./akari < example.ppm > odd_output.ppm
./akari - - even < example.ppm > even_output.ppm
./akari example.ppm odd_output.ppm
make akari2.c
cat akari2.c
make akari2
./akari2 < akari2.c
./akari2 rot13 < akari2.c
make akari3.c
cat akari3.c
make akari3
./akari3
make akari4.c
cat akari4.c
./akari4
### Selected Judges Remarks:
Akari is an image downsampling utility that accepts 3 inout formats:
* PGM (netpbm grayscale image). Akari only accept PGM files with this
header: P5 <width> <height> 255. Images with extra comments such as
the ones produced by GIMP will not be parsed properly.
* PPM (netpbm RGB image). Only PPM files with this header are
accepted: P6 <width> <height> 255.
* ASCII art (with end of lines in LF bytes only, not CR-LF)
Anything that is not parseable as PGM or PPM will be downsampled as ASCII art.
## Author's comments:
Akari is an image downsampling utility. She accepts up to 3 arguments:
First argument is the input image. If it's "-" or unspecified, Akari
will read from stdin.
Second argument is the output image. If it's "-" or unspecified,
Akari will write to stdout.
Third argument, if specified, causes Akari to keep even pixels on even
scanlines. By default Akari will keep odd pixels on odd scanlines.
Examples:
gcc akari.c -o akari
./akari < example.ppm > odd_output.ppm
./akari - - even < example.ppm > even_output.ppm
./akari example.ppm odd_output.ppm
Akari accepts 3 input formats:
* PGM (netpbm grayscale image). Akari only accept PGM files with this
header: P5 <width> <height> 255. Images with extra comments such as
the ones produced by GIMP will not be parsed properly.
* PPM (netpbm RGB image). Only PPM files with this header are
accepted: P6 <width> <height> 255.
* ASCII art (with end of lines in LF bytes only, not CR-LF)
This is useful for decoding some curiously interlaced images, such as
the included example.ppm
Anything that is not parseable as PGM or PPM will be downsampled as
ASCII art. Since the source code is formatted as ASCII art, it's only
natural to try:
./akari akari.c akari2.c
akari2.c is also a valid C program, and accepts up to 1 argument.
By default, this second program reads text from stdin and writes
expanded output to stdout. If the extra argument is specified, the
output text will also pass through a rot13 filter.
gcc akari2.c -o akari2
./akari2 < input.txt > expanded_output.txt
./akari2 rot13 < input.txt > expanded_and_rot13_output.txt
You can combine the two programs together to have just a regular rot13
filter:
./akari2 rot13 < input.txt | ./akari > rot13.txt
Of course, we wouldn't stop with just 2 programs, you can downsample
the source *again* and get yet another C program:
./akari < akari.c | ./akari > akari3.c
We must go deeper:
./akari < akari.c | ./akari | ./akari > akari4.c
akari3.c and akari4.c are still (mostly valid) C programs.
"gcc -Wall" will output a few warnings, but still produce output
executables. The output executables each print a message to stdout.
It takes quite a bit of skill and obfuscation to interleave a
C program 4 levels deep, it's much easier to interleave something like
a brainf#$% program in a C program, for example. For comparison, a
brainf#$% program is embedded inside akari.c
--------------------------------------------------------------------------------
<!--
(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/
-->
+13
View File
@@ -0,0 +1,13 @@
###
# #
#
##
#
# #
###
+117
View File
@@ -0,0 +1,117 @@
#!/usr/bin/env make
#
# 2011 makefile
#
# Copyright (C) 2011, Landon Curt Noll, Simon Cooper, and Leonid A. Broukhis.
#
# Creative Commons Attribution-ShareAlike 3.0 Unported License.
# See: http://creativecommons.org/licenses/by-sa/3.0/
################
# tool locations
################
#
SHELL= /bin/bash
CP= cp
CPP= cpp
GUNZIP= gunzip
LD= ld
MAKE= make
RM= rm
SED= sed
TAR= tar
TRUE= true
# optimization
#
# Most compiles will safely use -O2. Some can use only -O1 or -O.
# A few compilers have broken optimizers or this entry make break
# under those buggy optimizers and thus you may not want anything.
#
OPT= -O2
# bitness
#
# Some entries require 32-bitness,
# other entries require 64-bitess.
# By default we assume nothing.
#
ARCH=
# default flags for ANSI C compilation
#
CFLAGS= -Wall -ansi -pedantic -Do=char -Dn=return -Dd=int -Dz=memset -Dk=sizeof -include stdio.h -include string.h -include unistd.h ${ARCH} ${OPT}
# ANSI compiler
#
# Set CC to the name of your ANSI compiler.
#
CC= cc
##############################
# Special flags for this entry
##############################
#
ENTRY= blakely
DATA= 3.dat evolve_to_3.dat t0_3.dat
#################
# build the entry
#################
#
all: ${ENTRY} ${DATA}
@${TRUE}
${ENTRY}: ${ENTRY}.c
${CC} ${CFLAGS} ${ENTRY}.c -o ${ENTRY}
# alternative executable
#
alt:
@${TRUE}
###############
# utility rules
###############
#
everything: all alt
clean:
${RM} -f ${ENTRY}.o
clobber: clean
${RM} -f ${ENTRY}
nuke: clobber
@echo gnab gib!
install:
@echo "Surely you're joking Mr. Feynman!"
# backwards compatibility
#
build: all
##################
# 133t hacker rulz
##################
#
love:
@echo 'not war?'
haste:
$(MAKE) waste
waste:
@echo 'waste'
easter_egg:
@echo you expected to mis-understand this $${RANDOM} magic
@echo chongo '<was here>' "/\\oo/\\"
@echo Readers shall not be disallowed from being unable to partly misunderstand this final echo.
@${TRUE}
+60
View File
@@ -0,0 +1,60 @@
d b,x,h;o q[9802],f[9802];void w(d i){fflush(stdout);printf(
"%c" , ( i>b)?(i%b>0?q[i-b-1]:10):5*(b==i?2:9));if(i<x+b
- 1 )w(i+1) ; } d p(o*e,d i ) { e +=i;n h = ( - b-1
) [ e ] % 2 + ( - b
) [ e ] % 2 +
(-b+1)[ e ] % 2 +( - 1 ) [ e
] % 2+ e [1 ]% 2 +b [ e - 1]% 2 + b[ e ]% 2 +
b [ e+1 ] %2 ;}d m ( d i ){ n
( i == x - 1 ) ?0 :( f [ i +
1 ]=m (i + 1) ) ,32 +3 / (
( p( q , i )> 3 || h < 2 )? 7 :
( ( h == 2 &&q[ i ] == 32
)? 8 : 1 ) );}d y
( d i ){ d j , s , t ,a ,u
;if ( x - 1== i ) n 1 ;if ( f [i]==2) {
f [i ] <<=4;if(y( i))n 1;f[i ]-=- 3 ; if (
y(i ) )n 1;n 0 ; };if((i % b ) ==
0 ||( i % b ) == b-
1 ) n y (i+1 ) ;j
= -1 ; l : ; j =j + 1 ;
if ( j >= ( i - i / b + 2
== b ? 1 : i > 2 * b ?i% b!=
1 ?2 : 2 * 1<< 1 :8 )) goto
c; u = p( f, i ) ; if ( i <
x - 2*b - 1 ) { a =( s =(( t=i % b==
1) ? 1 : i % b != b
- 2 ) ) && i < 2 * b;u+= (
a ? ( j& 4 )
>> 2 : 0 ) + (t ? ( j & 2 ) / 2 : 0) + (
s? ( j&1):0);}else a =t=s=0;if((u&2)+(u&4)!= 2 &&
(q[ i]& 2 ) ==2||u==2&& (f[i]+q[i]) % 2 ==1 ||u
== 3 && ( q [ i]&2)== 0 )
goto l ; b
[i + f ] ^= ! t ? 0
: b[ i + f ] ^ ( 10 + ( j & 2 )
/ 2 ) * 3+2;b[ i + f + 1 - b ] ^= !
a ?0 : b [i + f +1 - b]^ (10+ (
j & 4) / 4 )* 3 +2 ; b [ i
+f + 1 ] ^= ! s ?0 : b [i+ f + 1
] ^ (10 + ( j &1) ) *3+ 2 ; if ( y ( i
+ 1) ){ n 1 ; }; ( a ?
i + 1 : 0 ) [ f ] =( t
? i+ b :0
) [ f ] = ( s ? i
+ b +1:0) [ f ] = 2 ;goto l ; c:n 0 ; } d
main(d c,o**v){d i; x=b=0;while((q[x++]=getchar() ) !=
EOF ){x-=(q[x-1]==10)? b+=1,1:0;q[x-1]^= (q[x-1] ==
32)? 0 : q [ x - 1 ] ^ 35 ; } ; w ( 0 );
for ( ; ;
) { z ( f , 2 , x *
k ( o ) ) ; for ( i = 0;i<=x - 1;
i = i + b )q [ i / b] = q [ x - b+ i /b
] = q [ i ]= q [ i - (
(i == 0) ? 0: 1) ] =f [ i /
b ] = f[ x -b -1+ i/ b] = f [i ] =f[
i - ( ( i == 0 ) ?
0 :1 ) ] = 32; if ( c ==
1 ) m ( 0 ); else
if (y ( b + 1)
==0)n 1;f[0]<<=1<<2;memcpy(q,f,x*k(o));w(0);sleep(1);};n 0;}
+13
View File
@@ -0,0 +1,13 @@
* *
* * *
*** ** *
** * *
* *
** ** *
*** ***
** * *
* * ** *
+254
View File
@@ -0,0 +1,254 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta name="GENERATOR" content="mkd2html 2.1.3 DL=DISCOUNT">
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=utf-8">
<link rel="stylesheet"
type="text/css"
href="../hint.css">
<title>Most devolving</title>
</head>
<body>
<h1>Most devolving</h1>
<p>Philip Blakely<br>
Cambridge, UK<br>
<a href="&#x6d;&#x61;&#105;&#108;&#116;&#111;&#58;&#112;&#109;&#98;&#x6c;&#97;&#107;&#101;&#x6c;&#121;&#x40;&#103;&#109;&#97;&#105;&#108;&#x2e;&#99;&#111;&#109;">&#112;&#109;&#x62;&#108;&#97;&#107;&#x65;&#108;&#121;&#x40;&#103;&#x6d;&#x61;&#x69;&#x6c;&#46;&#x63;&#111;&#x6d;</a></p>
<h2>Judges' comments:</h2>
<h3>To build:</h3>
<pre><code>make blakely
</code></pre>
<h3>To run:</h3>
<pre><code># Zoom out and make your terminal window 53 or more lines deep
./blakely &lt; blakely.c | head -300
</code></pre>
<h3>Try:</h3>
<pre><code>./blakely &lt; 3.dat | head -100
./blakely - &lt; 3.dat | head -40
./blakely &lt; evolve_to_3.dat | head -55
./blakely &lt; t0_3.dat
</code></pre>
<h3>Selected Judges Remarks:</h3>
<p>This program plays Life, computes Pi to 16 digits
if given its own source as input, and allows to check if your garden
is a <a href="http://en.wikipedia.org/wiki/Garden_of_Eden_%28cellular_automaton%29">Garden of Eden</a>, all in one source.</p>
<p>If you have enough time to spare, put the plan of your garden in a text file,
and run:</p>
<pre><code>./blakely - &lt; garden.txt
</code></pre>
<h2>Author&rsquo;s comments:</h2>
<h2>Remarks</h2>
<p>This program uses a well-known algorithm in order to display pi to
fifteen decimal places. The source-layout itself demonstrates the importance of
using the correct amount of whitespace in code and the clear superiority of spaces over tabs.</p>
<p>In order to see the main feature of the code, type:</p>
<pre><code>./blakely &lt; blakely.c
</code></pre>
<p>and wait for about four seconds before using Ctrl-C (or whatever) to end the program. The
results are best viewed in a terminal window at least 60 characters
high and wide. Alternatively, redirect the output to a separate file
(killing when necessary).</p>
<h2>Overview</h2>
<p>The program emulates John Conway&rsquo;s ceullular automaton known as &ldquo;The
Game of Life&rdquo;, using standard input as a starting grid. The layout of
the source-code is such that it evolves to a digital representation of
the first 15 decimal places of pi after 4 time steps. This was setup
using the other feature of the program which can be demonstrated as follows:</p>
<pre><code>./blakely - &lt; 3.dat
</code></pre>
<p>The program will first display the grid given in 3.dat, and then three
more grids (taking a few minutes to display the last). Waiting for any more grids will
take a substantial amount of time. The final grid has been put into
evolve_to_3.dat, and if you type</p>
<pre><code>./blakely &lt; evolve_to_3.dat
</code></pre>
<p>then the 3 will reappear after three time steps.</p>
<p>As should now be clear, this use of program will attempt to evolve a given setup backwards in
time according to the Life rules. The resulting grid is clearly not
necessarily unique. The program will evolve backwards given <em>any</em> single
command line option.</p>
<p>When evolving forwards, the code can only be stopped by killing the
program. In the reverse direction, the code can either be killed, or
will stop if it is unable to find a grid that will evolve to the
current layout correctly. This can be seen with the sample grid
t0_3.dat, which evolves backwards by only two time-steps.</p>
<h2>Input file format</h2>
<p>The input files must encode a square grid, where a space is a dead
cell, and any other character (except a newline) is a living cell. Each line must be the same
length, and end with a single newline character \n (ASCII 10), including the last line. When
designing grids, it may help to type full-stops in place of spaces,
and do a global replace afterwards. Any deviation from this format will
cause errors in the output.</p>
<h2>Limitations</h2>
<p>This is only an approximation to the original Life, as it takes place
on a finite grid, with borders that are automatically killed off
before each time step. However, when evolving backwards, the resulting
grids will not cause any cells on the boundaries to come alive.
As the display is performed before killing off the borders, some
boundary cells may sometimes appear to be alive, but not be treated as
such for the following time-step, although any living cells on the
right border will never be displayed.</p>
<p>The maximum grid size is currently 99 by 99 (exceeding this will cause a
seg-fault), but changing the two 9802s to MAX_SIZE*MAX_SIZE+1 will
solve this, although some reformatting of the
code may have to be done to allow larger numbers.</p>
<h2>Compiler warnings/assumptions</h2>
<p>When compiled with the -Wall -pedantic -ansi options of gcc, some
warnings suggesting extra parentheses occur (not necessary for anyone
fully conversant with operator precedence). There is one unused
variable, v, but unnamed function parameters are not permitted in ANSI
C, so naming it is necessary, and gcc no longer warns about its
existence, although earlier versions did.</p>
<p>Since the program calculates ASCII character values for display, an
ASCII based system is required to run it. Also, as mentioned above,
any system that uses anything other than a plain &lsquo;\n&rsquo; to end a line will cause
problems when reading in files.</p>
<h2>Obfuscations</h2>
<p>Given the finely-tuned layout required to evolve into pi, this is one of the
main obfuscations used in the code. However, running the code through the
preprocessor, expanding the defines, and applying GNU&rsquo;s indent, although
making the location of functions and statements clear, by no means makes the
code entirely clear. Note that expanding out the #defines does not take the
program over the character limit. The main reason for these is to do with the
layout, since there are few places that keywords or tokens of over 2
characters can be fitted, and requiring the first few lines to be #includes
would cause similar problems.</p>
<p>Other obfuscations used are:</p>
<ul>
<li>Use of the classic 2[a] syntax to access the third element of the
array a</li>
<li>Nested ternary operators, combined with shortcut evaluation being
required for correct operation</li>
<li>Use of the comma operator to embed operations inside one another</li>
<li>Calculation of ASCII codes</li>
<li>Needlessly recursive functions</li>
<li>Use of bitwise-operations.</li>
<li>Storing a variable whose value could easily be found from another</li>
<li>Use of gotos to emulate a for loop</li>
</ul>
<h2>Algorithm</h2>
<p>The forwards evolution of the grid is straightforward.</p>
<p>The reverse evolution is done using a brute-force method. As far as I
know, a brute-force method is the only viable automatic approach for
general grids, although more intelligent algorithms would be possible
given more space.</p>
<p>The program starts with an empty &ldquo;trial&rdquo; grid and, starting from the
top-left, tries all possibilities for the neighbours of the current
cell that will cause the cell to evolve to the required state. It then
proceeds to the right and down. Thus, it only ever needs to look at
the cells below and to the right when testing. However, the already
defined cells above and/or to the left of the cell may mean that there
are no possibilities that will give the correct state, in which case
the code backtracks and tries other possibilities on previous
cells. The program knows it has a valid grid if it gets to the last
cell. If it cannot find a valid grid, the program exits.</p>
<p>Since this uses brute-force, it can be very slow. (In fact, the
various obfuscations have, at least for the gcc compiler,
caused a substantial slowdown.)</p>
<h2>Program layout</h2>
<p>The &ldquo;calculation&rdquo; of pi was chosen purely because algorithms to find
pi are numerous, but the Game of Life is rarely (if ever?) used for
this purpose. Also, separate digits made determining the layout somewhat easier.</p>
<p>Deriving the layout was the most complicated part of the program. As is clear from
the final layout featuring pi, the grid was divided into sixteen squares,
and layouts that would evolve to each of the nine digits required were
found. (This used the three-by-five digit-layout embedded in, at first, a
nine-by-nine grid, then in larger grids, until fifteen-by-fifteen was
reached.) The fifteen-by-fifteen grids give enough blank cells around
them that the digits will not collide when evolving.</p>
<p>However, this did not allow for sufficient characters to fit the code
into. Therefore it was necessary to add some regions that would quickly die off
without expanding to collide with the digits' evolution.
Groups of cells such as singletons, pairs, and larger groups like</p>
<pre><code>* * * * * * * * * *
*****************
* * * * * * * * * *
</code></pre>
<p>were useful in this regard.</p>
<p>Other problems were given by keywords which need to be all in one
string, keywords requiring space after them, and
multi-character tokens. Some of these problems were dealt with by
using the #defines and #includes given in the build-script, as there
was no way to have sufficient separate lines in the code to do this
without causing many difficulties. Some rejigging of the grid&rsquo;s layout
as the code was fitted into its format was also done, resorting to
trial-and-improvement in some cases. Occasional use of constructs such
as f -= -3 was made as f += 3 could not be fitted into the required format.
The fact that the borders would be killed off immediately was also helpful.</p>
<p>It should be noted that evolving a full 60-by-60 grid backwards using
this code would probably take us at least up to the heat-death of the
universe.</p>
<p>The command ./blakely - &lt; blakely.c is therefore <em>not</em> recommended.</p>
<hr />
<!--
(c) Copyright 1984-2012, [Leo Broukhis, Simon Cooper, Landon Curt Noll][judges] - All rights reserved
This work is licensed under a [Creative Commons Attribution-ShareAlike 3.0 Unported License][cc].
[judges]: http://www.ioccc.org/judges.html
[cc]: http://creativecommons.org/licenses/by-sa/3.0/
-->
<TABLE><TR>
<TD><a rel="license" href="http://creativecommons.org/licenses/by-sa/3.0/"><img alt="Creative Commons License" style="border-width:0" src="http://i.creativecommons.org/l/by-sa/3.0/88x31.png" /></a></TD>
<TD><P>&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>
+227
View File
@@ -0,0 +1,227 @@
# Most devolving
Philip Blakely
Cambridge, UK
<pmblakely@gmail.com>
## Judges' comments:
### To build:
make blakely
### To run:
# Zoom out and make your terminal window 53 or more lines deep
./blakely < blakely.c | head -300
### Try:
./blakely < 3.dat | head -100
./blakely - < 3.dat | head -40
./blakely < evolve_to_3.dat | head -55
./blakely < t0_3.dat
### Selected Judges Remarks:
This program plays Life, computes Pi to 16 digits
if given its own source as input, and allows to check if your garden
is a [Garden of Eden](http://en.wikipedia.org/wiki/Garden_of_Eden_%28cellular_automaton%29), all in one source.
If you have enough time to spare, put the plan of your garden in a text file,
and run:
./blakely - < garden.txt
## Author's comments:
Remarks
-------
This program uses a well-known algorithm in order to display pi to
fifteen decimal places. The source-layout itself demonstrates the importance of
using the correct amount of whitespace in code and the clear superiority of spaces over tabs.
In order to see the main feature of the code, type:
./blakely < blakely.c
and wait for about four seconds before using Ctrl-C (or whatever) to end the program. The
results are best viewed in a terminal window at least 60 characters
high and wide. Alternatively, redirect the output to a separate file
(killing when necessary).
Overview
--------
The program emulates John Conway's ceullular automaton known as "The
Game of Life", using standard input as a starting grid. The layout of
the source-code is such that it evolves to a digital representation of
the first 15 decimal places of pi after 4 time steps. This was setup
using the other feature of the program which can be demonstrated as follows:
./blakely - < 3.dat
The program will first display the grid given in 3.dat, and then three
more grids (taking a few minutes to display the last). Waiting for any more grids will
take a substantial amount of time. The final grid has been put into
evolve\_to\_3.dat, and if you type
./blakely < evolve_to_3.dat
then the 3 will reappear after three time steps.
As should now be clear, this use of program will attempt to evolve a given setup backwards in
time according to the Life rules. The resulting grid is clearly not
necessarily unique. The program will evolve backwards given *any* single
command line option.
When evolving forwards, the code can only be stopped by killing the
program. In the reverse direction, the code can either be killed, or
will stop if it is unable to find a grid that will evolve to the
current layout correctly. This can be seen with the sample grid
t0_3.dat, which evolves backwards by only two time-steps.
Input file format
-----------
The input files must encode a square grid, where a space is a dead
cell, and any other character (except a newline) is a living cell. Each line must be the same
length, and end with a single newline character \n (ASCII 10), including the last line. When
designing grids, it may help to type full-stops in place of spaces,
and do a global replace afterwards. Any deviation from this format will
cause errors in the output.
Limitations
-----------
This is only an approximation to the original Life, as it takes place
on a finite grid, with borders that are automatically killed off
before each time step. However, when evolving backwards, the resulting
grids will not cause any cells on the boundaries to come alive.
As the display is performed before killing off the borders, some
boundary cells may sometimes appear to be alive, but not be treated as
such for the following time-step, although any living cells on the
right border will never be displayed.
The maximum grid size is currently 99 by 99 (exceeding this will cause a
seg-fault), but changing the two 9802s to MAX\_SIZE*MAX\_SIZE+1 will
solve this, although some reformatting of the
code may have to be done to allow larger numbers.
Compiler warnings/assumptions
-----------------------------
When compiled with the -Wall -pedantic -ansi options of gcc, some
warnings suggesting extra parentheses occur (not necessary for anyone
fully conversant with operator precedence). There is one unused
variable, v, but unnamed function parameters are not permitted in ANSI
C, so naming it is necessary, and gcc no longer warns about its
existence, although earlier versions did.
Since the program calculates ASCII character values for display, an
ASCII based system is required to run it. Also, as mentioned above,
any system that uses anything other than a plain '\n' to end a line will cause
problems when reading in files.
Obfuscations
------------
Given the finely-tuned layout required to evolve into pi, this is one of the
main obfuscations used in the code. However, running the code through the
preprocessor, expanding the defines, and applying GNU's indent, although
making the location of functions and statements clear, by no means makes the
code entirely clear. Note that expanding out the #defines does not take the
program over the character limit. The main reason for these is to do with the
layout, since there are few places that keywords or tokens of over 2
characters can be fitted, and requiring the first few lines to be #includes
would cause similar problems.
Other obfuscations used are:
- Use of the classic 2[a] syntax to access the third element of the
array a
- Nested ternary operators, combined with shortcut evaluation being
required for correct operation
- Use of the comma operator to embed operations inside one another
- Calculation of ASCII codes
- Needlessly recursive functions
- Use of bitwise-operations.
- Storing a variable whose value could easily be found from another
- Use of gotos to emulate a for loop
Algorithm
---------
The forwards evolution of the grid is straightforward.
The reverse evolution is done using a brute-force method. As far as I
know, a brute-force method is the only viable automatic approach for
general grids, although more intelligent algorithms would be possible
given more space.
The program starts with an empty "trial" grid and, starting from the
top-left, tries all possibilities for the neighbours of the current
cell that will cause the cell to evolve to the required state. It then
proceeds to the right and down. Thus, it only ever needs to look at
the cells below and to the right when testing. However, the already
defined cells above and/or to the left of the cell may mean that there
are no possibilities that will give the correct state, in which case
the code backtracks and tries other possibilities on previous
cells. The program knows it has a valid grid if it gets to the last
cell. If it cannot find a valid grid, the program exits.
Since this uses brute-force, it can be very slow. (In fact, the
various obfuscations have, at least for the gcc compiler,
caused a substantial slowdown.)
Program layout
--------------
The "calculation" of pi was chosen purely because algorithms to find
pi are numerous, but the Game of Life is rarely (if ever?) used for
this purpose. Also, separate digits made determining the layout somewhat easier.
Deriving the layout was the most complicated part of the program. As is clear from
the final layout featuring pi, the grid was divided into sixteen squares,
and layouts that would evolve to each of the nine digits required were
found. (This used the three-by-five digit-layout embedded in, at first, a
nine-by-nine grid, then in larger grids, until fifteen-by-fifteen was
reached.) The fifteen-by-fifteen grids give enough blank cells around
them that the digits will not collide when evolving.
However, this did not allow for sufficient characters to fit the code
into. Therefore it was necessary to add some regions that would quickly die off
without expanding to collide with the digits' evolution.
Groups of cells such as singletons, pairs, and larger groups like
* * * * * * * * * *
*****************
* * * * * * * * * *
were useful in this regard.
Other problems were given by keywords which need to be all in one
string, keywords requiring space after them, and
multi-character tokens. Some of these problems were dealt with by
using the #defines and #includes given in the build-script, as there
was no way to have sufficient separate lines in the code to do this
without causing many difficulties. Some rejigging of the grid's layout
as the code was fitted into its format was also done, resorting to
trial-and-improvement in some cases. Occasional use of constructs such
as f -= -3 was made as f += 3 could not be fitted into the required format.
The fact that the borders would be killed off immediately was also helpful.
It should be noted that evolving a full 60-by-60 grid backwards using
this code would probably take us at least up to the heat-death of the
universe.
The command ./blakely - < blakely.c is therefore *not* recommended.
--------------------------------------------------------------------------------
<!--
(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/
-->
+9
View File
@@ -0,0 +1,9 @@
###
#
###
#
###
+117
View File
@@ -0,0 +1,117 @@
#!/usr/bin/env make
#
# 2011 makefile
#
# Copyright (C) 2011, Landon Curt Noll, Simon Cooper, and Leonid A. Broukhis.
#
# Creative Commons Attribution-ShareAlike 3.0 Unported License.
# See: http://creativecommons.org/licenses/by-sa/3.0/
################
# tool locations
################
#
SHELL= /bin/bash
CP= cp
CPP= cpp
GUNZIP= gunzip
LD= ld
MAKE= make
RM= rm
SED= sed
TAR= tar
TRUE= true
# optimization
#
# Most compiles will safely use -O2. Some can use only -O1 or -O.
# A few compilers have broken optimizers or this entry make break
# under those buggy optimizers and thus you may not want anything.
#
OPT= -O2
# bitness
#
# Some entries require 32-bitness,
# other entries require 64-bitess.
# By default we assume nothing.
#
ARCH=
# default flags for ANSI C compilation
#
CFLAGS= -Wall -W -ansi ${ARCH} ${OPT} -lm
# ANSI compiler
#
# Set CC to the name of your ANSI compiler.
#
CC= cc
##############################
# Special flags for this entry
##############################
#
ENTRY= borsanyi
DATA= data.1 data.2 data.3
#################
# build the entry
#################
#
all: ${ENTRY} ${DATA}
@${TRUE}
${ENTRY}: ${ENTRY}.c
${CC} ${CFLAGS} ${ENTRY}.c -o ${ENTRY}
# alternative executable
#
alt:
@${TRUE}
###############
# utility rules
###############
#
everything: all alt
clean:
${RM} -f ${ENTRY}.o
clobber: clean
${RM} -f ${ENTRY}
nuke: clobber
@echo gnab gib!
install:
@echo "Surely you're joking Mr. Feynman!"
# backwards compatibility
#
build: all
##################
# 133t hacker rulz
##################
#
love:
@echo 'not war?'
haste:
$(MAKE) waste
waste:
@echo 'waste'
easter_egg:
@echo you expected to mis-understand this $${RANDOM} magic
@echo chongo '<was here>' "/\\oo/\\"
@echo Readers shall not be disallowed from being unable to partly misunderstand this final echo.
@${TRUE}
+12
View File
@@ -0,0 +1,12 @@
# include <math.h>
# include <stdio.h>
# define d double
d a,s;int n;p(d t ,d M,d x)
{ return x>0?x>1 &&!fork( )?p(t,s+=
a ,x-1):0 :scanf( "%lf",&x )-1?a=(M-
t )/22,s= pow(10, (int)( log10(a)) /*It is
a simple tool to quickly analyze data. */
- 2),s=t- (a =s*( int)(a/s ))/2,p(t, s,(int)(
( a+M-t)/ a)):p(t >M|x<t?x :t,t>M|x >M?x:M ,--n)+(x
> s&&x <= s+a); } main(j){ j==1?j=p (1,0,0) ,printf(
"%+12g %4d",s+a/2,j,wait(NULL)),main(j*400/n):putchar(35-25*!j)&' '&&main(j+1);}
+2000
View File
File diff suppressed because it is too large. Load diff
+100
View File
@@ -0,0 +1,100 @@
-0.692307692307693
-0.653846153846154
-0.846153846153846
-1.07692307692308
-0.269230769230769
-0.461538461538462
-0.923076923076923
-0.692307692307691
-0.0769230769230778
-1.23076923076923
-1.23076923076923
-0.23076923076923
0.923076923076923
0.653846153846153
0.384615384615385
-0.576923076923077
-0.5
0.153846153846154
-2.23076923076923
-0.846153846153846
0.846153846153846
-0.576923076923077
0.423076923076922
-0.346153846153847
-1.42307692307692
0.807692307692307
-0.0384615384615377
0.346153846153847
-1.15384615384615
-1.57692307692308
-0.0384615384615383
-0.576923076923078
-0.384615384615385
-0.76923076923077
-0.538461538461539
-0.269230769230769
8.32667268468867e-16
-0.692307692307693
-1.69230769230769
0.615384615384616
-3.33066907387547e-16
-1.61538461538462
-0.269230769230769
-1.03846153846154
-0.884615384615383
-1.38461538461538
0.26923076923077
-8.88178419700125e-16
-0.0769230769230773
-0.769230769230769
0.769230769230768
-1.23076923076923
-0.0384615384615387
-0.153846153846155
0.115384615384616
0.73076923076923
-0.923076923076923
-0.384615384615384
-0.461538461538461
-0.807692307692307
-0.653846153846154
0.384615384615385
-0.692307692307691
-1.80769230769231
-0.653846153846154
-0.384615384615386
-1.46153846153846
-0.846153846153845
-0.653846153846154
0.0384615384615383
-1.46153846153846
-0.846153846153845
-2.23076923076923
-1.50573997714787e-15
0.500000000000001
-1.11538461538462
0.153846153846154
-0.615384615384615
1.38461538461538
-0.307692307692308
-0.461538461538462
0.230769230769231
-0.423076923076923
-1.84615384615385
0.576923076923077
-1.34615384615385
-0.730769230769229
-1.19230769230769
0.615384615384616
-0.730769230769231
-0.961538461538462
-0.961538461538461
0.307692307692308
0.0769230769230764
-0.192307692307693
-0.384615384615386
-1.61538461538462
0.153846153846154
-1.23076923076923
-0.538461538461537
+100
View File
@@ -0,0 +1,100 @@
120
109
115
122
97
118
98
103
116
100
117
116
110
114
103
114
105
112
97
101
101
100
121
108
121
112
113
97
99
121
116
115
110
116
110
104
113
106
101
104
106
98
111
105
120
121
106
119
116
106
113
108
121
118
108
101
98
101
121
97
105
121
120
108
118
116
111
112
105
109
112
107
113
110
122
122
105
97
117
101
120
103
99
105
112
105
118
99
120
108
115
121
122
109
98
103
106
114
121
117
+114
View File
@@ -0,0 +1,114 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta name="GENERATOR" content="mkd2html 2.1.3 DL=DISCOUNT">
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=utf-8">
<link rel="stylesheet"
type="text/css"
href="../hint.css">
<title>Best data utility</title>
</head>
<body>
<h1>Best data utility</h1>
<p>Szabolcs Borsanyi<br>
Theoretische Physik<br>
Gaussstraße 20<br>
42097 Wuppertal<br>
Germany<br>
<a href="&#x6d;&#x61;&#105;&#108;&#116;&#111;&#58;&#98;&#111;&#114;&#x73;&#97;&#110;&#121;&#x69;&#64;&#x75;&#110;&#105;&#45;&#119;&#117;&#x70;&#112;&#101;&#114;&#116;&#97;&#x6c;&#46;&#100;&#101;">&#x62;&#111;&#114;&#x73;&#97;&#x6e;&#x79;&#x69;&#x40;&#117;&#x6e;&#105;&#x2d;&#119;&#117;&#112;&#112;&#x65;&#114;&#116;&#x61;&#108;&#46;&#x64;&#101;</a></p>
<h2>Judges' comments:</h2>
<h3>To build:</h3>
<pre><code>make borsanyi
</code></pre>
<h3>To run:</h3>
<pre><code>./borsanyi &lt; some_data_file
</code></pre>
<h3>Try:</h3>
<pre><code>./borsanyi &lt; data.1
./borsanyi &lt; data.2
./borsanyi &lt; data.3
</code></pre>
<h3>Selected Judges Remarks:</h3>
<p>This is a nice quick histogram plotter. A useful utility when you need to
look at the distribution of some data.</p>
<p>Here are some challenges:</p>
<p>You can modify the number of histogram bins and the scaling of the histogram
by editing the source. Try to find them!</p>
<p>If you look at the source you will notice that the usual array of
histogram bins is missing. The source contains no arrays and it does not
use malloc or alloca. How does it build the histogram?</p>
<p>While the input does not need to be sorted, the histogram output is sorted.
How does it put the data into buckets? Why does it fork 22 times?</p>
<h2>Author&rsquo;s comments:</h2>
<p>This small piece of program is meant to be a useful tool, when
there are some data around and you need a quick glance at the
histogram. I am all too often logged in to a remote machine with
slow X connection, and a terminal-based program would be of
great help.</p>
<h1>Limitations:</h1>
<ul>
<li>I optimized the output for the data I had around, you might want to adjust
for your needs. For a great excess of data points the program will crash
(depending on the available stack).</li>
<li>Giving too few (distinct) points can also cause crash (or division by zero).</li>
<li>The program expects plain numbers separated by white spaces.</li>
<li>ASCII is assumed.</li>
<li>Some POSIX-like system is assumed (fork and wait(NULL) are used)</li>
<li>Do not give any arguments to the program.</li>
<li>Could rounding errors cause the omission of the highest bin? There might be
empty bins at the edges.</li>
</ul>
<h1>Obfuscation:</h1>
<ul>
<li>The program follows a rather unconventional approach to the task
of histogram building. The usual array of integers (for the histogram
bins) is missing entirely. The data are read once, the range is determined,
but the data points are not put in any array. Yet they are remembered,
and each of them is put into its own bin afterwards. But where are the bins?</li>
<li>I tried to use as few keywords as possible, hence there are no loops.</li>
<li>Multi-process approach for optimal use of resources.</li>
<li>Some bin size obfuscation.</li>
</ul>
<hr />
<!--
(c) Copyright 1984-2012, [Leo Broukhis, Simon Cooper, Landon Curt Noll][judges] - All rights reserved
This work is licensed under a [Creative Commons Attribution-ShareAlike 3.0 Unported License][cc].
[judges]: http://www.ioccc.org/judges.html
[cc]: http://creativecommons.org/licenses/by-sa/3.0/
-->
<TABLE><TR>
<TD><a rel="license" href="http://creativecommons.org/licenses/by-sa/3.0/"><img alt="Creative Commons License" style="border-width:0" src="http://i.creativecommons.org/l/by-sa/3.0/88x31.png" /></a></TD>
<TD><P>&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>
+81
View File
@@ -0,0 +1,81 @@
# Best data utility
Szabolcs Borsanyi
Theoretische Physik
Gaussstraße 20
42097 Wuppertal
Germany
<borsanyi@uni-wuppertal.de>
## Judges' comments:
### To build:
make borsanyi
### To run:
./borsanyi < some_data_file
### Try:
./borsanyi < data.1
./borsanyi < data.2
./borsanyi < data.3
### Selected Judges Remarks:
This is a nice quick histogram plotter. A useful utility when you need to
look at the distribution of some data.
Here are some challenges:
You can modify the number of histogram bins and the scaling of the histogram
by editing the source. Try to find them!
If you look at the source you will notice that the usual array of
histogram bins is missing. The source contains no arrays and it does not
use malloc or alloca. How does it build the histogram?
While the input does not need to be sorted, the histogram output is sorted.
How does it put the data into buckets? Why does it fork 22 times?
## Author's comments:
This small piece of program is meant to be a useful tool, when
there are some data around and you need a quick glance at the
histogram. I am all too often logged in to a remote machine with
slow X connection, and a terminal-based program would be of
great help.
# Limitations:
* I optimized the output for the data I had around, you might want to adjust
for your needs. For a great excess of data points the program will crash
(depending on the available stack).
* Giving too few (distinct) points can also cause crash (or division by zero).
* The program expects plain numbers separated by white spaces.
* ASCII is assumed.
* Some POSIX-like system is assumed (fork and wait(NULL) are used)
* Do not give any arguments to the program.
* Could rounding errors cause the omission of the highest bin? There might be
empty bins at the edges.
# Obfuscation:
* The program follows a rather unconventional approach to the task
of histogram building. The usual array of integers (for the histogram
bins) is missing entirely. The data are read once, the range is determined,
but the data points are not put in any array. Yet they are remembered,
and each of them is put into its own bin afterwards. But where are the bins?
* I tried to use as few keywords as possible, hence there are no loops.
* Multi-process approach for optimal use of resources.
* Some bin size obfuscation.
--------------------------------------------------------------------------------
<!--
(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/
-->
+127
View File
@@ -0,0 +1,127 @@
#!/usr/bin/env make
#
# 2011 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
# Compiler warnings
#
CWARN= -Wall -W
# compiler standard
#
CSTD= -std=c99
# compiler bit architecture
#
# Some entries require 32-bitness,
# other entries require 64-bitess.
# 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= -O2
# default flags for ANSI C compilation
#
CFLAGS= ${CWARN} ${CSTD} ${ARCH} ${OPT} -lm -D_BSD_SOURCE
# ANSI compiler
#
# Set CC to the name of your ANSI compiler.
#
CC= cc
##############################
# Special flags for this entry
##############################
#
ENTRY= dlowe
DATA= earlystop.pl
#################
# build the entry
#################
#
all: ${ENTRY} ${DATA}
@${TRUE}
${ENTRY}: ${ENTRY}.c
${CC} ${CFLAGS} ${ENTRY}.c -o ${ENTRY}
# alternative executable
#
alt:
@${TRUE}
###############
# utility rules
###############
#
everything: all alt
clean:
${RM} -f ${ENTRY}.o
clobber: clean
${RM} -f ${ENTRY}
nuke: clobber
@echo gnab gib!
install:
@echo "Surely you're joking Mr. Feynman!"
# backwards compatibility
#
build: all
##################
# 133t hacker rulz
##################
#
love:
@echo 'not war?'
haste:
$(MAKE) waste
waste:
@echo 'waste'
easter_egg:
@echo you expected to mis-understand this $${RANDOM} magic
@echo chongo '<was here>' "/\\oo/\\"
@echo Readers shall not be disallowed from being unable to partly misunderstand this final echo.
@${TRUE}
Binary file not shown.
+43
View File
@@ -0,0 +1,43 @@
#include <stdlib.h>
#include <string.h>
#include <dirent.h>
#include <stdio.h>
#include <math.h>
#include <time.h>
#define _ float
_ CRUSH(_*LEG,int ARM,_*FINGER) {
_ GORE; for(GORE=0,--ARM; ARM>=0; --ARM)GORE+=FINGER[ARM]*ARM
[LEG]; return GORE; } _*BITE(){ _*BRAIN=calloc(sizeof(_),1<<17);int TOE
=getc(stdin),EYE,SKULL=0; while((EYE=getc(stdin))!=EOF){ ++BRAIN[(TOE<<8) +
EYE]; ++SKULL; TOE=EYE; } if(SKULL)for(TOE=0; TOE<8<<13; ++ TOE)BRAIN [TOE]/=
SKULL; return BRAIN; } _ CHEW(_*GUT,_ BONE[][1<<16]){ int GRR; for(GRR=0; GRR<
6; ++GRR){ GUT[GRR+256*256]=powf(1+expf(-CRUSH(BONE[GRR],1<<16,GUT)),-1); BONE
[6][50+GRR]=GUT[256*256+GRR]*(1.-GUT[(8<<13)+GRR]); } BONE[6][81]=1/(1 +expf(-
CRUSH(GUT+(1<<16),6,BONE[6]))); return BONE[6][82]=BONE[6][81]*(1.-BONE[6][81]
),BONE[6][81]; } _ GNAW(_ FLESH,_ LEG[][2<<15],_*EYE){ int UG,MMM; LEG[6][13]=
FLESH-CHEW(EYE,LEG); LEG[6][14]=LEG[6][ 82]*LEG[6][13]; for(UG=0; UG<6; ++UG){
LEG[6][34]=LEG[6][UG+(1<<7)-14]*LEG[6][7<<1]*LEG[6][UG]; for(MMM=0; MMM<4<<14;
++MMM)LEG [UG][MMM]+=LEG[6][34]*.3*EYE[MMM]; LEG[6][UG]+=.3*LEG[6][14
]*EYE[ 256*256+UG]; } return powf(LEG[6] [13],2); } _
**EAT( char*TOMB){ DIR*BONE = opendir( TOMB); int
BRAIN= 0; struct dirent*TOOTH; _**BODY =0; while
(BONE?(TOOTH= readdir(BONE)):0){ if( TOOTH-> d_name[0]
!=46){ char*MOAN=malloc(strlen(TOMB)+strlen(TOOTH->d_name )+1); sprintf(
MOAN, "%s%s",TOMB,TOOTH ->d_name); if(freopen(MOAN, "r",stdin)){ BODY=realloc(
BODY,sizeof(_*)*(BRAIN+1)); BRAIN ++ [BODY]=BITE(); } } } return BODY=realloc(
BODY,(1+BRAIN)*sizeof(_*)),BODY[BRAIN]=0,BODY; } int main(int GRR,char **UGH){
_ BRAINS[7][1<<16],***CORPSES; int PUS,OOZE,UG; for(srand(time(0)),PUS=0; PUS<
7; ++PUS)for(OOZE=0; OOZE<4<<14; ++OOZE)BRAINS[PUS][OOZE]=rand()/(_)RAND_MAX
-.5;fread(BRAINS,sizeof(BRAINS),1,stdin); if(*UGH[1]==45){ GRR-=2; CORPSES
=malloc( sizeof(_
**)*GRR ); for(
PUS=0; PUS<
GRR; ++ PUS)CORPSES[PUS]=EAT(UGH[2+PUS]); for(UG=
0; UG<atoi (&(UGH[1][1])); ++UG){ BRAINS[6][97]= 0; for(PUS
=0; PUS<GRR; ++PUS)for(OOZE=0; CORPSES[PUS][OOZE]; ++OOZE)BRAINS [6][
97]+=GNAW(1.-(_) PUS/(GRR-1),BRAINS,CORPSES[PUS][OOZE]); fprintf(
stderr,"%d: %f\n",UG,BRAINS[6][97]); } fwrite( BRAINS, sizeof(
BRAINS),1,stdout); } else for(UG=1; UG<GRR; ++UG)if(freopen(
UGH[UG],"r",stdin))fprintf(stderr,"%s %f\n",UGH[UG],
CHEW(BITE(),BRAINS)); return 0; }
+37
View File
@@ -0,0 +1,37 @@
#!/usr/bin/env perl
use strict;
use warnings;
if ($#ARGV != 4) {
die "usage: $0 <net> <train corpus 1> <train corpus 0> <test corpus 1> <test corpus 0>\n"
}
my ($net, $train1, $train0, $test1, $test0) = @ARGV[0..4];
my $error = undef;
my $n = 1;
open TOUCH, '>', $net;
close TOUCH;
while (1) {
print "training $n to " . ($n+1000) . "...\n";
system "./dlowe -1000 $train1 $train0 < $net > $net.tmp 2>/dev/null";
rename "$net.tmp", $net;
my $current_error = 0;
for my $r (split /\s+/, `./dlowe $test1* < $net 2>&1 | awk '{print \$NF}'`) {
$current_error += ((1.0 - $r) ** 2);
}
for my $r (split /\s+/, `./dlowe $test0* < $net 2>&1 | awk '{print \$NF}'`) {
$current_error += ((0.0 - $r) ** 2);
}
if (defined $error) {
print "prior error = $error; current error = $current_error\n";
if ($error - $current_error < 0.01) {
last;
}
}
$error = $current_error;
$n += 1000;
}
+336
View File
@@ -0,0 +1,336 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta name="GENERATOR" content="mkd2html 2.1.3 DL=DISCOUNT">
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=utf-8">
<link rel="stylesheet"
type="text/css"
href="../hint.css">
<title>Most self deprecating</title>
</head>
<body>
<h1>Most self deprecating</h1>
<p>David Lowe<br>
434 Tenney Drive<br>
Rogue River, OR<br>
97537<br>
<a href="&#x6d;&#x61;&#105;&#108;&#116;&#111;&#58;&#106;&#46;&#100;&#x61;&#118;&#105;&#100;&#x2e;&#108;&#x6f;&#119;&#101;&#64;&#103;&#109;&#x61;&#105;&#108;&#46;&#99;&#111;&#x6d;">&#106;&#46;&#100;&#x61;&#118;&#105;&#x64;&#46;&#x6c;&#x6f;&#x77;&#x65;&#64;&#x67;&#109;&#x61;&#105;&#108;&#46;&#99;&#x6f;&#109;</a><br>
<a href="http://www.pootpoot.net/">http://www.pootpoot.net/</a></p>
<h2>Judges' comments:</h2>
<h3>To build:</h3>
<pre><code>make dlowe
</code></pre>
<h3>To run:</h3>
<pre><code>./dlowe -&lt;n_iterations&gt; corpus1/ [...] corpus0/ &lt; start.net &gt; end.net
NOTE: The directory entries MUST end in a /
./dlowe file [file ...] &lt; trained.net
</code></pre>
<h3>Try:</h3>
<pre><code>Download the dlowe-aux-data.tar.bz2 file from:
curl -O http://www.ioccc.org/2011/dlowe/dlowe-aux-data.tar.bz2
tar -jxf dlowe-aux-data.tar.bz2
./dlowe dlowe.c &lt; ioccc-winlose-trained.net
./dlowe dlowe &lt; ioccc-winlose-trained.net
./dlowe xor-0/00 &lt; xor-trained.net
./dlowe xor-0/11 &lt; xor-trained.net
./dlowe xor-1/01 &lt; xor-trained.net
./dlowe xor-1/10 &lt; xor-trained.net
./dlowe hint.html &lt; english-trained.net
./dlowe dlowe-aux-data.tar.bz2 &lt; png-trained.net
</code></pre>
<h3>Selected Judges Remarks:</h3>
<p>This entry is a ghoulish example of a brain (dead?) neural network classifier.
It comes with a set of corpora for you to try.</p>
<h4>ioccc-winlose-trained.net</h4>
<p>You can create your own trained networks. For example, we trained a network
on the C code of entries that were supplied to the 20Th IOCCC.</p>
<p>The ioccc-winlose-trained.net was trained using the earlystop.pl tool:</p>
<pre><code>rm -f ioccc-winlose-trained.net
./earlystop.pl ioccc-winlose-trained.net ioccc_won_training/ ioccc_lost_training/ ioccc_won_test/ ioccc_lost_test/
</code></pre>
<p>where:</p>
<pre><code>ioccc_won_training/
1/2 of C code of the 20th IOCCC winners (except for dlowe.c from 2011)
plus 1/2 of the C code winners from prior IOCCC contests
ioccc_won_test/
1/2 of C code of the 20th IOCCC winners (except for dlowe.c from 2011)
plus 1/2 of the C code winners from prior IOCCC contests
ioccc_lost_training/
1/2 of C code from entries that that did not win
ioccc_lost_test/
1/2 of C code from entries that that did not win
NOTE: The above directies were not shipped and the C code from
entries that that did not win was flushed to /dev/null.
</code></pre>
<p>The earlystop.pl tool wrote:</p>
<pre><code>training 1 to 1001...
training 1001 to 2001...
prior error = 56.746974766043; current error = 58.095691135305
</code></pre>
<p>The resulting ioccc-winlose-trained.net file was included in the
dlowe-aux-data.tar.bz2 file in the above mentioned URL.</p>
<p>The dlowe.c was explicitly excluded from this trailing set. So this test is interesting:</p>
<pre><code>./dlowe dlowe.c &lt; ioccc-winlose-trained.net
</code></pre>
<p>The match of dlowe.c to the lose/win trailed network was:</p>
<pre><code>dlowe.c 0.125108
</code></pre>
<p>NOTE: The non-artificially intelligent decisions of the IOCCC judges include random
quirks and their non-linear judgment calls not found in the ioccc trained network.
Just because C code is or isn&rsquo;t scored highly by this network does not
mean it will win or lose a future IOCCC. On the other hand &hellip; it just might!</p>
<h4>other data sets to try</h4>
<p>While we cannot supply you with the losing IOCCC source code, the author did supply a number
data sets on which to test:</p>
<p>We created the english-trained.net as follows:</p>
<pre><code>./dlowe -8000 english-1/ english-0/ &lt; /dev/null &gt; english-trained.net
english-0/
Non-English (French) text
english-1/
English (non-French) text
</code></pre>
<p>We created the png-trained.net as follows:</p>
<pre><code>./dlowe -8000 png-1/ png-0/ &lt; /dev/null &gt; png-trained.net
png-0/
Non-png (gif) images
png-1/
png (non-gif) images
</code></pre>
<p>We created the xor-trained.net as follows:</p>
<pre><code>./dlowe -8000 xor-1/ xor-0/ &lt; /dev/null &gt; xor-trained.net
xor-0/
Data that XORs to 0
xor-1/
Data that XORs to 1
</code></pre>
<h2>Author&rsquo;s comments:</h2>
<h1>Synopsis:</h1>
<p>This is an artificially intelligent judging tool to help the IOCCC judges.
Here&rsquo;s to shorter, more frequent contests!</p>
<h1>Description:</h1>
<p>This is a multilayer perceptron (a feedforward artificial neural network)
which can be trained, using on-line backpropagation, to classify input files.</p>
<p>It has a fixed topology of 2<sup>16</sup> input neurons, 6 hidden neurons and 1 output
neuron.</p>
<p>The neurons' activation function is the logistic function 1 / (1 + e ^ -x).</p>
<h2>Classifying</h2>
<pre><code>./dlowe file [file ...] &lt; trained.net
</code></pre>
<p>To classify files, one specifies a trained network (on stdin) and one or more
files to classify. The program will output one line per successfully-classified
file to stderr, with the filename and the classification: a number between 0
and 1.</p>
<p>The interpretation of the classification number depends on how the network was
trained, but it&rsquo;s geared toward interpretation as a <em>probability</em> or a
<em>confidence</em>.</p>
<h2>Training</h2>
<pre><code>./dlowe -&lt;n_iterations&gt; corpus1/ [...] corpus0/ &lt; start.net &gt; end.net
NOTE: The directory args must end in a / for them to work.
</code></pre>
<p>To train a network, one specifies a starting network (on stdin), two or more
corpora (directories containing training data), and the number of training
iterations to run. The program will write some progress data to stderr and,
when it&rsquo;s done, will serialize the updated network to stdout.</p>
<p>If no input network is given, a random new network will be generated as a
starting point (i.e. provide an empty stdin).</p>
<p>The first corpus will be assigned a target value of 1. The last will be
assigned a target value of 0. Intervening directories (if any) will be assigned
intermediate target values.</p>
<p>The learning rate is hard-coded as 0.3. No momentum factor is used.</p>
<h3>png corpora</h3>
<p>The png-1 corpus was obtained by manually scraping the first results from an
https://images.google.com search for &ldquo;obfuscate filetype:png&rdquo;.</p>
<p>The png-0 corpus was obtained by manually scraping the first results from an
https://images.google.com search for &ldquo;obfuscate filetype:gif&rdquo;.</p>
<p>Results:</p>
<ul>
<li>using these corpora as a training set</li>
<li>using several hundred random <em>.gif and </em>.png files from my home computer as
a test set</li>
<li>using the included &ldquo;earlystop.pl&rdquo; script, which stopped after 67000 iterations.</li>
<li>interpreting output of &ldquo;> 0.5&rdquo; as &ldquo;probably a .png&rdquo; and &ldquo;&lt; 0.5&rdquo; as &ldquo;probably
a .gif&rdquo;</li>
<li>produced a network with about 87% accuracy</li>
</ul>
<h3>english corpora</h3>
<p>The english-1 corpus was obtained by manually scraping the first results from
a https://www.google.com/webhp?lr=lang_en search for &ldquo;paris filetype:txt&rdquo;.</p>
<p>The english-0 corpus was obtained by manually scraping the first results from
a https://www.google.com/webhp?lr=lang_fr search for &ldquo;paris filetype:txt&rdquo;.</p>
<p>Results:</p>
<ul>
<li>using these corpora as a training set</li>
<li>using several dozen additional text files (obtained by the same methods)
as a test set</li>
<li>using the included &ldquo;earlystop.pl&rdquo; script, which stopped after 10000
iterations.</li>
<li>interpreting output of &ldquo;> 0.5&rdquo; as &ldquo;probably english&rdquo; and &ldquo;&lt; 0.5&rdquo; as
&ldquo;probably french&rdquo;</li>
<li>produced a network with 100% accuracy</li>
</ul>
<h3>xor corpora</h3>
<p>The xor-1 corpus consists of two files containing &lsquo;01&rsquo; and &lsquo;10&rsquo; respectively.</p>
<p>The xor-0 corpus consists of two files containing &lsquo;00&rsquo; and &lsquo;11&rsquo; respectively.</p>
<p>Results:</p>
<ul>
<li>using these corpora as a training set</li>
<li>takes about 8000 iterations to learn xor to within a tolerance of &lt;0.01</li>
</ul>
<h1>Limitations</h1>
<p>The program can&rsquo;t tell you anything meaningful about files with less than two
bytes in them (I&rsquo;m looking at you, smr.c!)</p>
<p>You must include the trailing directory separator on training directories
(this allows the program to be portable without wasting precious bytes on
figuring out how to concatenate directory and file names&hellip;)</p>
<p>Serialized network files are only portable between systems with the same
floating-point representation and endianness.</p>
<p>Making sure not to overfit the network to the training data is a bit of a
black art. I have enclosed &lsquo;earlystop.pl&rsquo;, a wrapper script that implements
a simple &lsquo;early stopping&rsquo; algorithm; other techniques are possible.</p>
<p>Bad input (e.g. nonexistent files, non-numeric number of iterations, etc.)
tends to result in empty output.</p>
<p>Given exactly one corpus, the program will crash or produce garbage.</p>
<p>Leaks memory and file descriptors while processing files.</p>
<p>Will crash and die horribly if it runs out of memory.</p>
<p>The Microsoft C compiler doesn&rsquo;t provide a dirent API, so to get this working
on a Windows system you&rsquo;ll need cygwin+gcc (tested) or a dirent compatibility
library (untested, but they do exist).</p>
<p>Backpropagation doesn&rsquo;t always converge: if you play with this long enough,
you&rsquo;ll eventually have a training session that completely fails to converge.</p>
<h1>Obfuscation:</h1>
<p>Zombies! (Since neural networks are modeled after BRAINS, ya know? And
corpus sounds a lot like corpse. And I have 4- and 7-year-old kids ;)</p>
<p>Neural networks are interesting, and while the math isn&rsquo;t terribly difficult,
their behavior is difficult to fully understand.</p>
<p>Had some extra space in one of the major data structures, and it seemed a
shame to waste it.</p>
<p>Similarly, I think three file pointers ought to be enough for anyone.</p>
<p>Lots of magic numbers expressed in various ways.</p>
<p>Random abuse of random C trivia.</p>
<p>Some textual changes were made to maximize the classification of this program
by a network trained to recognize ioccc winners ;)</p>
<p>&hellip; but mostly zombies!</p>
<hr />
<!--
(c) Copyright 1984-2012, [Leo Broukhis, Simon Cooper, Landon Curt Noll][judges] - All rights reserved
This work is licensed under a [Creative Commons Attribution-ShareAlike 3.0 Unported License][cc].
[judges]: http://www.ioccc.org/judges.html
[cc]: http://creativecommons.org/licenses/by-sa/3.0/
-->
<TABLE><TR>
<TD><a rel="license" href="http://creativecommons.org/licenses/by-sa/3.0/"><img alt="Creative Commons License" style="border-width:0" src="http://i.creativecommons.org/l/by-sa/3.0/88x31.png" /></a></TD>
<TD><P>&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>
+287
View File
@@ -0,0 +1,287 @@
# Most self deprecating
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 -<n_iterations> corpus1/ [...] corpus0/ < start.net > end.net
NOTE: The directory entries MUST end in a /
./dlowe file [file ...] < trained.net
### Try:
Download the dlowe-aux-data.tar.bz2 file from:
curl -O http://www.ioccc.org/2011/dlowe/dlowe-aux-data.tar.bz2
tar -jxf dlowe-aux-data.tar.bz2
./dlowe dlowe.c < ioccc-winlose-trained.net
./dlowe dlowe < ioccc-winlose-trained.net
./dlowe xor-0/00 < xor-trained.net
./dlowe xor-0/11 < xor-trained.net
./dlowe xor-1/01 < xor-trained.net
./dlowe xor-1/10 < xor-trained.net
./dlowe hint.html < english-trained.net
./dlowe dlowe-aux-data.tar.bz2 < png-trained.net
### Selected Judges Remarks:
This entry is a ghoulish example of a brain (dead?) neural network classifier.
It comes with a set of corpora for you to try.
#### ioccc-winlose-trained.net
You can create your own trained networks. For example, we trained a network
on the C code of entries that were supplied to the 20Th IOCCC.
The ioccc-winlose-trained.net was trained using the earlystop.pl tool:
rm -f ioccc-winlose-trained.net
./earlystop.pl ioccc-winlose-trained.net ioccc_won_training/ ioccc_lost_training/ ioccc_won_test/ ioccc_lost_test/
where:
ioccc_won_training/
1/2 of C code of the 20th IOCCC winners (except for dlowe.c from 2011)
plus 1/2 of the C code winners from prior IOCCC contests
ioccc_won_test/
1/2 of C code of the 20th IOCCC winners (except for dlowe.c from 2011)
plus 1/2 of the C code winners from prior IOCCC contests
ioccc_lost_training/
1/2 of C code from entries that that did not win
ioccc_lost_test/
1/2 of C code from entries that that did not win
NOTE: The above directies were not shipped and the C code from
entries that that did not win was flushed to /dev/null.
The earlystop.pl tool wrote:
training 1 to 1001...
training 1001 to 2001...
prior error = 56.746974766043; current error = 58.095691135305
The resulting ioccc-winlose-trained.net file was included in the
dlowe-aux-data.tar.bz2 file in the above mentioned URL.
The dlowe.c was explicitly excluded from this trailing set. So this test is interesting:
./dlowe dlowe.c < ioccc-winlose-trained.net
The match of dlowe.c to the lose/win trailed network was:
dlowe.c 0.125108
NOTE: The non-artificially intelligent decisions of the IOCCC judges include random
quirks and their non-linear judgment calls not found in the ioccc trained network.
Just because C code is or isn't scored highly by this network does not
mean it will win or lose a future IOCCC. On the other hand ... it just might!
#### other data sets to try
While we cannot supply you with the losing IOCCC source code, the author did supply a number
data sets on which to test:
We created the english-trained.net as follows:
./dlowe -8000 english-1/ english-0/ < /dev/null > english-trained.net
english-0/
Non-English (French) text
english-1/
English (non-French) text
We created the png-trained.net as follows:
./dlowe -8000 png-1/ png-0/ < /dev/null > png-trained.net
png-0/
Non-png (gif) images
png-1/
png (non-gif) images
We created the xor-trained.net as follows:
./dlowe -8000 xor-1/ xor-0/ < /dev/null > xor-trained.net
xor-0/
Data that XORs to 0
xor-1/
Data that XORs to 1
## Author's comments:
# Synopsis:
This is an artificially intelligent judging tool to help the IOCCC judges.
Here's to shorter, more frequent contests!
# Description:
This is a multilayer perceptron (a feedforward artificial neural network)
which can be trained, using on-line backpropagation, to classify input files.
It has a fixed topology of 2^16 input neurons, 6 hidden neurons and 1 output
neuron.
The neurons' activation function is the logistic function 1 / (1 + e ^ -x).
## Classifying
./dlowe file [file ...] < trained.net
To classify files, one specifies a trained network (on stdin) and one or more
files to classify. The program will output one line per successfully-classified
file to stderr, with the filename and the classification: a number between 0
and 1.
The interpretation of the classification number depends on how the network was
trained, but it's geared toward interpretation as a *probability* or a
*confidence*.
## Training
./dlowe -<n_iterations> corpus1/ [...] corpus0/ < start.net > end.net
NOTE: The directory args must end in a / for them to work.
To train a network, one specifies a starting network (on stdin), two or more
corpora (directories containing training data), and the number of training
iterations to run. The program will write some progress data to stderr and,
when it's done, will serialize the updated network to stdout.
If no input network is given, a random new network will be generated as a
starting point (i.e. provide an empty stdin).
The first corpus will be assigned a target value of 1. The last will be
assigned a target value of 0. Intervening directories (if any) will be assigned
intermediate target values.
The learning rate is hard-coded as 0.3. No momentum factor is used.
### png corpora
The png-1 corpus was obtained by manually scraping the first results from an
https://images.google.com search for "obfuscate filetype:png".
The png-0 corpus was obtained by manually scraping the first results from an
https://images.google.com search for "obfuscate filetype:gif".
Results:
* using these corpora as a training set
* using several hundred random *.gif and *.png files from my home computer as
a test set
* using the included "earlystop.pl" script, which stopped after 67000 iterations.
* interpreting output of "> 0.5" as "probably a .png" and "< 0.5" as "probably
a .gif"
* produced a network with about 87% accuracy
### english corpora
The english-1 corpus was obtained by manually scraping the first results from
a https://www.google.com/webhp?lr=lang_en search for "paris filetype:txt".
The english-0 corpus was obtained by manually scraping the first results from
a https://www.google.com/webhp?lr=lang_fr search for "paris filetype:txt".
Results:
* using these corpora as a training set
* using several dozen additional text files (obtained by the same methods)
as a test set
* using the included "earlystop.pl" script, which stopped after 10000
iterations.
* interpreting output of "> 0.5" as "probably english" and "< 0.5" as
"probably french"
* produced a network with 100% accuracy
### xor corpora
The xor-1 corpus consists of two files containing '01' and '10' respectively.
The xor-0 corpus consists of two files containing '00' and '11' respectively.
Results:
* using these corpora as a training set
* takes about 8000 iterations to learn xor to within a tolerance of <0.01
# Limitations
The program can't tell you anything meaningful about files with less than two
bytes in them (I'm looking at you, smr.c!)
You must include the trailing directory separator on training directories
(this allows the program to be portable without wasting precious bytes on
figuring out how to concatenate directory and file names...)
Serialized network files are only portable between systems with the same
floating-point representation and endianness.
Making sure not to overfit the network to the training data is a bit of a
black art. I have enclosed 'earlystop.pl', a wrapper script that implements
a simple 'early stopping' algorithm; other techniques are possible.
Bad input (e.g. nonexistent files, non-numeric number of iterations, etc.)
tends to result in empty output.
Given exactly one corpus, the program will crash or produce garbage.
Leaks memory and file descriptors while processing files.
Will crash and die horribly if it runs out of memory.
The Microsoft C compiler doesn't provide a dirent API, so to get this working
on a Windows system you'll need cygwin+gcc (tested) or a dirent compatibility
library (untested, but they do exist).
Backpropagation doesn't always converge: if you play with this long enough,
you'll eventually have a training session that completely fails to converge.
# Obfuscation:
Zombies! (Since neural networks are modeled after BRAINS, ya know? And
corpus sounds a lot like corpse. And I have 4- and 7-year-old kids ;)
Neural networks are interesting, and while the math isn't terribly difficult,
their behavior is difficult to fully understand.
Had some extra space in one of the major data structures, and it seemed a
shame to waste it.
Similarly, I think three file pointers ought to be enough for anyone.
Lots of magic numbers expressed in various ways.
Random abuse of random C trivia.
Some textual changes were made to maximize the classification of this program
by a network trained to recognize ioccc winners ;)
... but mostly zombies!
--------------------------------------------------------------------------------
<!--
(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/
-->
+117
View File
@@ -0,0 +1,117 @@
#!/usr/bin/env make
#
# 2011 makefile
#
# Copyright (C) 2011, Landon Curt Noll, Simon Cooper, and Leonid A. Broukhis.
#
# Creative Commons Attribution-ShareAlike 3.0 Unported License.
# See: http://creativecommons.org/licenses/by-sa/3.0/
################
# tool locations
################
#
SHELL= /bin/bash
CP= cp
CPP= cpp
GUNZIP= gunzip
LD= ld
MAKE= make
RM= rm
SED= sed
TAR= tar
TRUE= true
# optimization
#
# Most compiles will safely use -O2. Some can use only -O1 or -O.
# A few compilers have broken optimizers or this entry make break
# under those buggy optimizers and thus you may not want anything.
#
OPT= -O2
# bitness
#
# Some entries require 32-bitness,
# other entries require 64-bitess.
# By default we assume nothing.
#
ARCH=
# default flags for ANSI C compilation
#
CFLAGS= -Wall -W -ansi ${ARCH} ${OPT} -lm
# ANSI compiler
#
# Set CC to the name of your ANSI compiler.
#
CC= cc
##############################
# Special flags for this entry
##############################
#
ENTRY= eastman
DATA=
#################
# build the entry
#################
#
all: ${ENTRY} ${DATA}
@${TRUE}
${ENTRY}: ${ENTRY}.c
${CC} ${CFLAGS} ${ENTRY}.c -o ${ENTRY}
# alternative executable
#
alt:
@${TRUE}
###############
# utility rules
###############
#
everything: all alt
clean:
${RM} -f ${ENTRY}.o
clobber: clean
${RM} -f ${ENTRY}
nuke: clobber
@echo gnab gib!
install:
@echo "Surely you're joking Mr. Feynman!"
# backwards compatibility
#
build: all
##################
# 133t hacker rulz
##################
#
love:
@echo 'not war?'
haste:
$(MAKE) waste
waste:
@echo 'waste'
easter_egg:
@echo you expected to mis-understand this $${RANDOM} magic
@echo chongo '<was here>' "/\\oo/\\"
@echo Readers shall not be disallowed from being unable to partly misunderstand this final echo.
@${TRUE}
+23
View File
@@ -0,0 +1,23 @@
#include <stdio.h>
#include <math.h>
#include <unistd.h>
#include <sys/ioctl.h>
main() {
short a[4];ioctl
(0,TIOCGWINSZ,&a);int
b,c,d=*a,e=a[1];float f,g,
h,i=d/2+d%2+1,j=d/5-1,k=0,l=e/
2,m=d/4,n=.01*e,o=0,p=.1;while (
printf("\x1b[H\x1B[?25l"),!usleep(
79383)){for (b=c=0;h=2*(m-c)/i,f=-
.3*(g=(l-b)/i)+.954*h,c<d;c+=(b=++
b%e)==0)printf("\x1B[%dm ",g*g>1-h
*h?c>d-j?b<d-c||d-c>e-b?40:100:b<j
||b>e-j?40:g*(g+.6)+.09+h*h<1?100:
47:((int)(9-k+(.954*g+.3*h)/sqrt
(1-f*f))+(int)(2+f*2))%2==0?107
:101);k+=p,m+=o,o=m>d-2*j?
-.04*d:o+.002*d;n=(l+=
n)<i||l>e-i?p=-p
,-n:n;}}
+118
View File
@@ -0,0 +1,118 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta name="GENERATOR" content="mkd2html 2.1.3 DL=DISCOUNT">
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=utf-8">
<link rel="stylesheet"
type="text/css"
href="../hint.css">
<title>Best ball</title>
</head>
<body>
<h1>Best ball</h1>
<p>Peter Eastman<br>
<a href="&#x6d;&#x61;&#105;&#108;&#116;&#111;&#58;&#112;&#101;&#116;&#x65;&#114;&#46;&#101;&#x61;&#115;&#x74;&#109;&#97;&#110;&#64;&#103;&#x6d;&#97;&#105;&#108;&#46;&#99;&#x6f;&#109;">&#112;&#101;&#x74;&#101;&#114;&#x2e;&#101;&#x61;&#x73;&#x74;&#x6d;&#97;&#x6e;&#64;&#x67;&#109;&#97;&#105;&#108;&#x2e;&#99;&#111;&#x6d;</a></p>
<h2>Judges' comments:</h2>
<h3>To build:</h3>
<pre><code>make eastman
</code></pre>
<h3>To run:</h3>
<pre><code>./eastman
</code></pre>
<h3>Try:</h3>
<pre><code>Quit the program. Resize your terminal window. Run it again.
</code></pre>
<h3>Selected Judges Remarks:</h3>
<p>This round program will generate a classic spherical result!</p>
<p>You will need a terminal capable of displaying coloured ANSI
characters (for example an xterm or a Terminal.app window).</p>
<p>You might also want to turn off any scrollback history. The program will
size itself to the initial geometry of your terminal.</p>
<p>If you are ambitious, make the font really small and the window really
large for hi-rez graphics!</p>
<h2>Author&rsquo;s comments:</h2>
<p>This program uses ANSI graphics to recreate the classic Boing Ball demo from
the Commodore Amiga. See http://www.youtube.com/watch?v=-ga41edXw3A if you
aren&rsquo;t familiar with it. Back in its day, this demo inspired lust and awe in
geeks around the world.</p>
<p>The graphics are raytraced, with procedural textures on the ball and the back
wall. I did cheat a little to simplify the calculations: it uses a parallel
projection, but textures the back wall to look as if there were a floor being
viewed in perspective. The shadow is also just part of the texture, not an
actual raytraced shadow.</p>
<p>This program automatically adapts to the size of the terminal it is running in,
so try enlarging the window to get higher resolution. Don&rsquo;t resize while the
program is running, though. It only checks the size once, when it starts up.</p>
<p>To compile:</p>
<p>cc -lm ball.c</p>
<p>Portability:</p>
<p>It should be completely portable. I&rsquo;ve tested with gcc on Mac OS X 10.7 and
Fedora 10. I would expect it to work in any Unix-like environment.</p>
<p>Obfuscation:</p>
<p>I have merged expressions wherever possible, making extensive use of ternary
operators, commas, return values of assignment operators, etc. The entire
raytracing computation, include ray intersection tests and procedural texture
evaluations, is a single expression involving 41 operators.</p>
<p>Variables are named alphabetically in the order they are declared.</p>
<p>The third argument to ioctl() should really be a &ldquo;struct winsize&rdquo;, and I should
then look up the ws_row and ws_col fields, but that makes it way too obvious
what I&rsquo;m doing there. Since a winsize just contains four unsigned shorts, I
replaced it with an array. And since all the values will be much less than
32767, I further simplified the type to just short[].</p>
<p>A wonderful thing about ANSI graphics is that it produces nearly unintelligible
code. Consider the printf spec to print a single space in a desired color:
&ldquo;\x1B[%dm &rdquo;. I could have done something to further obfuscate it, but it&rsquo;s
already indistinguishable from line noise, so why bother?</p>
<p>There are lots of other minor obfuscations to make the code less obvious. For
example, I could have written the outer loop as while(1), but why write a 1
when I can calculate it from the return value of usleep() instead? And I could
have written usleep(80000), but usleep(79383) just looks so much better. And
so on.</p>
<hr />
<!--
(c) Copyright 1984-2012, [Leo Broukhis, Simon Cooper, Landon Curt Noll][judges] - All rights reserved
This work is licensed under a [Creative Commons Attribution-ShareAlike 3.0 Unported License][cc].
[judges]: http://www.ioccc.org/judges.html
[cc]: http://creativecommons.org/licenses/by-sa/3.0/
-->
<TABLE><TR>
<TD><a rel="license" href="http://creativecommons.org/licenses/by-sa/3.0/"><img alt="Creative Commons License" style="border-width:0" src="http://i.creativecommons.org/l/by-sa/3.0/88x31.png" /></a></TD>
<TD><P>&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>
+91
View File
@@ -0,0 +1,91 @@
# Best ball
Peter Eastman
<peter.eastman@gmail.com>
## Judges' comments:
### To build:
make eastman
### To run:
./eastman
### Try:
Quit the program. Resize your terminal window. Run it again.
### Selected Judges Remarks:
This round program will generate a classic spherical result!
You will need a terminal capable of displaying coloured ANSI
characters (for example an xterm or a Terminal.app window).
You might also want to turn off any scrollback history. The program will
size itself to the initial geometry of your terminal.
If you are ambitious, make the font really small and the window really
large for hi-rez graphics!
## Author's comments:
This program uses ANSI graphics to recreate the classic Boing Ball demo from
the Commodore Amiga. See http://www.youtube.com/watch?v=-ga41edXw3A if you
aren't familiar with it. Back in its day, this demo inspired lust and awe in
geeks around the world.
The graphics are raytraced, with procedural textures on the ball and the back
wall. I did cheat a little to simplify the calculations: it uses a parallel
projection, but textures the back wall to look as if there were a floor being
viewed in perspective. The shadow is also just part of the texture, not an
actual raytraced shadow.
This program automatically adapts to the size of the terminal it is running in,
so try enlarging the window to get higher resolution. Don't resize while the
program is running, though. It only checks the size once, when it starts up.
To compile:
cc -lm ball.c
Portability:
It should be completely portable. I've tested with gcc on Mac OS X 10.7 and
Fedora 10. I would expect it to work in any Unix-like environment.
Obfuscation:
I have merged expressions wherever possible, making extensive use of ternary
operators, commas, return values of assignment operators, etc. The entire
raytracing computation, include ray intersection tests and procedural texture
evaluations, is a single expression involving 41 operators.
Variables are named alphabetically in the order they are declared.
The third argument to ioctl() should really be a "struct winsize", and I should
then look up the ws_row and ws_col fields, but that makes it way too obvious
what I'm doing there. Since a winsize just contains four unsigned shorts, I
replaced it with an array. And since all the values will be much less than
32767, I further simplified the type to just short[].
A wonderful thing about ANSI graphics is that it produces nearly unintelligible
code. Consider the printf spec to print a single space in a desired color:
"\x1B[%dm ". I could have done something to further obfuscate it, but it's
already indistinguishable from line noise, so why bother?
There are lots of other minor obfuscations to make the code less obvious. For
example, I could have written the outer loop as while(1), but why write a 1
when I can calculate it from the return value of usleep() instead? And I could
have written usleep(80000), but usleep(79383) just looks so much better. And
so on.
--------------------------------------------------------------------------------
<!--
(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/
-->
+117
View File
@@ -0,0 +1,117 @@
#!/usr/bin/env make
#
# 2011 makefile
#
# Copyright (C) 2011, Landon Curt Noll, Simon Cooper, and Leonid A. Broukhis.
#
# Creative Commons Attribution-ShareAlike 3.0 Unported License.
# See: http://creativecommons.org/licenses/by-sa/3.0/
################
# tool locations
################
#
SHELL= /bin/bash
CP= cp
CPP= cpp
GUNZIP= gunzip
LD= ld
MAKE= make
RM= rm
SED= sed
TAR= tar
TRUE= true
# optimization
#
# Most compiles will safely use -O2. Some can use only -O1 or -O.
# A few compilers have broken optimizers or this entry make break
# under those buggy optimizers and thus you may not want anything.
#
OPT= -O2
# bitness
#
# Some entries require 32-bitness,
# other entries require 64-bitess.
# By default we assume nothing.
#
ARCH=
# default flags for ANSI C compilation
#
CFLAGS= -Wall -W -ansi ${ARCH} ${OPT}
# ANSI compiler
#
# Set CC to the name of your ANSI compiler.
#
CC= cc
##############################
# Special flags for this entry
##############################
#
ENTRY= fredriksson
DATA=
#################
# build the entry
#################
#
all: ${ENTRY} ${DATA}
@${TRUE}
${ENTRY}: ${ENTRY}.c
${CC} ${CFLAGS} ${ENTRY}.c -o ${ENTRY}
# alternative executable
#
alt:
@${TRUE}
###############
# utility rules
###############
#
everything: all alt
clean:
${RM} -f ${ENTRY}.o ag.c
clobber: clean
${RM} -f ${ENTRY} ag
nuke: clobber
@echo gnab gib!
install:
@echo "Surely you're joking Mr. Feynman!"
# backwards compatibility
#
build: all
##################
# 133t hacker rulz
##################
#
love:
@echo 'not war?'
haste:
$(MAKE) waste
waste:
@echo 'waste'
easter_egg:
@echo you expected to mis-understand this $${RANDOM} magic
@echo chongo '<was here>' "/\\oo/\\"
@echo Readers shall not be disallowed from being unable to partly misunderstand this final echo.
@${TRUE}
+21
View File
@@ -0,0 +1,21 @@
#include<stdio.h>
void exit(int);
int(*Q)(int,char**),b['['+']']={'-'-'-'},i,j,s,t,D['C'*' '-'-'],z,system(char*);
char O['C'*' '-'-'],p[]="@cs \"$ | ,& |& (&)x ) &,( ,(| ,( ,{ |,},; ,( ;,> ,( ,( ,;, );g cgt3odt - <~+<+- + ~ <&~<~+ <&+~+ ~ <=- = ( - !() c !(&( ! \n$P & m& )P )o )e')\")\"' ) w_ 'w)e ')x') ')q 'a_ )x'\"up)q &]v\") &t &t-k[]t\\.nivc -:l O CI:OnO lCl ={ -: =(- +[=+ =C =]\\.[- & - ~ -(|,g& -&- <- ( ~ -g()= Q| b) *,t, Q- ( - (\n& ~ & Q \n &\n,&g r& \n& \n ,&~\nt &=\n &n) rt)+=\n& (~ &k= &g(-&= (Q -( P ) \n )\n ) \"+\"' )z\"ujlpx)\"*bgQ Px )(\")x)\" P \"P\"'i x )\")m') axP \")\" Pv pP)e )O\"_\"apvP(t(c )d) \")\"pqpmpleP \"*te\" t\n \"] \"O_\" g c *P )\" =+ * r\n&r\nr \n! * (* (* + *. )x ')+) +)* ,\n )&* + ma +) 'j )d)' m)O )e)nc )m )n ) ')\"'jl _) _)_ )nps' )cix'iml )tit_eqp)m )rcnMm+wnhdl)esakn )\")ryPiam)O)v} no)zdOui =( \" '+'= ~(=(= (\n= ()=(@_& ~@' ( = '%; go. PO 'x )p)g <h )kh ) \"k\" M ai) <eu + =z q =x =eowe =v+kO= c= ! =dMe ij lmp c p _) c_O |tp=^ c sz^o ^sibnj^jis <^q^e aQ ^ thug^eiawyq=!=a<]= vhyh > '@ =\n '= &=,-\n=,=\n (& [ ()* , * ,*= )& (\n, \n , \n ,& ,*('l'c ) l \\ 's 'l' ci lcad eilm nq_dkv<=-^ (@, \n(& !\n=, ( , (/\n @ m h =*(.c. (&' ( =,(=(| (|(|(|\n&(,& [g(, (,\n tni^-,=(=(u t&(=)(~,=d(,( = ,sep wpg\n@\nan,\n&,* n a,$=,=|\n.( c'=~,~,=(,\n=(,[(o ad#( \n (d x=~,\n,='e, ( = '~),~=(, O=\n ( oc -~= ,\n =<, <=,(@='\\i|~ i~, =\n =i o i=-\n,i(=v t l t l * ,+ *+ *, p u=\n!=,\n(=,( e a*=, \n=\n[f(< n~('n i n,n \n,eu s( ,|&^,(=l op='&|,\n ,+\n^\n !,(= o, =/-=(/=%+ , e, (= ,()= | ] |OtvO)\n ) \n)k ')n\n' - (=( | - ( > - =(";
FILE*f;
int main(int _,char**v){
_>(_^_)&&(t=_,i='C'*' '-'-'+~!!"",Q=main,Q(-!!"",v),i^=i,Q(~!!"",v),i=s^=s,Q(~-~!!"",v),i='C'*' '-'-',j=-~('('*'('),Q((-~!!""*~!!""),v),
f=fopen(O,"w"),fprintf(f,O+~-(~-~!!""*~!!""),'C'*' '-'-'-((~!!""*~!!"")*''+-~-~!!""),O+((~!!""*~!!"")*''+-~-~!!"")),fclose(f),
sprintf(p,O+(~-(~-~!!""*~!!"")<<!!"")),i=!!"",Q(~-(-~!!""*~!!""),v),exit(system(p)),'r')
||
_==~!_&&i>=(i^i)&&
((p[i]==' '&&(p[i]=(-~i)[p])||p[i]=='@'&&(p[i]=' ')||p[i]=='$'&&(p[i]^=p[i])),i=~-i,Q(_,v))
||
_==~!!""&&i<'C'*' '-'-'&&(D[i]=~-(i[p][b]=-~i[p][b]),i=-~i,Q(_,v))
||
_==~-~!!""&&i<(!!""<<-~(~-~!!""*~!!""))&&(z=b[i],i[b]=s,s+=z,i=-~i,Q(_,v))
||
_==(-~!!""*~!!"")&&-~(i=~-i)&&(i[O]=p[j],j=D[j]+j[p][b],Q(_,v))
||
_==~-(-~!!""*~!!"")&&i<t&&(sprintf(p,"%s %s",p,i[v]),i=-~i,Q(_,v));
}
+315
View File
@@ -0,0 +1,315 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta name="GENERATOR" content="mkd2html 2.1.3 DL=DISCOUNT">
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=utf-8">
<link rel="stylesheet"
type="text/css"
href="../hint.css">
<title>Most useful</title>
</head>
<body>
<h1>Most useful</h1>
<p>Kimmo Fredriksson<br>
<a href="&#x6d;&#x61;&#105;&#108;&#116;&#111;&#58;&#107;&#105;&#109;&#x6d;&#111;&#46;&#107;&#x2e;&#107;&#x2e;&#102;&#114;&#101;&#100;&#114;&#x69;&#107;&#115;&#115;&#111;&#110;&#x40;&#103;&#109;&#97;&#x69;&#108;&#46;&#x63;&#111;&#x6d;">&#x6b;&#x69;&#x6d;&#109;&#x6f;&#46;&#x6b;&#46;&#107;&#46;&#102;&#x72;&#101;&#100;&#x72;&#105;&#107;&#x73;&#115;&#x6f;&#x6e;&#x40;&#x67;&#109;&#x61;&#105;&#108;&#46;&#x63;&#x6f;&#x6d;</a></p>
<h2>Judges' comments:</h2>
<h3>To build:</h3>
<pre><code>make fredriksson
</code></pre>
<h3>To run:</h3>
<pre><code>./fredriksson [-icvtnk#] regexp &lt; file
</code></pre>
<h3>Try:</h3>
<pre><code>./fredriksson -k1 -i POOT &lt; /etc/group
ulimit -s unlimited
./fredriksson -k2 -t -n bofuskate &lt; /usr/share/dict/words
</code></pre>
<h3>Selected Judges Remarks:</h3>
<p>The author of this entry was making sure that it does not win the
&ldquo;Best Short Program&rdquo; award. On the outside, the program behaves
as an approximate grep. On the inside, it is a Burrows-Wheeler
transform decompressor that produces the source code of the actual
obfuscated approximate grep program and calls it. As an exercise,
try writing the compressor.</p>
<h2>Author&rsquo;s comments:</h2>
<h1>Approximate grep</h1>
<p>Implements a variant of grep.</p>
<h2>Usage</h2>
<p>To search regexp from file, do:</p>
<pre><code>./fredriksson [-icvtnk#] regexp &lt; file
</code></pre>
<p>Pipes may not work, see the section Limitations.
The options <code>-i -c -v</code> and <code>-n</code> are the classic ones:</p>
<ul>
<li><p><code>-i</code> Ignore case.</p></li>
<li><p><code>-c</code> Count only, prints the number of matches, but not the matching lines.</p></li>
<li><p><code>-v</code> Invert match.</p></li>
<li><p><code>-n</code> Prefixes each printed line by its line number (only if
<code>-c</code> was not given).</p></li>
</ul>
<p>This version of grep recognizes two more options, not present in normal
grep implementations:</p>
<ul>
<li><p><code>-kN</code> Permit <code>N</code> insertions, deletions or mismatches of characters in the
matches (aka edit-distance). E.g. &ldquo;obfuscated&rdquo; matches &ldquo;obfuscation&rdquo;
with one deletion and two mismatches. Likewise, &ldquo;obfuscate&rdquo; and
&ldquo;oversimplify&rdquo; match with 7 edit operations. The default is <code>-k0</code>
(i.e. exact match).</p></li>
<li><p><code>-t</code> Add local transpositions to the set of allowed edit-operations.
That is, &ldquo;ab&rdquo; matches &ldquo;ba&rdquo; with one transposition (swap), and
&ldquo;obfuscated&rdquo; matches &ldquo;bofsuact&rdquo; with three swaps and two insertions,
i.e. use <code>-tk5</code> to find this.</p></li>
</ul>
<p>Of course, one could construct a standard regexp that matches the same
patterns, but the problem is that such a regexp grows exponentially in
size when the number of allowed edit operations is increased.</p>
<p>This version does not recognize all regular expressions, but the
following are allowed:</p>
<ul>
<li><p>Wild card: <code>.</code> (dot) matches any character.</p></li>
<li><p>Bracket expression: list of charactres enclosed by <code>[</code> and <code>]</code>,
matches any single character in the list.</p></li>
<li><p>Range expression: two characters separated by hyphen and enclosed in
brackets, matches any character that is lexicographically between the
two characters (inclusive). E.g. <code>[a-d]</code> is the same as <code>[abcd]</code>.</p></li>
</ul>
<p>The special characters must be escaped, if they are to be taken
literally (i.e. use e.g. <code>\.</code> to match period). You might want to protect
these with <code>'</code>, i.e. use <code>'foo\[bar'</code> instead of <code>foo\[bar</code>. If you want to
use the literal <code>-</code> in bracket expression, protect that too (<code>\-</code>),
otherwise this is not needed. Note that the syntax differs from standard
(?) grep a bit, i.e. in plain grep you can use <code>]</code> and <code>-</code> in bracket
expressions by putting <code>]</code> as the first character, and putting <code>-</code> last.</p>
<h3>Other uses</h3>
<ul>
<li><p>You can use this in place of cat. Just say</p>
<pre><code> ./fredriksson -k3 cat &lt; file
</code></pre></li>
<li><p>Like with cat, you can append line numbers too:</p>
<pre><code> ./fredriksson -nk3 cat &lt; file
</code></pre></li>
</ul>
<h3>Other features</h3>
<ul>
<li><p>It is assumed that the user knows how to feed correct input to the
program. If undefined options are given, the result is also undefined.
This is a feature.</p></li>
<li><p>It may consume huge amounts of memory, and a stack overflow may occur.
This results in Segmentation fault (or the equivalent of your favorite
system, such as Bus error). This is a feature, that can be used to detect
overly long lines in the input file, such as checking the lenght of one
liners in IOCCC entries, just adjust your stack size to a suitable
threshold, and search for &ldquo;ioccc&rdquo;, with option <code>-vk5</code>.</p></li>
</ul>
<h2>Limitations and remarks</h2>
<ul>
<li><p>Using warning options (such as -Wall) when building gives a lot of warning,
such as <code>suggest parentheses around '&amp;&amp;' within '||'</code>, <code>value computed is
not used</code>, <code>implicit declaration of function 'putchar'</code>, <code>implicit
declaration of function 'getchar'</code>, <code>control reaches end of non-void
function</code> and <code>format not a string literal and no format arguments</code>.
Please ignore them all, since they just try to tell you that the source
is obfuscated.</p></li>
<li><p>Only standard input is handled. And <em>only</em> if stdin comes from a file,
i.e. pipes may or may not work. If you want to count only (<code>-c</code> option),
then this shouldn&rsquo;t be an issue.</p></li>
<li><p>The total lenght of the (preprocessed) pattern is at most
<code>sizeof(long)*CHAR_BIT</code>. That does not count things like bracket expressions
or escape chars, that is, the pattern <code>'a[bcd]e\.f'</code> is 5 chars long, not
10 chars. That does not mean that the matched substring in the standard
input has this limit, as using the edit operations can make the string
longer. However, no assumptions are made for <code>sizeof(long)</code>. In fact,
you can easily use <code>long long</code> instead,</p></li>
<li><p>Depending on the file, may require a lot of stack space. If the
program segfaults (because of this), say</p>
<pre><code> ulimit -s unlimited
</code></pre>
<p>cross your fingers, hope it is enough, and try again.</p></li>
<li><p>Assumes C99 standard, because of the one very long line. Most C compilers
handle this just fine even in C89 mode, though.</p></li>
<li><p>The code should be reasonably portable, it assumes standard ASCII codes
for each char, and that a C compiler is on $PATH; the latter is hard coded
to be &lsquo;gcc&rsquo;, but any compiler would work, provided that it supports
C99, or long lines as an extension. This code has been tested on:</p>
<ul>
<li>GNU/Linux FC4, i386, gcc</li>
<li>GNU/Linux FC7, x86_64, gcc 4.1.2, tcc 0.9.24 and icc 10.0</li>
<li>GNU/Linux FC9, x86_64, gcc 4.?.?</li>
<li>GNU/Linux CentOS 5, gcc 4.1.2</li>
<li>GNU/Linux Ubuntu 11.04, gcc 4.5.2</li>
<li>SunOS 5.8, UltraSPARC IIIi, gcc 4.1.2</li>
<li>SunOS 5.9, UltraSPARC IIIi, gcc 4.1.1 and Sun ONE Studio 8 CC</li>
<li>AIX 5.3, IBM eServer p5-550, gcc 3.3.3 and AIX CC Version 6</li>
</ul>
<p>(Btw, tcc has its roots in IOCCC&hellip;)</p></li>
</ul>
<h2>Obfuscations (a.k.a. spoilers&hellip;)</h2>
<ul>
<li><p>The initialized char array includes the source code of the real program,
as well as its name and commands to build and run it, all Burrows-Wheeler
-transformed, then run-length-encoded with unary coding. The main program
extracts and builds that, and then calls it. More precicely, the command
to build is</p>
<pre><code> gcc -O3 ag.c -o ag
</code></pre>
<p>To change that you need to edit the char array <code>p[]</code> and (possibly) two
specially encoded constants, <code>-~('('*'(')</code> and <code>'C'*' '-'-'</code>.
The extracted source (<code>ag.c</code>) is obfuscated as well.</p>
<p>(The original version also deleted the generated source and the
corresponding binary after running it, but this feature was removed
from the submitted entry.)</p></li>
<li><p>The code demonstrates several useful programming paradigms, such as</p>
<ul>
<li>recursion to remove all loops</li>
<li>sub routines (<code>main()</code> contains several logical sub routines,
selected by the first argument)</li>
<li>function pointers</li>
</ul>
</li>
<li><p>Algorithmically, it incorporates the following</p>
<ul>
<li>(inverse) Burrows-Wheeler transform (used also e.g. in bzip2)</li>
<li>data compression (really expansion :-), run-lenght-encoding,
unary coding (this is why it is expansion rather than compression)</li>
<li>approximate string matching</li>
<li>dynamic programming to compute the edit distance</li>
<li>parallel computation in sequential computers (by packing
several objects into a single long, to speed up the dynamic
programming)</li>
<li>self extracting, compiling and running code</li>
</ul>
</li>
<li><p>As a C program, it demonstrates that</p>
<ul>
<li>a C subset without reserved words is complete enough,
(excluding data type specific things (<code>int</code>, <code>char</code>, <code>void</code> &hellip;))</li>
<li>only letters are needed (i.e. the digits 0-9 are not)</li>
<li>only one statement is enough to code any program (plus
variable definitions)</li>
<li>white space has other uses than just indenting the code</li>
</ul>
</li>
<li><p>It also shows the power of boolean logic and bitwise arithmetic.</p></li>
<li><p>This is the first (?) entry in the history of IOCCC, that cannot be
totally un-obfuscated by the author. This is due to the clever choice of
the actual algorithm, that is obfucated by nature, and it is an open
research problem whether a simpler algorithm exists, with the same time
complexity.</p></li>
<li><p>The main obfuscation comes from using only arithmetic and boolean
(short-circuit) logic combined with recursion to remove all loops and
if-then-else constructs (also, no ternary <code>?:</code> constructs are present).
Two&rsquo;s complement representation of integers is also abused. E.g. instead
of writing <code>x++</code> or <code>x-1</code>, it is much better to write <code>x=-~x</code> and <code>~-x</code>.</p></li>
<li><p>No numerical values, other than in the initialized char array, try</p>
<pre><code> ./fredriksson -ck0 [0-9] &lt; fredriksson.c
</code></pre>
<p>This should print 1, as there is a numer &lsquo;3&rsquo; in the char array (only).
You can also try</p>
<pre><code> ./fredriksson -ck0 [0-9] &lt; ag.c
</code></pre>
<p>after running fredriksson at least once (since this generates that
<code>ag.c</code> file), and this should print 0.</p></li>
<li><p>The source code is best viewed with cat (or using the program itself),
instead of some editor. (This is a somewhat system dependent thing.)</p>
<p>One reason for this is that the code builds (some of the) constant
values from string literal <code>"\b"</code>, except that the backspace <code>\b</code> is not
escaped like that, the source uses the raw ascii value (010 octal) instead.
Thus when viewing with cat or something, that backspace erases the leading
quotation mark. Makes it appear uncompilable, and it is: if you copy-paste
the cat output from terminal to some editor, save it, the result would not
compile.</p>
<p>Some other constants are built from ASCII values of chars.</p>
<p>Besides of making the code hard to read, all this makes it also quite large.</p></li>
<li><p>Running it through GNU indent or bcpp (C beautifiers) does not beautify
it a bit. In fact, indent makes it only worse (at least with the default
options). Running it through the preprocessor does basically nothing,
since no <code>#define</code>s are used.</p></li>
<li><p>Some <em>abuse of the rules</em>. The number of non-whitespace and <code>;</code>, <code>{</code>
and <code>}</code> chars is below the limit, but most of the whitespace chars are
in an <em>initialized character array</em>. That is, the number of chars in the
program exceeds the 2048 limit. However, whitespace is whitespace and
the rules did not specify that these must be in between the statements.
A character is a whitespace if <code>isspace()</code> returns non-zero value. Even
if deleting even one of those chars breaks the program! (This does not
apply to the generated source <code>ag.c</code>.)</p></li>
</ul>
<hr />
<!--
(c) Copyright 1984-2012, [Leo Broukhis, Simon Cooper, Landon Curt Noll][judges] - All rights reserved
This work is licensed under a [Creative Commons Attribution-ShareAlike 3.0 Unported License][cc].
[judges]: http://www.ioccc.org/judges.html
[cc]: http://creativecommons.org/licenses/by-sa/3.0/
-->
<TABLE><TR>
<TD><a rel="license" href="http://creativecommons.org/licenses/by-sa/3.0/"><img alt="Creative Commons License" style="border-width:0" src="http://i.creativecommons.org/l/by-sa/3.0/88x31.png" /></a></TD>
<TD><P>&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>
+274
View File
@@ -0,0 +1,274 @@
# Most useful
Kimmo Fredriksson
<kimmo.k.k.fredriksson@gmail.com>
## Judges' comments:
### To build:
make fredriksson
### To run:
./fredriksson [-icvtnk#] regexp < file
### Try:
./fredriksson -k1 -i POOT < /etc/group
ulimit -s unlimited
./fredriksson -k2 -t -n bofuskate < /usr/share/dict/words
### Selected Judges Remarks:
The author of this entry was making sure that it does not win the
"Best Short Program" award. On the outside, the program behaves
as an approximate grep. On the inside, it is a Burrows-Wheeler
transform decompressor that produces the source code of the actual
obfuscated approximate grep program and calls it. As an exercise,
try writing the compressor.
## Author's comments:
# Approximate grep
Implements a variant of grep.
## Usage
To search regexp from file, do:
./fredriksson [-icvtnk#] regexp < file
Pipes may not work, see the section Limitations.
The options `-i -c -v` and `-n` are the classic ones:
* `-i` Ignore case.
* `-c` Count only, prints the number of matches, but not the matching lines.
* `-v` Invert match.
* `-n` Prefixes each printed line by its line number (only if
`-c` was not given).
This version of grep recognizes two more options, not present in normal
grep implementations:
* `-kN` Permit `N` insertions, deletions or mismatches of characters in the
matches (aka edit-distance). E.g. "obfuscated" matches "obfuscation"
with one deletion and two mismatches. Likewise, "obfuscate" and
"oversimplify" match with 7 edit operations. The default is `-k0`
(i.e. exact match).
* `-t` Add local transpositions to the set of allowed edit-operations.
That is, "ab" matches "ba" with one transposition (swap), and
"obfuscated" matches "bofsuact" with three swaps and two insertions,
i.e. use `-tk5` to find this.
Of course, one could construct a standard regexp that matches the same
patterns, but the problem is that such a regexp grows exponentially in
size when the number of allowed edit operations is increased.
This version does not recognize all regular expressions, but the
following are allowed:
* Wild card: `.` (dot) matches any character.
* Bracket expression: list of charactres enclosed by `[` and `]`,
matches any single character in the list.
* Range expression: two characters separated by hyphen and enclosed in
brackets, matches any character that is lexicographically between the
two characters (inclusive). E.g. `[a-d]` is the same as `[abcd]`.
The special characters must be escaped, if they are to be taken
literally (i.e. use e.g. `\.` to match period). You might want to protect
these with `'`, i.e. use `'foo\[bar'` instead of `foo\[bar`. If you want to
use the literal `-` in bracket expression, protect that too (`\-`),
otherwise this is not needed. Note that the syntax differs from standard
(?) grep a bit, i.e. in plain grep you can use `]` and `-` in bracket
expressions by putting `]` as the first character, and putting `-` last.
### Other uses
* You can use this in place of cat. Just say
./fredriksson -k3 cat < file
* Like with cat, you can append line numbers too:
./fredriksson -nk3 cat < file
### Other features
* It is assumed that the user knows how to feed correct input to the
program. If undefined options are given, the result is also undefined.
This is a feature.
* It may consume huge amounts of memory, and a stack overflow may occur.
This results in Segmentation fault (or the equivalent of your favorite
system, such as Bus error). This is a feature, that can be used to detect
overly long lines in the input file, such as checking the lenght of one
liners in IOCCC entries, just adjust your stack size to a suitable
threshold, and search for "ioccc", with option `-vk5`.
## Limitations and remarks
* Using warning options (such as -Wall) when building gives a lot of warning,
such as `suggest parentheses around '&&' within '||'`, `value computed is
not used`, `implicit declaration of function 'putchar'`, `implicit
declaration of function 'getchar'`, `control reaches end of non-void
function` and `format not a string literal and no format arguments`.
Please ignore them all, since they just try to tell you that the source
is obfuscated.
* Only standard input is handled. And _only_ if stdin comes from a file,
i.e. pipes may or may not work. If you want to count only (`-c` option),
then this shouldn't be an issue.
* The total lenght of the (preprocessed) pattern is at most
`sizeof(long)*CHAR_BIT`. That does not count things like bracket expressions
or escape chars, that is, the pattern `'a[bcd]e\.f'` is 5 chars long, not
10 chars. That does not mean that the matched substring in the standard
input has this limit, as using the edit operations can make the string
longer. However, no assumptions are made for `sizeof(long)`. In fact,
you can easily use `long long` instead,
* Depending on the file, may require a lot of stack space. If the
program segfaults (because of this), say
ulimit -s unlimited
cross your fingers, hope it is enough, and try again.
* Assumes C99 standard, because of the one very long line. Most C compilers
handle this just fine even in C89 mode, though.
* The code should be reasonably portable, it assumes standard ASCII codes
for each char, and that a C compiler is on $PATH; the latter is hard coded
to be 'gcc', but any compiler would work, provided that it supports
C99, or long lines as an extension. This code has been tested on:
- GNU/Linux FC4, i386, gcc
- GNU/Linux FC7, x86_64, gcc 4.1.2, tcc 0.9.24 and icc 10.0
- GNU/Linux FC9, x86_64, gcc 4.?.?
- GNU/Linux CentOS 5, gcc 4.1.2
- GNU/Linux Ubuntu 11.04, gcc 4.5.2
- SunOS 5.8, UltraSPARC IIIi, gcc 4.1.2
- SunOS 5.9, UltraSPARC IIIi, gcc 4.1.1 and Sun ONE Studio 8 CC
- AIX 5.3, IBM eServer p5-550, gcc 3.3.3 and AIX CC Version 6
(Btw, tcc has its roots in IOCCC...)
## Obfuscations (a.k.a. spoilers...)
* The initialized char array includes the source code of the real program,
as well as its name and commands to build and run it, all Burrows-Wheeler
-transformed, then run-length-encoded with unary coding. The main program
extracts and builds that, and then calls it. More precicely, the command
to build is
gcc -O3 ag.c -o ag
To change that you need to edit the char array `p[]` and (possibly) two
specially encoded constants, `-~('('*'(')` and `'C'*' '-'-'`.
The extracted source (`ag.c`) is obfuscated as well.
(The original version also deleted the generated source and the
corresponding binary after running it, but this feature was removed
from the submitted entry.)
* The code demonstrates several useful programming paradigms, such as
- recursion to remove all loops
- sub routines (`main()` contains several logical sub routines,
selected by the first argument)
- function pointers
* Algorithmically, it incorporates the following
- (inverse) Burrows-Wheeler transform (used also e.g. in bzip2)
- data compression (really expansion :-), run-lenght-encoding,
unary coding (this is why it is expansion rather than compression)
- approximate string matching
- dynamic programming to compute the edit distance
- parallel computation in sequential computers (by packing
several objects into a single long, to speed up the dynamic
programming)
- self extracting, compiling and running code
* As a C program, it demonstrates that
- a C subset without reserved words is complete enough,
(excluding data type specific things (`int`, `char`, `void` ...))
- only letters are needed (i.e. the digits 0-9 are not)
- only one statement is enough to code any program (plus
variable definitions)
- white space has other uses than just indenting the code
* It also shows the power of boolean logic and bitwise arithmetic.
* This is the first (?) entry in the history of IOCCC, that cannot be
totally un-obfuscated by the author. This is due to the clever choice of
the actual algorithm, that is obfucated by nature, and it is an open
research problem whether a simpler algorithm exists, with the same time
complexity.
* The main obfuscation comes from using only arithmetic and boolean
(short-circuit) logic combined with recursion to remove all loops and
if-then-else constructs (also, no ternary `?:` constructs are present).
Two's complement representation of integers is also abused. E.g. instead
of writing `x++` or `x-1`, it is much better to write `x=-~x` and `~-x`.
* No numerical values, other than in the initialized char array, try
./fredriksson -ck0 [0-9] < fredriksson.c
This should print 1, as there is a numer '3' in the char array (only).
You can also try
./fredriksson -ck0 [0-9] < ag.c
after running fredriksson at least once (since this generates that
`ag.c` file), and this should print 0.
* The source code is best viewed with cat (or using the program itself),
instead of some editor. (This is a somewhat system dependent thing.)
One reason for this is that the code builds (some of the) constant
values from string literal `"\b"`, except that the backspace `\b` is not
escaped like that, the source uses the raw ascii value (010 octal) instead.
Thus when viewing with cat or something, that backspace erases the leading
quotation mark. Makes it appear uncompilable, and it is: if you copy-paste
the cat output from terminal to some editor, save it, the result would not
compile.
Some other constants are built from ASCII values of chars.
Besides of making the code hard to read, all this makes it also quite large.
* Running it through GNU indent or bcpp (C beautifiers) does not beautify
it a bit. In fact, indent makes it only worse (at least with the default
options). Running it through the preprocessor does basically nothing,
since no `#define`s are used.
* Some _abuse of the rules_. The number of non-whitespace and `;`, `{`
and `}` chars is below the limit, but most of the whitespace chars are
in an _initialized character array_. That is, the number of chars in the
program exceeds the 2048 limit. However, whitespace is whitespace and
the rules did not specify that these must be in between the statements.
A character is a whitespace if `isspace()` returns non-zero value. Even
if deleting even one of those chars breaks the program! (This does not
apply to the generated source `ag.c`.)
--------------------------------------------------------------------------------
<!--
(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/
-->
+138
View File
@@ -0,0 +1,138 @@
#!/usr/bin/env make
#
# 2011 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
# Compiler warnings
#
CWARN=
# compiler standard
#
CSTD= -ansi
# compiler bit architecture
#
# Some entries require 32-bitness,
# other entries require 64-bitess.
# By default we assume nothing.
#
# Under Mac OS X / Darwin, we must use -arch i386
# Linux does not like this do let gnu make
# detect the target and only add for Darwin.
#
ifeq ($(target),)
target=$(shell uname -s 2>/dev/null)
endif
ifeq ($(target),Darwin)
ARCH= -arch i386
else
ARCH=
endif
# optimization
#
# Most compiles will safely use -O2. Some can use only -O1 or -O.
# A few compilers have broken optimizers or this entry make break
# under those buggy optimizers and thus you may not want anything.
#
OPT= -O2
# default flags for ANSI C compilation
#
CFLAGS= ${CWARN} ${CSTD} ${ARCH} ${OPT}
# ANSI compiler
#
# Set CC to the name of your ANSI compiler.
#
CC= cc
##############################
# Special flags for this entry
##############################
#
ENTRY= goren
DATA=
#################
# build the entry
#################
#
all: ${ENTRY} ${DATA}
@${TRUE}
${ENTRY}: ${ENTRY}.c
${CC} ${CFLAGS} ${ENTRY}.c -o ${ENTRY}
# alternative executable
#
alt:
@${TRUE}
###############
# utility rules
###############
#
everything: all alt
clean:
${RM} -f ${ENTRY}.o
clobber: clean
${RM} -f ${ENTRY}
nuke: clobber
@echo gnab gib!
install:
@echo "Surely you're joking Mr. Feynman!"
# backwards compatibility
#
build: all
##################
# 133t hacker rulz
##################
#
love:
@echo 'not war?'
haste:
$(MAKE) waste
waste:
@echo 'waste'
easter_egg:
@echo you expected to mis-understand this $${RANDOM} magic
@echo chongo '<was here>' "/\\oo/\\"
@echo Readers shall not be disallowed from being unable to partly misunderstand this final echo.
@${TRUE}
+20
View File
@@ -0,0 +1,20 @@
typedef unsigned char t;t*F="%c",l[]="|\\/=_ \n](.\0(),*(.(=(}*.)[[*.",N='\n',*
r;typedef(*H)();extern H Ar;Q(a){return(a|-a)>>31;}H S(c,a){return(H)(a&~c|(int
)Ar&c);}extern t*ist;V(t*u){*u^=*u&2^(*u>>7)*185;}Z(t*u,t n){*u-=n;}e(t c,H h){
R(h,Q(* r^c));}
I(){r=l +7-4*Q(
getchar ()^*l);
}R(H h, int c){Ar=S
(c,h);- main() ;}P(){r
++;}z() { O(&N);}
O(t*c){ printf( F,+*c);
}T(){r= "This is not a function\n" ;}w(U){
U=Z(r,8 ); r-=~Q(*
r/8-4); return 0; }M(){r=
ist-68; } h(){t G
=r[1]-r [2]^*r;
G^=30;V (&G);e(
0,(O(&G ),P(P(*
r++)),z));}g(){M();R(h,0);}f(){P(O(r));e('f',g);}p(){P();e('a',f);}d(){P(O(r));
e('n',p);}c(u){u=r[-2];T(Ar=d);R(f,Q(u^'"'));}n(){e(w(O(l+*r%8)),c);}a(){I();R(
n,0);}main(){S(Q(Ar),a)();}H Ar;t*ist="Rene Magritte"-(1898-1967);
+120
View File
@@ -0,0 +1,120 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta name="GENERATOR" content="mkd2html 2.1.3 DL=DISCOUNT">
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=utf-8">
<link rel="stylesheet"
type="text/css"
href="../hint.css">
<title>Most artistic</title>
</head>
<body>
<h1>Most artistic</h1>
<p>Uri Goren<br>
<a href="&#x6d;&#x61;&#105;&#108;&#116;&#111;&#58;&#103;&#111;&#114;&#x65;&#110;&#46;&#117;&#x72;&#105;&#x40;&#103;&#109;&#97;&#105;&#108;&#x2e;&#99;&#111;&#109;">&#103;&#111;&#x72;&#101;&#110;&#46;&#x75;&#114;&#105;&#x40;&#103;&#x6d;&#x61;&#x69;&#x6c;&#46;&#x63;&#111;&#x6d;</a></p>
<h2>Judges' comments:</h2>
<h3>To build:</h3>
<pre><code>make goren
</code></pre>
<h3>To run:</h3>
<pre><code>echo "some text" | ./goren
</code></pre>
<h3>Try:</h3>
<pre><code>echo "Hello, world!" | ./goren
</code></pre>
<h3>Selected Judges Remarks:</h3>
<p>In the words of <a href="http://en.wikipedia.org/wiki/Rene_Magritte">René François Ghislain Magritte Magritte</a>:</p>
<p><img src="http://upload.wikimedia.org/wikipedia/en/b/b9/MagrittePipe.jpg" title="Ceci n'est pas une pipe" alt="This is not a pipe" /></p>
<p>One may ask the surrealist question:</p>
<pre><code>echo 'If | is just a representation of a pipe, then how can data stuff it?' | ./goren
</code></pre>
<p>However if one takes a firm stand and declares:</p>
<pre><code>echo '| is just a representation of a pipe because I say so! So stuff it!' | ./goren
</code></pre>
<p>something happens! Why?</p>
<h2>Author&rsquo;s comments:</h2>
<p>This program was written in homage to Rene Magritte&rsquo;s picture &ldquo;La
trahison des images&rdquo; (The Treachery of Images).</p>
<p>In order to show my unconditional admiration of this work, I avoided
using conditions.</p>
<p>In this work, Magritte points out that a picture of a pipe is not
a pipe. But what IS a pipe? This program tries to provide an answer.</p>
<p>Magritte&rsquo;s [test for pipes](http://en.wikipedia.org/wiki/The_Treachery_of_Images} is:</p>
<pre><code>The famous pipe. How people reproached me for it! And yet, could
you stuff my pipe? No, it's just a representation, is it not?
</code></pre>
<p>Accordingly, this program only approves pipes which can be used for
stuffing data.</p>
<p>One thing I tried to achieve is condition free programming. Many
have noted that conditions make the code harder to read and understand.
A good example would be:</p>
<p><a href="http://www.ioccc.org/years.html#2004_burley">Brent Burley&rsquo;s 2004 IOCCC winner</a></p>
<p>That entry omits conditional statements such as &ldquo;if&rdquo; and &ldquo;while&rdquo;.
His achievement in improving clarity by omitting conditions is
impressive, but I think it can be taken further, in two ways.</p>
<p>First, conditional operators, such as ?:, &amp;&amp; and ||, can be thrown
away. Second, using setjmp and longjmp, which are unfortunately
not in common use, might make it difficult for a novice programmer
to understnad the code without referring to the man page.</p>
<p>By removing these, the code is 100% condition free, and every
function runs its instructions in perfect order. Naturally, this
makes the program flow trivial to understand. This can be verified
by disassembling the compiled code and looking for conditional jumps
(when compiled with gcc on x86, there are none).</p>
<h3>Compatibility:</h3>
<p>The program should compile with any C compiler, but was tested
mostly with gcc on Linux.</p>
<p>It doesn&rsquo;t support 64 bits (due to integer-pointer casts, and a >>31).
It does work on 64-bit Linux, becasue all functions are below 4GB.</p>
<hr />
<!--
(c) Copyright 1984-2012, [Leo Broukhis, Simon Cooper, Landon Curt Noll][judges] - All rights reserved
This work is licensed under a [Creative Commons Attribution-ShareAlike 3.0 Unported License][cc].
[judges]: http://www.ioccc.org/judges.html
[cc]: http://creativecommons.org/licenses/by-sa/3.0/
-->
<TABLE><TR>
<TD><a rel="license" href="http://creativecommons.org/licenses/by-sa/3.0/"><img alt="Creative Commons License" style="border-width:0" src="http://i.creativecommons.org/l/by-sa/3.0/88x31.png" /></a></TD>
<TD><P>&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>
+90
View File
@@ -0,0 +1,90 @@
# Most artistic
Uri Goren
<goren.uri@gmail.com>
## Judges' comments:
### To build:
make goren
### To run:
echo "some text" | ./goren
### Try:
echo "Hello, world!" | ./goren
### Selected Judges Remarks:
In the words of [René François Ghislain Magritte Magritte](http://en.wikipedia.org/wiki/Rene_Magritte):
![This is not a pipe](http://upload.wikimedia.org/wikipedia/en/b/b9/MagrittePipe.jpg "Ceci n'est pas une pipe")
One may ask the surrealist question:
echo 'If | is just a representation of a pipe, then how can data stuff it?' | ./goren
However if one takes a firm stand and declares:
echo '| is just a representation of a pipe because I say so! So stuff it!' | ./goren
something happens! Why?
## Author's comments:
This program was written in homage to Rene Magritte's picture "La
trahison des images" (The Treachery of Images).
In order to show my unconditional admiration of this work, I avoided
using conditions.
In this work, Magritte points out that a picture of a pipe is not
a pipe. But what IS a pipe? This program tries to provide an answer.
Magritte's [test for pipes](http://en.wikipedia.org/wiki/The_Treachery_of_Images} is:
The famous pipe. How people reproached me for it! And yet, could
you stuff my pipe? No, it's just a representation, is it not?
Accordingly, this program only approves pipes which can be used for
stuffing data.
One thing I tried to achieve is condition free programming. Many
have noted that conditions make the code harder to read and understand.
A good example would be:
[Brent Burley's 2004 IOCCC winner](http://www.ioccc.org/years.html#2004_burley)
That entry omits conditional statements such as "if" and "while".
His achievement in improving clarity by omitting conditions is
impressive, but I think it can be taken further, in two ways.
First, conditional operators, such as ?:, && and ||, can be thrown
away. Second, using setjmp and longjmp, which are unfortunately
not in common use, might make it difficult for a novice programmer
to understnad the code without referring to the man page.
By removing these, the code is 100% condition free, and every
function runs its instructions in perfect order. Naturally, this
makes the program flow trivial to understand. This can be verified
by disassembling the compiled code and looking for conditional jumps
(when compiled with gcc on x86, there are none).
### Compatibility:
The program should compile with any C compiler, but was tested
mostly with gcc on Linux.
It doesn't support 64 bits (due to integer-pointer casts, and a >>31).
It does work on 64-bit Linux, becasue all functions are below 4GB.
--------------------------------------------------------------------------------
<!--
(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/
-->
+588
View File
@@ -0,0 +1,588 @@
20th International Obfuscated C Code Contest Guidelines, Hints and Comments
Copyright (C) 2006,2011 Leonid A. Broukhis, Simon Cooper, Landon Curt Noll and
Peter Seebach.
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.
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.
| WHAT'S NEW IN 2011:
| The contest runs from 12-Nov-2011 11:00 UTC to 12-Jan-2012 12:12 UTC.
| Only online submissions will be accepted this year.
See the following for details,
| https://submit.ioccc.org/
|
| (Will be active 2011-12-01)
| 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. :-)
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.
| Wise people, when submitting something clever entry that might
| depend on such a misleading statement, 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!" may want to try and be more creative.
Ultra-obfuscated programs are in some cases 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.
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.
| The judges quite like "markdown" for formatting text (the 2005 and
| 2006 hints are formatted this way). You are encouraged, but not
| required to submit remarks and documentation in this format. Future
| competitions may require this. For more info on Markdown, see
|
| http://daringfireball.net/projects/markdown/syntax
|
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.
| Local function declarations, such as:
#include <stdio.h>
int
main() {
void blah() { printf("blah\n"); }
blah();
}
| are found in many C compilers (such as gcc v4). Such a feature
| often requires one to compile with a flag such as -fnested-functions.
| If you do use local function declarations, please provide
| gcc v4 (or later version) compatible compile flags. I.e.,
|
| cc -fnested-functions prog.c -o prog
|
| At least one judge doesn't like to execute instructions if they are
| on the stack.
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.
The build file should not be used to try and get around the size
limit. It is one thing to make use of a several -D's to help out,
but it is quite another to use 200+ bytes of -D's in order to
try and squeeze the source under the size limit. You should feel
free to make use of the build file space, but you are better off
if you show some amount of restraint.
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:
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:
cc prog.c -DNONHUMAN -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.
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. Don't
depend on a particular type of display. For example, don't depend
on color or a given size. Don't require backing store.
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 M*tif, Xv*ew, or OpenL*ok
toolkits, since not everyone has them. Use of OpenMotif is permitted
because it is more widely and freely available.
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".
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, so avoid stuff like POSIX real
time, security, etc.
| You might not be prohibited from failing to not partly misunderstand
| this particular guideline.
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 helps!)
Some types of programs can't excel (tm) in some areas. Of course, 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.
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");
| 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.
| 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 tradeoffs that obfuscators face!
Be 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.
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.
JUDGING PROCESS:
Entries are judged by Leonid A. Broukhis, Simon Cooper, Landon Curt Noll.
| This list may change before the contest closes.
Each entry submitted is given an id number and subdirectory. The
"program", "info", "build" and "remarks" portions of a submission are
stored and judged from this directory.
Any "author" and identifiable "entry" information is not read until
the judging process is complete, and then only from entries that have
won an award.
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 the "program", "info", "build", or "remarks"
| portions of your entry. We are usually kept in the dark as much as you
| are until the final awards are given. We like 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. (For the curious,
we do indicate the volume of paper consumed when presenting the IOCCC
winners at talks)
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 "build" information
* reading the "program"
* reading the program "info", if any
* 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
In later rounds, other actions are performed:
* compiling/building the source
* running the program
* 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
* best X client (see OUR LIKES AND DISLIKES)
| * best abuse of ISO/IEC 9899-1999 ("ISO C99") C or ANSI C
* 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 often than not, we select a small entry (usually one line), a
strange/creative layout entry, and an entry that abuses the contest
rules in some way.
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 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 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.
| The judges won't promise to post the winning entries to news groups.
| Does anyone still read any of the following groups?
comp.lang.c comp.lang.c.moderated alt.sources
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.
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.2011@ioccc.org (do not submit entries to this address)
| You must include the words 'ioccc 2011 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/\
+127
View File
@@ -0,0 +1,127 @@
#!/usr/bin/env make
#
# 2011 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
# Compiler warnings
#
CWARN= -Wall -W
# compiler standard
#
CSTD= -std=c99
# compiler bit architecture
#
# Some entries require 32-bitness,
# other entries require 64-bitess.
# 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= -O2
# default flags for ANSI C compilation
#
CFLAGS= ${CWARN} ${CSTD} ${ARCH} ${OPT}
# ANSI compiler
#
# Set CC to the name of your ANSI compiler.
#
CC= cc
##############################
# Special flags for this entry
##############################
#
ENTRY= hamaji
DATA= dragon.nono random.nono soccer.nono
#################
# build the entry
#################
#
all: ${ENTRY} ${DATA}
@${TRUE}
${ENTRY}: ${ENTRY}.c
${CC} ${CFLAGS} ${ENTRY}.c -o ${ENTRY}
# alternative executable
#
alt:
@${TRUE}
###############
# utility rules
###############
#
everything: all alt
clean:
${RM} -f ${ENTRY}.o
clobber: clean
${RM} -f ${ENTRY}
nuke: clobber
@echo gnab gib!
install:
@echo "Surely you're joking Mr. Feynman!"
# backwards compatibility
#
build: all
##################
# 133t hacker rulz
##################
#
love:
@echo 'not war?'
haste:
$(MAKE) waste
waste:
@echo 'waste'
easter_egg:
@echo you expected to mis-understand this $${RANDOM} magic
@echo chongo '<was here>' "/\\oo/\\"
@echo Readers shall not be disallowed from being unable to partly misunderstand this final echo.
@${TRUE}
+4
View File
@@ -0,0 +1,4 @@
#!/usr/bin/perl -n0
s%^ *((\d+\.)+\d+)|/$%print$1||"-","
"%emg;s%^/.+%%ms;for$i(18..75){print/^.{$i}([\d.])/gm,"
"}
+29
View File
@@ -0,0 +1,29 @@
3.4.3.3
1.1.1.1.1.1
1.1.1.1.1.3
1.1.1.1.1.1
3.4.3.3
0
2.4.1.3
1.1.1.1.1
1.2.1.1.1.3
1.1.1.1.1.1
2.4.3.1
-
5.3
1.1.1.1
1.1.1.1.1
2
5
1.1.5
1.1.1.1
5.1.1
5
5
1.1.5
1.1.1
3.1
0
5.5
1.1.1.1.1
1.1.1.1.1
+94
View File
@@ -0,0 +1,94 @@
13.3.37
12.2.39
11.2.40
10.39
9.36
9.31
8.3.32
7.3.30
5.3.29
3.1.3.1.28
1.2.4.31
7.5.31
1.6.5.30
5.10.12.16
5.11.5.4.12.4
15.2.4.4.11.5
16.3.4.2.2.5.5
14.8.7.3
12.1.4.1.6.2
11.3.4.6.1
10.1.8.8.5.1
9.8.11.5
9.5.6.1.2.4.1
9.3.5.1.5
3.2.6.5.1
2.6.3.5.1
2.1.2.6.3.6.1
2.1.2.2.1.5.2.5.1
2.1.2.5.5.6.3
4.1.9.7.5.1
5.19.6.1.2
24.6.3.3
24.1.2.9.7.4
25.1.2.25
28.1.26
-
11.23
10.22
10.12.6
9.12.9
9.13.5
8.2.9.4
8.2.9.8
7.2.11.2.5
6.1.2.11.5
4.2.1.8.1.6
3.3.2.7.9
2.2.1.6.8
1.1.1.5.7
1.6.7
2.6.7
2.4.1.6
1.5.6
1.6.6
1.3.1.2.5
3.2.2.5
3.5.5
4.5.6
5.6.6
5.3.6
5.6.3.2
5.7.2.1
5.1.6.2.3
7.2.4.2.1
8.9.2
9.9.2
18.3
18.4
15.7.1
14.12
14.1.13
17.14
17.6.7
16.5.5
15.3.4
14.3.3
13.2.3
13.2.2.3.3
17.3.3.2
17.2.2.3
16.3.3
16.3.4
16.1.5
18.4
19.2.3
20.4.3
22.6.2
29.2
15.11.2
14.2.9.2
17.6.3
18.4
19.5
21.1.4.6
+31
View File
@@ -0,0 +1,31 @@
5.5
3.5.3
2.9.2
1.2.1.2.1
1.11.1
4.1.4
4.1.4
13
6.6
13
1.2.2.1
1.11.1
2.9.2
3.5.3
5.5
-
5.5
3.5.3
2.9.2
1.11.1
1.1.6.2.1
2.1.3.3
2.1.3.3
7.1.3
2.1.3.3
2.1.3.3
1.1.6.2.1
1.11.1
2.9.2
3.5.3
5.5
+47
View File
@@ -0,0 +1,47 @@
#include<stdint.h>// 4
#include<stdio.h>/* 76. 1
..2321 1 57 3
21.... . .. .11 1 2
1 88..1321 2 33 5512 1 277 14 1
099..12.... . .. .... 1 4 11111...111 122 5.1 .
11...221.821112411123455676489 51.176543232666 902 .27 1
10111...1.....................11.417...........1...21..11.
..2239921176566156225563322299887...6533233233182469196894
22...............................111......................
*/// 3269548556987776665556662131223412347543332334543322223456
/*
13.3.37 */char C[120] [60 ];int R[120][60],W,H,J,K,B[61][61],/*
12.2.39 */r,i,j,c,*q =& H,t=7200,x,y,k;int64_t*U,T[28800],*S=/*
11.2.40 */T,O[120], Z[ 120],v,z;void D(){for(k=-1;7200>++k;S[/*
10.39 */k]=v)r=! ~(v=U[k])&&*R[k/60]?2:S[k]-v?1:r;;;;}/*
9.36 */void L( ){for(r=1;r==1;){r=3;;for(i=0;120>/*
9.31 */i;i++){ for(k=z=1,j=0;v=R[i][j];j++)O/*
8.3.32 */[i]|=( 1LL <<v)-1<<k,k+=v,0,Z[i]=z|=1LL<</*
7.3.30 */k++;; v=~ (3LL<<k-2);for(j=-61;++j<60;/*
5.3.29 */v=( v|~ z)&(j<0?v>>1:v<<1|1))v=S[60/*
3.1.3.1.28 */* i +(j < 0?~j:j)]|=j?v:~3;}for(z=0;/*
1.2.4.31 ; */ 7200 >z;z++)i=z/60,j=z%60,(B[i<60?/*
7.5.31 */i:j][ i<60? j:i-60]=~S[z]&O[i]?~S[z]&Z[i]/*
1.6.5.30 ; */?r=0 :(U=O ,1):(U=Z,2))?k=i<60?j+60:j,S/*
5.10.12.16 */[i% 60+60*k]|= ~U[k]:0;U=S; S-=t*=-1;D();z/*
5.11.5.4.12.4 */*9; }}int main( ){for (;K= scanf("%d",R [*/*
15.2.4.4.11.5 */q+c*60]+j)<1? q= &W,j --,2 >++c:'\n';j =-K/*
16.3.4.2.2.5.5 */+getchar()?j+1 :++ *q*0 ); L( );;if (!r/*
14.8.7.3 */)for(K=0;K<W *60;K++) if(K%60 </*
12.1.4.1.6.2 */W&!B[K/60] [ K%60 ] ){for( /*
11.3.4.6.1 */c=64;c--; )if (!(1 &S[K/* ;
10.1.8.8.5.1 */]>>c))U= S ,000,S+= J=14400, D()/* ;
9.8.11.5 */,S[K]=~ (1LL<<c) ,L(),S-=J,S [K]/*
9.5.6.1.2.4.1 */|=r==2? 1LL<< c:0;L( ) ;} q=/* ;
9.3.5.1.5 */&K;;for (J= K=i=0 ; 120/*
3.2.6.5.1 */> i; Z[i]=k --,/* ;
2.6.3.5.1 */ i>59?q =&J :0,/* ;
2.1.2.6.3.6.1 */ * q< k?*q=k :0, 0,C[/* ;
2.1.2.2.1.5.2.5.1 */ i ++ ][ k ]=' ' ){ j=k/* ;
2.1.2.5.5.6.3 */ = 0; for(; x=R[i ][j++] ;/*
4.1.9.7.5.1 */0) k +=sprintf ((00,C[ i]+/* ;
5.19.6.1.2 */k), "%d.",x);}i=~J;;r&1 ||puts ( /*
24.6.3.3 */r?"invalid":"failed"); for(;i <H; i/*
24.1.2.9.7.4 */++,puts(""))for(j=~K;j < W; )putchar( i<0?j<0 ||/*
25.1.2.25 */(k=i+Z[j+60])<0?' ':C[j + 60 ][k]:j<00?(k=j+Z[i])<0?/*
28.1.26 */' ':C[i][k]:"?X "[B[i][j]] ) ,j++;return 0;} /* 2012 */
+250
View File
@@ -0,0 +1,250 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta name="GENERATOR" content="mkd2html 2.1.3 DL=DISCOUNT">
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=utf-8">
<link rel="stylesheet"
type="text/css"
href="../hint.css">
<title>Best solved puzzle</title>
</head>
<body>
<h1>Best solved puzzle</h1>
<p>Shinichiro Hamaji<br>
<a href="&#x6d;&#x61;&#105;&#108;&#116;&#111;&#58;&#115;&#104;&#105;&#x6e;&#105;&#99;&#104;&#x69;&#114;&#x6f;&#46;&#104;&#97;&#109;&#97;&#x6a;&#105;&#64;&#103;&#109;&#97;&#x69;&#108;&#46;&#99;&#x6f;&#109;">&#115;&#x68;&#105;&#x6e;&#x69;&#x63;&#x68;&#105;&#x72;&#111;&#x2e;&#104;&#97;&#109;&#97;&#x6a;&#105;&#64;&#x67;&#109;&#97;&#x69;&#108;&#x2e;&#x63;&#x6f;&#x6d;</a></p>
<p>bsoup</p>
<h2>Judges' comments:</h2>
<h3>To build:</h3>
<pre><code>make hamaji
</code></pre>
<h3>To run:</h3>
<pre><code>./hamaji &lt; a_nonogram_file
</code></pre>
<h3>Try:</h3>
<pre><code>./hamaji &lt; dragon.nono
./hamaji &lt; random.nono
./hamaji &lt; soccer.nono
./hamaji &lt; codegolf.nono
./hamaji &lt; face.nono
./hamaji &lt; penguin.nono
./hamaji &lt; samurai.nono
</code></pre>
<h3>Selected Judges Remarks:</h3>
<p>This program solves &ldquo;Nonogram&rdquo;, which also known as &ldquo;Paint by Numbers&rdquo;:</p>
<p><a href="http://en.wikipedia.org/wiki/Nonogram">http://en.wikipedia.org/wiki/Nonogram</a></p>
<p>This entry roar as the Year of the Dragon: A year considered
some to be good luck. Well it was certainly true that the
IOCCC was lucky to get such a fine submission!</p>
<p>The source code is a solution to a Paint by Numbers puzzle when you
paint by C. Try your hand at solving a few of the other .nono
files and then compare your solution with this program!</p>
<p>NOTE: NONOGRAM &reg; is a registered Trademark and is used with permission.
See http://nonogram.com/ for more information.</p>
<h2>Author&rsquo;s comments:</h2>
<p>The format of the input files are as same as this site:</p>
<p><a href="http://codegolf.com/paint-by-numbers">http://codegolf.com/paint-by-numbers</a></p>
<p>For example, for a simple problem which shows a glider of <a href="http://en.wikipedia.org/wiki/Conway's_Game_of_Life">conway&rsquo;s
lifegame</a>.</p>
<pre><code> 1
.
112
1 X
1 X
3 XXX
</code></pre>
<p>the input should be</p>
<pre><code>1
1
3
-
1
1.1
2
</code></pre>
<p>The width and the height of an input puzzle should be less than or
equal to 60.</p>
<p>When this solver finds the problem has no solution, it prints &ldquo;invalid&rdquo;.
This means the problem is indeed broken. For example, this happens for
an input like</p>
<pre><code>2
-
2
</code></pre>
<p>When this solver cannot find a solution, it prints &ldquo;failed&rdquo;. This
failure can happen when the problem has more than one solution or the
solver cannot solve the input problem. Here is an example input of the
former:</p>
<pre><code>1
1
-
1
1
</code></pre>
<p>There are two solutions:</p>
<pre><code> 11
1 X
1 X
</code></pre>
<p>and</p>
<pre><code> 11
1 X
1 X
</code></pre>
<h3>Detail</h3>
<p>Solving Nonogram is known NP-complete, so we cannot make a solver
which solves all puzzles. However, we can write a solver which solves
most problems solvable by humans. There are a bunch of ways to write
such programs. The two most obvious approaches are:</p>
<ol>
<li>Check all possible solutions with backtracking.</li>
<li>Implement all techniques which humans use.</li>
</ol>
<p>The former, brute-force approach is easy to implement. However, it
works only for smaller problems (width and height should be at most 30
or so). Similarly, using generic probabilistic metaheuristics such as
simulated annealing doesn&rsquo;t work for big problems.</p>
<p><a href="http://ccl.northwestern.edu/netlogo/models/community/Nonogram">http://ccl.northwestern.edu/netlogo/models/community/Nonogram</a></p>
<p>By its definition, the latter works for all human-solvable
problems. The issue of the latter approach is this kind of programs
tends to be lengthy. This approach still requires some recursions. The
most difficult problems which are considered human-solvable may
require some &ldquo;guesses&rdquo;. For this kind of problems, we need to assume a
cell is a space or a box, go ahead some steps with simple methods,
mark the tried cell as a box (or a space if we assumed the tried cell
is a box) if a contradiction is found.</p>
<p>My program uses an approach like &ldquo;Set based solver&rdquo; introduced in
<a href="http://www.haskell.org/haskellwiki/Nonogram">http://www.haskell.org/haskellwiki/Nonogram</a> .
This should be equivalent to the combinations of simple methods (no
advanced reasoning with guess). My solver also runs non-recursive
guess for each undetermined cells. So, my program should be able to
solve most human-solvable problems (assuming humans cannot execute
deeper recursions).</p>
<h3>Obfuscation</h3>
<p>First of all, as you see, my program looks like a nonogram puzzle
which results a dragon. This puzzle is &ldquo;dragon.nono&rdquo; in this
directory. Note that whitespaces in character literals, a string
literal, and around the last comment are considered as a boxed cell.</p>
<p>My program is based on bit operations for speed. Many values are
stored using negative logic (0 means on and 1 means off) to utilize
the initial value of global variables. Thus, it might be difficult to
figure out how it works.</p>
<p>My program is decently shortened, because the size of source code is
limited by IOCCC&rsquo;s rule (2048 non-whitespace characters) and a lot of
characters are just wasted for numbers around the picture.</p>
<p>The three requirements (dragon, speed, and size) naturally ended up
with the well obfuscated code.</p>
<h3>Portability</h3>
<p>This program uses two C99 features. One line comments and &ldquo;long long&rdquo;.
GCC&rsquo;s &ldquo;-ansi -pedantic&rdquo; check should pass:</p>
<pre><code>$ gcc -ansi -pedantic -std=c99 hamaji.c
</code></pre>
<p>I checked my program with gcc-4.6.2 on linux, llvm-gcc-4.2 on mac, and
clang-3.0 on mac.</p>
<p>Note that the behavior of scanf differs on linux and mac, but this
program supports both semantics.</p>
<p>This program should not depend on sizeof(int), sizeof(void*), ASCII,
memory layout, undefined evaluation order (e.g., a[i++]=i), etc.
This program won&rsquo;t work if the size of long long literal is less than 8.
By grepping the source code of gcc</p>
<pre><code>grep LONG_LONG_TYPE_SIZE gcc/config/*/*
</code></pre>
<p>I found long long may be 32bit integers only on AVR.</p>
<h3>A few more</h3>
<p>This code is considered as a new year&rsquo;s postcard in Japan. We chose
the dragon because 2012 is the year of dragon.</p>
<p><a href="http://en.wikipedia.org/wiki/Japanese_New_Year#Postcards">http://en.wikipedia.org/wiki/Japanese_New_Year#Postcards</a></p>
<p>The second author wrote the picture, and the first author did
everything else.</p>
<p>The dragon.nono, samurai.nono, and penguin.nono was written by the
second author. The soccer.nono was from a wikipedia entry. This file
is important because it requires some guesses. The random.nono file
was randomly generated. The codegolf.nono and face.nono have borrowed
from this site:</p>
<p><a href="http://codegolf.com/paint-by-numbers">http://codegolf.com/paint-by-numbers</a></p>
<p>You can reproduce dragon.nono from hamaji.c using c2nono.pl:</p>
<pre><code>perl c2nono.pl hamaji.c | ./hamaji
</code></pre>
<hr />
<!--
(c) Copyright 1984-2012, [Leo Broukhis, Simon Cooper, Landon Curt Noll][judges] - All rights reserved
This work is licensed under a [Creative Commons Attribution-ShareAlike 3.0 Unported License][cc].
[judges]: http://www.ioccc.org/judges.html
[cc]: http://creativecommons.org/licenses/by-sa/3.0/
-->
<TABLE><TR>
<TD><a rel="license" href="http://creativecommons.org/licenses/by-sa/3.0/"><img alt="Creative Commons License" style="border-width:0" src="http://i.creativecommons.org/l/by-sa/3.0/88x31.png" /></a></TD>
<TD><P>&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>
+211
View File
@@ -0,0 +1,211 @@
# Best solved puzzle
Shinichiro Hamaji
<shinichiro.hamaji@gmail.com>
bsoup
## Judges' comments:
### To build:
make hamaji
### To run:
./hamaji < a_nonogram_file
### Try:
./hamaji < dragon.nono
./hamaji < random.nono
./hamaji < soccer.nono
./hamaji < codegolf.nono
./hamaji < face.nono
./hamaji < penguin.nono
./hamaji < samurai.nono
### Selected Judges Remarks:
This program solves "Nonogram", which also known as "Paint by Numbers":
<http://en.wikipedia.org/wiki/Nonogram>
This entry roar as the Year of the Dragon: A year considered
some to be good luck. Well it was certainly true that the
IOCCC was lucky to get such a fine submission!
The source code is a solution to a Paint by Numbers puzzle when you
paint by C. Try your hand at solving a few of the other .nono
files and then compare your solution with this program!
NOTE: NONOGRAM (r) is a registered Trademark and is used with permission.
See http://nonogram.com/ for more information.
## Author's comments:
The format of the input files are as same as this site:
<http://codegolf.com/paint-by-numbers>
For example, for a simple problem which shows a glider of [conway's
lifegame](http://en.wikipedia.org/wiki/Conway's_Game_of_Life).
1
.
112
1 X
1 X
3 XXX
the input should be
1
1
3
-
1
1.1
2
The width and the height of an input puzzle should be less than or
equal to 60.
When this solver finds the problem has no solution, it prints "invalid".
This means the problem is indeed broken. For example, this happens for
an input like
2
-
2
When this solver cannot find a solution, it prints "failed". This
failure can happen when the problem has more than one solution or the
solver cannot solve the input problem. Here is an example input of the
former:
1
1
-
1
1
There are two solutions:
11
1 X
1 X
and
11
1 X
1 X
### Detail
Solving Nonogram is known NP-complete, so we cannot make a solver
which solves all puzzles. However, we can write a solver which solves
most problems solvable by humans. There are a bunch of ways to write
such programs. The two most obvious approaches are:
1. Check all possible solutions with backtracking.
2. Implement all techniques which humans use.
The former, brute-force approach is easy to implement. However, it
works only for smaller problems (width and height should be at most 30
or so). Similarly, using generic probabilistic metaheuristics such as
simulated annealing doesn't work for big problems.
<http://ccl.northwestern.edu/netlogo/models/community/Nonogram>
By its definition, the latter works for all human-solvable
problems. The issue of the latter approach is this kind of programs
tends to be lengthy. This approach still requires some recursions. The
most difficult problems which are considered human-solvable may
require some "guesses". For this kind of problems, we need to assume a
cell is a space or a box, go ahead some steps with simple methods,
mark the tried cell as a box (or a space if we assumed the tried cell
is a box) if a contradiction is found.
My program uses an approach like "Set based solver" introduced in
[http://www.haskell.org/haskellwiki/Nonogram](http://www.haskell.org/haskellwiki/Nonogram) .
This should be equivalent to the combinations of simple methods (no
advanced reasoning with guess). My solver also runs non-recursive
guess for each undetermined cells. So, my program should be able to
solve most human-solvable problems (assuming humans cannot execute
deeper recursions).
### Obfuscation
First of all, as you see, my program looks like a nonogram puzzle
which results a dragon. This puzzle is "dragon.nono" in this
directory. Note that whitespaces in character literals, a string
literal, and around the last comment are considered as a boxed cell.
My program is based on bit operations for speed. Many values are
stored using negative logic (0 means on and 1 means off) to utilize
the initial value of global variables. Thus, it might be difficult to
figure out how it works.
My program is decently shortened, because the size of source code is
limited by IOCCC's rule (2048 non-whitespace characters) and a lot of
characters are just wasted for numbers around the picture.
The three requirements (dragon, speed, and size) naturally ended up
with the well obfuscated code.
### Portability
This program uses two C99 features. One line comments and "long long".
GCC's "-ansi -pedantic" check should pass:
$ gcc -ansi -pedantic -std=c99 hamaji.c
I checked my program with gcc-4.6.2 on linux, llvm-gcc-4.2 on mac, and
clang-3.0 on mac.
Note that the behavior of scanf differs on linux and mac, but this
program supports both semantics.
This program should not depend on sizeof(int), sizeof(void*), ASCII,
memory layout, undefined evaluation order (e.g., a[i++]=i), etc.
This program won't work if the size of long long literal is less than 8.
By grepping the source code of gcc
grep LONG_LONG_TYPE_SIZE gcc/config/*/*
I found long long may be 32bit integers only on AVR.
### A few more
This code is considered as a new year's postcard in Japan. We chose
the dragon because 2012 is the year of dragon.
<http://en.wikipedia.org/wiki/Japanese_New_Year#Postcards>
The second author wrote the picture, and the first author did
everything else.
The dragon.nono, samurai.nono, and penguin.nono was written by the
second author. The soccer.nono was from a wikipedia entry. This file
is important because it requires some guesses. The random.nono file
was randomly generated. The codegolf.nono and face.nono have borrowed
from this site:
<http://codegolf.com/paint-by-numbers>
You can reproduce dragon.nono from hamaji.c using c2nono.pl:
perl c2nono.pl hamaji.c | ./hamaji
--------------------------------------------------------------------------------
<!--
(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/
-->
+45
View File
@@ -0,0 +1,45 @@
6
8
3.5
2.4
3.1.4
2.1.4
5.5
3.5.2
6.2
1.3
2.2
2.2.2.2
2.1.5.1.2
1.1.3.1
4.5
1.1
1.1
1.1
1.1
1.1
1.1.1.1
1.2.3.2
14
6.3
-
2.3
3.2.1
1.2.1.1.1
3.2.1.8.2
3.8.3
3.1.1.2
2.1.1.1.2
2.2.1.4
3.2.1.3
4.3.1.1
8.2.1
7.1.2
5.4
4.3
3.2.2
2.3.2
2.2.6
2.1
2.1
3
+19
View File
@@ -0,0 +1,19 @@
1.1.1.1
3.3
2.2.1
5
3.1.1
2
1.1.3
2.3.1
5
2.1.1
-
1.1.1.1
4.2
1.2.2
4.4
3.2
2.1.5
2.3.1
2.2.1
+73
View File
@@ -0,0 +1,73 @@
3
5
6
5.4
7.5
3.7
5.7
6
6
5
8
11
13
14
15
16
18
19
21
4.16
3.5.9
3.3.9
2.11
2.14
1.18
21
24
25
12.11
9.10
9.9
10.4
7.3
4.2
3.5
3.5
-
2
2
2
1
2
2
2
2.2
2.4
2.5
2.2.6
3.7.1
1.4.7
1.6.7
1.1.6.7
3.8.7
3.9.8
3.10.9
2.9.9
3.19
3.19
3.19
3.2.18
3.5.18
29
1.27
28
28
5.6.9
3.8
9
12
12
9.2
6.2
2
+41
View File
@@ -0,0 +1,41 @@
3
5
3.1
2.1
3.3.4
2.2.7
6.1.1
4.2.2
1.1
3.1
6
2.7
6.3.1
1.2.2.1.1
4.1.1.3
4.2.2
3.3.1
3.3
3
2.1
-
2
1.2
2.3
2.3
3.1.1
2.1.1
1.1.1.2.2
1.1.3.1.3
2.6.4
3.3.9.1
5.3.2
3.1.2.2
2.1.7
3.3.2
2.4
2.1.2
2.2.1
2.2
1
1
+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;
}
+117
View File
@@ -0,0 +1,117 @@
#!/usr/bin/env make
#
# 2011 makefile
#
# Copyright (C) 2011, Landon Curt Noll, Simon Cooper, and Leonid A. Broukhis.
#
# Creative Commons Attribution-ShareAlike 3.0 Unported License.
# See: http://creativecommons.org/licenses/by-sa/3.0/
################
# tool locations
################
#
SHELL= /bin/bash
CP= cp
CPP= cpp
GUNZIP= gunzip
LD= ld
MAKE= make
RM= rm
SED= sed
TAR= tar
TRUE= true
# optimization
#
# Most compiles will safely use -O2. Some can use only -O1 or -O.
# A few compilers have broken optimizers or this entry make break
# under those buggy optimizers and thus you may not want anything.
#
OPT= -O2
# bitness
#
# Some entries require 32-bitness,
# other entries require 64-bitess.
# By default we assume nothing.
#
ARCH=
# default flags for ANSI C compilation
#
CFLAGS= -Wall -W -ansi -pedantic ${ARCH} ${OPT} -lm
# ANSI compiler
#
# Set CC to the name of your ANSI compiler.
#
CC= cc
##############################
# Special flags for this entry
##############################
#
ENTRY= hou
DATA=
#################
# build the entry
#################
#
all: ${ENTRY} ${DATA}
@${TRUE}
${ENTRY}: ${ENTRY}.c
${CC} ${CFLAGS} ${ENTRY}.c -o ${ENTRY}
# alternative executable
#
alt:
@${TRUE}
###############
# utility rules
###############
#
everything: all alt
clean:
${RM} -f ${ENTRY}.o
clobber: clean
${RM} -f ${ENTRY}
nuke: clobber
@echo gnab gib!
install:
@echo "Surely you're joking Mr. Feynman!"
# backwards compatibility
#
build: all
##################
# 133t hacker rulz
##################
#
love:
@echo 'not war?'
haste:
$(MAKE) waste
waste:
@echo 'waste'
easter_egg:
@echo you expected to mis-understand this $${RANDOM} magic
@echo chongo '<was here>' "/\\oo/\\"
@echo Readers shall not be disallowed from being unable to partly misunderstand this final echo.
@${TRUE}
+145
View File
@@ -0,0 +1,145 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta name="GENERATOR" content="mkd2html 2.1.3 DL=DISCOUNT">
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=utf-8">
<link rel="stylesheet"
type="text/css"
href="../hint.css">
<title>Best self documenting program</title>
</head>
<body>
<h1>Best self documenting program</h1>
<p>Hou Qiming<br>
<a href="&#x6d;&#x61;&#105;&#108;&#116;&#111;&#58;&#104;&#113;&#109;&#x30;&#51;&#115;&#116;&#x65;&#114;&#x40;&#103;&#109;&#97;&#105;&#108;&#x2e;&#99;&#111;&#109;">&#104;&#113;&#x6d;&#48;&#51;&#115;&#x74;&#101;&#114;&#x40;&#103;&#x6d;&#x61;&#x69;&#x6c;&#46;&#x63;&#111;&#x6d;</a></p>
<h2>Judges' comments:</h2>
<h3>To build:</h3>
<pre><code>make hou
</code></pre>
<h3>To run:</h3>
<pre><code>./hou 'a calculator expression -- see the C Code for details'
</code></pre>
<h3>Try:</h3>
<pre><code>./hou 11/26+222/31
./hou 'log((21701-19937)-(23209-21701))/log(2)'
./hou 'sin(1.5708)+0.04321+log(sqrt(exp(1*1*1)))+(1+2*3)-0.4-0.6+(4+6)*(2-1+2*3)-tan(0.785398)+2*10/3*6*sqrt(16/2/2)*10+10000-1000'
</code></pre>
<h3>Selected Judges Remarks:</h3>
<p>This self-documenting scientific calculator compiles clean with no
warnings under the most strict pedantic mode of gcc and clang.</p>
<p>The first example, along with the correct result appears in the
source code. What does it mean?</p>
<p>The calculator obeys the precendence rules and allows parenthesis,</p>
<pre><code> ./hou '1+2*3'
./hou '(1+2)*3'
</code></pre>
<p>What exactly does the text formatting do?</p>
<p>What does this evaluate to in C?</p>
<pre><code> +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~+
</code></pre>
<h4>Self documenting source</h4>
<p>Comments would almost be redundant. :-}</p>
<h4>The ASCII art is valid C code</h4>
<p>Not just fancy formatted comment removed by the C Pre-processor</p>
<h4>The only multi-byte strings are format strings</h4>
<p>The code does not contain some simple string-encoded lookup table for calculator operations.</p>
<h4>Example input and output in the source</h4>
<p>The example input and output in the C code is significant. Can you find out why?</p>
<h4>The button layout</h4>
<p>The button layout in the C code is significant &hellip; not just a nice looking layout.</p>
<h4>input parsing</h4>
<p>The parser is functionally equivalent to a normal arithmetic parser for all valid inputs.
For another fun challenge: try to determine how it parses the command line argument.</p>
<h2>Author&rsquo;s comments:</h2>
<h3>Obfuscations</h3>
<p>This program is designed to be self-documenting. It doesn&rsquo;t just provide an
example command line. It also provides the expected output and illustrates all
supported functionality using embedded ASCII art.</p>
<ul>
<li>A few line numbers are significant and careless beautification will break the program.</li>
<li>The entire ASCII art is valid code. The preprocessor won&rsquo;t remove any part of it.</li>
<li>The only strings longer than 1 byte are printf/sscanf format strings, even
after preprocessing. No string-encoded lookup table is used.</li>
<li>The example input and its expected output are both algorithmically significant.</li>
<li>The button layout is also significant.</li>
<li>The actual syntax being parsed is not the obvious, despite being
functionally equivalent for all correct inputs.</li>
</ul>
<h3>Portability</h3>
<ul>
<li>This program requires &ldquo;argv&rdquo; to point to writable memory. It doesn&rsquo;t require
the actual argv strings to be writable, though.</li>
<li>This program requires ASCII.</li>
<li>This program doesn&rsquo;t work with %e style numbers like &ldquo;1e-4&rdquo;.</li>
<li>Some seemingly redundant code works to eliminate warnings and evade a gcc bug.</li>
</ul>
<h3>Spoilers</h3>
<p>The parser parses function names, substraction, and division as single-letter
unary operators. A bitmask encoded hash table is used to check no-ops/digits
and another hash function maps the ASCII to a function ordinal, which is then
executed by the button panel.</p>
<p>Both hash functions are found using a separate search program. Another program
is used to find a way to format one hash function as example input such that
it produces something resembling the bitmask hash table as part of its output.</p>
<hr />
<!--
(c) Copyright 1984-2012, [Leo Broukhis, Simon Cooper, Landon Curt Noll][judges] - All rights reserved
This work is licensed under a [Creative Commons Attribution-ShareAlike 3.0 Unported License][cc].
[judges]: http://www.ioccc.org/judges.html
[cc]: http://creativecommons.org/licenses/by-sa/3.0/
-->
<TABLE><TR>
<TD><a rel="license" href="http://creativecommons.org/licenses/by-sa/3.0/"><img alt="Creative Commons License" style="border-width:0" src="http://i.creativecommons.org/l/by-sa/3.0/88x31.png" /></a></TD>
<TD><P>&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>
+111
View File
@@ -0,0 +1,111 @@
# Best self documenting program
Hou Qiming
<hqm03ster@gmail.com>
## Judges' comments:
### To build:
make hou
### To run:
./hou 'a calculator expression -- see the C Code for details'
### Try:
./hou 11/26+222/31
./hou 'log((21701-19937)-(23209-21701))/log(2)'
./hou 'sin(1.5708)+0.04321+log(sqrt(exp(1*1*1)))+(1+2*3)-0.4-0.6+(4+6)*(2-1+2*3)-tan(0.785398)+2*10/3*6*sqrt(16/2/2)*10+10000-1000'
### Selected Judges Remarks:
This self-documenting scientific calculator compiles clean with no
warnings under the most strict pedantic mode of gcc and clang.
The first example, along with the correct result appears in the
source code. What does it mean?
The calculator obeys the precendence rules and allows parenthesis,
./hou '1+2*3'
./hou '(1+2)*3'
What exactly does the text formatting do?
What does this evaluate to in C?
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~+
#### Self documenting source
Comments would almost be redundant. :-}
#### The ASCII art is valid C code
Not just fancy formatted comment removed by the C Pre-processor
#### The only multi-byte strings are format strings
The code does not contain some simple string-encoded lookup table for calculator operations.
#### Example input and output in the source
The example input and output in the C code is significant. Can you find out why?
#### The button layout
The button layout in the C code is significant ... not just a nice looking layout.
#### input parsing
The parser is functionally equivalent to a normal arithmetic parser for all valid inputs.
For another fun challenge: try to determine how it parses the command line argument.
## Author's comments:
### Obfuscations
This program is designed to be self-documenting. It doesn't just provide an
example command line. It also provides the expected output and illustrates all
supported functionality using embedded ASCII art.
- A few line numbers are significant and careless beautification will break the program.
- The entire ASCII art is valid code. The preprocessor won't remove any part of it.
- The only strings longer than 1 byte are printf/sscanf format strings, even
after preprocessing. No string-encoded lookup table is used.
- The example input and its expected output are both algorithmically significant.
- The button layout is also significant.
- The actual syntax being parsed is not the obvious, despite being
functionally equivalent for all correct inputs.
### Portability
- This program requires "argv" to point to writable memory. It doesn't require
the actual argv strings to be writable, though.
- This program requires ASCII.
- This program doesn't work with %e style numbers like "1e-4".
- Some seemingly redundant code works to eliminate warnings and evade a gcc bug.
### Spoilers
The parser parses function names, substraction, and division as single-letter
unary operators. A bitmask encoded hash table is used to check no-ops/digits
and another hash function maps the ASCII to a function ordinal, which is then
executed by the button panel.
Both hash functions are found using a separate search program. Another program
is used to find a way to format one hash function as example input such that
it produces something resembling the bitmask hash table as part of its output.
--------------------------------------------------------------------------------
<!--
(c) Copyright 1984-2012, [Leo Broukhis, Simon Cooper, Landon Curt Noll][judges] - All rights reserved
This work is licensed under a [Creative Commons Attribution-ShareAlike 3.0 Unported License][cc].
[judges]: http://www.ioccc.org/judges.html
[cc]: http://creativecommons.org/licenses/by-sa/3.0/
-->
+34
View File
@@ -0,0 +1,34 @@
#include <stdio.h>
#include <math.h>
#define clear 1;if(c>=11){c=0;sscanf(_,"%lf%c",&r,&c);while(*++_-c);}\
else if(argc>=4&&!main(4-(*_++=='('),argv))_++;g:c+=
#define puts(d,e) return 0;}{double a;int b;char c=(argc<4?d)&15;\
b=(*_%__LINE__+7)%9*(3*e>>c&1);c+=
#define I(d) (r);if(argc<4&&*#d==*_){a=r;r=usage?r*a:r+a;goto g;}c=c
#define return if(argc==2)printf("%f\n",r);return argc>=4+
#define usage main(4-__LINE__/26,argv)
#define calculator *_*(int)
#define l (r);r=--b?r:
#define _ argv[1]
#define x
double r;
int main(int argc,char** argv){
if(argc<2){
puts(
usage: calculator 11/26+222/31
+~~~~~~~~~~~~~~~~~~~~~~~~calculator-\
! 7.584,367 )
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~+
! clear ! 0 ||l -x l tan I (/) |
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~+
! 1 | 2 | 3 ||l 1/x l cos I (*) |
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~+
! 4 | 5 | 6 ||l exp l sqrt I (+) |
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~+
! 7 | 8 | 9 ||l sin l log I (-) |
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~(0
);
}
return 0;
}
+127
View File
@@ -0,0 +1,127 @@
#!/usr/bin/env make
#
# 2011 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
# Compiler warnings
#
CWARN= -Wall -W
# compiler standard
#
CSTD= -ansi
# compiler bit architecture
#
# Some entries require 32-bitness,
# other entries require 64-bitess.
# 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= -O2
# default flags for ANSI C compilation
#
CFLAGS= ${CWARN} ${CSTD} ${ARCH} ${OPT}
# ANSI compiler
#
# Set CC to the name of your ANSI compiler.
#
CC= cc
##############################
# Special flags for this entry
##############################
#
ENTRY= konno
DATA=
#################
# build the entry
#################
#
all: ${ENTRY} ${DATA}
@${TRUE}
${ENTRY}: ${ENTRY}.c
${CC} ${CFLAGS} ${ENTRY}.c -o ${ENTRY}
# alternative executable
#
alt:
@${TRUE}
###############
# utility rules
###############
#
everything: all alt
clean:
${RM} -f ${ENTRY}.o
clobber: clean
${RM} -f ${ENTRY}
nuke: clobber
@echo gnab gib!
install:
@echo "Surely you're joking Mr. Feynman!"
# backwards compatibility
#
build: all
##################
# 133t hacker rulz
##################
#
love:
@echo 'not war?'
haste:
$(MAKE) waste
waste:
@echo 'waste'
easter_egg:
@echo you expected to mis-understand this $${RANDOM} magic
@echo chongo '<was here>' "/\\oo/\\"
@echo Readers shall not be disallowed from being unable to partly misunderstand this final echo.
@${TRUE}
+85
View File
@@ -0,0 +1,85 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta name="GENERATOR" content="mkd2html 2.1.3 DL=DISCOUNT">
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=utf-8">
<link rel="stylesheet"
type="text/css"
href="../hint.css">
<title>Best one liner</title>
</head>
<body>
<h1>Best one liner</h1>
<p>Taketo Konno<br>
Tokyo, Japan<br>
<a href="&#x6d;&#x61;&#105;&#108;&#116;&#111;&#58;&#105;&#110;&#97;&#x6e;&#105;&#119;&#97;&#x33;&#64;&#x67;&#109;&#97;&#105;&#108;&#46;&#x63;&#111;&#109;">&#105;&#110;&#97;&#x6e;&#105;&#119;&#97;&#x33;&#64;&#103;&#x6d;&#97;&#x69;&#x6c;&#x2e;&#x63;&#111;&#x6d;</a></p>
<h2>Judges' comments:</h2>
<h3>To build:</h3>
<pre><code>make konno
</code></pre>
<h3>To run:</h3>
<pre><code>./konno just_a_single_argument_of_lower_case_letters
</code></pre>
<h3>Try:</h3>
<pre><code>./konno qwerty
./konno ioccc
./konno "the quick brown fox jumps over the lazy dog"
</code></pre>
<h3>Selected Judges Remarks:</h3>
<p>This tiny program outputs what looks like a tiny keyboard.<br>
OK, so the letters are missing. But that is no problem because
this program identifes the lower case letters that were pressed!</p>
<p>It is one of those minimal keyboards without all of those
confusing symbols keys. No shift for SHOULDING CAPS
but at least it does not have that useless caps lock key!</p>
<p>We recommend that you completely deconstruct / figure out
how this program works and does what it does. Can you
extend this program to deal with a full QWERTY keyboard?
Can you then minimize the size of that code?</p>
<h2>Author&rsquo;s comments:</h2>
<h3>Limitation</h3>
<p>This program ignores non-lower case letters.</p>
<h3>Obfuscation</h3>
<ul>
<li>&ldquo;for&rdquo; is not used.</li>
<li>A part of program is encrypted.</li>
</ul>
<hr />
<!--
(c) Copyright 1984-2012, [Leo Broukhis, Simon Cooper, Landon Curt Noll][judges] - All rights reserved
This work is licensed under a [Creative Commons Attribution-ShareAlike 3.0 Unported License][cc].
[judges]: http://www.ioccc.org/judges.html
[cc]: http://creativecommons.org/licenses/by-sa/3.0/
-->
<TABLE><TR>
<TD><a rel="license" href="http://creativecommons.org/licenses/by-sa/3.0/"><img alt="Creative Commons License" style="border-width:0" src="http://i.creativecommons.org/l/by-sa/3.0/88x31.png" /></a></TD>
<TD><P>&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>
+55
View File
@@ -0,0 +1,55 @@
# Best one liner
Taketo Konno
Tokyo, Japan
<inaniwa3@gmail.com>
## Judges' comments:
### To build:
make konno
### To run:
./konno just_a_single_argument_of_lower_case_letters
### Try:
./konno qwerty
./konno ioccc
./konno "the quick brown fox jumps over the lazy dog"
### Selected Judges Remarks:
This tiny program outputs what looks like a tiny keyboard.
OK, so the letters are missing. But that is no problem because
this program identifes the lower case letters that were pressed!
It is one of those minimal keyboards without all of those
confusing symbols keys. No shift for SHOULDING CAPS
but at least it does not have that useless caps lock key!
We recommend that you completely deconstruct / figure out
how this program works and does what it does. Can you
extend this program to deal with a full QWERTY keyboard?
Can you then minimize the size of that code?
## Author's comments:
### Limitation
This program ignores non-lower case letters.
### Obfuscation
* "for" is not used.
* A part of program is encrypted.
--------------------------------------------------------------------------------
<!--
(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/
-->
+1
View File
@@ -0,0 +1 @@
main(_,l)char**l;{6*putchar(--_%20?_+_/21&56>_?strchr(1[l],_^"pt`u}rxf~c{wk~zyHHOJ]QULGQ[Z"[_/2])?111:46:32:10)^_&&main(2+_,l);}
+117
View File
@@ -0,0 +1,117 @@
#!/usr/bin/env make
#
# 2011 makefile
#
# Copyright (C) 2011, Landon Curt Noll, Simon Cooper, and Leonid A. Broukhis.
#
# Creative Commons Attribution-ShareAlike 3.0 Unported License.
# See: http://creativecommons.org/licenses/by-sa/3.0/
################
# tool locations
################
#
SHELL= /bin/bash
CP= cp
CPP= cpp
GUNZIP= gunzip
LD= ld
MAKE= make
RM= rm
SED= sed
TAR= tar
TRUE= true
# optimization
#
# Most compiles will safely use -O2. Some can use only -O1 or -O.
# A few compilers have broken optimizers or this entry make break
# under those buggy optimizers and thus you may not want anything.
#
OPT= -O2
# bitness
#
# Some entries require 32-bitness,
# other entries require 64-bitess.
# By default we assume nothing.
#
ARCH=
# default flags for ANSI C compilation
#
CFLAGS= -Wall -W ${ARCH} ${OPT}
# ANSI compiler
#
# Set CC to the name of your ANSI compiler.
#
CC= cc
##############################
# Special flags for this entry
##############################
#
ENTRY= richards
DATA=
#################
# build the entry
#################
#
all: ${ENTRY} ${DATA}
@${TRUE}
${ENTRY}: ${ENTRY}.c
${CC} ${CFLAGS} ${ENTRY}.c -o ${ENTRY}
# alternative executable
#
alt:
@${TRUE}
###############
# utility rules
###############
#
everything: all alt
clean:
${RM} -f ${ENTRY}.o
clobber: clean
${RM} -f ${ENTRY}
nuke: clobber
@echo gnab gib!
install:
@echo "Surely you're joking Mr. Feynman!"
# backwards compatibility
#
build: all
##################
# 133t hacker rulz
##################
#
love:
@echo 'not war?'
haste:
$(MAKE) waste
waste:
@echo 'waste'
easter_egg:
@echo you expected to mis-understand this $${RANDOM} magic
@echo chongo '<was here>' "/\\oo/\\"
@echo Readers shall not be disallowed from being unable to partly misunderstand this final echo.
@${TRUE}
+112
View File
@@ -0,0 +1,112 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta name="GENERATOR" content="mkd2html 2.1.3 DL=DISCOUNT">
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=utf-8">
<link rel="stylesheet"
type="text/css"
href="../hint.css">
<title>Most surprisingly portable</title>
</head>
<body>
<h1>Most surprisingly portable</h1>
<p>Gregor Richards<br>
<a href="&#x6d;&#x61;&#105;&#108;&#116;&#111;&#58;&#82;&#105;&#99;&#x68;&#97;&#114;&#100;&#x73;&#64;&#x63;&#111;&#100;&#117;&#46;&#111;&#x72;&#103;">&#82;&#105;&#99;&#104;&#x61;&#114;&#100;&#115;&#x40;&#99;&#111;&#x64;&#117;&#x2e;&#x6f;&#x72;&#x67;</a></p>
<h2>Judges' comments:</h2>
<h3>To build:</h3>
<pre><code>make richards
</code></pre>
<h3>To run:</h3>
<pre><code>./richards
</code></pre>
<h3>Try:</h3>
<pre><code>echo '10 9 8 7 6 5 4 3 2 1*p*p*p*p*p*p*p*p*p' | ./richards
</code></pre>
<h3>Selected Judges Remarks:</h3>
<p>Oh no, yet another dc-style calculator? (see 2000/dlowe using an embedded Perl
interpreter and deemed Worst Abuse of the Rules).
Well, this one does it (expression calculation, that is, not the rule abuse) in a different way.
The author claims that his calculator does just-in-time compilation.
What would you do to prove or disprove his claim without attempting to unravel the source?</p>
<h2>Author&rsquo;s comments:</h2>
<p>This is an implementation of the classic UNIX dc command, the reverse-polish
calculator. Actually it&rsquo;s a pretty bad implementation, since it only implements
32-bit integers (well, sizeof(int)-sized integers). It only implements the
commands +, -, *, /, p (only for numbers), register stacks, macros and
comparisons. Wow, you&rsquo;d think I could&rsquo;ve done better in 2K of code.</p>
<p>OH! I forgot to mention! It&rsquo;s a JIT.</p>
<p>Wait, don&rsquo;t stop reading! I know what you&rsquo;re thinking, platform-specific code
is discouraged in IOCCC. But do you see any platform-specific code? There&rsquo;s no
assembler here! This JIT works on a dozen platforms, and the only
platform-specific assumptions it makes are that the stack grows down and
integers are at least 32-bit.</p>
<p>You will probably get warnings while compiling the code. In particular:</p>
<ul>
<li>If your system requires the inclusion of alloca.h to use alloca, use the
compile flag -DAH</li>
<li>If your system cannot use mmap, use the compile flag -DNM</li>
<li>I don&rsquo;t include any headers I don&rsquo;t strictly need to, so you&rsquo;ll get warnings
about (at least) memcpy, isdigit, atoi, calloc, malloc and alloca if you
didn&rsquo;t use -DAH.</li>
<li>GCC likes to complain about while (a = b) (assignments as a condition).</li>
<li>I don&rsquo;t return from main, even though it&rsquo;s declared to return int.</li>
</ul>
<p>Platforms on which all known/tested optimization levels work with no additional
flags:</p>
<ul>
<li>gcc 4.6.2 + x86[_64] + GNU/Linux, Mac OS X or Windows</li>
<li>clang 2.9-16 + x86[_64] + GNU/Linux or Mac OS X</li>
<li>tcc 0.9.25</li>
<li>gcc 4.4.5 + alpha, arm, mips[el], powerpc[64], s390x (IBM zSeries)</li>
<li>gcc 4.1.3 + vax + NetBSD</li>
</ul>
<p>Platforms which work but not at all optimization levels or needing special
flags:</p>
<ul>
<li>owcc 1.9 + x86 + Windows: Needs -DNM -DAH -fno-stack-check</li>
<li>gcc 4.4.5 + sh4: -O0 works, higher optimization levels don&rsquo;t work for unknown reasons.</li>
</ul>
<hr />
<!--
(c) Copyright 1984-2012, [Leo Broukhis, Simon Cooper, Landon Curt Noll][judges] - All rights reserved
This work is licensed under a [Creative Commons Attribution-ShareAlike 3.0 Unported License][cc].
[judges]: http://www.ioccc.org/judges.html
[cc]: http://creativecommons.org/licenses/by-sa/3.0/
-->
<TABLE><TR>
<TD><a rel="license" href="http://creativecommons.org/licenses/by-sa/3.0/"><img alt="Creative Commons License" style="border-width:0" src="http://i.creativecommons.org/l/by-sa/3.0/88x31.png" /></a></TD>
<TD><P>&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>
+76
View File
@@ -0,0 +1,76 @@
# Most surprisingly portable
Gregor Richards
<Richards@codu.org>
## Judges' comments:
### To build:
make richards
### To run:
./richards
### Try:
echo '10 9 8 7 6 5 4 3 2 1*p*p*p*p*p*p*p*p*p' | ./richards
### Selected Judges Remarks:
Oh no, yet another dc-style calculator? (see 2000/dlowe using an embedded Perl
interpreter and deemed Worst Abuse of the Rules).
Well, this one does it (expression calculation, that is, not the rule abuse) in a different way.
The author claims that his calculator does just-in-time compilation.
What would you do to prove or disprove his claim without attempting to unravel the source?
## Author's comments:
This is an implementation of the classic UNIX dc command, the reverse-polish
calculator. Actually it's a pretty bad implementation, since it only implements
32-bit integers (well, sizeof(int)-sized integers). It only implements the
commands +, -, *, /, p (only for numbers), register stacks, macros and
comparisons. Wow, you'd think I could've done better in 2K of code.
OH! I forgot to mention! It's a JIT.
Wait, don't stop reading! I know what you're thinking, platform-specific code
is discouraged in IOCCC. But do you see any platform-specific code? There's no
assembler here! This JIT works on a dozen platforms, and the only
platform-specific assumptions it makes are that the stack grows down and
integers are at least 32-bit.
You will probably get warnings while compiling the code. In particular:
* If your system requires the inclusion of alloca.h to use alloca, use the
compile flag -DAH
* If your system cannot use mmap, use the compile flag -DNM
* I don't include any headers I don't strictly need to, so you'll get warnings
about (at least) memcpy, isdigit, atoi, calloc, malloc and alloca if you
didn't use -DAH.
* GCC likes to complain about while (a = b) (assignments as a condition).
* I don't return from main, even though it's declared to return int.
Platforms on which all known/tested optimization levels work with no additional
flags:
* gcc 4.6.2 + x86[_64] + GNU/Linux, Mac OS X or Windows
* clang 2.9-16 + x86[_64] + GNU/Linux or Mac OS X
* tcc 0.9.25
* gcc 4.4.5 + alpha, arm, mips[el], powerpc[64], s390x (IBM zSeries)
* gcc 4.1.3 + vax + NetBSD
Platforms which work but not at all optimization levels or needing special
flags:
* owcc 1.9 + x86 + Windows: Needs -DNM -DAH -fno-stack-check
* gcc 4.4.5 + sh4: -O0 works, higher optimization levels don't work for unknown reasons.
--------------------------------------------------------------------------------
<!--
(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/
-->
+199
View File
@@ -0,0 +1,199 @@
#ifdef AH
#include<alloca.h>
#endif
#include<setjmp.h>
#include<stdio.h>
#if !NM
#include<sys/mman.h>
#endif
#define vo volatile
#define A(x,y,z) O(x,y,z##1)O(x,y,z##2)O(x,y,z##3)
#define B(x,y) A(x,y,1)A(x,y,2)A(x,y,3)
#define C(x,y) B(x,y##1)B(x,y##2)B(x,y##3)
#define D(x) C(x,1)C(x,2)C(x,3)
#define E(x) D(x##1)D(x##2)D(x##3)
#define G E(1)E(2)E(3)
#define S d->
#define M S a
#define R(x) ; S r(#x);
#define L(x,y) S l[x](d)R(y)
#define F(x) void l##x(vo dt d) {
#define Q(x); M--; *M=*M x M[1]; R(x)
#define O(x,y,z) x##y##z,
#define q typedef
#define H 9<<16
#define I case
#define J(i) calloc(i,1)
#define W(c) e=(k*)memcpy(e,x[(u)c],y[(u)c])+y[(u)c];
#define N break; I
q char k;
q void o;
q int u;
q o(*f) (vo o *);
q struct {
u *a, **R, *m, h, c;
k **s;
f *l, *j, r;
} *dt;
u m[] = { G 0 } ;
u n[H];
dt st;
u sk[H];
k *w;
o *x[H];
u y[H];
k *j, *e;
u l=256;
o g(u v)
{
if (v > l) {
g(v / l);
g(l);
W('*') g(v % l);
W('+')} else {
W(m[v])}
}
f K(k * p, dt d)
{
k c, n = 0;
f r = (f) e;
W(1) while ((c = *p)) {
switch (c) {
I '#':
while (*++p != 10);
N '[':c = 1;
S s[S c] = ++p;
for (; c; p++) {
if (*p == '[')
c++;
else if (*p == ']')
c--;
}
p[-1] = 0;
g(S c++);
N '!':n = 1;
c = *++p;
if (!(c & 1))
I '<': I '>':
c ^= 2;
I '=':W(c) if (n) {
W('!') n = 0;
}
g(*++p);
W('|') p++;
N 's': I 'S': I 'l':
I 'L':g(*++p);
W(c) p++;
N '_':p++;
default:
if (isdigit(*p)) {
g(atoi(p));
while (isdigit(*p))
p++;
} else
p++;
W(c)}
}
W(2) return r;
}
o t(vo dt d)
{
S r("\01") Q(+)Q(-)Q(*) * M = -*M;
R(_)Q( ==) Q(<)Q(>) * M = !*M;
R(!)M[-1] ^= *M;
*M ^= M[-1] R(r) M[1] = *M;
M++ R(d) * S R[*M] = M[-1];
M--;
R(s) * ++S R[*M] = M[-1];
M--;
R(S) * M = *S R[*M];
R(l) * M = *S R[*M]--;
R(L) L(1, /)L(2, p) L(3, x) L(4, |)
#undef O
#define O(x,y,z) *++M=S m[(x*S h+y)*S h+z]; S r("");
G S l[0] (d);
}
o T()
{
}
o rd(u v)
{
k *a = 0, **b = &a, **c = b + 32;
x[v] = w;
for (; b < c && (*b < w || *b > (k *) T || *b == (k *) (long) v); b++);
if (b == c) {
jmp_buf *j = alloca(sizeof(*j));
setjmp(*j);
rd(v);
} else {
y[v] = *b - w;
w = *b;
}
}
q o(*rt) (u);
vo rt rs = rd;
o re(vo k * rec)
{
static u i = 0;
*(st->a = sk + 9) = 0;
rs(*rec ? *rec : m[i++]);
} F(d) M--;
*M /= M[1];
} F(p) printf("%d\n", *M);
} F(x) u n = *M--;
if (!S j[n])
S j[n] = K(S s[n], d);
S j[n] (d);
}
F(1) M -= 2;
if (M[1])
{
M++;
*M = *S R[M[1]];
lx(d);
}
}
o *lib1[] = { T, T, T, T, T } ;
o *lib2[] = { T, ld, lp, lx, l1 } ;
u main()
{
u i;
k *b;
dt d = st = J(sizeof(*st));
M = sk + 9;
S R = J(l * sizeof(k *));
for (i = 0; i < l; i++)
S R[i] = J(H);
S m = n;
S s = J(H);
S l = (f *) lib1;
S j = J(H);
S r = (f) re;
for (i = 0; m[i]; i++)
n[m[i]] = i;
w = (k *) t;
t(d);
x[2] = w;
y[2] = (k *) T - w + 8;
S h = 100;
S l = (f *) lib2;
S r = (f) T;
j = e =
#if NM
malloc(H);
#else
mmap(0, H, -1, MAP_PRIVATE | MAP_ANON, -1, 0);
#endif
while (b = fgets(malloc(999), 999, stdin))
((f) K(b, d)) (d);
}
+149
View File
@@ -0,0 +1,149 @@
20th International Obfuscated C Code Contest Rules
Copyright (C) 2006,2011 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.
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 20th IOCCC contest window is:
| 12-Nov-2011 11:00:00 UTC to 12-Jan-2012 12:12:12 UTC
RULES:
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/
| (Will be available 2011-12-01)
4) If your entry is selected as a winner, it will be modified as follows:
Your 'build' instructions will be incorporated into a
makefile. If your build instructions *is* a makefile then
it should be portable and usable from within a master
makefile.
Your program source will be renamed using an identifier of
our choice (usually your family name or anonymous) followed
by an optional digit, followed by '.c'
Your entry will be compiled into a file with the above name
minus the '.c'.
If your entry requires that a build file exist, state so in
your entry's remark section. The makefile will be arranged to
execute a build shell script containing the 'build'
information. The name of this build shell script will be your
entry's title, possibly followed by a digit, followed by '.sh'.
If needed, your entry's remarks should indicate how your entry
must be changed in order to deal with the new filenames.
5) The build file, the source and the resulting executable should be
treated as read-only files. If your entry needs to modify these files,
it should make and modify a copy of the appropriate file. If this
occurs, state so in your entry's remarks.
6) Your program source must be able to be compiled cleanly by an ANSI C
compiler, or if there are any compile errors, they must be documented
in the "remarks" section of your submission.
7) The program must be of original work. All submitted programs are
are thereby put in the public domain. All explicitly copyrighted
programs will be rejected.
| 8) Entries must be received prior to 12-Jan-2012 12:12:12 UTC.
An EMail a confirmation of submission will be sent to the sender
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 submitted "remarks".
13) Your source may not contain unescaped octets with the high bit set.
I.e., your source may not contain octet values between 128 and 255.
14) Any program that fails to compile because of lines with trailing
control-M's (\r or \015) will be rejected.
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.
FOR MORE INFORMATION:
The judging will be done by Leonid A. Broukhis, Simon Cooper, Landon
| Curt Noll, this list may be updated before the close of the competition.
| Please send questions or comments about the contest, to:
| q.2011@ioccc.org (for questions only!)
| You must include the words ``ioccc 2011 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).
Details of how to submit your entry will be made available on 2011-12-01
Leonid A. Broukhis
Simon Cooper
chongo (Landon Curt Noll) /\cc/\
+125
View File
@@ -0,0 +1,125 @@
#!/usr/bin/env make
#
# 2011 makefile
#
# Copyright (C) 2011, Landon Curt Noll, Simon Cooper, and Leonid A. Broukhis.
#
# Creative Commons Attribution-ShareAlike 3.0 Unported License.
# See: http://creativecommons.org/licenses/by-sa/3.0/
################
# tool locations
################
#
SHELL= /bin/bash
CP= cp
CPP= cpp
GUNZIP= gunzip
LD= ld
MAKE= make
RM= rm
SED= sed
TAR= tar
TRUE= true
# 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
# optimization
#
# Most compiles will safely use -O2. Some can use only -O1 or -O.
# A few compilers have broken optimizers or this entry make break
# under those buggy optimizers and thus you may not want anything.
#
OPT= -O2
# bitness
#
# Some entries require 32-bitness,
# other entries require 64-bitess.
# By default we assume nothing.
#
ARCH=
# default flags for ANSI C compilation
#
CFLAGS= -Wall -W -ansi ${ARCH} ${OPT} -I${X11_INCDIR} -L${X11_LIBDIR} -lX11 -lm -DA=XK_Up:XK_w -DB=XK_Left:XK_a -DC=XK_Right:XK_d -DD=XK_Down:XK_s -DE=XK_BackSpace:XK_Tab "-DQ=XFillRectangle(W,X,Y,"
# ANSI compiler
#
# Set CC to the name of your ANSI compiler.
#
CC= cc
##############################
# Special flags for this entry
##############################
#
ENTRY= toledo
DATA=
#################
# build the entry
#################
#
all: ${ENTRY} ${DATA}
@${TRUE}
${ENTRY}: ${ENTRY}.c
${CC} ${CFLAGS} ${ENTRY}.c -o ${ENTRY}
# alternative executable
#
alt:
@${TRUE}
###############
# utility rules
###############
#
everything: all alt
clean:
${RM} -f ${ENTRY}.o
clobber: clean
${RM} -f ${ENTRY}
nuke: clobber
@echo gnab gib!
install:
@echo "Surely you're joking Mr. Feynman!"
# backwards compatibility
#
build: all
##################
# 133t hacker rulz
##################
#
love:
@echo 'not war?'
haste:
$(MAKE) waste
waste:
@echo 'waste'
easter_egg:
@echo you expected to mis-understand this $${RANDOM} magic
@echo chongo '<was here>' "/\\oo/\\"
@echo Readers shall not be disallowed from being unable to partly misunderstand this final echo.
@${TRUE}
+291
View File
@@ -0,0 +1,291 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta name="GENERATOR" content="mkd2html 2.1.3 DL=DISCOUNT">
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=utf-8">
<link rel="stylesheet"
type="text/css"
href="../hint.css">
<title>Best non-chess game</title>
</head>
<body>
<h1>Best non-chess game</h1>
<p>Oscar Toledo G.<br>
Av. Sta. Cruz del Monte 9-304<br>
Cd. Satelite. Edo. de Mexico.<br>
CP. 53110. Mexico.<br>
<a href="&#x6d;&#x61;&#105;&#108;&#116;&#111;&#58;&#98;&#105;&#121;&#x75;&#98;&#105;&#64;&#x67;&#109;&#x61;&#105;&#108;&#46;&#99;&#111;&#x6d;">&#98;&#105;&#121;&#117;&#98;&#x69;&#64;&#103;&#109;&#x61;&#105;&#108;&#x2e;&#99;&#x6f;&#x6d;</a><br>
<a href="http://nanochess.110mb.com/">http://nanochess.110mb.com/</a></p>
<h2>Judges' comments:</h2>
<h3>To build:</h3>
<pre><code>make toledo
</code></pre>
<h3>To run:</h3>
<pre><code>./toledo
# NOTE: This requires X11 to run or modifications to use layer.c on
# Windows
</code></pre>
<h3>Try:</h3>
<pre><code>./toledo
</code></pre>
<h3>Selected Judges Remarks:</h3>
<p>This two player game uses X11. The control keys can be configured by
modifying the A,B,C and D macros at compilation.</p>
<p>After a quick splash screen the objective should be clear. There
are Red, Green and Cyan tanks. A larger window can be made by altering
the source early on, right before the code gets hard to follow.</p>
<p>Like Oscar&rsquo;s previous winning X11 program for the 19th IOCCC, if
you remove both the X11 include files and replace them with</p>
<pre><code>#include "layer.c"
</code></pre>
<p>you ought to be able to compile and run this program on Windows.</p>
<h2>Author&rsquo;s comments:</h2>
<pre><code> /=========\
\==\ /==/ ||
|| || /====\ |\/=\ || //==\ ==\ |=\
|| || || || || || // || =| | |
|| || //===| || || ||=// \\=\\ ==/ |=/
|| || || || || || || \\ || User's
\===/ \\==// || || || \\ \==// Manual
</code></pre>
<p>This is a color X11 3D tank-game for two players, just compile
and run it without arguments.</p>
<p>You will see briefly a tank spinning before each level.</p>
<p>Left half of the window shows the red player view and right
half shows the green player view, the background will change to
blue when the view goes inactive.</p>
<p>The objective is to chase and destroy the other player&rsquo;s tank,
there is also an aqua tank for testing your aim and getting
extra points.</p>
<blockquote><p>Caveat: You can shoot only 3 bullets at a time.
Trick: You can fire faster if they explode on anything.
Believe it or not, it has strategy!</p></blockquote>
<p>When only one tank remains on the field, the level will advance.
Don&rsquo;t forget to destroy the aqua tank.</p>
<p>The playground is surrounded by mountains and each level is
filled with random obstacles (pyramids and cubes).</p>
<p>The bars show players energy and score, each bar shows energy
and indicates current player view (wider on the left), right
part grows with every point.</p>
<p>Keys for player 1 (lowercase):</p>
<ul>
<li>Tab - Fire</li>
<li>w - Go ahead</li>
<li>s - Go backwards</li>
<li>a - Turn left</li>
<li>d - Turn right</li>
</ul>
<p>Keys for player 2:</p>
<ul>
<li>Backspace - Fire</li>
<li>Up arrow - Go ahead</li>
<li>Down arrow - Go backwards</li>
<li>Left arrow - Turn left</li>
<li>Right arrow - Turn right</li>
</ul>
<blockquote><p>Note: Numeric keys don&rsquo;t work.</p></blockquote>
<p>If you don&rsquo;t like the keys assignment, you can change it on the
the makefile.</p>
<h2>PARENTAL ADVISORY WARNING:</h2>
<p>This game is highly violent, when the tank explodes you can
see the little stick man blowing in parts.</p>
<p>Not really, just kidding :D</p>
<h2>PLATFORMS TESTED:</h2>
<ul>
<li>openSuSE 10.2 x86-32, X11R6 1024x768 32-bits color.</li>
<li>Fedora Core 8 x86-64, X11R6 1280x1024 32-bits color.</li>
<li>Fedora Core 11 x86-64, X11R6 1024x768 32-bits color.</li>
<li>Fedora Core 14 x86-64, X11R6 1024x768 32-bits color.</li>
</ul>
<h2>COMPLETE FEATURE SET:</h2>
<ul>
<li>Multiplayer out of the box.</li>
<li>Totally self-contained, no external files.</li>
<li>Fast-furious action at 29.97 frames per second.</li>
<li>Just as the movies, 16:9 aspect-ratio.</li>
<li>Beautiful mountains landscape plus horizon line :)</li>
<li>Tanks and bullets exploding as wires with weird physics.</li>
<li>Tanks backoff when firing.</li>
<li>There is an infinite number of levels.</li>
<li>Always different levels.</li>
<li>Animated intro.</li>
<li>It has color!.</li>
</ul>
<h2>FEATURES THAT PROGRAMMERS WILL FIND APPEALING:</h2>
<ul>
<li>Works both with x86-32 and x86-64 processors.</li>
<li>Double buffered, portable to any X11 with 24/32-bit color.</li>
<li>Memory-hungry as must be any 3-D program, uses a 256 MB
array.</li>
<li>Total and absolute irreverent coding style, so it generates
a lot of warnings when compiled.</li>
<li>It can take several minutes to compile (known culprits:
Fedora Core 11-14 on x86-64 512 MB)</li>
<li>It is written in the only true C: K&amp;R, and no, it not means
Katherine &amp; Rose.</li>
<li>Vectorial scalable graphics, do you want a bigger
playfield? change variables M &amp; N.</li>
<li>Half of the program is formatted as 3-D cube, view with
Tabs at 8 columns and a square font.</li>
<li>The other half of the program is unprintable source code,
so no typing from paper, you have to write a converter of
tabs and formfeeds to its C escaped forms.</li>
<li>No text, so this program can be used and understood easily
on any country.</li>
<li>This program is highly ecologic, it sleeps when it is not
doing anything.</li>
<li>Virtual world with its own physics laws.</li>
<li>When closing the window it will show an X11 error :P</li>
</ul>
<h2>OBFUSCATION TRICKS:</h2>
<ul>
<li>Loop code included inside loop test.</li>
<li>Function arguments used as variables.</li>
<li>Operators used freely.</li>
<li>Precalculated values to save bytes.</li>
<li><p>Uses the +++, +- and *+ undocumented C operators :P</p>
<pre><code> ....,,,,---++++++--,,..
.,,,....... .$@@@@@@@@@@@@$$@@@@@@@@@@@@@@#+
@@@@@###@@@@$$$@@@@$$$@@@-......-@+......,,,,,,##
=++==++++++++=@@$==#$$$$$---,,,,@@@,,,,,,-------@@,..........,,.
,===#$$$$$$###$####=======@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+=##$@@@@@@@@.
+@,,++++++++=+=========++++===++++++++++-+++@@-,,,,,,,,---+++=++++--,,... @.
.@. .......,,,,-----++=@=++==@$=+--,,... @.
$# S P O I L E R .,,-#@--,,,@$..... @.
.@ ..,--+==++-,,,,.,,,,=@+++++====+++++---,,,....@.
@+ ..,,-+++++++-,,.. @. ....,,,,,---+@@
,@ ..,--+++=+++,,.. $# .==+
@#--++==++-,,.. ,@ S P O I L E R .==+
,#@@$+,,. @. ==+
.,,+++++,,. S P O I L E R $= +=+
..,-==++-,. ,@ ---
.,-+=+++,.. @. .++-
.,,++=++-,. @+ ==+
.,-++==+-,. +@ ==+
..,+++=+-,.. .@. +=+
.,-+++++,@@==
</code></pre></li>
</ul>
<h1>THE HISTORY OF THIS PROGRAM:</h1>
<p>When I started working on this program, I figured that it would
be easy to fit on the character limit, but I missed three
things, the enormous X11 names, the unportable keycodes and my
2 KB of artwork.</p>
<p>Very hard coding did the first thing, in fact I worked out
twenty-nine different versions, at one step I had four
parallel versions with different characteristics removed
(mountains, horizon line, score/status bars and explosions),
I&rsquo;ve managed to fit it all together!.</p>
<p>The second thing was solved using the makefile, it is under
160 bytes and you get adjustable keyboard. The greatest
mistery on the earth is why X11 handles unportable keycodes to
the user.</p>
<p>And finally, the third &ldquo;Thing&rdquo; was growing and growing, and
growing, eating bytes for lunch&hellip; after endless rounds of
crunching I obtained three-hundred seventy-eight bytes of
artwork and guess what?, it doesn&rsquo;t fitted.</p>
<p>So I had to integrate a decompressor, based on the space,
tabulators and other non-counted characters.</p>
<p>The final program is composed of eight microfunctions, one is
the core and does most of the hard work, other functions help
doing the X11 things, explosion effects, 3-D calculations and
viewing.</p>
<ul>
<li>K() - 3-D transformation</li>
<li>s() - Rendering</li>
<li>b() - Line color selection</li>
<li>G() - Explosion animation</li>
<li>g() - Moves 3-D object backward and forward</li>
<li>F() - Collision detection</li>
<li>T() - Core (also known as main loop :D)</li>
<li>main() - Initialization and uncruncher, what a common name!,
C programs should start in the cool() function :).</li>
</ul>
<p>The source code was formatted as an cube using a specially
written program, the reality is that the program is smaller and
obfuscated of what is needed so the reformatting doesn&rsquo;t
exceeded the character limits, the crunched vectors were
generated by another special program and the tank that
surrounds this text was generated by yet another program.</p>
<p><em>Have fun!</em></p>
<hr />
<!--
(c) Copyright 1984-2012, [Leo Broukhis, Simon Cooper, Landon Curt Noll][judges] - All rights reserved
This work is licensed under a [Creative Commons Attribution-ShareAlike 3.0 Unported License][cc].
[judges]: http://www.ioccc.org/judges.html
[cc]: http://creativecommons.org/licenses/by-sa/3.0/
-->
<TABLE><TR>
<TD><a rel="license" href="http://creativecommons.org/licenses/by-sa/3.0/"><img alt="Creative Commons License" style="border-width:0" src="http://i.creativecommons.org/l/by-sa/3.0/88x31.png" /></a></TD>
<TD><P>&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>
+248
View File
@@ -0,0 +1,248 @@
# Best non-chess game
Oscar Toledo G.
Av. Sta. Cruz del Monte 9-304
Cd. Satelite. Edo. de Mexico.
CP. 53110. Mexico.
<biyubi@gmail.com>
<http://nanochess.110mb.com/>
## Judges' comments:
### To build:
make toledo
### To run:
./toledo
# NOTE: This requires X11 to run or modifications to use layer.c on
# Windows
### Try:
./toledo
### Selected Judges Remarks:
This two player game uses X11. The control keys can be configured by
modifying the A,B,C and D macros at compilation.
After a quick splash screen the objective should be clear. There
are Red, Green and Cyan tanks. A larger window can be made by altering
the source early on, right before the code gets hard to follow.
Like Oscar's previous winning X11 program for the 19th IOCCC, if
you remove both the X11 include files and replace them with
#include "layer.c"
you ought to be able to compile and run this program on Windows.
## Author's comments:
/=========\
\==\ /==/ ||
|| || /====\ |\/=\ || //==\ ==\ |=\
|| || || || || || // || =| | |
|| || //===| || || ||=// \\=\\ ==/ |=/
|| || || || || || || \\ || User's
\===/ \\==// || || || \\ \==// Manual
This is a color X11 3D tank-game for two players, just compile
and run it without arguments.
You will see briefly a tank spinning before each level.
Left half of the window shows the red player view and right
half shows the green player view, the background will change to
blue when the view goes inactive.
The objective is to chase and destroy the other player's tank,
there is also an aqua tank for testing your aim and getting
extra points.
> Caveat: You can shoot only 3 bullets at a time.
> Trick: You can fire faster if they explode on anything.
> Believe it or not, it has strategy!
When only one tank remains on the field, the level will advance.
Don't forget to destroy the aqua tank.
The playground is surrounded by mountains and each level is
filled with random obstacles (pyramids and cubes).
The bars show players energy and score, each bar shows energy
and indicates current player view (wider on the left), right
part grows with every point.
Keys for player 1 (lowercase):
* Tab - Fire
* w - Go ahead
* s - Go backwards
* a - Turn left
* d - Turn right
Keys for player 2:
* Backspace - Fire
* Up arrow - Go ahead
* Down arrow - Go backwards
* Left arrow - Turn left
* Right arrow - Turn right
> Note: Numeric keys don't work.
If you don't like the keys assignment, you can change it on the
the makefile.
PARENTAL ADVISORY WARNING:
--------------------------
This game is highly violent, when the tank explodes you can
see the little stick man blowing in parts.
Not really, just kidding :D
PLATFORMS TESTED:
-----------------
* openSuSE 10.2 x86-32, X11R6 1024x768 32-bits color.
* Fedora Core 8 x86-64, X11R6 1280x1024 32-bits color.
* Fedora Core 11 x86-64, X11R6 1024x768 32-bits color.
* Fedora Core 14 x86-64, X11R6 1024x768 32-bits color.
COMPLETE FEATURE SET:
---------------------
* Multiplayer out of the box.
* Totally self-contained, no external files.
* Fast-furious action at 29.97 frames per second.
* Just as the movies, 16:9 aspect-ratio.
* Beautiful mountains landscape plus horizon line :)
* Tanks and bullets exploding as wires with weird physics.
* Tanks backoff when firing.
* There is an infinite number of levels.
* Always different levels.
* Animated intro.
* It has color!.
FEATURES THAT PROGRAMMERS WILL FIND APPEALING:
----------------------------------------------
* Works both with x86-32 and x86-64 processors.
* Double buffered, portable to any X11 with 24/32-bit color.
* Memory-hungry as must be any 3-D program, uses a 256 MB
array.
* Total and absolute irreverent coding style, so it generates
a lot of warnings when compiled.
* It can take several minutes to compile (known culprits:
Fedora Core 11-14 on x86-64 512 MB)
* It is written in the only true C: K&R, and no, it not means
Katherine & Rose.
* Vectorial scalable graphics, do you want a bigger
playfield? change variables M & N.
* Half of the program is formatted as 3-D cube, view with
Tabs at 8 columns and a square font.
* The other half of the program is unprintable source code,
so no typing from paper, you have to write a converter of
tabs and formfeeds to its C escaped forms.
* No text, so this program can be used and understood easily
on any country.
* This program is highly ecologic, it sleeps when it is not
doing anything.
* Virtual world with its own physics laws.
* When closing the window it will show an X11 error :P
OBFUSCATION TRICKS:
-------------------
* Loop code included inside loop test.
* Function arguments used as variables.
* Operators used freely.
* Precalculated values to save bytes.
* Uses the +++, +- and *+ undocumented C operators :P
....,,,,---++++++--,,..
.,,,....... .$@@@@@@@@@@@@$$@@@@@@@@@@@@@@#+
@@@@@###@@@@$$$@@@@$$$@@@-......-@+......,,,,,,##
=++==++++++++=@@$==#$$$$$---,,,,@@@,,,,,,-------@@,..........,,.
,===#$$$$$$###$####=======@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+=##$@@@@@@@@.
+@,,++++++++=+=========++++===++++++++++-+++@@-,,,,,,,,---+++=++++--,,... @.
.@. .......,,,,-----++=@=++==@$=+--,,... @.
$# S P O I L E R .,,-#@--,,,@$..... @.
.@ ..,--+==++-,,,,.,,,,=@+++++====+++++---,,,....@.
@+ ..,,-+++++++-,,.. @. ....,,,,,---+@@
,@ ..,--+++=+++,,.. $# .==+
@#--++==++-,,.. ,@ S P O I L E R .==+
,#@@$+,,. @. ==+
.,,+++++,,. S P O I L E R $= +=+
..,-==++-,. ,@ ---
.,-+=+++,.. @. .++-
.,,++=++-,. @+ ==+
.,-++==+-,. +@ ==+
..,+++=+-,.. .@. +=+
.,-+++++,@@==
THE HISTORY OF THIS PROGRAM:
============================
When I started working on this program, I figured that it would
be easy to fit on the character limit, but I missed three
things, the enormous X11 names, the unportable keycodes and my
2 KB of artwork.
Very hard coding did the first thing, in fact I worked out
twenty-nine different versions, at one step I had four
parallel versions with different characteristics removed
(mountains, horizon line, score/status bars and explosions),
I've managed to fit it all together!.
The second thing was solved using the makefile, it is under
160 bytes and you get adjustable keyboard. The greatest
mistery on the earth is why X11 handles unportable keycodes to
the user.
And finally, the third "Thing" was growing and growing, and
growing, eating bytes for lunch... after endless rounds of
crunching I obtained three-hundred seventy-eight bytes of
artwork and guess what?, it doesn't fitted.
So I had to integrate a decompressor, based on the space,
tabulators and other non-counted characters.
The final program is composed of eight microfunctions, one is
the core and does most of the hard work, other functions help
doing the X11 things, explosion effects, 3-D calculations and
viewing.
* K() - 3-D transformation
* s() - Rendering
* b() - Line color selection
* G() - Explosion animation
* g() - Moves 3-D object backward and forward
* F() - Collision detection
* T() - Core (also known as main loop :D)
* main() - Initialization and uncruncher, what a common name!,
C programs should start in the cool() function :).
The source code was formatted as an cube using a specially
written program, the reality is that the program is smaller and
obfuscated of what is needed so the reformatting doesn't
exceeded the character limits, the crunched vectors were
generated by another special program and the tank that
surrounds this text was generated by yet another program.
*Have fun!*
--------------------------------------------------------------------------------
<!--
(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/
-->
+130
View File
@@ -0,0 +1,130 @@
/*
** Translation layer to make my 3D Tanks game (20th IOCCC, best non-chess game)
** to work in Windows
**
** by Oscar Toledo G.
** http://nanochess.110mb.com/
**
** From the original game replace:
** #include <X11/Xlib.h>
** #include <X11/keysym.h>
**
** with this:
** #include "layer.c"
**
** Only tested with Dev-C++ 4.9.9.2
**
** Creation: Feb/10/2012.
*/
#include <windows.h> /* Windows headers */
extern int L[]; /* Keyboard table from game */
/*
** Original makefile translated
** Choose your keys if you like
*/
#define A VK_UP:0x57
#define B VK_LEFT:0x41
#define C VK_RIGHT:0x44
#define D VK_DOWN:0x53
#define E VK_BACK:VK_TAB
#define Q XFillRectangle(W,X,Y,
/*
** Some X11 definitions translated
*/
#define main ma
#define Display int
#define GC HDC
#define Pixmap HBITMAP
#define Window HWND
typedef struct{ int foreground; int line_width; } XGCValues;
typedef struct{ int type,X; } XEvent;
/* XNextEvent, read Windows messages */
#define XNextEvent(a,b)(GetMessage(&mm,0,0,0),TranslateMessage(&mm),\
DispatchMessage(&mm),*b=oo,oo.type=0)
/* XOpenDisplay, not needed */
#define XOpenDisplay(a)NULL
/* XSelectInput, only needs to process second argument */
#define XSelectInput(a,b,c)b
/* XCreateSimpleWindow */
#define XCreateSimpleWindow(a,b,c,d,e,f,g,h,i)CreateWindowEx(0,"a","3D Tanks",\
0xcf0000,c,d,e+8,f+32,0,0,aa,0)
/* XMapWindow, activate window and get DC to draw */
#define XMapWindow(a,b)(ShowWindow(b,dd),h1=GetDC(b),h3=CreateCompatibleDC(h1))
/* XPending, check for pending windows messages */
#define XPending(a)PeekMessage(&mm,O,0,0,PM_NOREMOVE)
/* XFlush, not needed */
#define XFlush(a)
/* XLookupKeysym, argument processing and returns key index */
#define XLookupKeysym(a,b)(b,(a)->X)
/* DefaultDepth, not needed */
#define DefaultDepth(a,b)0
/* XCreatePixmap, creates a double-buffer bitmap */
#define XCreatePixmap(a,b,c,d,e)CreateCompatibleBitmap(h1,c,d)
/* XCreateGC, instead selects bitmap for drawing */
#define XCreateGC(a,b,c,d)(SelectObject(h3,b),h3)
/* XChangeGC, selection of color and line width, all this is required */
#define XChangeGC(a,b,c,d)(rr!=INVALID_HANDLE_VALUE?DeleteObject(rr):0,\
(d)->foreground=((d)->foreground&0xff0000)>>16|((d)->foreground&0xff)<<16|\
(d)->foreground&0xff00,\
rr=CreateSolidBrush((d)->foreground),\
e2=CreatePen(PS_SOLID,(d)->line_width,(d)->foreground),\
SelectObject(b,e2),\
e1!=INVALID_HANDLE_VALUE?DeleteObject(e1):0,e1=e2)
/* XCopyArea, copies double buffer into main for non-flickering display */
#define XCopyArea(a,b,c,d,e,f,g,h,i,j)BitBlt(h1,i,j,g,h,h3,0,0,SRCCOPY)
/* Some windows variables required */
HBITMAP bb;
HBRUSH rr = INVALID_HANDLE_VALUE;
HPEN e1 = INVALID_HANDLE_VALUE, e2;
PAINTSTRUCT pp;
HDC h1, h2, h3;
XEvent oo;
HINSTANCE aa;
int dd;
MSG mm;
/* Main message processing */
LRESULT CALLBACK WP(HWND h,UINT m,WPARAM w,LPARAM l)
{
if (m==WM_KEYDOWN&&L[w]==0)oo.type=2,oo.X=w;
else if (m==WM_KEYUP&&L[w]==1)oo.type=3,oo.X=w;
else if (m==WM_PAINT)BeginPaint(h,&pp),EndPaint(h,&pp);
else if (m==15)oo.type=12;
else if (m==2)exit(1);/*PostQuitMessage(0);*/
else return DefWindowProc(h, m, w, l);
return 0;
}
/* Main function */
int WINAPI WinMain(HINSTANCE a,HINSTANCE b,LPSTR c,int d)
{
static WNDCLASSEX w;
return aa=a,w.hInstance=a,w.lpszClassName="a",
w.lpfnWndProc=WP,w.cbSize=sizeof(WNDCLASSEX),dd=d,
w.hIcon=LoadIcon(0,IDI_APPLICATION),
w.hIconSm=LoadIcon(0,IDI_APPLICATION),
w.hCursor=LoadCursor(0,IDC_ARROW),
w.hbrBackground=GetStockObject(BLACK_BRUSH),
RegisterClassEx(&w),
main();
}
/* XFillRectangle, note that X uses size and Windows uses coordinates */
void XFillRectangle(int *a, HBITMAP b, HDC c, int d, int e, int f, int g)
{
RECT rect;
rect.left = d;
rect.top = e;
rect.right = f + d;
rect.bottom = g + e;
FillRect(c, &rect, rr);
}
/* XDrawLine */
void XDrawLine(int *a, HBITMAP b, HDC c, int d, int e, int f, int g)
{
MoveToEx(c, d, e, NULL);
LineTo(c, f, g);
}
+64
View File
@@ -0,0 +1,64 @@
#include <X11/Xlib.h>
#include <X11/keysym.h>
#define I XDrawLine(W,X,Y,
#define l rand()%
#define R while(
#define n *h++
#define x _ c].
#define S if(
#define _ _[
*h ;
M=512; i; N=
288; e; d; u; p; L[1
<<28]; float w=11.46; m; a ;
P; k[9304]; *j=k; c; f; q; r; t; v ;
* z; K(N,i) { t=u*+cos(N/w)-i*sin(N/w); p=i*
cos(N/w)+u*sin(N/w); u=t; } Display*W; GC Y; Pixmap
X; s(o,t,g,w,v) { h=v+k; q=2*n; R u=n, r=12+n, K(t,n), K(o,+
p+w,u+=g), d=1>p?1:p, u=u*N/d+M/2, d=N/2+r*N/d, u=u>
-M*2 ?u<M*2?u:2*M:-2*M, 1&q?i>0|p>0?I f,e,u,d):0: (i=p
,e=d,f=u ), --q); } struct{ int c,o,m,f,u,s,i ,e,r; }
_ 21 ] ; Window O; b(y) { XGCValues g ; g .
foreground=y; g. line_width = 2 ; XChangeGC(W,Y,20
,&g); } G(o) { z=x f + k; h=(x f= 381+193*c)+k; i=2*(n
=*z++); R--i&1?d=l 9-4,e =l 9 -4*(8>o):0,n=*z+++d,0<(n
=*z+++e)?h[-1]=0:0,n=*z+++d, i); } g(o) { u=0; K(x s,o<<9
); x u-=u; x r-=p; } F(m,c ) { f=5120*c; c=12; R +c--&&m
==+c |abs(x u-_ m].u)>f |x i <1|x c>2 |abs(x r-_ m].r)>f)
; return c+1; } T(o) { c=11; S!P){ a=++a%72; S!a){ P=1; R
c--){ x c=x m=0; x i=c>2?2:1 ; R x u=l 978-499<<8, x s= l
71, x r=l 979-501<<8, F(c,2) ); x f=c>2?l +2*+73:147; x o
=2>c?249<<16-c*8:64987<<8*(c >2); } } } S P){ c=11; R 4&x
i? ++x m-64&&x m-71? o=1,64> x m?(d=F(c,1))?x m=64,d<4?j[
x e]++,++_ --d].c:0:g(7):G(x m -65) :_ x i=0,x e].e-- :0,
20>++c); c=3; R c--) { S 1&x i) { o++; S x c>2) x m>15? x
i=0:G(x m++); else { S x m ) S x m-->6) g(4); S c<2) { x
s=(72+x s+L[c?B]-L[c?C])%72; S d=4*L[c?A]-L[c?D]*4) { g(d
); S F(c,2)) g(-d); } S L[c? E]&!x m&x e<3) { d=10; R _++
d].i) ; g(-4); _ d]=_ c]; _ d].e=c; x e++; x m=7; c=d; x
f = 122 ; x i=4; g(19); x o= 4092<<12; c=x e; } } } } } P
-=o<2; } v=2; R v--){ m=(108 - _ v].s)%72; b(3^_ v].c?0:
128); Q c=0,0,M,N); S!P) s(+ 36,54-a,0,-120,-+-+-+-+147,b
((1<<16)-1)); S P) { b(255); I 0,N/2,M,N/2); t=-.889*m; h
=k+340; R u=(t+=q=n)*M/32,d= n*N/48,q?I f,e,u,d):0,f=u,e=
+d,k+378>h); R x i&&c-v?s(m, x s,x u-_ v].u>>8,x r-_ v].r
>>8,x f,b(x o)):0,20>c++); c =0; R e=16+32*c,Q v^c?16:8,e
,(c^v?68:76)+c[b(x o),j] , 16), b(0,d=20*x c), Q
80-d,4+e,d,8),2>c++) ; } b(255); I M,0,M,
N); XCopyArea(W, X,O,Y,0,0,M,N,v*
M,0); } }
char*o="{ } { } { { } ; { } ; { ; { ; { ; { } ; { } ; { ; { ; } ; { ; { } } ; { ; } { } ; { ; { } ; { ; } { } { { } ; { } ; { ; { ; } { } { } } { } { } { } } { } } { } { } { } } { } { } { ; ; ; ; } { ; } { { } ; } } ; { ; } { ; } { { } ; { } ; { ; { ; } } { ; } { { } } } { ; } { ; { } ; } } } { } { } ; } } } } } { } ; } ; } ; { } { } ; { } ; } ; } } { } { } } { } { } } } } { { } } } } } { { } } { ; { { } ; { ; { { ; { ; { { } ; { ; { { ; ; } ; ; } ; ; } } { { } { { } { { { { } } } } } { { { { } { } { { } { { } { { { { } } ";
main(){
XEvent e; W=
XOpenDisplay(k);
XSelectInput(W,O=
XCreateSimpleWindow(W,DefaultRootWindow(W),64,64,M*2,N,2,P,r),3);
XMapWindow(W,O); srand(time(0)); Y=
XCreateGC(W,X=
XCreatePixmap(W,O,M,N,DefaultDepth(W,r)),P,r); R*o){ S*o^59)d=64&*o?'{'^*o++:3,
32^*o?d+=*o^9?2:1:0,*j+=P?d*9-43:d,j+=P,P=!P; else R*j=j[-3],j++,*++o^9); o++;
} R 7){ T(0);
XFlush(W); usleep(33367); R
XPending(W)) L[
XLookupKeysym(&e,
XNextEvent(W,&e)&0)]^=1==e.type/2; } }
+118
View File
@@ -0,0 +1,118 @@
#!/usr/bin/env make
#
# 2011 makefile
#
# Copyright (C) 2011, Landon Curt Noll, Simon Cooper, and Leonid A. Broukhis.
#
# Creative Commons Attribution-ShareAlike 3.0 Unported License.
# See: http://creativecommons.org/licenses/by-sa/3.0/
################
# tool locations
################
#
SHELL= /bin/bash
CP= cp
CPP= cpp
GUNZIP= gunzip
LD= ld
MAKE= make
RM= rm
SED= sed
TAR= tar
TRUE= true
# optimization
#
# Most compiles will safely use -O2. Some can use only -O1 or -O.
# A few compilers have broken optimizers or this entry make break
# under those buggy optimizers and thus you may not want anything.
#
OPT= -O2
# bitness
#
# Some entries require 32-bitness,
# other entries require 64-bitess.
# By default we assume nothing.
#
ARCH=
# default flags for ANSI C compilation
#
CFLAGS= -Wall -W -ansi ${ARCH} ${OPT}
# ANSI compiler
#
# Set CC to the name of your ANSI compiler.
#
CC= cc
##############################
# Special flags for this entry
##############################
#
ENTRY= vik
DATA= imaginal_state.mod mad_world.mod
#################
# build the entry
#################
#
all: ${ENTRY} ${DATA}
@${TRUE}
${ENTRY}: ${ENTRY}.c
@echo This next compile may take a while ...
${CC} ${CFLAGS} ${ENTRY}.c -o ${ENTRY}
# alternative executable
#
alt:
@${TRUE}
###############
# utility rules
###############
#
everything: all alt
clean:
${RM} -f ${ENTRY}.o
clobber: clean
${RM} -f ${ENTRY}
nuke: clobber
@echo gnab gib!
install:
@echo "Surely you're joking Mr. Feynman!"
# backwards compatibility
#
build: all
##################
# 133t hacker rulz
##################
#
love:
@echo 'not war?'
haste:
$(MAKE) waste
waste:
@echo 'waste'
easter_egg:
@echo you expected to mis-understand this $${RANDOM} magic
@echo chongo '<was here>' "/\\oo/\\"
@echo Readers shall not be disallowed from being unable to partly misunderstand this final echo.
@${TRUE}
+195
View File
@@ -0,0 +1,195 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta name="GENERATOR" content="mkd2html 2.1.3 DL=DISCOUNT">
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=utf-8">
<link rel="stylesheet"
type="text/css"
href="../hint.css">
<title>Most sound</title>
</head>
<body>
<h1>Most sound</h1>
<p>Daniel Vik<br>
802 Durshire Way<br>
Sunnyvale, Ca 94087<br>
<a href="&#x6d;&#x61;&#105;&#108;&#116;&#111;&#58;&#100;&#97;&#110;&#x69;&#101;&#108;&#64;&#x76;&#105;&#x6b;&#46;&#99;&#99;">&#100;&#97;&#x6e;&#105;&#101;&#108;&#64;&#118;&#x69;&#107;&#46;&#99;&#x63;</a><br>
<a href="http://www.danielvik.com">http://www.danielvik.com</a></p>
<h2>Judges' comments:</h2>
<h3>To build:</h3>
<pre><code>make vik
</code></pre>
<h3>To run:</h3>
<pre><code>./vik file.mod &gt; audio_file.raw
</code></pre>
<h3>Try:</h3>
<pre><code>./vik randowan.mod | mplayer -demuxer rawaudio -
./vik mad_world.mod | mplayer -demuxer rawaudio -
</code></pre>
<p>Alternatively, you can use</p>
<pre><code>./vik file.mod &gt; file.raw; ./raw2wav file.raw &gt; file.wav
</code></pre>
<p>It is possible to download a number of Mod files from <a href="http://modarchive.org">The Mod Archive</a>.</p>
<p>The randowan.mod and mad_world.mod files were created by
<a href="http://www.translucentboy.com">Henrik Bertilsson</a> and
are included with his permission.</p>
<h3>Selected Judges Remarks:</h3>
<p>This entry converts .MOD audio files to a playable stream
in a most pleasing manner if you don&rsquo;t like tremolo or vibrato.</p>
<p>Also it abuses the C compiler and/or assembler with a partially
initialized 32 MByte array. Can you tell what is that partial
initilzation for?</p>
<p>Does it take your system a long time to compile? You may want to do try:</p>
<pre><code> cc -S vik.c
</code></pre>
<p>and to examine the resulting assembly file vik.s. On some platforms
the assembly file is about 128 MBytes in size!</p>
<h2>Author&rsquo;s comments:</h2>
<h1>Introduction</h1>
<p>In 1987, Karsten Obarski changed the way music was handled in games and
demos with the introducton of the MOD file format on Commodore Amiga.</p>
<p>A MOD file contains a set of samples, a number of patterns indicating
how and when the samples are to be played, a list of what patterns to
play in what order, and a number of effects.</p>
<h1>Features</h1>
<p>This program converts MOD files created with the standard trackers for
Amiga, e.g. Pro Tracker, Noise Tracker and Sound Tracker to raw 16 bit
44.1kHz stereo audio. The program supports MOD music with 4, 6, and 8
channels MOD files with up to 31 samples.</p>
<p>The MOD format includes many effects for each audio channel and this
program supports most of them, including:</p>
<ul>
<li>Arpeggio</li>
<li>Slide and fine slide up/down/to note</li>
<li>Set sample offset</li>
<li>Volume slide</li>
<li>Pattern break</li>
<li>Filter on/off</li>
<li>Set volume</li>
<li>Cut sample</li>
<li>Delay sample</li>
<li>Delay pattern</li>
<li>Set speed</li>
</ul>
<p>Due to size constraints tremolo and vibrato is not supported. Also, to
avoid infinite long songs, the position jump feature is ignored.</p>
<h1>Songs</h1>
<p>With his permission, the package incldues two songs composed by Henrik
Bertilsson, also known as Deelite:</p>
<ol>
<li> Mad World</li>
<li> Randowan</li>
</ol>
<h1>Build</h1>
<p>Compiling for *nix systems (including cygwin) is straight forward:</p>
<pre><code>$ gcc -o vik vik.c
</code></pre>
<h1>Usage</h1>
<h3>Convert MOD file to raw 44.1kHz stereo audio file</h3>
<pre><code>$ ./vik mad_world.mod &gt; audio_file.raw
</code></pre>
<h3>Listen to the MOD file (streaming to mplayer)</h3>
<pre><code>$ ./vik randowan.mod | mplayer -demuxer rawaudio -
</code></pre>
<p>(Don&rsquo;t forget the last &lsquo;-&rsquo; as it makes mplayer read from stdin.)</p>
<h1>Obfuscation</h1>
<p>The IOCCC rules did not put a limit on the entropy of the source code,
and it appears that the general entropy rules doesn&rsquo;t apply. An estimate
is that the code density entropy of this entry is ~1.2 which means that
there are around 2500 characters of code carrying information, yet there
are only 2037 IOCCC characters of actual code. Most of the additional
characters are encoded with non-counting characters in the frequency
table. But there are also ~50 or so white space characters spread out
through the source code that carry information.</p>
<p>The use of macros certainly adds to the obfuscation but the reason for
using them is mainly to fit as many features as possible within the size
limits. So please excuse the use of them.</p>
<p>Once the preprocessor is run, the code gets more interesting. The MOD
player is basically a register based state machine and all the magic is
hidden in a fog of short statements. Many of the register updates are
conditional and the program uses the ? operator (sigh) mainly to save
space, but also to leverage the comma operator and precedence more
efficiently.</p>
<h1>Portability</h1>
<p>The progam is portable to most platforms. The only system dependency is
that the program relies on writing binary data to stdout.</p>
<p>Microsoft compilers adds a carriges return to newlines, and to compile
the program with this platform, the following line can be added after
the main declaration in order for the program to run correctly:</p>
<pre><code>_setmode(_fileno(stdout), 0x8000);
</code></pre>
<h1>Limitations</h1>
<p>The program only runs when a valid MOD file is passed as argument. If
no argument is passed, the program crashes.</p>
<hr />
<!--
(c) Copyright 1984-2012, [Leo Broukhis, Simon Cooper, Landon Curt Noll][judges] - All rights reserved
This work is licensed under a [Creative Commons Attribution-ShareAlike 3.0 Unported License][cc].
[judges]: http://www.ioccc.org/judges.html
[cc]: http://creativecommons.org/licenses/by-sa/3.0/
-->
<TABLE><TR>
<TD><a rel="license" href="http://creativecommons.org/licenses/by-sa/3.0/"><img alt="Creative Commons License" style="border-width:0" src="http://i.creativecommons.org/l/by-sa/3.0/88x31.png" /></a></TD>
<TD><P>&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>
+171
View File
@@ -0,0 +1,171 @@
# Most sound
Daniel Vik
802 Durshire Way
Sunnyvale, Ca 94087
<daniel@vik.cc>
<http://www.danielvik.com>
## Judges' comments:
### To build:
make vik
### To run:
./vik file.mod > audio_file.raw
### Try:
./vik randowan.mod | mplayer -demuxer rawaudio -
./vik mad_world.mod | mplayer -demuxer rawaudio -
Alternatively, you can use
./vik file.mod > file.raw; ./raw2wav file.raw > file.wav
It is possible to download a number of Mod files from [The Mod Archive](http://modarchive.org).
The randowan.mod and mad_world.mod files were created by
[Henrik Bertilsson](http://www.translucentboy.com) and
are included with his permission.
### Selected Judges Remarks:
This entry converts .MOD audio files to a playable stream
in a most pleasing manner if you don't like tremolo or vibrato.
Also it abuses the C compiler and/or assembler with a partially
initialized 32 MByte array. Can you tell what is that partial
initilzation for?
Does it take your system a long time to compile? You may want to do try:
cc -S vik.c
and to examine the resulting assembly file vik.s. On some platforms
the assembly file is about 128 MBytes in size!
## Author's comments:
Introduction
============
In 1987, Karsten Obarski changed the way music was handled in games and
demos with the introducton of the MOD file format on Commodore Amiga.
A MOD file contains a set of samples, a number of patterns indicating
how and when the samples are to be played, a list of what patterns to
play in what order, and a number of effects.
Features
========
This program converts MOD files created with the standard trackers for
Amiga, e.g. Pro Tracker, Noise Tracker and Sound Tracker to raw 16 bit
44.1kHz stereo audio. The program supports MOD music with 4, 6, and 8
channels MOD files with up to 31 samples.
The MOD format includes many effects for each audio channel and this
program supports most of them, including:
* Arpeggio
* Slide and fine slide up/down/to note
* Set sample offset
* Volume slide
* Pattern break
* Filter on/off
* Set volume
* Cut sample
* Delay sample
* Delay pattern
* Set speed
Due to size constraints tremolo and vibrato is not supported. Also, to
avoid infinite long songs, the position jump feature is ignored.
Songs
=====
With his permission, the package incldues two songs composed by Henrik
Bertilsson, also known as Deelite:
1. Mad World
2. Randowan
Build
=====
Compiling for *nix systems (including cygwin) is straight forward:
$ gcc -o vik vik.c
Usage
=====
### Convert MOD file to raw 44.1kHz stereo audio file
$ ./vik mad_world.mod > audio_file.raw
### Listen to the MOD file (streaming to mplayer)
$ ./vik randowan.mod | mplayer -demuxer rawaudio -
(Don't forget the last '-' as it makes mplayer read from stdin.)
Obfuscation
===========
The IOCCC rules did not put a limit on the entropy of the source code,
and it appears that the general entropy rules doesn't apply. An estimate
is that the code density entropy of this entry is ~1.2 which means that
there are around 2500 characters of code carrying information, yet there
are only 2037 IOCCC characters of actual code. Most of the additional
characters are encoded with non-counting characters in the frequency
table. But there are also ~50 or so white space characters spread out
through the source code that carry information.
The use of macros certainly adds to the obfuscation but the reason for
using them is mainly to fit as many features as possible within the size
limits. So please excuse the use of them.
Once the preprocessor is run, the code gets more interesting. The MOD
player is basically a register based state machine and all the magic is
hidden in a fog of short statements. Many of the register updates are
conditional and the program uses the ? operator (sigh) mainly to save
space, but also to leverage the comma operator and precedence more
efficiently.
Portability
===========
The progam is portable to most platforms. The only system dependency is
that the program relies on writing binary data to stdout.
Microsoft compilers adds a carriges return to newlines, and to compile
the program with this platform, the following line can be added after
the main declaration in order for the program to run correctly:
_setmode(_fileno(stdout), 0x8000);
Limitations
===========
The program only runs when a valid MOD file is passed as argument. If
no argument is passed, the program crashes.
--------------------------------------------------------------------------------
<!--
(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/
-->
Binary file not shown.
Binary file not shown.
+28
View File
@@ -0,0 +1,28 @@
#!/usr/bin/perl
#
# This work by Simon Cooper is licensed under a Creative Commons
# Attribution-ShareAlike 3.0 Unported License.
#
# Info from: https://ccrma.stanford.edu/courses/422/projects/WaveFormat/
my $file = shift @ARGV;
my $size = -s $file;
my $rate = 44100;
my $samp = 16;
my $chan = 2;
print "RIFF".
pack("V", $size-8). # File size -8
"WAVE". # "Format"
"fmt ". # Subchunk1ID
pack("V", 16). # Subchunk1Size
pack("v", 1). # PCM
pack("v", $chan). # NumChannels
pack("V", $rate). # SampleRate
pack("V", ($rate>>3)*$chan*$samp). # ByteRate
pack("v", $chan*$samp>>3). # BlockAlign
pack("v", $samp). # BitsPerSample
"data". # Subchunk2ID
pack("V",$size-44); # SubchunkSize
system "cat", $file;
+90
View File
@@ -0,0 +1,90 @@
#include <stdio.h>
char E[1<<25]=" ; } } { { } { { ; ; { } } { { ; { { { { { } ; } { { ; { { { ; { } ; ; ; { ; ; ; } } ; } { { ; } } ; } } ; ; } { ; } } { } } } } } ; { { } } } ; } } } { } ; ; ; { } ; { { { ; { ; } } { { { } { { ; ; { { } } { { ; { { { { { } ; } { { ; { { { ; { } ; ; ; ; ; } } ; } { { ; } } ; } ; ; } { ; } } } } } } } ; { { } ; ; } ; { } ; ; ; { } ; { { ; { ; } } { { { } { ; ; { { } } { { { { { { { { ; { ; { { ; { { ; ; { } ; ",
*a[40],*q=E+20,*T=E+1080;
int i=1,j,k,l,u,w,I,J,K,h,H,G,R=4,U,e[999],*p=e+5,*r,*s,*v,b[999],L[1<<16],
F=882,n[99];
FILE*f;
#define Y(a,b) (a)<(b)?(a):(b)
#define Z(a,b) (a)>(b)?(a):(b)
#define X(x,a,b)Z(a,Y(b,x))
#define O [s]
#define N [v]
#define M [r]
#define C ++
#define m :0
#define g m,
#define d u==
#define z(o) 32 O?n[X(32 O+o+(35 O-24)/256,0,59)]m
#define y(o) 32 O?8 O=z(o)m
#define x (p=e+5*34 O,2 M-3 && 2 M-5?y(0),l=p[4],a[i]=a[8+34 O],3 N=l>1?\
2*(p[3]+l):2*p[0],4 N=l>1?2*l:1,0 N=Y(2 M-9?0:9 O<<8,3 N-1) m)
#define W(t,i) (u=t[i]>>4,w=t[i]&15),
#define Q(e) ((1 N+=13200)>=5 N?1 N-=5 N, C 0 N>=3 N?0 N-=4 N m g e*6 N*q[0\
N]/34)+
#define D(b,i) T[i]==*#b&&T[i+2]==#b[1]
#define A ((unsigned char*)q)
#define V *p C=
#define S(a) V(A[a]<<8)|A[a+1],
#define P 2 M==
#define B ,putchar
#define o for(
int main(int t,char**c)
{
o; w=E[u]; C u)n[u/10]+=(w-59?w-125?w-32?1 m:2:3)<<u%10;
o t=fread(E,i,1<<24,f=fopen(c[i],"rb")),
t=D(FT,0)?R=T[3]-48,32:D(CN,1)?R=*T-48,32:D(MK,0)?32:16;
i C<t;
S(0)V(A[2]&7)-2*(A[2]&8),V A[3],S(4)S(6)q+=8) q+=22;
o H=*A,T=q+=2,q+=t>15?132:128;
k<128;
k C) G=X(G,T[k]+1,128);
o p=L; j C<R*64*G; q+=4)
o W(A,2)V*A&240|u,V i=0,V w,V A[3],k=((*A&15)<<8)|A[1],l=9<<19;
k&&i C<60;
u=k-n[i],u*u<l?p[-3]=i,l=u*u:l);
o i=1; i<t; a[8+i]=q,q+=2*e[5*i C]);
o t=6; !U; ) {
o i=0; i<R;
v=b+7*i,r=L+4*(R*(64*T[K]+J)+i),s=e+200+50*i,j=3 M&15,
I?
W(s,2 M)P 5||P 6||P 10?0 O =u?Y(0 O+u,64):Z(0 O-w,0) g
P 0?W(r,3)(u|w)?y((I%3-1?I%3-2?0:w:u)) m g
8 O=P 1?Z(113,8 O-1 O):P 2?Y(856,8 O+2 O):8 O,
P 5||P 3?l=z(0),8 O>l?8 O=Z(8 O-3 O,l):8 O<l?Y(8 O+3 O,l) m g
U|=P 11&&I==t-1,
P 13&&I==t-1?W(r,3)K C,J=10*u+w-1 g
P 14?
W(r,3)
d 6?j?I==t-1?38 O=38 O<j?J=37 O-1,38 O+1 m m:(37 O=J) g
d 9&&C 39 O==25 O?39 O=0,x g
d 12&&I==28 O?0 O=0 g
d 13&&I==e[29]?x m
m
:(
0 M?34 O=0 M,p=e+5*34 O,35 O=p[1],0 O=p[2] g
3 M?2 M O=3 M g
1 M&&(2 M-14||((3 M>>4)-13))?32 O=1 M,x g
0 O=P 12?X(3 M,0,64) m O ,
P 15?(l=3 M)?l<33?t=l:(F=110250/l) m g
P 14?
W(r,3)
j?(16+u) O=j g
8 O=d 1?Z(113,8 O-17 O):d 2?Y(856,8 O+18 O):8 O,
d 5?35 O=(j&7)-2*(j&8) g
d 9?39 O=25 O&&!1 M?x,0 m g
0 O=d 10?Y(0 O+26 O,64):d 11?Z(0 O-27 O,0):0 O,
d 14?h=30 O m m),
6 N =X(0 O,0,64),
5 N =999*8 O,
i C);
o C I>=t+t*h?I=h=0,C J>=64?J=0,U|=C K>=H m g j=F; j--; 0
B(u)B(u>>8)B(w)B(w>>8))
o i=u=w=0; i<R;
v=b+7*i,q=a[i C],q?l=Q(1)Q(4)Q(12)Q(12)Q(4)Q(1)0,
k=1<<(i&2),u+=l/k,w+=l/(k^5) m);
}
return 0;
}
+144
View File
@@ -0,0 +1,144 @@
<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
<HTML>
<HEAD>
<META name="description" content="International Obfuscated C Code Contest">
<META name="keywords" content="International, Obfuscated, C, c, IOCCC,ioccc, obfuscated, Obfuscate, obfuscate, Landon Curt Noll, chongo, Leonid A. Broukhis, leob, Simon Cooper, sc">
<link rel="stylesheet"
type="text/css"
href="hint.css" />
<TITLE>Who won the 20th IOCCC</TITLE>
</HEAD>
<BODY TEXT="#000000">
<CENTER><IMG SRC="/png/ioccc.png" ALT="IOCCC" height=78 width=267>
<P><i><FONT size=+3>The International Obfuscated C Code Contest</FONT></i>
<P><B><FONT size=+4>The 20th IOCCC Winners</FONT></B>
<P><FONT size=+1>
[ <A HREF="/judges.html">The judges</A> |
<A HREF="/index.html">IOCCC home page</A> |
<A HREF="/faq.html">FAQ</A> |
<A HREF="/winners.html">People who have won</A> |
<A HREF="/years.html">Winning entries</A> ]
</FONT>
</CENTER>
<P>
<HR SIZE="1" WIDTH="90%">
<P>Here are the names and categories for the winners of the 20th IOCCC:
</P>
<UL>
<LI>
<A HREF="blakely/hint.html"><B>Most devolving</B></A>
<BLOCKQUOTE>Philip Blakely - Life/reverse life<BR>
UK</BLOCKQUOTE>
<LI>
<A HREF="borsanyi/hint.html"><B>Best data utility</B></A>
<BLOCKQUOTE>Szabolcs Borsanyi - Bar graph plotter<BR>
Germany</BLOCKQUOTE>
<LI>
<A HREF="dlowe/hint.html"><B>Most self deprecating</B></A>
<BLOCKQUOTE>David Lowe - Neural network classifier<BR>
USA</BLOCKQUOTE>
<LI>
<A HREF="eastman/hint.html"><B>Best ball</B></A>
<BLOCKQUOTE>Peter Eastman - Bouncing Ball in ANSI Graphics<BR>
USA</BLOCKQUOTE>
<LI>
<A HREF="fredriksson/hint.html"><B>Most useful</B></A>
<BLOCKQUOTE>Kimmo Fredriksson - Aproximate grep<BR>
Finland</BLOCKQUOTE>
<LI>
<A HREF="goren/hint.html"><B>Most artistic</B></A>
<BLOCKQUOTE>Uri Goren - Magritte tribute<BR>
Israel</BLOCKQUOTE>
<LI>
<A HREF="hou/hint.html"><B>Best self documenting program</B></A>
<BLOCKQUOTE>Hou Qiming - Scientific calculator<BR>
China</BLOCKQUOTE>
<LI>
<A HREF="konno/hint.html"><B>Best one liner</B></A>
<BLOCKQUOTE>Taketo Konno - QWERTY keyboard position identifer<BR>
Japan</BLOCKQUOTE>
<LI>
<A HREF="hamaji/hint.html"><B>Best solved puzzle</B></A>
<BLOCKQUOTE>Shinichiro Hamaji - Paint by number puzzle<BR>
Japan</BLOCKQUOTE>
<LI>
<A HREF="hamaji/hint.html"><B>Best solved puzzle</B></A>
<BLOCKQUOTE> bsoup - Paint by number puzzle<BR>
Japan</BLOCKQUOTE>
<LI>
<A HREF="richards/hint.html"><B>Most surprisingly portable</B></A>
<BLOCKQUOTE>Gregor Richards - JIT dc<BR>
USA</BLOCKQUOTE>
<LI>
<A HREF="toledo/hint.html"><B>Best non-chess game</B></A>
<BLOCKQUOTE>Oscar Toledo G. - Dual player tank shooter game<BR>
Mexico</BLOCKQUOTE>
<LI>
<A HREF="vik/hint.html"><B>Most sound</B></A>
<BLOCKQUOTE>Daniel Vik - Tracker player<BR>
USA</BLOCKQUOTE>
<LI>
<A HREF="zucker/hint.html"><B>Most shiny</B></A>
<BLOCKQUOTE>Matt Zucker - Text raytracing<BR>
USA</BLOCKQUOTE>
<LI>
<A HREF="akari/hint.html"><B>Best of Show - Most Shrinkable</B></A>
<BLOCKQUOTE>Don Yang - Downsampler with 3 embeded programs<BR>
USA</BLOCKQUOTE>
</UL>
<P>
<HR SIZE="1">
<!-- Authored by: <A HREF="http://www.sfik.com">sc</A> -->
<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>This work by <A HREF="/judges.html">Landon Curt Noll, Simon Cooper, and Leonid A. Broukhis</A>
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>
</TR>
</TABLE>
</BODY>
</HTML>
+117
View File
@@ -0,0 +1,117 @@
#!/usr/bin/env make
#
# 2011 makefile
#
# Copyright (C) 2011, Landon Curt Noll, Simon Cooper, and Leonid A. Broukhis.
#
# Creative Commons Attribution-ShareAlike 3.0 Unported License.
# See: http://creativecommons.org/licenses/by-sa/3.0/
################
# tool locations
################
#
SHELL= /bin/bash
CP= cp
CPP= cpp
GUNZIP= gunzip
LD= ld
MAKE= make
RM= rm
SED= sed
TAR= tar
TRUE= true
# optimization
#
# Most compiles will safely use -O2. Some can use only -O1 or -O.
# A few compilers have broken optimizers or this entry make break
# under those buggy optimizers and thus you may not want anything.
#
OPT= -O2
# bitness
#
# Some entries require 32-bitness,
# other entries require 64-bitess.
# By default we assume nothing.
#
ARCH=
# default flags for ANSI C compilation
#
CFLAGS= -Wall -W -ansi ${ARCH} ${OPT} -D_BSD_SOURCE -lm
# ANSI compiler
#
# Set CC to the name of your ANSI compiler.
#
CC= cc
##############################
# Special flags for this entry
##############################
#
ENTRY= zucker
DATA=
#################
# build the entry
#################
#
all: ${ENTRY} ${DATA}
@${TRUE}
${ENTRY}: ${ENTRY}.c
${CC} ${CFLAGS} ${ENTRY}.c -o ${ENTRY}
# alternative executable
#
alt:
@${TRUE}
###############
# utility rules
###############
#
everything: all alt
clean:
${RM} -f ${ENTRY}.o
clobber: clean
${RM} -f ${ENTRY}
nuke: clobber
@echo gnab gib!
install:
@echo "Surely you're joking Mr. Feynman!"
# backwards compatibility
#
build: all
##################
# 133t hacker rulz
##################
#
love:
@echo 'not war?'
haste:
$(MAKE) waste
waste:
@echo 'waste'
easter_egg:
@echo you expected to mis-understand this $${RANDOM} magic
@echo chongo '<was here>' "/\\oo/\\"
@echo Readers shall not be disallowed from being unable to partly misunderstand this final echo.
@${TRUE}
+194
View File
@@ -0,0 +1,194 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta name="GENERATOR" content="mkd2html 2.1.3 DL=DISCOUNT">
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=utf-8">
<link rel="stylesheet"
type="text/css"
href="../hint.css">
<title>Most shiny</title>
</head>
<body>
<h1>Most shiny</h1>
<p>Matt Zucker<br>
<a href="&#x6d;&#x61;&#105;&#108;&#116;&#111;&#58;&#109;&#122;&#117;&#x63;&#107;&#101;&#114;&#x31;&#64;&#x73;&#119;&#97;&#114;&#116;&#104;&#x6d;&#111;&#114;&#101;&#46;&#101;&#x64;&#117;">&#109;&#122;&#x75;&#99;&#107;&#x65;&#114;&#x31;&#x40;&#x73;&#x77;&#97;&#x72;&#116;&#x68;&#109;&#111;&#114;&#101;&#x2e;&#101;&#100;&#x75;</a><br>
<a href="http://www.swarthmore.edu/NatSci/mzucker1/">http://www.swarthmore.edu/NatSci/mzucker1/</a></p>
<h2>Judges' comments:</h2>
<h3>To build:</h3>
<pre><code>make zucker
</code></pre>
<h3>To run:</h3>
<pre><code>./zucker &gt; image.ppm
</code></pre>
<h3>Try:</h3>
<pre><code>./zucker "Hello!!!" &gt; hello.ppm
./zucker faster\! -preview &gt; image2.ppm
# Display the PPM image with your favorite image viewer
</code></pre>
<h3>Selected Judges Remarks:</h3>
<p>The rendered image is centered and is output as a 600 by 220 pixel PPM.
The vector font is proportional.</p>
<p>This entry uses no local variables. None! At! All!</p>
<h2>Author&rsquo;s comments:</h2>
<h1>An image generator</h1>
<h2>What it does:</h2>
<p>This program makes pretty pictures. To see the default output, try
running</p>
<pre><code> ./zucker &gt; image.ppm
</code></pre>
<p>On the author&rsquo;s 2.5 GHz MacBook Pro, this command takes approximately
1 minute and 18 seconds to run &ndash; your runtime may vary. You will
need an image viewer capable of displaying Netpbm images in order to
display the output. On the Mac, <a href="http://wakaba.c3.cx/s/apps/xee">Xee</a>
works well; otherwise <a href="http://www.imagemagick.org/">ImageMagick</a>
and/or <a href="http://www.graphicsmagick.org/">GraphicsMagick</a> are both
capable of displaying Netpbm files, and are available on multiple
platforms. (Using Xee is particularly nice because it periodically
reloads the image as it is rendered.)</p>
<p>Aside from the default image, you may create your own by running the
program as follows:</p>
<pre><code> ./zucker "your text" &gt; image.ppm
</code></pre>
<p>To mitigate long runtimes, the program can be invoked in a &ldquo;preview&rdquo;
mode by appending <code>-preview</code> to the command line arguments, like so:</p>
<pre><code> ./zucker faster\! -preview &gt; image.ppm
</code></pre>
<p>If your platform distinguishes between binary and text streams, you
may need to insert some code to reopen standard output in binary mode
at the start of <code>main</code>. An ASCII platform is assumed.</p>
<h2>Pedagogical value:</h2>
<p>This program is quite suitable for the inexperienced programmer, due
to a number of considerations:</p>
<ul>
<li><p>It is fairly short: just 4 preprocessor directives followed by 29
lines of source.</p></li>
<li><p>It compiles cleanly as ANSI C under gcc 4.2.1 with very strict
compilation flags.</p></li>
<li><p>It uses a very small subset of the keywords available in C, namely
<code>char</code>, <code>float</code>, <code>int</code>, <code>typedef</code>, <code>struct</code>, <code>for</code>, and <code>return</code>.
More difficult concepts such as <code>void</code>, <code>if</code>, <code>switch</code>, and
<code>while</code> are eschewed for simplicity&rsquo;s sake.</p></li>
<li><p>It also uses a very small number of library functions: just <code>putchar</code>,
<code>cos</code>, <code>sin</code>, <code>atan2</code>, <code>sqrt</code>, and <code>pow</code>.</p></li>
<li><p>New programmers often prefer to use global variables when
possible. Hence, <em>all</em> variables in this program (aside from
function parameters) have global scope.</p></li>
<li><p>An important aspect of the computation is graphically illustrated
by the source code itself: the geometric construction of a
reflection ray at an object&rsquo;s surface, given the incoming
direction and surface normal.</p></li>
</ul>
<h2>Further details (contains spoilers):</h2>
<p>The program is not quite a traditional ray tracer, but a &ldquo;sphere
tracer&rdquo; which uses distance fields to encode proximity to objects in
the scene. Using sphere tracing to compute visibility instead of
analytic ray tracing provides two advantages: first, it greatly eases
the computation of ray-torus intersection (which would otherwise
require solving a quartic polynomial), and second, it makes it
possible to compute ambient occlusion (which is used to generate soft
shadows). Unlike many traditional ray tracers and sphere tracers, this
one uses iteration instead of recursion to compute the effect of
reflections. This, unfortunately, resulted in the programmer going
insane; however, program size was reduced and readability
hindered. Neither the plaintext for the program&rsquo;s default output nor
for the Netpbm header appears in the program source, which hinders
readability as well. Also, unlike some previous IOCCC entries which
render ASCII text, this one uses a vector (as opposed to raster)
font. Although the program does not generate uppercase letters, it
handles them in a reasonable manner when they appear in the input.</p>
<p>Even when the program is pretty-printed and preprocessor macros are
expanded, it should be fairly resistant to analysis due to reckless
reuse of global variables, to the inherently opaque nature of the
math, and to its overall density. Global variables are used to store
the results of intermediate computation. As a result, seemingly simple
functions have important side effects. Although some of the global
variables are simply constants, their use is overloaded. For instance,
the variable <code>X</code> is used both as the number 40 and as the ASCII
character <code>'('</code>. Maintainability is hindered due to hardcoding
several aspects of the program in multiple locations. As an example,
it is impossible to modify either the image width or height without
changing the source in at least three different places, including
inside the large string literal.</p>
<p>Some of the functions are simple vector algebra operations such as
vector construction, dot product, and normalization. However, it was
found to be much more compact to define a single operation for
multiply-and-add rather than to have separate functions for addition,
subtraction, and scaling. Again, compactness led to obfuscation.</p>
<p>This program heavily abuses <code>for</code> loops. The comma operator is used to
get as much milage as possible out of statements inside of loop
declarations. Between <code>for</code> loops, the comma operator, and the ternary
operator, it was possible to avoid <code>if</code> and <code>while</code> altogether.</p>
<p>Bitwise and arithmetic operators are used instead of logical operators
whenever gcc doesn&rsquo;t warn about it. Conversely, integer
multiplication, division, and modulus are sometimes used in place of
traditional bitwise operators just to keep the reader on his or her
toes. Automatic casting between characters, integers, and floats is
performed just about everywhere. Fascinatingly, this doesn&rsquo;t seem to
affect performance too badly. Sometimes when an explicit cast
(i.e. from float to int) is needed, the program instead simply assigns
to a free variable of the desired type instead. Both the <code>array[index]</code>
and <code>index[array]</code> notations are used interchangably throughout the
program.</p>
<p>Two other programs were written to support development of this
program. The first used a randomized search algorithm to deduce the
most compact encoding of the vector font instructions into ASCII; the
second used a modified form of the Knuth-Plass algorithm to layout the
final text on top of a hand-generated ASCII &ldquo;stencil&rdquo;. The programs
were not submitted as entries for this year&rsquo;s IOCCC, not because they
lack obfuscation, but because neither is written in C (they are in C++
and Python, respectively).</p>
<hr />
<!--
(c) Copyright 1984-2012, [Leo Broukhis, Simon Cooper, Landon Curt Noll][judges] - All rights reserved
This work is licensed under a [Creative Commons Attribution-ShareAlike 3.0 Unported License][cc].
[judges]: http://www.ioccc.org/judges.html
[cc]: http://creativecommons.org/licenses/by-sa/3.0/
-->
<TABLE><TR>
<TD><a rel="license" href="http://creativecommons.org/licenses/by-sa/3.0/"><img alt="Creative Commons License" style="border-width:0" src="http://i.creativecommons.org/l/by-sa/3.0/88x31.png" /></a></TD>
<TD><P>&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>
+171
View File
@@ -0,0 +1,171 @@
# Most shiny
Matt Zucker
<mzucker1@swarthmore.edu>
<http://www.swarthmore.edu/NatSci/mzucker1/>
## Judges' comments:
### To build:
make zucker
### To run:
./zucker > image.ppm
### Try:
./zucker "Hello!!!" > hello.ppm
./zucker faster\! -preview > image2.ppm
# Display the PPM image with your favorite image viewer
### Selected Judges Remarks:
The rendered image is centered and is output as a 600 by 220 pixel PPM.
The vector font is proportional.
This entry uses no local variables. None! At! All!
## Author's comments:
An image generator
==================
What it does:
-------------
This program makes pretty pictures. To see the default output, try
running
./zucker > image.ppm
On the author's 2.5 GHz MacBook Pro, this command takes approximately
1 minute and 18 seconds to run -- your runtime may vary. You will
need an image viewer capable of displaying Netpbm images in order to
display the output. On the Mac, [Xee](http://wakaba.c3.cx/s/apps/xee)
works well; otherwise [ImageMagick](http://www.imagemagick.org/)
and/or [GraphicsMagick](http://www.graphicsmagick.org/) are both
capable of displaying Netpbm files, and are available on multiple
platforms. (Using Xee is particularly nice because it periodically
reloads the image as it is rendered.)
Aside from the default image, you may create your own by running the
program as follows:
./zucker "your text" > image.ppm
To mitigate long runtimes, the program can be invoked in a "preview"
mode by appending `-preview` to the command line arguments, like so:
./zucker faster\! -preview > image.ppm
If your platform distinguishes between binary and text streams, you
may need to insert some code to reopen standard output in binary mode
at the start of `main`. An ASCII platform is assumed.
Pedagogical value:
------------------
This program is quite suitable for the inexperienced programmer, due
to a number of considerations:
* It is fairly short: just 4 preprocessor directives followed by 29
lines of source.
* It compiles cleanly as ANSI C under gcc 4.2.1 with very strict
compilation flags.
* It uses a very small subset of the keywords available in C, namely
`char`, `float`, `int`, `typedef`, `struct`, `for`, and `return`.
More difficult concepts such as `void`, `if`, `switch`, and
`while` are eschewed for simplicity's sake.
* It also uses a very small number of library functions: just `putchar`,
`cos`, `sin`, `atan2`, `sqrt`, and `pow`.
* New programmers often prefer to use global variables when
possible. Hence, *all* variables in this program (aside from
function parameters) have global scope.
* An important aspect of the computation is graphically illustrated
by the source code itself: the geometric construction of a
reflection ray at an object's surface, given the incoming
direction and surface normal.
Further details (contains spoilers):
------------------------------------
The program is not quite a traditional ray tracer, but a "sphere
tracer" which uses distance fields to encode proximity to objects in
the scene. Using sphere tracing to compute visibility instead of
analytic ray tracing provides two advantages: first, it greatly eases
the computation of ray-torus intersection (which would otherwise
require solving a quartic polynomial), and second, it makes it
possible to compute ambient occlusion (which is used to generate soft
shadows). Unlike many traditional ray tracers and sphere tracers, this
one uses iteration instead of recursion to compute the effect of
reflections. This, unfortunately, resulted in the programmer going
insane; however, program size was reduced and readability
hindered. Neither the plaintext for the program's default output nor
for the Netpbm header appears in the program source, which hinders
readability as well. Also, unlike some previous IOCCC entries which
render ASCII text, this one uses a vector (as opposed to raster)
font. Although the program does not generate uppercase letters, it
handles them in a reasonable manner when they appear in the input.
Even when the program is pretty-printed and preprocessor macros are
expanded, it should be fairly resistant to analysis due to reckless
reuse of global variables, to the inherently opaque nature of the
math, and to its overall density. Global variables are used to store
the results of intermediate computation. As a result, seemingly simple
functions have important side effects. Although some of the global
variables are simply constants, their use is overloaded. For instance,
the variable `X` is used both as the number 40 and as the ASCII
character `'('`. Maintainability is hindered due to hardcoding
several aspects of the program in multiple locations. As an example,
it is impossible to modify either the image width or height without
changing the source in at least three different places, including
inside the large string literal.
Some of the functions are simple vector algebra operations such as
vector construction, dot product, and normalization. However, it was
found to be much more compact to define a single operation for
multiply-and-add rather than to have separate functions for addition,
subtraction, and scaling. Again, compactness led to obfuscation.
This program heavily abuses `for` loops. The comma operator is used to
get as much milage as possible out of statements inside of loop
declarations. Between `for` loops, the comma operator, and the ternary
operator, it was possible to avoid `if` and `while` altogether.
Bitwise and arithmetic operators are used instead of logical operators
whenever gcc doesn't warn about it. Conversely, integer
multiplication, division, and modulus are sometimes used in place of
traditional bitwise operators just to keep the reader on his or her
toes. Automatic casting between characters, integers, and floats is
performed just about everywhere. Fascinatingly, this doesn't seem to
affect performance too badly. Sometimes when an explicit cast
(i.e. from float to int) is needed, the program instead simply assigns
to a free variable of the desired type instead. Both the `array[index]`
and `index[array]` notations are used interchangably throughout the
program.
Two other programs were written to support development of this
program. The first used a randomized search algorithm to deduce the
most compact encoding of the vector font instructions into ASCII; the
second used a modified form of the Knuth-Plass algorithm to layout the
final text on top of a hand-generated ASCII "stencil". The programs
were not submitted as entries for this year's IOCCC, not because they
lack obfuscation, but because neither is written in C (they are in C++
and Python, respectively).
--------------------------------------------------------------------------------
<!--
(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/
-->
+33
View File
@@ -0,0 +1,33 @@
#include <stdio.h>
#include <math.h>
#define E return
#define S for
char*J="LJFFF%7544x^H^XXHZZXHZ]]2#( #@@DA#(.@@%(0CAaIqDCI$IDEH%P@T@qL%PEaIpBJCA\
I%KBPBEP%CBPEaIqBAI%CAaIqBqDAI%U@PE%AAaIqBcDAI%ACaIaCqDCI%(aHCcIpBBH%E@aIqBAI%A\
AaIqB%AAaIqBEH%AAPBaIqB%PCDHxL%H@hIcBBI%E@qJBH#C@@D%aIBI@D%E@QB2P#E@'C@qJBHqJBH\
%C@qJBH%AAaIqBAI%C@cJ%" "cJ" "CH%C@qJ%aIqB1I%PCDI`I%BAaICH%KH+@'JH+@KP*@%S@\
3P%H@ABhIaBBI%P@S@PC#", *j ,*e;typedef float x;x U(x a){E a<0?0:a>1?1:a; }
typedef struct{x c,a,t; } y;y W={1,1,1},Z={0,0,0},B[99],P,C,M,N,K,p,s,d,h
;y G(x t,x a,x c){K.c=t ; K.t=c; K.a=a;E K;}int T=-1,b=0,r,F=-111,(*m)(i\
nt)=putchar,X=40,z=5,o, a, c,t=0 ,n,R;y A(y a,y b,x c){E G(a.c+b.c*c,a.a
+c*b.a,b.t*c+a.t);}x H= .5,Y =.66 ,I,l=0,q,w,u,i,g;x O(y a,y b){E q=a.t*
b.t+b.c*a.c+a.a*b.a;}x Q(){E A(P,M,T ),O(K,K)<I?C=M,I=q:0;}y V(y a){E A(Z,
a,pow(O(a,a),-H));}x D(y p){S(I=X,P =p,b=T; M=B[++b],p=B[M.c+=8.8-l*.45,
++b],b<=r;Q())M=p.t?q =M_PI*H,w=atan2( P.a-M.a,P.c-M.c) /q,o=p.c-2,a=p.a+1,t=
o+a,w=q*(w>t+H*a?o: w>t?t:w<o-H*a?t :w<o?o:w),A( M,G(cos(w),sin(w),0),
1):A(M,p,U(O(A(P,M,T) ,p)/O(p,p))); M=P;M.a=- .9;o=P.c/8+8;o^=a=P.t
/8+8; M=Q ()?o&1 ?G(Y,0,0):W :G(Y,Y,1);E sqrt (I)-.45;}
int main( int L,char **k){ S(e =L>1?1[z= 0, k]:J ;*e &&l<24 ;
++e)S(o=a =0,j =J+9;(c= *++j)&& !(o&&c< X&&(q=l+=w) );o ?o=*j++/
32,b++[B] =G(q +=*j/8&3,* j&7,0 ),B[r =b++]=G((c/8& 3)*( o<2?
T:1), (c& 7)+ 1e-4,o>2),1: (o =(a =(c-=X)<0?w=c+6 ,t= a+1:c?(t
?0:m(c),a ):*++j)==((*e|32 ) ^z)&&1[j]-X));S(z =3*( L<3);++
F<110;)S(L=-301;p=Z,++L<300;m( p.c),m(p.a),m(p.t))S(c=T;++c<=z;)S(h
=G(-4,4.6,29),d=V(A(A(A(Z,V(G(5,0 ,2)),L+L+c/2),V(G(2,-73,0)),F+F+c%2),G
(30.75,-6,-75),20)),g=R=255-(n=z)*64; R*n+R;g*=H){S(u=i=R=0;!R&&94>(u+=i=D(h=
A(h,d,i)));R=i<.01);S(N=V(A(P,C, T)),q=d.t*d.t,s=M,u=1;++i<6*R;u-=
U(i/3-D(A(h,N,i/3)))/pow( 2,i));s=R?i=pow(U(O(N,V(A(
M=V(G(T,1,2)),d,T)))) ,X),p=A(p,W,g*i),u*=U(
O(N,M))*H*Y+Y,g*= n--?Y-Y*i:1-i,s:G(
q,q,1); p=A(p,s ,g*u);h=A(h,N,.1
);d=A(d,N,-2*O (d,N));}E 0;}