I recently came accross the C code for the old computer game “Adventure”.
I played this game for hours on end when I was much younger. So I decided
to port it to QNX6. It’s adventure4 actually. This version seemed easy
to port. It also has some new rooms and features.
So now the games working. Everyone knows that the game was driven from
a text file. I go to look at the text file and it’s somewhat encoded. So
I decided to look at the C code. I remember seeing the Fortran IV code
some 20 odd years ago and it was somewhat reabable.
But the C code! HOLY CRAP ! ! !
What sick bastard wrote this? For starters, none of the variable or
function names are descriptive. Now I realize that someone can easily take
a working program and run the source through something to mangle all of the
names. But even aside from that, all it does is reference array elements
that are numeric only. Here’s a small sample of the code:
int d34() { if (t7(t11(670),16)) { z5(700,670); if (e0[700]>1) { if (m1(64))
{ l12(0,64,1); } else { i7(76,1606,670); }}} } int w24() { if (e0[697]==1)
{ if (g10(114,4) || g10(111,4) || q8(113,-1)) { s4(‘s’,t11(697),5); i7(76,1023,113);
} i7(76,818,113); } i7(64,915,0); } int r26() { if (e0[697]==1) { if (g10(114,3)
|| g10(111,3) || t7(t11(671),9)) { s4(‘s’,t11(697),5); i7(76,1023,669);
} i7(76,818,669); } i7(64,915,0); } int b26() { l12(0,699,1); if (g10(99,1)
|| t7(t11(671),3)) { l12(0,699,0); } else { if (g10(95,3)) { l12(0,699,0);
}} } int b27() { s9(101,485); if (j0[7]==155) { s4(‘s’,155,8); } } int a25()
{ if (e0[759]<135) { i7(0,868,0); } else { i7(2,699,0); } e0[699] = d2(150);
e0[759] += e0[700]; e0[759] += e0[699]; if (e0[759]>1500) { l12(0,759,1500);
} longjmp(n0,1); } int p34() { e0[715] += 1; if (j0[110]==484 && e0[w9]!=412)
{ s9(110,412); s4(‘c’,110,4); } } int a26() { l12(0,686,0); if (e0[715]<1)
{ return 0; } l12(1,702,760); e0[702] *= 100; e0[702] /= e0[715]; e0[702]
*= e0[134]; if (d2(100)<e0[702]) { e0[701] = d2(e0[760]); e0[701] += 1;
*v7(675)= -1; e0[675]=r0-1; while (++e0[675]<=n1) { if (t7(t11(675),3) &&
j0[e0[675]]==435) { e0[701] -= 1; if (e0[701]==0) { l12(1,686,675); return
0; }}}} }
Anyway, if anyone is interested, I have a copy of the code all ready to
go for QNX6.