text adventure game module for Python

Michael Bauers me at michaelbauers.com
Fri Jul 19 19:45:05 EDT 2002


Having always been interested in languages for doing text adventures, I
thought Python was the perfect match.

I wrote a module that reads a file to create a parsing system, and then
provides an interpreter to invoke methods based on matching input against
the sentences in the file.

e.g.'s
   "drop" object, player.drop(obj)
   "look", player.loc().look()
   "north", player.loc().move_north(player)

If the user types in "drop rock", the interepreter will return a string like
'player.drop(rock)' which is then 'exec'd.  Note that interperter excepts
any string for object.

The module also provides classes for common text adventure objects like
room, and player.

I post this to see if anyone finds this an interesting project, and would be
interested in seeing it fully developed.  Perhaps something like this would
have uses beyond text adventures.  Obviously they are mostly a thing of the
past.






More information about the Python-list mailing list