These small programs are for beginning programers who wonder: how in heck would one go about writing a text adventure? They also serve as meditations for me as I design fancier adventure game engines.
Here is a prototype text adventure that I wrote in Prolog back in 2002-2004: prolog code files (uses SWI-Prolog, licensed under the GNU GPL V3)
In writing it, my first objective was to create a non-player character inside an adventure game that could do goal solving. I also was considering issues of how to design the simulation such that both human players and NPCs could interact with the simulation on equal footing: To that end, all outputs from the simulation are bi-lingual messages, marked-up-English and Logic. I never got the goal solver entirely debugged, and have since found much more efficient algorithms. Prolog is such a one-trick horse, I've since switched to using inference engines inside other more multifaceted languages.