Last year, MIT Press released a book that examines computing through a miniature art form: the BASIC-language one-liner, or one-line program, and the subculture surrounding it. The title of the book is 10 PRINT CHR$(205.5+RND(1)); : GOTO 10 (or 10 PRINT for short). You can buy a paper copy or download a free ebook from 10print.org.
The unusual title of the book is the one-liner itself, a famous one for the Commodore 64 computer that draws an hypnotic, flowing maze pattern on the screen. This maze is the starting point for all the authors’ speculations and essays, and they range widely.
For context, here is a video of the 10 PRINT pattern in action.
As an example of what is to be found in the book, there is a history of mazes and labyrinths; a survey of repeating mathematical shapes in modern art such as dance; and a couple of chapters devoted to porting the one-liner to other platforms. I found that the Applesoft BASIC version given (for the Apple II+ and later) works just the same on my Model T (TRS-80 Model 100 / Tandy 102), because both BASICs are typical Microsoft implementations of the era. However, because both the Apple and the T lack the special graphic characters that make up the maze on the C64, this version uses slash and backslash characters instead (/ and \), and the result is a little unsatisfying.
10 PRINT CHR$(47+(INT(RND(1)*2)*45)); : GOTO 10
Here is a screenshot of this Applesoft code running on the Model T (actually the Virtual T 1.5 emulator running on my Ubuntu netbook). Note that this pattern, and all the others, is moving and constantly growing. (Click to enlarge.)
I decided to see if I could improve on the canonical Applesoft version with some of the Model T’s own graphic characters, and used 4 of them instead of 2 (characters 251 through 254). My one-liner is shorter than the Applesoft version, and the result is more graphically striking, but it doesn’t generate a maze so much as an irregular network of caves. Not quite what I was going for, but if the Model T used screensavers, this would be a pretty good one, I think. Note that this Model T pattern and some of the others below can be duplicated fairly closely on the Commodore 64 as well (see the “Variations in Basic” chapter).
10 PRINT CHR$(251+(INT(RND(1)*4))); : GOTO 10
I wondered if any M100 mailing list members who’d worked with the graphics characters on the Model T would like to try improving my version and posting their code back to the list, and several did. Jan VANDEN BOSSCHE was the first to respond, saying, “I don’t have a Model T handy – not even an emulator – but what about this?”
10 PRINT CHR$(229.5+RND(1)); : GOTO 10
A nice pattern, especially for writing it in his head. I also like how he managed to keep the “char.5” trick from the original. Jan said, “I could keep the .5 trick because these characters are also next to each other, just like the original C=64 ones.”
Willard Goosey’s judgment was, “Neat pattern, but too closed in to be a maze.” Next, Donald Kyllo offered the following one-liner, to which Willard responded, “Now that’s a maze generator!” I concur.
Finally, Ken Pettit, a VIP in the Model T community (he runs the Club100 user group and invented the popular NADSBox storage device for the Model T), had more or less the last word. He wrote, ‘Okay, well this sorta breaks the spirit of “10 PRINT”, but I have a one-liner that produces very similar graphics to the C64’s one-liner. I make the first statement a “10 PRINT” by printing a CHR$(12) (clear screen) in an attempt to keep with tradition of “10 PRINT”. Otherwise this uses the line command. Take it for what it is.’
I think this and Don Kyllo’s are my favorites. Don’s is more elegant, more in keeping with the original code, but Ken reproduces the original Commodore graphics better. It doesn’t scroll like the others, but fills the screen and starts at the top again with an intriguing ripple effect.
I don’t think that Ken breaks the spirit of 10 PRINT entirely. At least it’s a one-liner, unlike most of the Processing ports in the book, which take a page. On the other hand, the Processing programmers were trying to reproduce the Commodore 64 experience as exactly as possible, as Ken was. At the other extreme, one of the 10 PRINT authors has a student who ported 10 PRINT to (if I recall correctly) 8 bytes of assembly language.
Juan Castro spoke up with a Mattel Aquarius port (!). He remarked, “[The Aquarius] has the convenient ‘spans all character cell’ slashes.” That’s not a port I expected to see.
To my remark that unlike the Aquarius, the Model T doesn’t seem to have graphics characters that fill their cells, John R. Hogerhuis responded, “Alphanumeric and punctuation characters generally don’t fill the cell because of the reserved ‘descender’ line. But the line drawing and block graphics characters fill the cell.”
Apart from the usual retrotechnical knowhow on the list, there was an unusual amount of artistic and cultural back-and-forth, as well as a fair amount of negative reaction. Paper copies of 10 PRINT have been selling very well, but it has been a little controversial. Some people think it’s pointlessly academic. I read it from front to back and enjoyed it a great deal, and I will point out that some of the authors of the book are technically adept professional developers of games and other applications for platforms as diverse as Facebook and the Atari 2600, not atechnical pomo flyweights.
Books recommended on-list for people who enjoy 10 PRINT include:
- 3:16 Bible Texts Illuminated by noted computer scientist Donald Knuth
- Le Ton Beau de Marot by Douglas Hofstadter
And that is where we left the conversation, Reader, but it’s not over. Please leave a comment with your own perspective on the 10 PRINT phenomenon. Have a port to an obscure platform, a link to a video of one, a favorite one-liner with a different purpose, news about a similar project, or hate mail? As long as it’s not pink and doesn’t come in a can, please comment away.