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.
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. 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.
Thanks! I feel the same way about those folks rewriting the Inform parser in Inform 7.
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.
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.)
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).
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!
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.