Recreating the first computer-generated screenplay
SAGA III is a playful reimplementation of one of the first known screenplays generated by a software program. Developed for National Novel Generation Month 2015, the program is a black box recreation of the output of the 1962 original. This project was an invited contribution to the Workshop on the History of Expressive Systems.
SAGA III was created to honor one of the lesser-known early computer-generated works: SAGA II, a program which can generate an infinite number of variations on a simple screenplay.
In 1962, CBS Television was producing a documentary on the then-nascent science of artificial intelligence. In addition to covering chess-playing, computer vision, and speech synthesis, the filmmakers wanted explore the question of whether computers could be “creative.” The final program, The Thinking Machine (1962), includes a segment on programming the advanced TX-0 computer, then on permanent loan to the MIT Research Laboratory of Electronics. The producers convinced the TX-0 team, on very short notice, to write a program that could generate an infinite number of stereotypical TV Western screenplays. CBS filmed multiple instances of the program’s output, including one bug-filled run in which the human actors become stuck in an infinite loop (perhaps the earliest deliberate “glitch art”).
A SAGA II story features two characters: a bank robber escaping with stolen money, and a sheriff who follows in pursuit. The character exhibit distinct personality traits: the robber frequently drinks alcohol and attempts to hide the money; the sheriff will fire his gun at the robber if the robber is visible to him.
As in modern role-playing games, each character can take a certain amount of damage until he dies, and character behavior changes in response to injury. Eventually one of the characters is killed, and the other is the victor of the scenario.
SAGA II is underappreciated relative to other early computer-generated art, though it would be many years before simulations with this depth were employed to generate creative works. Donald Knuth does describe the program in detail in his chapter on randomness in The Art of Computer Programming, and includes some of the most complete transcripts readily available online:
Saga #2. (The gun is in the right hand; the money is in the left hand; the glass is on the table; the bottle is on the table; 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.) ROBBER: (The robber is at the window.) Go to door; open door; go thru door; close door; go to corner; put money down at corner; go to window; put gun down at window; lean on window and look; lean on window and look; go to corner; count money; go to table; pick up glass with right hand (empty); take glass from right hand with left hand; pick up bottle with right hand; pour; put bottle on table; take glass from left hand.
National Novel Generation Month encourages participants to have fun. To that end, I intended to produce output that superficially resembled the screenplays generated by SAGA II, but did not seek to replicate its inner workings. That said, studying some implementation details was instructive, especially given that the number of extant transcripts is quite small.
SAGA III is written in Python. The implementation demonstrates many of the features of the original: each actor’s hand is individually represented, and there is a simple world model of containers and supporters.
At each time step, the actors “roll for initiative” (much like in modern RPGs) to determine who performs an action. Because the robber appears in the scene first, the sheriff’s initiative is hard-coded to be zero for the initial time steps.
When an actor wins the initiative roll, the program selects the action for the actor. Each actor maintains a queue of next actions to take, which may be zero-length. If an action is in the queue, it is performed immediately; if no actions are queued, the actor chooses from a weighted series of actions: take a drink, move to a new location, etc. Some actions will take multiple time steps, like “hide the money”; when taken, this action will push all its dependent actions into the queue.
The specific instances of Robber and Sheriff have different weights attached to each behavior. The Robber will attempt to hide the money; the Sheriff will move directly to the house on his first turn. Outcomes of actions are influenced by story state: the Robber has better aim if his drunkenness value is high; the Sheriff has better aim if he is injured.
SAGA III An Original Play by a Computer Act 1 Scene 1 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 gun is in the robber's right hand. The money is in the robber's left hand. ROBBER (The robber is at the window.) open door go through door close door go to corner put money on corner go to table pick up the glass with the robber's left hand put glass on table pick up the bottle with the robber's left hand put gun on table pour pick up the glass with the robber's right hand take a drink from glass take a drink from glass take a drink from glass put glass on table go to window put bottle on window go to corner SHERIFF go to window open door go through door ROBBER go to table SHERIFF close door aim fire robber HIT ROBBER pick up the gun with the robber's right hand aim fire sheriff HIT SHERIFF aim ROBBER aim fire MISSED aim fire sheriff NICKED SHERIFF fire MISSED ROBBER aim SHERIFF fire robber NICKED fire robber NICKED fire MISSED ROBBER fire sheriff NICKED fire sheriff HIT SHERIFF sheriff dies. ROBBER blow out barrel put gun in holster pick up the glass with the robber's right hand go to corner pick up the money with the robber's left hand open door CURTAIN