Colossal Cave Adventure in Python
By Christopher Swenson

Colossal Cave, also known as Adventure or ADVENT, is the original text adventure. It was written in FORTRAN IV and there is practically no way to run the original program without translating it. We'll explore software archeology to write a Python interpreter to run the FORTRAN code as-is, without translating it. Come learn about pre-ASCII and 36-bit integers and writing interpreters in Python!

Saturday 5:45 p.m.–6:10 p.m.

The oldest known Colossal Cave source code we have is from 1977 and written for the then 11-year-old PDP-10 in a variant of FORTRAN IV that is now completely defunct and was specific to the PDP-10.

We'll talk briefly about a history of video games, FORTRAN, and the PDP machines that led to this, and explain how the quirks of this machine were baked into its variant of FORTRAN IV. We'll look at some ancient PDP manuals to discover the secrets you need to know to read this amazing source code.

We'll delve into how one goes about writing a simple interpreter in Python to run this FORTRAN IV code as-is: translating strings, implementing its odd arithmetic and conditional statements, reading in data from our "tape" drive, how we get input and send output using our "teletype".

If you want a demo of this game playing right now, it is running on Heroku and accessible via SMS. Just text anything to +1 (669) 238-3683 ("669 ADVENT3") to start a game. Send RESET to restart the game. Case doesn't matter when sending commands. It identifies you based on your phone number and will remember your game indefinitely. (We'll also talk about how we achieved this in Heroku.)

Christopher Swenson

Dr. Christopher Swenson is an architect and principal engineer at Twilio, and is enthusiastic about programming, software engineering, mathematics, writing, and open source. Previously, Christopher worked as an engineer at Simple, Google, and as a code breaker, computer scientist, mathematician, and supercomputer programmer for the US Government. Christopher holds a Ph.D in computer science from The University of Tulsa and wrote the book Modern Cryptanalysis.

Twitter

Sponsors