Inspired by one of the earliest computer generated narratives: SAGA II, created by Douglas T. Ross and Harrison R. Morse at MIT and featured on The Thinking Machine, a 1962 television special co-produced by CBS and MIT. The entire hour-long special is online.
I came upon the work the day before NaNoGenMo started (!) while taking Mark Sample's EdX course on Electronic Literature, where it's mentioned in a lecture. Hooray!
Source code for the original SAGA II seems to be lost, but in addition to the footage of storyboards and captions from the television special, there are a few other resources:
PDF scan of the Preliminary Operating Notes for SAGA II includes examples of the branching and switching logic.
The Art of Computer Programming, Volume 2 by Donald Knuth contains two examples of the original output. I used this as my reference implementation:
First example and second example [links are to the excerpts on Safari]
This deliberately doesn't try to mimic the original architecture, as that would hardly make sense in a modern programming environment (and NaNoGenMo is supposed to be fun). I did study all the exemplars I could find and try to back-port the logic, including some pretty tedious manual manipulation of objects.
The code is pure Python 3, no dependencies. In its default mode, it runs through a single scene and outputs a simple text file (line breaks shortened for brevity):
The gun is in the robber's right hand. The money is in the robber's
left hand. The holster is on the robber. The sheriff's gun is in the
sheriff's right hand. The sheriff's holster is on the sheriff. The
glass is on the table. The bottle is on the table.
ROBBER
(The robber is at the window.) Open door; go through door;
close door; go to corner; put money on corner; go to table; go to
window; check gun; go to corner; go to table; pick up the glass with
the robber's left hand; go to window; go to corner; count money
SHERIFF
Go to window; open door; go through door
ROBBER
Fire; sheriff NICKED
SHERIFF
Close door; aim
ROBBER
Fire; MISSED
SHERIFF
Fire; MISSED
ROBBER
Fire; sheriff NICKED
SHERIFF
Aim; fire; robber NICKED
ROBBER
Aim; fire; sheriff HIT; aim; fire; sheriff NICKED
SHERIFF
Sheriff dies.
ROBBER
Blow out barrel; put gun in holster; pick up the money with the
robber's right hand; go to table; open door; go through door; close
door
CURTAIN
In this, the Director's Cut, 349 scenes were restored to meet the 50,000 word rule. SAGA III: A teleplay in one act, 350 scenes and 53,392 words.