My favorite object containment related ZORK bug (which I discovered in the origin ZORK on MIT-DM, but which persisted in the InfoCom version), involves the troll holding an axe, blocking the door to the depths of the dungeon, who eats anything you give to him:

>GIVE AXE TO TROLL

The troll, who is not overly proud, graciously accepts the gift
and not having the most discriminating tastes, gleefully eats it.

The troll, disarmed, cowers in terror, pleading for
his life in the guttural tongue of the trolls.

To have killed him in cold blood then would have been cruel, so I tried something else:

>GIVE TROLL TO TROLL

The troll, who is not overly proud, graciously accepts the gift
and not having the most discriminating tastes, gleefully eats it.

*POOF*! No more troll!

(I've actually been able to successfully apply this technique of giving HN trolls their own weapons (quoting their own words back to them), then giving them to themselves (pointing them back to their previous posts), to make them disappear from HN!)

But giving the troll to itself triggered another bug, because apparently it forgot to clear the TROLL flag, so you could still not leave the room, because when you tried to go through the exit the troll previously blocked, it said that "The troll fends you off with a menacing gesture." even though there was no troll in the room.

Decades later I finally found the Zork source code, and it turns out there was actually a troll flag called "TROLL-FLAG!-FLAG" that it forgot to clear, which the exit depended on.

I wrote up the bug in more details, with links to the source code:

https://news.ycombinator.com/item?id=19672436

DonHopkins on April 16, 2019 | prev | next [–]

I wrote some comments on the Wikipedia Zork talk page:

https://en.wikipedia.org/wiki/Talk%3AZork#Link_to_the_origin...

Link to the original Zork source code in MDL

I suggest linking to the original Zork source code in MDL which is available here:

http://retro.co.za/adventure/zork-mdl/

Is it OK to link to that source code from Wikipedia? I don't know who officially owns it, though. It was never a commercial product, and was developed at MIT. As the Zork article mentions, the Zork source code was leaked way back in 1977, so the cat's been out of the bag for a long time. A link to the actual source code would be a nice thing to cite in that section.

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!):

<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.">)>>

Xardox (talk) 02:45, 15 January 2013 (UTC)

You can give something that you don't have? I was under the impression that it wouldn't work. Double sharp (talk) 13:17, 13 March 2013 (UTC)

You can give anything that's in the room or your inventory to the troll. So if his axe falls on the floor, "give axe to troll" will work without having to pick it up first, which is supposed to work. But even before he drops the axe you can go "give axe to troll" and he'll eat it while he's holding it, since it's transitively in the room. That's the first thing I did, that made me think of typing "give troll to troll"! Xardox (talk) 03:32, 30 March 2016 (UTC)