Daily Archives: June 2, 2011

The Completed Adventure, Part 1

Don Woods was a graduate student in computer science at Stanford University when he first heard about Adventure in early 1977 from another student who had found it on, of all places, the Stanford Medical Center’s computer system. How it got from Crowther’s employer at the time he wrote it, BBN Technologies in Boston, to northern California is likely to remain a mystery. We do know, however, that Woods was intrigued enough by the game to secure a copy and install it on the PDP-10 minicomputer at the Stanford Artificial Intelligence Laboratory (SAIL), the place where he spent most of his time hacking. After plumbing its (limited) depths as a player, Woods conceived the idea of picking up where Crowther had left off and finishing the thing. Unfortunately, he had only the binary executable, not the FORTRAN source code. What followed is one of the legendary anecdotes of hacker lore, but it’s amusing enough that I’ll repeat it here.

Crowther’s program — as you can verify for yourself if you like — contains only one clue about its origin. In the in-game instructions it says, in Crowther’s inimitable terse diction, “ERRORS, SUGGESTIONS, COMPLAINTS TO CROWTHER.” Crowther had apparently never anticipated the program, at least in this incomplete state, getting beyond the small circle of BBN hackers who would immediately know who “CROWTHER” was and how to contact him. To make things even more difficult, Crowther had left BBN by the time Woods discovered Adventure, and was now employed by Xerox in California. (Perhaps Adventure actually came west with him?) Woods’s solution was to attempt to send an email to crowther@xxx, where “xxx” represented every single current domain on the Internet. In addition to laying claim to being the first spammer, Woods found Crowther at Xerox and secured his permission to complete the game and, most importantly, the precious source code. The Internet was a smaller place in those days…

Woods was not yet 23 when he discovered Adventure, but he had already secured a place for himself in hacker history by co-creating the joke programming language INTERCAL, one of the more bizarre and elaborate examples of hacker humor. In Hackers, Steven Levy makes much of the alleged contrast between East Coast and West Coast hacker culture:

“The difference began with the setting, a semecircular concrete-glass-and-redwood former conference center in the hills overlooking the Stanford campus. Inside the building, hackers would work at any of sixty-four terminals scattered around the various offices. None of the claustrophobia of Tech Square. No elevators, no deafening air conditioning hiss. The laid-back style meant that much of MIT’s sometimes constructive acrimony — the shouting sessions at the TMRC classroom, the religious wars between grad students and hackers — did not carry over. Instead of the battle-strewn imagery of shoot-’em-up space science fiction that pervaded Tech Square, the Stanford imagery was the gentle lore of elves, hobbits, and wizards described in J.R.R. Tolkien’s Middle Earth trilogy. Rooms in the AI lab were named after Middle Earth locations, and the SAIL printer was rigged so it could handle three different Elven type fonts.”

My own feeling is that Levy probably overemphasizes the cultural divide between the alleged crew-cut-wearing, conservative Heinlein fans clustered around MIT and the gentle Tolkien dudes of Stanford. Certainly the groups shared common preferences in hardware (DEC PDP systems), operating systems (TOPS-10), programming languages (no BASIC please!), and the general way that computing “should” be done that gave them much more in common with each other than either group had with the populists of the People’s Computer Company. I do think, however, that we can see some differences in the approaches that Crowther and Woods took to programming, differences which are not so much down to geography as temporality. Before I explain that, though, let me back up quickly and introduce some technical background.

Adventure ran on a DEC PDP-10 under the TOPS-10 operating system. As I’ve already mentioned in passing, DEC’s machines were the unqualified favorites of hackers for at least 20 years, from 1960 to 1980. Both the machines and the company that produced them were consistently innovative, large enough to get the job done but small enough to be flexible. Most importantly, DEC not only understood hacker ideals but embraced them, using cutting-edge research facilities like MIT and Stanford as laboratories to refine and even develop both software and hardware, and sometimes hiring the best and the brightest from that world to come work for them directly. The contrast to a condescending and stodgy behemoth like IBM could hardly have been more stark. TOPS-10, meanwhile, was as beloved as the hardware, having been developed and refined by DEC consistently since the late 1960s with the active assistance of the hacker community. Until Unix and DEC’s own successor OS TOPS-20 took its place, something that was already slowly beginning to happen in 1977, TOPS-10 was simply the hacker OS.

Adventure was written in FORTRAN (Formula Translating System), which was already a very old programming language when Crowther and Woods used it. It was in fact the very first significant high-level programming language to appear, having been introduced by IBM on its mainframe systems in the late 1950s. The version Crowther and Woods used obeyed the so-called FORTRAN IV standard, which dated from 1965. For all the grief that hackers gave BASIC, FORTRAN IV wasn’t much better, requiring as it did line numbers and copious use of the dreaded GOTO statement to get anything done. It was if anything particularly unsuited for writing a text adventure, including as it did almost no text storage or manipulation abilities whatsoever. That’s the reason Crowther chose to put all of the game’s text into an external file; it was just easier to deal with that way. Ironically, FORTRAN 77, a major expansion of the language that included proper string variables and heaps of other improvements, appeared the same year that Woods completed Adventure — but too late to be of use for that project.

So, then, why FORTRAN? Well, beyond FORTRAN and assembly language, in which a program like Adventure would have been tedious indeed to implement, normal TOPS-10 programming languages at this time included only the scorned BASIC and the perhaps even more loathed COBOL, a rigidly inflexible language designed for non-interactive batch processing — i.e., dull billing jobs and other rote calculating tasks that hackers found utterly uninteresting. Displaying plenty of vitriol if not much diversity of wit, Edsger Dijkstra made almost the same statement about COBOL as he had about BASIC: “The use of COBOL cripples the mind; its teaching should, therefore, be regarded as a criminal offense.” So, FORTRAN it was.

Crowther and Wood may both have been working in the same language, but the differences in their coding styles are immense. Crowther’s original source is itself a “maze of twisty little passages,” a huge pile of spaghetti code that is commented only sporadically and tersely. Efficient it undoubtedly is, but readable and maintainable, at least for anyone other than Crowther, it isn’t. Woods’s final version of Adventure is, by contrast, a model of clarity: commented frequently and at length, and structured as cleanly and logically as the limited tool that is FORTRAN IV will allow. Given the limitations Woods was working under, it’s a joy to read. Indeed, its clarity might help explain why Adventure was so quickly and so frequently ported to other languages and platforms; Woods’s code makes doing so almost a mechanical exercise.

Of course, we are comparing a complete with an incomplete program, and that is not entirely fair to Crowther. Certainly it’s unlikely that Woods’s code was so clean and readable during development as it became when the time came to release. Still, I think there might be something else going on here as well. Partly we might see a difference in personalities; Crowther had a reputation as a brilliant but a solitary programmer, after all, and doesn’t strike me as the kind of fellow interested in explaining himself or coddling those who followed in his footsteps. In addition, though, Crowther and Woods came from different hacker generations. Crowther came up in the 1960s, when the rules of “proper” coding were still largely unwritten and the emphasis was on just getting things done in whatever way the primitive hardware of the day could be coaxed into doing it. Woods came up in the 1970s, when the importance of structure, readability, and maintainability were becoming clear, and computer scientists were laying down the rules of good programming practice which we still follow — with a few additions, of course — today.

Next up, some observations on actually playing the completed Adventure.