Source code for Zork, Hitchhiker’s Guide, and other Infocom games
I wrote some comments on the Wikipedia Zork talk page:<p><a href="https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;Talk:Zork#Link_to_the_original_Zork_source_code_in_MDL" rel="nofollow">https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;Talk:Zork#Link_to_the_origin...</a><p>Link to the original Zork source code in MDL<p>I suggest linking to the original Zork source code in MDL which is available here:<p><a href="http:&#x2F;&#x2F;retro.co.za&#x2F;adventure&#x2F;zork-mdl&#x2F;" rel="nofollow">http:&#x2F;&#x2F;retro.co.za&#x2F;adventure&#x2F;zork-mdl&#x2F;</a><p>Is it OK to link to that source code from Wikipedia? I don&#x27;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&#x27;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.<p>It is fascinating to read, and really beautiful code, quite understandable even if you don&#x27;t know MDL, and practically a form of literature.<p>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!<p>While I was playing Zork, I found a bug. First some context: when you&#x27;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.<p>So I tried &quot;give axe to troll,&quot; and he ate his own axe, then cowered in terror: &quot;The troll, disarmed, cowers in terror, pleading for his life in the guttural tongue of the trolls.&quot;<p>Not satisfied with that, I tried &quot;give troll to troll&quot;, and he devoured himself: &quot;The troll, who is remarkably coordinated, catches the troll and not having the most discriminating tastes, gleefully eats it.&quot;<p>...Except that I still could not get out of the exit, because every time I tried, it said &quot;The troll fends you off with a menacing gesture.&quot;<p>I figured there must be a troll flag that wasn&#x27;t getting cleared when the troll devoured itself. And sure enough, I found it in the code, and it&#x27;s called &quot;TROLL-FLAG!-FLAG&quot;!<p>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&#x27;t (well that&#x27;s how I would fix it!):<p><pre><code>               &lt;COND (&lt;VERB? &quot;THROW&quot; &quot;GIVE&quot;&gt;
                      &lt;COND (&lt;VERB? &quot;THROW&quot;&gt;
                             &lt;TELL
    &quot;The troll, who is remarkably coordinated, catches the &quot; 1 &lt;ODESC2 &lt;PRSO&gt;&gt;&gt;)
                            (&lt;TELL
    &quot;The troll, who is not overly proud, graciously accepts the gift&quot;&gt;)&gt;
                      &lt;COND (&lt;==? &lt;PRSO&gt; &lt;SFIND-OBJ &quot;KNIFE&quot;&gt;&gt;
                             &lt;TELL
    &quot;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.&quot; ,LONG-TELL1&gt;
                             &lt;TRO .T ,FIGHTBIT&gt;)
                            (&lt;TELL
    &quot;and not having the most discriminating tastes, gleefully eats it.&quot;&gt;
                      &lt;REMOVE-OBJECT &lt;PRSO&gt;&gt;)&gt;)
                     (&lt;VERB? &quot;TAKE&quot; &quot;MOVE&quot;&gt;
                      &lt;TELL
    &quot;The troll spits in your face, saying \&quot;Better luck next time.\&quot;&quot;&gt;)
                     (&lt;VERB? &quot;MUNG&quot;&gt;
                      &lt;TELL
    &quot;The troll laughs at your puny gesture.&quot;&gt;)&gt;)
              (&lt;AND ,TROLL-FLAG!-FLAG
                    &lt;VERB? &quot;HELLO&quot;&gt;&gt;
               &lt;TELL &quot;Unfortunately, the troll can&#x27;t hear you.&quot;&gt;)&gt;&gt;
</code></pre>
Xardox (talk) 02:45, 15 January 2013 (UTC)<p>You can give something that you don&#x27;t have? I was under the impression that it wouldn&#x27;t work. Double sharp (talk) 13:17, 13 March 2013 (UTC)<p>You can give anything that&#x27;s in the room or your inventory to the troll. So if his axe falls on the floor, &quot;give axe to troll&quot; will work without having to pick it up first, which is supposed to work. But even before he drops the axe you can go &quot;give axe to troll&quot; and he&#x27;ll eat it while he&#x27;s holding it, since it&#x27;s transitively in the room. That&#x27;s the first thing I did, that made me think of typing &quot;give troll to troll&quot;! Xardox (talk) 03:32, 30 March 2016 (UTC)