You can now play Colossal Cave Adventure, the first text adventure game, via SMS

A year or so before you could be eaten by a grue, you could stand at the end of a road before a small brick building, walk inside, and get a lamp. That was the start of Colossal Cave Adventure, the formative text adventure game (and one of the most important games of all time) written for the PDP-10, back when you could call something a minicomputer if it didn't take up a whole room. Colossal Cave is old enough that it could be (and often was) simply called Adventure—in 1976, no other game had laid claim to that word, yet. Programmer Will Crowther wrote an early version of the game as a fantastical take on the Mammoth Cave in Kentucky, and later Don Woods expanded the game with more overt Tolkienesque fantasy.

At first, the game was only playable on the PDP-10, which was still a huge mainframe, even if it wasn't room sized. But soon enough it was ported to other computers like the Commodore 64 and IBM PC, meaning you could play Colossal Cave on a system that fit on your desk. Now that another 35 years or so have passed, you don't even need that: you can play one of the most formative PC games of all time on your phone, via SMS.

All you have to do is text this number: +1 (669) 238-3683.

I recently watched a fun talk by programmer Chris Swenson from the North Bay Python conference, in which he walked through the process of taking the 1977 source code for Colossal Cave Adventure and rewriting it in a modern language to run on a server you can talk to via text message. Here's the talk: 

A lot of what Swenson says goes over my head, as the talk is aimed at programmers and I am definitely not one. At one point the crowd gasps and then laughs in disbelief as Swenson explains: "I wanted to store the state because this is going to be running on a web server where someone's going to be textring into, and it's going to have to respond, so it needs to keep all of that structure. So I take the entire interpreter state right here, throw it in a dictionary, and then I pickle it, and compress that, and throw that whole big blob in a postgres database and store it per-user." The vibe I get is that this is extremely improper code etiquette. But hey, it worked!

Other parts of Swenson's talk are a bit easier to follow, and there's something really cool in translating a game as old as Colossal Cave into a more modern programming language. Specifically, Swenson was dealing with FORTRAN IV code, common in supercomputers of the day but unused for decades now. Notably, FORTRAN IV predated the standard of 8 bits in a byte. The PDP-10 was a 36-bit system.

"It was a fun challenge to get this to work at all," he said in the talk. "You can't actually take FORTRAN IV and compile it these days. There's not a compiler. And even if there was one, we don't have a PDP-10 to run it on."

Swenson talked about what it was like to deal with the 36-bit code at about the 11 minute mark, which is probably my favorite part of the presentation. Then he talks about simulating "loading the tape drive" for the PDP-10, which is of course just a text file now.

Swenson's interpreter ended up being more complicated than the original code it was designed to interpret, but efficiency isn't really the goal with a fun project like this one. It was only designed to work for this one piece of software, not all FORTRAN IV code, but it does that job, along with adding some modern touches. Like, well, responding by SMS.

Art from the ZX Spectrum version of Adventure. Image via the Internet Archive.

Art from the ZX Spectrum version of Adventure. Image via the Internet Archive.

If you text +1 (669) 238-3683, the server will respond after a few seconds with the opening spiel of Colossal Cave Adventure: 

WELCOME TO ADVENTURE!! WOULD YOU LIKE INSTRUCTIONS?

SOMEWHERE NEARBY IS COLOSSAL CAVE, WHERE OTHERS HAVE FOUND FORTUNES IN TREASURE AND GOLD, THOUGH IT IS RUMORED THAT SOME WHO ENTER ARE NEVER SEEN AGAIN. MAGIC IS SAID TO WORK IN THE CAVE. I WILL BE YOUR EYES AND HANDS. DIRECT ME WITH COMMANDS OF 1 OR 2 WORDS.

(ERRORS, SUGGESTIONS, COMPLAINTS TO CROWTHER)

(IF STUCK TYPE HELP FOR SOME HINTS)

YOU ARE STANDING AT THE END OF A ROAD BEFORE A SMALL BRICK BUILDING. AROUND YOU IS A FOREST. A SMALL STREAM FLOWS OUT OF THE BUILDING AND DOWN A GULLY.

Near as I can tell, the original code didn't display in all-caps like the Colossal Cave Python bot, but playing it via text is a genuinely cool experience. You can play for a few minutes and simply stop responding, and then come back hours or days later and pick up right where you left off, for as long as Swenson keeps the server running.

If you've never played Colossal Cave Adventure, here are a few command tips to get you started:

Type the first letter of compass directions to move: N, S, E, W. NW, SE, etc.

Try one-word commands like "In," "Exit," "Get," "Drop" to interact.

There are a few other commands, but keep things as simple as possible and use single words. You'll be adventuring in no time.