4 ms·
The original Zork source code in MDL which is available here: http://retro.co.za/adventure/zork-mdl/ http://retro.co.za/adventure/zork-mdl/ It's also here on g
by DonHopkins 10y ago
The original Zork source code in MDL which is available here:
http://retro.co.za/adventure/zork-mdl/ http://retro.co.za/adventure/zork-mdl/
It's also here on github: https://github.com/itafroma/zork-mdl https://github.com/itafroma/zork-mdl
It is fascinating to read, and really beautiful code, quite understandable even if you don't know MDL, and practically a form of literature.
I played the original Zork on MIT-DM and also the Infocom versions of course. Reading the source code is like seeing the behind-the-scenes underground rooms and passages at Disneyland!
While I was playing Zork, I found a bug. First some context: when you're battling the troll, you can give things to him, and he eats them! Sometimes he drops his axe, and you can pick it up and kill him with it. He blocks the exits until you kill him.
So I tried "give axe to troll," and he ate his own axe, then cowered in terror: "The troll, disarmed, cowers in terror, pleading for his life in the guttural tongue of the trolls."
Not satisfied with that, I tried "give troll to troll", and he devoured himself: "The troll, who is remarkably coordinated, catches the troll and not having the most discriminating tastes, gleefully eats it."
...Except that I still could not get out of the exit, because every time I tried, it said "The troll fends you off with a menacing gesture."
I figured there must be a troll flag that wasn't getting cleared when the troll devoured itself. And sure enough, I found it in the code, and it's called "TROLL-FLAG!-FLAG"!
Here is an excerpt of the MDL troll code, where you can see the bug, where it should clear the troll flag when the troll devours itself, but doesn't (well that's how I would fix it!):
https://github.com/itafroma/zork-mdl/blob/be079a4ed234071222e991d0da0f9e8c7f96d125/act1.mud#L1337 https://github.com/itafroma/zork-mdl/blob/be079a4ed234071222...
<COND (<VERB? "THROW" "GIVE">
<COND (<VERB? "THROW">
<TELL
"The troll, who is remarkably coordinated, catches the " 1 <ODESC2 <PRSO>>>)
(<TELL
"The troll, who is not overly proud, graciously accepts the gift">)>
<COND (<==? <PRSO> <SFIND-OBJ "KNIFE">>
<TELL
"and being for the moment sated, throws it back. Fortunately, the
troll has poor control, and the knife falls to the floor. He does
not look pleased." ,LONG-TELL1>
<TRO .T ,FIGHTBIT>)
(<TELL
"and not having the most discriminating tastes, gleefully eats it.">
<REMOVE-OBJECT <PRSO>>)>)
(<VERB? "TAKE" "MOVE">
<TELL
"The troll spits in your face, saying \"Better luck next time.\"">)
(<VERB? "MUNG">
<TELL
"The troll laughs at your puny gesture.">)>)
(<AND ,TROLL-FLAG!-FLAG
<VERB? "HELLO">>
<TELL "Unfortunately, the troll can't hear you.">)>>
The troll bugs are also in Zork I! Here's a newspaper article from January 8 1985 about "Infocom Glitches Bug Game Players"!
http://articles.sun-sentinel.com/1985-01-18/features/8501020995_1_typing-troll-adventure-games http://articles.sun-sentinel.com/1985-01-18/features/8501020...
And here's another article from March 29, 1985: "Zork I Fuddles Mental Health With Choices":
http://articles.sun-sentinel.com/1985-03-29/features/8501120597_1_trap-door-computer-games-troll http://articles.sun-sentinel.com/1985-03-29/features/8501120...