Mine uses some template trickery, so it's not that straightforward either.
Printable View
Mine uses some template trickery, so it's not that straightforward either.
my entry, featuring:Code:#ifdef oI0Io
OX0XO(1<<4, -~ox0xo):0x0D:0xD0;}
sqrt _(sin){OX0XO(16, 0); ___ 0;}
#else
#ifdef ooIoo
o0o0o&0x40?OX0XO(-!!&ox0xo,0x168+0xA*ox0xo):
o0o0o&0x20?OX0XO(~-'-'-'-',
0x1E*ox0xo):
o0o0o&0x02?OoooO
&&ox0xo==0x0?OX0XO
(-'/'/'/',01024):0xB0,ox0xo>=0x0?
OX0XO(32,ox0xo),
OX0XO(2,~-ox0xo):0xC0:
o0o0o&0x10?ox0xo<014?
OX0XO(1<<3,0),OX0XO(1<<6,ox0xo)
,
OX0XO(1<<2,0),OX0XO(1<<1,ox0xo),(
OoooO|=~!OoooO),
#define oI0Io
#define _ main
#include __
#else
#ifdef oi0io
(-~ox0xo)[Oo0oO]>=0141&&
(-~ox0xo)[Oo0oO]<=0155?(-~ox0xo)
[Oo0oO]+0xD:(-~ox0xo)[Oo0oO]>=
0156&&(-~ox0xo)[Oo0oO]<=0172?(-~ox0xo)[Oo0oO]
-
0xD:(-~ox0xo)[Oo0oO]
),
(-~-~ox0xo)[Oo0oO]!=044?
Ox0xO((-~-~ox0xo)[Oo0oO]==053?040:
(-~-~ox0xo)[Oo0oO]==043?012:(-~-~ox0xo)[Oo0oO]>=0141&&(-~
-~
ox0xo)[Oo0oO]<=0155?
(-~-~ox0xo)[Oo0oO]+0xD:(-~-~ox0xo)
[Oo0oO]>=0156&&
(-~-~ox0xo)[Oo0oO]<=0172?(-~-~ox0xo)[Oo0oO]
-0xD:(-~-~ox0xo)[Oo0oO]
),
OX0XO(-1,ox0xo+-~(1<<1)):
0x800:
0x080:
0x008:
o0o0o&0x08?OX0XO(~-!Oo0oO,0x1E0):
o0o0o&0x04?OX0XO(-~~!!o0o0o,0x1E8):
#define ooIoo
#include __
#else
#ifdef oiOio
sqrt OX0XO(sqrt o0o0o,sqrt ox0xo){
___
o0o0o==-0x01?
ox0xo[Oo0oO]!=044?Ox0xO(
ox0xo[Oo0oO]==053?
040:ox0xo[Oo0oO]==043?012:
ox0xo[Oo0oO]>=0141&&ox0xo[Oo0oO]<=0155?
ox0xo[Oo0oO]+0xD:
ox0xo[Oo0oO]>=0156
&&ox0xo[Oo0oO]<=0172?ox0xo[Oo0oO]-0xD:ox0xo
[
Oo0oO]),
(-~ox0xo)[Oo0oO]!=044?Ox0xO((-~ox0xo)[Oo0oO]==053?
040:(-~ox0xo)[Oo0oO]==043?012:
#define oi0io
#include __
#else
#include <stdio.h>
#define sin void
#define cos char
#define sqrt int
#define ___ return
#define __ __FILE__
sqrt(*Ox0xO)(sqrt)=putchar;
cos Oo0oO[]="n+cnegevqtr+va+n+crne+gerr.##$gjb+ghegyr+q\
birf,#$qsw+Bsh+Us$guerr+Ferapu+uraf,#$Qfs+bdj+T$sbhe+pn\
yyvat+oveqf,#$qbv+P+Ah$svir+tbyqra+evatf,#$wat+q+Xzq$fv\
k+trrfr+n-ynlvat,#$vpib+kyd$frira+fjnaf+n-fjvzzvat,#$q+\
bx$rvtug+znvqf+n-zvyxvat,#$jvqbq$avar+ynqvrf+qnapvat,#$\
bxia+iw$gra+ybeqf+n-yrncvat,#$iwp+ak+$ryrira+cvcref+cvc\
vat,#$p+Ko+a$gjryir+qehzzref+qehzzvat,#$i+$svefg$pio$fr\
pbaq$ip$guveq$aoo$sbhegu$lg$svsgu$jre$fvkgu$Gte$friragu\
$e$rvtugu$re$avagu$lgg$gragu$hlr$ryriragu$$gjrysgu$r$Oa\
+gur+$+qnl+bs+Cuevfgznf,#zl+gehr+ybir+frag+gb+zr#$naq+$"
,OoooO;
#define oiOio
#include __
#endif
#endif
#endif
#endif
*) all kinds of preprocessor abuse.
*) the song function is just one statement.
*) not a single if/while/for etc...
*) some weird ways to calculate things.
and more!
I love the way you include yourself :)
Very well, here's mine
Code://§%)=/"=§&(%§=&?%(§=$§(%%§&%)=&`§"=&?$%%=$?(&/§(%§$($§/)&/?§)=$/(§&?)"/%$(&?/
// Start obfuscated part. )?%"``%"`(§`=)&§"`%§`"§/%`=)(&??/
void rec();
// Application entry point!%§?§?I§"?%)§"=%!?"%??/
int main()??<rec();??>
??=define o <
void rec(int,char**);
??=define i000004 iter
??=define gone int main(){\
rec(0,0);??>
??=define S(s) _S(s)
??=define __ typename
??=define i000002 str
??=define Q(_a,_a_) _Q(_a,_a_)
??=define i100000 ream
??=define st1 first
??=define c >
??=define _Q(_a,_a_) _a ??=??= _a_
??=define come using namespace std;
??=define i400000 ator
gone
??=define i200000 ing
??=define i000005 funct
??=define main rec
??=define at _argument_type
??=include Q(Q(o,i000004),Q(i400000,c))
??=define _S(s) #s
??=include Q(Q(o,i000002),Q(i200000,c))
??=define i000003 algor
??=define ___ _(bind2nd
come
??=define i000001 iost
??=define cs const string
??=define i500000 ional
??=include Q(Q(o,i000001),Q(i100000,c))
??=define i300000 ithm
??=define nd2 second
??=include Q(Q(o,i000003),Q(i300000,c))
??=define ender begin
??=include Q(Q(o,i000005),Q(i500000,c))
cs i000001??(??)={"ts-&(","`Luc`S","eTifs","^flicL","*utqe","{!/(#","-u$ -1 ","TWTT_R","mL]bU",
"+eitT","z+t5v)!#",").v%\"%z"};cs i100000??(??)={"queml","39m,.1","/4 ,p","()))1<","\\sq##",
"while","foreach","123456","!=123","i % 4","japanese","kingdom"};
cs i000002??(??)={"0\\QkJiXP\\c^PSUe^i,- 1,er-(t?B/","Bb[l^c_t8m0d;1r!","AWZQTm3]S[RQ 4|{.",
"2WbbfQMWUSnA0lvr<y","1VbOkRoFzn) D$v%$","=UcfOe2*l 'G+t*tzg","<eC w:""%w')!8tC%0um:q-t",
"-UQWtZ$y!os^nI%y}wiLq","5W[PkTa6 v. B yn|)$","CU\\f[Y]Q_iL-8 rp4\"r","4[P""v@\":y$\"e?06+z-$n1",
"CeT\\dLjR_cm9m-')~rTz+ y\""};cs i200000??(??)={"12347681614912 A brand new SCV",
"2543623 Two Terr""an Wraiths","318412352317"" Three Marines","4830924576 Four Hydralisks",
"53464""5 Five Newborn Queens","64598 Six Zealots Fighting","7 Seven Ze""rglings Swarming",
"8461 Eight Archons Burning","923548 Nine Battlecruisers","10291653465 Ten Ultralisks",
"115 Ele""ven Science Vessels","121""0295232 Twelve Arbiters"};
template<__ F, __ G>class _t:public
binary_function
<__
G::
Q(st1,at)
,
__
G
::
Q(nd2,at),
__
F
::result_type
>??<F f;G g;
public:
??=define endest end
_t(F a,G b):f(a),g(b){??>__ F::result_type operator()(
const
__
G
::Q(st1,at)
&x
,
const __
G::
Q(nd2,at)&
y)const??<return f(g(x,y));??>??>;
template<__ F,__ G>_t<F, G> _(F f,G g) ??<return _t<F,G>(f,g);??>void main(int
n, char** d){if(!d){if(((int)n)<12){cout Q(o,o)S(On the )" ";transform(iost??(n
].begin(),iost??(n].end(),ream??(n].begin(),ostreambuf_iterator<char>(cout),___(plus
<char>(),1 Q(o,o)5),___(modulus<int>(),5*19),___(minus<int>(),0x40),plus<int>()))));cout<<
" "S(day of Christmas)","S(\nmy true love sent to me\n);if(n)main(n,(char**)1);else
cout<<"A partridge in a pear tree";cout<<".\n\n";rec(n+1,d);}}else{transform(str[n??).
ender(),str[n??).endest(),ing[n??).ender(),ostreambuf_iterator<char>(cout),___(plus<char
>(),0x20),___(modulus<int>(),190/2),___(minus<int>(),1 Q(o,o)6),plus<int>()))));if(n){
cout<<",\n";rec(n-1,d);}}}
Oops, forgot about that. Delete the line -- it's not needed.Quote:
Originally posted by Magos
The final \ makes the comment continue on the next row in VC, not in Borland though.
GlUser: heh, we used the same include obfuscation :D
CornedBee: Heh, love that song, but shouldn't it be the 'original'? Also, the Archon and the Zergling doesn't always say the same thing on all days :).
Anyway, since everyone else posts theirs, here's mine:
Code:#ifdef oOoO
l0ng kill(){wh1le(l0ng i=0;i<12;i++)O0oO(i);quit 1?0:1;}
#undef oOoO
#endif
#ifdef o0Oo
lnt eger*o0O0[]={
"a partridge in a pear tree","two turtle doves","three French hens","four calling birds",
"five golden rings","six geese a-laying","seven swans a-swimming","eight maids a-milking",
"nine ladies dancing","ten lords a-leaping","eleven pipers piping","twelve drummers drumming",};
#undef o0Oo
#define oO0o
#include me
#endif
#ifdef oOo0
#define l0ng int
#undef oOo0
#define eger char
#define lnt const
#define o0Oo
#define f0r if
#define doub1e void
#include me
#endif
#ifdef oO0o
lnt eger*oO00[]={"first","second","third","fourth","fifth","sixth",
"seventh","eighth","ninth","tenth","eleventh","twelwth",};
#undef oO0o
#define o0o0
#include me
#endif
#ifdef O0o0
#undef O0o0
#define kill main
doub1e O0oO(l0ng i){cout<<"On the "<<oO00[i]<<" day of Christmas,\n";
cout<<"my true love sent to me\n"<<o0O0[i]<<(i==0?".\n":",")<<"\n";f0r(i>0)o0oO(i-1,i);}
#define oOoO
#include me
#endif
#ifndef Oo0o
#define Oo0o
#define me "ChristmasDays.cpp"
#include <iostream>
using namespace std;
#define wh1le for
#define quit return
#define oOo0
#include me
#endif
#ifdef o0o0
doub1e o0oO(l0ng i, l0ng m){f0r(i<0)quit;f0r(i==1?1:0)cout<<"and ";
#undef o0o0
cout<<o0O0[i]<<(i==0?".\n":",")<<"\n";o0oO(i-1,m);}
#define O0o0
#include me
#endif
Magos: it prints the original song. It was just something I thought would be funny ;)
A problem with your code might be that Salem apparently changes the file names, which would cause your code not to compile...
CornedBee:
I thought of using trigraphs but gcc requires adding "-trigraphs" to the cammand line in order to compile, so I didn't, the code is obfuscated quite well anyway :)
Magos:
Interesting how we both thought of self including and naming variables similarly (usage of Os and 0s), you should have used __FILE__ macro instead of hard-coding the file name though.
Didn't know that about GCC and couldn't test, as my Linux laptop is in repair.
wow... I don't really stand a chance (then again, I didn't really think i did in the first place :rolleyes:)
here's my submission:not very obscure, just kinda hard to follow... I made sure my program matched exactly what the song was (as in "and a partridge in a pear tree" for each line except the first, and the commas, etc.)Code:#include<iostream>
using std::cin;
using std::cout;
using std::endl;
void line12(char*);
void rest(int,int,char*,char*,char*);
int main(){char day[12][9]={{"first"},{"second"},{"third"},{"fourth"},{"fifth"},{"sixth"},{"seventh"},{"eighth"},{"ninth"},{"tenth"},{"eleventh"},{"twelfth"}};char num[12][7]={{"A"},{"Two"},{"Three"},{"Four"},{"Five"},{"Six"},{"Seven"},{"Eight"},{"Nine"},{"Ten"},{"Eleven"},{"Twelve"}};char object[12][10]=/*2-5 are reverse*/{{"Partridge"},{"Doves"},{"Hens"},{"Birds"},{"Rings"},{"Geese"},{"swans"},{"maids"},{"ladies"},{"lords"},{"pipers"},{"drummers"}};char verb[12][15]=/*2-5 are reverse*/{{"in a pear tree"},{"Turtle"},{"French"},{"Calling"},{"Golden"},{"a-laying"},{"a-swimming"},{"a-milking"},{"dancing"},{"a-leaping"},{"piping"},{"drumming"}};for(int O=0;O<12;O++){line12(day[O]);for(int i=O;i>=0;i--)rest(O,i,num[i],object[i],verb[i]);cout<<endl;}cin.get();return(0);}
void line12(char*day){cout<<"On The "<<day<<" day of christmas,"<<endl<<"my true love gave to me"<<endl;}
void rest(int O,int i,char*num,char*object,char*verb){if(i>0){if(i<5)cout<<num<<' '<<verb<<' '<<object<<','<<endl;else cout<<num<<' '<<object<<' '<<verb<<','<<endl;}else if(O>0)cout<<"And "<<num<<' '<<object<<' '<<verb<<'.'<<endl;else cout<<num<<' '<<object<<' '<<verb<<'.'<<endl;}
mine isn't too cloaked, really didn't spend a lot of time on it.
Do I get points for size? :)Code:#include <stdio.h>
void out (int);
void test (int [],int);
int main (void)
{
int c, c2;
int title[]={46,8,5,53,46,23,5,12,22,5,53,30,1,25,19,53,15,6,53,29,8,18,9,19,20,13,1,19};
int true_love[]={13,25,53,20,18,21,5,53,12,15,22,5,53,19,5,14,20,53,20,15,53,13,5,54};
int on_the[]={54,54,41,14,53,20,8,5,53};
int days[12][8]={
{6,9,18,19,20},
{19,5,3,15,14,4},
{20,8,9,18,4},
{6,15,21,18,20,8},
{6,9,6,20,8},
{19,9,24,20,8},
{19,5,22,5,14,20,8},
{5,9,7,8,20,8},
{14,9,14,20,8},
{20,5,14,20,8},
{5,12,5,22,5,14,20,8},
{20,23,5,12,6,20,8}
};
int dayof[]={53,4,1,25,53,15,6,53,29,8,18,9,19,20,13,1,19,55,54};
int and_a[]={27,14,4,53,1,53};
int a[]={27,53};
int gifts[12][25]={
{16,1,18,20,18,9,4,7,5,53,9,14,53,1,53,16,5,1,18,53,20,18,5,5,54},
{46,23,15,53,20,21,18,20,12,5,53,4,15,22,5,19,54},
{46,8,18,5,5,53,32,18,5,14,3,8,53,8,5,14,19,54},
{32,15,21,18,53,3,1,12,12,9,14,7,53,2,9,18,4,19,54},
{32,9,22,5,53,7,15,12,4,5,14,53,18,9,14,7,19,54},
{45,9,24,53,7,5,5,19,5,53,1,56,12,1,25,9,14,7,54},
{45,5,22,5,14,53,19,23,1,14,19,53,1,56,19,23,9,13,13,9,14,7,54},
{31,9,7,8,20,53,13,1,9,4,19,53,1,56,13,9,12,11,9,14,7,54},
{40,9,14,5,53,12,1,4,9,5,19,53,4,1,14,3,9,14,7,54},
{46,5,14,53,12,15,18,4,19,53,1,56,12,5,1,16,9,14,7,54},
{31,12,5,22,5,14,53,16,9,16,5,18,19,53,16,9,16,9,14,7,54},
{46,23,5,12,22,5,53,4,18,21,13,13,5,18,19,53,4,18,21,13,13,9,14,7,54}
};
test(title, sizeof(title));
test(on_the, sizeof(on_the));
test(days[0], sizeof(days[0]));
test(dayof, sizeof(dayof));
test(true_love, sizeof(true_love));
test(a, sizeof(a));
test(gifts[0], sizeof(gifts[0]));
for (c=1; c<12; ++c)
{
test(on_the, sizeof(on_the));
test(days[c], sizeof(days[c]));
test(dayof, sizeof(dayof));
test(true_love, sizeof(true_love));
for (c2=c; c2>0; --c2)
test(gifts[c2], sizeof(gifts[c2]));
test(and_a, sizeof(and_a));
test(gifts[0], sizeof(gifts[0]));
}
printf("\n\n");
return 0;
}
void test (int test[], int size)
{
int count;
size /= 4;
for (count=0; count < size; ++count)
{
out( test[count] );
}
}
void out (int selector)
{
switch (selector)
{
case 1: putchar('a');break;
case 2: putchar('b');break;
case 3: putchar('c');break;
case 4: putchar('d');break;
case 5: putchar('e');break;
case 6: putchar('f');break;
case 7: putchar('g');break;
case 8: putchar('h');break;
case 9: putchar('i');break;
case 10: putchar('j');break;
case 11: putchar('k');break;
case 12: putchar('l');break;
case 13: putchar('m');break;
case 14: putchar('n');break;
case 15: putchar('o');break;
case 16: putchar('p');break;
case 17: putchar('q');break;
case 18: putchar('r');break;
case 19: putchar('s');break;
case 20: putchar('t');break;
case 21: putchar('u');break;
case 22: putchar('v');break;
case 23: putchar('w');break;
case 24: putchar('x');break;
case 25: putchar('y');break;
case 26: putchar('z');break;
case 27: putchar('A');break;
case 28: putchar('B');break;
case 29: putchar('C');break;
case 30: putchar('D');break;
case 31: putchar('E');break;
case 32: putchar('F');break;
case 33: putchar('G');break;
case 34: putchar('H');break;
case 35: putchar('I');break;
case 36: putchar('J');break;
case 37: putchar('K');break;
case 38: putchar('L');break;
case 39: putchar('M');break;
case 40: putchar('N');break;
case 41: putchar('O');break;
case 42: putchar('P');break;
case 43: putchar('Q');break;
case 44: putchar('R');break;
case 45: putchar('S');break;
case 46: putchar('T');break;
case 47: putchar('U');break;
case 48: putchar('V');break;
case 49: putchar('W');break;
case 50: putchar('X');break;
case 51: putchar('Y');break;
case 52: putchar('Z');break;
case 53: putchar(' ');break;
case 54: putchar('\n');break;
case 55: putchar(',');break;
case 56: putchar('-');break;
}
}
Well, since my entry for #2 was apparently not included, I'll dump it here now.Quote:
-----Original Message-----
From: Dave Sinkula
Sent: Wednesday, December 10, 2003 7:36 PM
To: [email protected]
Subject: Xmas competitions: Competition 2
This is ASCII-dependent, but otherwise (hopefully) standard. It is in the spirit of the original, except it uses iteration instead of recursion -- partly because the original uses a non-standard main. I'm also not sure whether the use of _ as an identifier is prohibited -- the standard states, "All identifiers that begin with an underscore [...]" (emphasis mine).
I couldn't decide whether to go with the basic block or the poor attempt at ASCII art. Ah well, let's try out my poor artistic skills.
Code:;
int
_,l;\
char*I,
*O[]={"",
"gjstu","t"
"fdpoe","uij"
"se","gpvsui",\
"gjgui","t"
"jyui","tfwf"
"oui","fjhiui",
"ojoui","ufoui",\
"fmfwfoui","uxfmgu"
"i","b!qbsusjehf!jo!"
"b!qfbs!usff/\xb\xb",""
"uxp!uvsumf!epwf"
"t-\xb","uisff!gsf"
"odi!ifot-!","gpvs!d"
"bmmjoh!cjset-!","gjwf"
"!hpme!sjoht<\xb","tjy!h"
"fftf!b.mbzjoh-!","tfwfo!t"
"xbot!b.txjnnjoh-\xb","fjhiu"
"!nbjet!b.njmljoh-!","ojof!mbe"
"jft!ebodjoh-!","ufo!m"
"pset!b.mfbqjoh-\xb","fm"
"fwfo!qjqfst!qjqjoh-!","ux"
"fmwf!esvnnfst!esvnnjoh-!",""
"Po!uif!","!ebz!pg!Disjtunbt!n"
"z!usvf!mpwf!hbwf!up!nf\xb","boe"
"!"};int putchar(int);int main(void
){while(l<(sizeof O/sizeof*O-2)/2-1){
I=O[_=!_?sizeof O/sizeof*O-
3:_<(sizeof(O)/sizeof*O-2)/2?
sizeof O/sizeof*O-2:_==(sizeof(
O)/sizeof*O-2)/2?++l,0:_<(sizeof(
O)/sizeof(*O))-3?(_-1)==(sizeof(O)/
sizeof*O-2)/2?sizeof O/sizeof*O-1:_-1
:_<sizeof(O)/sizeof*O-2?l+1:_<sizeof(O)
/sizeof*O-1?l+(sizeof O/sizeof(*O)-2)/2:(
sizeof(O)/sizeof*O-2)/2];while(*I){putchar(
*I++-1);}}
return 0;}
Deadline to #3 is approaching rapidly - has anyone actually submitted anything?
I've only just started to learn, looking at any of the stuff you people are posting. Well impressed. GAGGING to know the results...