Adventure

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.

Almost looks like some of the source code from the Obfuscated C Code
Contest. It’s worth having a look if you’ve never seen it:

http://www0.us.ioccc.org/main.html


Gilles

Bill Caroselli wrote:

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.

Bill Caroselli wrote:

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.

I think I remember reading someplace that the C code was automatically
generated by a Fortran to C converter. That knowledge doesn’t make it
any easier to read, but it might do something for your bad thoughts
about the guy that wrote it!

Murf

Bill Caroselli wrote:

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.

Ah, Adventure… that was the first game I ever completed. On my Vic-20.

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 ! ! !
[… horrible, seizure-inducing example code …]

Maybe it was generated from f2c (ancient Fortran to C translator) or
something nasty like that? Please?!?


Chris Herborth (cherborth@qnx.com)
Never send a monster to do the work of an evil scientist.

I have seen it, and I agree. I was going to mention it. I just couldn’t
figure out how to spell ‘Obfuscated’.

The best ones that I’ev seen look like typewritter pictures. Know what
the program does when you run it. It prints out typewritter pictures.


Gilles Roy <groy@qnx.com> wrote:
GR > Almost looks like some of the source code from the Obfuscated C Code
GR > Contest. It’s worth having a look if you’ve never seen it:

GR > http://www0.us.ioccc.org/main.html

GR > Gilles


GR > Bill Caroselli wrote:

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.


Bill Caroselli – Q-TPS Consulting
qtps@earthlink.net

Bill Caroselli <qtps@earthlink.net> wrote:

But the C code! HOLY CRAP ! ! !

What sick bastard wrote this?

I imagine that since encryption technology wasn’t quite as advanced in those
days when this was originally written, chances are the algorithm isn’t all
that secure. I suspect the code is intentially made obfuscated to add some
security to the encryption and that this was an effort to make it more
difficult to arbitrarily decrypt the file.

Anyway, if anyone is interested, I have a copy of the code all ready to
go for QNX6.

Get it compiled up and running and we can make it available on QNXzone.

Cheers,
Camz.


Martin Zimmerman camz@passageway.com
Camz Software Enterprises www.passageway.com/camz/qnx/
QNX Programming & Consulting www.qnxzone.com

camz@passageway.com wrote:
cpc > Bill Caroselli <qtps@earthlink.net> wrote:

But the C code! HOLY CRAP ! ! !

What sick bastard wrote this?

cpc > I imagine that since encryption technology wasn’t quite as advanced in those
cpc > days when this was originally written, chances are the algorithm isn’t all
cpc > that secure. I suspect the code is intentially made obfuscated to add some
cpc > security to the encryption and that this was an effort to make it more
cpc > difficult to arbitrarily decrypt the file.

What was cool about the true text file was that you could edit it.
I.E. You could add rooms and personalize the file.
E.I.E.I.O

"You are standing in the boss’s office (Mr. Jerkoff). He’s very
upset and throws an axe at you. The axe misses and disappears.

There is a door that leads to the hallway and to your office. There is
also a trap door that leads to the unemployment office."

Like I said, “Ah the good old days!”



Anyway, if anyone is interested, I have a copy of the code all ready to
go for QNX6.

cpc > Get it compiled up and running and we can make it available on QNXzone.

I’m doing that now.

Bill Caroselli <qtps@earthlink.net> wrote:
BC > camz@passageway.com wrote:

Anyway, if anyone is interested, I have a copy of the code all ready to
go for QNX6.

BC > cpc > Get it compiled up and running and we can make it available on QNXzone.

BC > I’m doing that now.

I have an archive ready to go. Does anyone know how to upload an archive
here using tin?

Bill Caroselli <qtps@earthlink.net> wrote:

Bill Caroselli <> qtps@earthlink.net> > wrote:
BC > > camz@passageway.com > wrote:

Anyway, if anyone is interested, I have a copy of the code all ready to
go for QNX6.

BC > cpc > Get it compiled up and running and we can make it available on QNXzone.

BC > I’m doing that now.

I have an archive ready to go. Does anyone know how to upload an archive
here using tin?

Since this is not a binary newsgroup, it is probably not a good idea
to post directly in. Maybe you should upload somewhere and post a link
here?

It is humbling, and quite depressing, that people who are obviously far more
intelligent than me are devoted to doing this.

Not depressing that they are doing it, but that there are so many of them so
much more intelligent than me, and still without purposeful pursuits.

What hope is there for my purpose? Especially when I am too confused and
stupid to see my own purpose-less-ness.

Perhaps I need a religion.

Robert.

Bill Caroselli wrote:

I have seen it, and I agree. I was going to mention it. I just
couldn’t figure out how to spell ‘Obfuscated’.

The best ones that I’ev seen look like typewritter pictures. Know
what the program does when you run it. It prints out typewritter
pictures.


Gilles Roy <> groy@qnx.com> > wrote:
GR > Almost looks like some of the source code from the Obfuscated C
Code GR > Contest. It’s worth having a look if you’ve never seen it:

GR > > http://www0.us.ioccc.org/main.html

GR > Gilles

http://projects.qnxzone.com/ works well for me.


Evan

Evan Hillas <evanh@clear.net.nz> wrote:
EH > http://projects.qnxzone.com/ works well for me.

EH > Evan

I’ve registered with QNX Zone.
But I can’t see how to upload a new project.

Bill Caroselli wrote:

Evan Hillas <> evanh@clear.net.nz> > wrote:
EH > > http://projects.qnxzone.com/ > works well for me.

EH > Evan

I’ve registered with QNX Zone.
But I can’t see how to upload a new project.

It’s been a while and I remember it being a bit complicated, but from

“My Page” click “Register Project
http://projects.qnxzone.com/register/
” and follow the form.


Evan
*
http://projects.qnxzone.com/register/*

Evan Hillas wrote:

http://projects.qnxzone.com/register/> >*

Eek! that’s what you get for experimenting with html editing mode. ;o

Bill sent me the tar ball and I have now made it available on qnxzone.

http://www.qnxzone.com/downloads/adventure4-qnx6.tgz (binary only)
http://www.qnxzone.com/downloads/adventure4-qnx6-src.tgz (source)

Cheers,
Camz.


Martin Zimmerman camz@passageway.com
Camz Software Enterprises www.passageway.com/camz/qnx/
QNX Programming & Consulting www.qnxzone.com