Entries for NaNoGenMo2015
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.


SAGA III: NaNoGenMo2015

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:

Page First example and second example [links are to the excerpts on Safari]

Implementation details


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.

      (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

               Go to window; open door; go through door

                         Fire; sheriff NICKED

                           Close door; aim

                             Fire; MISSED

                             Fire; MISSED

                         Fire; sheriff NICKED

                       Aim; fire; robber NICKED

          Aim; fire; sheriff HIT; aim; fire; sheriff NICKED

                            Sheriff dies.

   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


The Story

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.