The code is available at http://xenon.stanford.edu/~lswartz/trolley/; the following are brief instructions on how to run the program on one of Stanford's Leland machines.
First, one must log in to one of the Leland machines (e.g. elaine.stanford.edu). The code can be run from its current location, but it's best to copy it to a directory where it can be edited. For example, if one makes a new directory (say,
mkdir trolley) then one can copy the files by typing the UNIX command
cp -r /afs/ir/users/l/s/lswartz/WWW/trolley/code/* trolley
Next, provided one is in the same directory as the code (e.g.
cd trolley), one can start Quintus Prolog by typing "quintus". Once Prolog is open and the
| ?- prompt appears, type
[trolley]. to load in the basic grammar (note the trailing period--it acts like the semicolon in C/Java as a line terminator).
To load in a new file, type
[ned].) The system may remind you that you are redefining various predicate functions (enter
p for proceed). [Unfortunately, I know of no easy way of restoring the initial program state (i.e. no situation loaded) without quitting and re-entering prolog, so if the results seem inconsistent, that may be the reason.]
To test the grammar, type
can(throw_switch). This evaluates if the action
throw_switch is permissible given the current causational data and goal.
obligatory(throw_switch). evaluates if the action is obligatory.
To quit prolog, type ctl-C, and then e (for exit)