12 days of Christmas

This originated as a casual game between some geek friends and I over email. We'd each try to produce a short version of the imfamous song, and then someone else would try to better it - either by finding a shortcut that someone else had missed, or by taking a different approach.

The process of discovery was so interesting that I truly don't remember who won!

main(i){char*q,p[]="thstndrd	12 drummers drumming	11 pipers piping	10 lords a leaping	9 ladies dancing	8 maids a milking	7 swans a swimming	6 geese a laying	5 golden rings	4 calling birds	3 french hens	2 turtle doves and	a partridge in a pear tree";for(;q=strrchr(p,9);printf("\nOn the %d%.2s day of christmas my true love sent to me%s\n",i,p+(i<4)*i*2,q),++i)++*q;}

I do remember I like the cheat of using tabs (character code 9) as a delimiter which wouldn't appear on-screen, (i<4)*i*2 code using logical operators to find offsets in the array to determine whether the day would appear as '1st', '2nd', '3rd', or 'Nth'.

Download the obfuscated 12 days of Christmas


Mandelbrot Set Generator

My favourite. It's just so meta, since the source looks like a mandelbrot as well as the output it produces. Also, it uses key presses to let you zoom into the set!

int main(int argc, char* argv[]){ unsigned
char c='r';double x1,y,y1,t=0,q=78,r=22,x,
x2,y2,a,b,v;do{(c=='r')?(y2=-(y1=-1.6),x1=
-2.0f,x2=0.8):(c=='?')? c=0,   printf("%f\
,%f:%f,%f",x1,y1,x2,y2):(c     <':'&&c>48)
?x=x1,y=y1,*(c>'3'&&c<':'        ?&y1: &t)
+=(y2-y1)/3,*(c>'6'&&c<            ':'?&y1
:&t)+=(y2-y1)/3, *((c               == '8'
||c+3=='8'||c+3 +3==               '8'?&x1
:&t))+=(x2-x1     )/                3,*((c
=='9'||c+3==                        '9'||c
+6=='9'                          ?&x1: &t)
)+=2*(x2-x1)                        /3,x2=
x1+(x2-x)/3,      y2                 =y1+(
y2-y)/3:(c=0);for(y=                y2;y>=
y1&&c;c=1,y-=(y2-y1)/r,            putchar
('\n')) for(x=x1;x<=x2;            x+=(x2-
x1)/q){a=b=c=0; while  (        ++c&&(a=(t
=a)*a)<4&&(v=b*b)<4)a-=v-x     ,b=y+b*2*t;
putchar("#@XMW*N&KPBQYKG$R"   "STEEVxHOUV"
"CT()[]%JL={}eou?/\\|Ili+~<>_-^\"!;:`,. "[
c?c>>2:63]);}} while((c=getchar ())!='x');
return 0;/* Mandelbrot - S.Goodwin.2001*/}

Download the obfuscated Mandelbrot Set Generator


99 Bottles of Beer

Another song, inspired partly from the previous Christmas competition, but also from the Esoteric languages archive which always demonstrated new languages with Hello World, and 99 Bottles.

b=100;*p=" bottles of beer",*q=" on the wall";main(){while(--b){printf("%d%s%s.\n%d%s,\nTake one down, pass it around.\n%d%s%s.\n\n",b,p,q,b,p,b-1,p,q);}}

Download the obfuscated 99 bottles of beer


Jacko

The reason it's called 'jacko.c' is in the output. But, for the life of me, I can't remember the origin of the phrase, or why I/we were writing it? Looking the code, however, it seems fairly obvious (!?!?!) that it was an experiment in obfuscated encoding.

d[256]={0x200000, 0x8000000, 0x10000, 
15,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,2,0,0,0
,0,0,0,0,0,0,0,112,36,0,1,4,32,0,96,0,68,137,0,8};

main(story)
{
	while(d[0]>16)-26)&0x1ff)>>1)]&(*d&d[2]?240:15)))>>(*d&d[2]?4:0)&(1<<(*d>>25))?putchar(((*d>>16)&0x1ff)),0x10000:0x10000;
}

Download the obfuscated jacko.c


Noise

This was an attempt to hide the message, along with the method, by using as few symbols as possible. This was made possible by relying on the two global variables (_ and __) being initialized to zero, and using clever mathematics to upscale from 0 to all the other numbers necessary for putchar to write out an ASCII message.

#define ______	putchar(
#define _____	(
#define ____	)
#define ___	<<


_,__;main(){ _=-~_,__=_- -_- -_, __=______ _____ _____ _ ___ __ ____- -_ ____
___ __ ____ , __=__- -_____ _____ _ ___ _ ___ _ ___ _ ___ _ ___ _ ____-_-_-_-
_ ____,__=______ __- -_ ____ ,__=______ ______ ______ __-_- -_____ _ ___ _- -
_- -_ ____ ____ ____- -_- -_- -_ ____, ______ _ ___ _ ___ _____ _ ___ _ ___ _ 
____ ____,______ __,______ __-_____ _____- -_- -_- -_ ____ ___ _- -_- -_ ____
____ ____,______ __=__- -_- -_- -_ ____ ,__-=_____ _- -_- -_ ____ ___ _____ _
____,______ __ ____,__^=_ ___ _ ___ _ ___ _,______ __ ____, __=_ ___ _,______
_____ __ ___ __ ____- -__ ____;}/* by Steev, but why did he sign his name? */

Download the obfuscated noise source