New C port of "Adventure"

I’ve just uploaded a new C port of Crowther and Woods’ “Adventure” to GitHub. If you know how to use a C compiler, please try out the game and report any bugs to me.

This is a refactoring of Knuth’s CWEB version. What’s wrong with Knuth’s version? Well, Knuth’s version has 81 global variables and a 3000-line main() function. My new version has 42 global variables (still way too many) and its longest function is 600 lines (still way too long). This makes it small enough that David Given’s old “vbccz” compiler (from way back in 2001) can compile it into something that runs on the Z-machine!!

Note that I stopped short of saying it “works” on the Z-machine. It patently does not “work”, yet. Probably due to compiler bugs that I will just have to find and fix one at a time. But even the horribly glitchy current version is pretty amusing… to me. You can play it on Parchment here. The early obvious glitches can be worked around if you’re clever; it’s playable for quite a long ways. I only gave up when going west from the dirty passage crashed the game.

Colossal Cave: The Board Game swag is in it for anyone who finds bugs in “advent.c” or helps fix bugs in vbccz!

1 Like

I just squashed a very big deficiency in the C-to-Inform compiler, and now “advent.z8” runs without all those glitches! I’ve uploaded the new version over top of the old one, so the super-glitchy version is no longer available. Sorry. :slight_smile: But now it actually “works” in Parchment, so go check it out!

I already know about one remaining compiler bug and one actual bug in my translation; I’m hoping to fix at least my own bug today. Third-party bug reports are still eagerly solicited.

This is very neat, and completely mad :smiley:

Thanks! I feel the same way about those folks rewriting the Inform parser in Inform 7. :slight_smile:

Just uploaded another new version; now I’m kicking off for the day. The “score” bug is still there, and I never saw the pirate show up in the game I just played, so maybe there’s another bug lurking there. But several other bugs are fixed now.

New version with a MUCH more user-friendly URL! As seen on Twitter (@ColossalCaveTBG):

If someone with experience (zarf, I’m looking at you:)) could help me understand why @save and @restore sometimes work and sometimes hang the Parchment interpreter, I’d be very grateful. (I think the hang manifests only when I’m looking at a copy of “play.html” on my local machine, and I type “RESTORE” before I’ve SAVEd anything. So it could be an obscure Parchment bug. But I bet it’s my own fault; I really don’t understand what @save does at all. Been assuming it just saves a snapshot of the VM’s entire state.)

Anyway, the source code of “advent” is still available at Bug reports still eagerly solicited.

Yes, @save snapshots the whole VM. But I’ve never looked at how Parchment handles save data, specifically.

Tonight I fixed the last bugs in my code of which I’m aware. In other words, I now believe this to be a complete, playable, winnable version of “Adventure”, as written by Crowther and Woods in 1976 (except that I’m following Knuth in using not-all-capital-letters and not caring about time-of-day or wizardliness, and I’ve also added the commands SAVE and RESTORE for convenience, and the initial help message includes post-1976 credits).

Next up: Adventure 550? :slight_smile:

Parchment uses Quetzal. It’s possible there’s a bug, but it’s also possible you’re not using the opcodes correctly. You’re using a very old version of Parchment so if it is broken I won’t be fixing it!

(I do need to update the Inform 7 template soon…)

Quux+1 just fixed a bug in this port involving the player’s inventory limit, and apparently there was a related (albeit completely inconsequential and unnoticed) bug in Woods’ original program. The one in the ANSI C port (not the one in the original Fortran) apparently allows you to arbitrarily raise the inventory limit, making it similar to the bug in Graham Nelson’s Inform port that lets you use the birdcage as a bag of holding with unlimited capacity.

1 Like