Blog  |  Publications  |  Puzzles
Fun & Games  |  About

The mark of the unicorn

It’s been a long while since I’ve posted, but hopefully, there are still one or two of you out there who understand the value of a good RSS feed. I’m back to write about a book I’m enjoying, with the following cryptic title:

10 PRINT CHR$(205.5+RND(1)); : GOTO 10

If this line of BASIC code already means something to you, then you are probably going to enjoy the book, go buy a copy right now, the proceeds go to a great charity. If the title looks like a bizarre and useless incantation (it is!), read on.

The book is an exploration of its title: A one-line BASIC program that was intended to run on an early 80s Commodore 64 computer. The program produces the maze-like pattern shown on the book’s cover, and its inner sleeves.

Each chapter explores a different facet of this program, and by doing so it covers an incredible amount of ground. There is a chapter on mazes, a chapter on randomness, a chapter on grids, a chapter on the BASIC language, and so on. If you think this is a lot of pages to devote to a one-line computer program, you are mistaken. This is not a long book, and it barely scratches the surface of each of the diverse subjects it touches upon, from Falcon looms and Truchet tiles, to 8-bit computers and flying toasters. There have been many books written about mazes, and whole careers built upon the study of randomness. Here each of these subject gets just a little chapter.

It is the surprising depth and far-reaching ramifications of little useless programs like 10 PRINT that got me into this game, back in the early 80s. I had a Timex Sinclair, and a VIC 20, both purchased at K-Mart, and I fondly remember writing one-liners like these, staring into the glowing phosphors of a little television, until I could barely keep my eyes open in the early morning light. During the months that I manipulated those phosphors, the symbols they represented were manipulating me. My fevered brain underwent more intellectual growth during that period than any time in my life since my early childhood.

The book was written by a team of what my colleagues call “unicorns” – cross-disciplinary people who bridge the worlds of creativity and technology. I was expecting a set of disconnected essays from different voices, but I didn’t get it. The authors used a Wiki to collaborate, and the book feels as if it were written by a single, extremely erudite, polymath author. The chapters cover separate subjects, but the whole is very much connected, helped by it’s extremely constrained subject – that single one line program. Although the book necessarily describes some technical subjects, it is written for a lay audience.

I think of myself as a unicorn. There are a lot of us out there, but we are not as common as I would like. My feeling is that unicorns provide an important bridge between the humanities and the sciences, and that unicorn skills should be nurtured. All of my professional career, I have obsessed over a set of subjects which were, until recently, not given sufficient attention in the computer science press.

For example, I’ve always been fascinated by the RND() function in the BASIC language – I initially thought it was the most important feature of the language. For a long time, the amount of joy I derived from writing software was proportional to the amount that the features depended on randomness. There is a relationship between the RND() function and the perception of utility. To me, programs that are useful, and that do not require randomness, are useful, but boring — they fill out your tax return and monitor patients in hospitals. The RND() function is like a firehose from God, and the programs that use it are useless, but fun — they are games, and simulations, and art.

So, as an auto-didact (as many unicorns are), I was surprised that in programming texts that describe programming languages, the RND() (or rand() or random()) feature is always given such brief, almost dismissive treatment. I’ve even met programmers who (gasp!) have never used it! Meanwhile outside of programming language texts, the topic is barely discussed. It’s not a topic that non-programmers have been exposed to. To me, it’s the first thing you should learn as a neophyte programmer — it opens up programming in a big way. Yet so many computer science students are not exposed to it early enough – instead, they are compelled to write functions which factor numbers and store fractions, and do other numeric manipulations. Many programmers have thrived in this sterile environment, but it doesn’t suit unicorns. For us, making random poetry and assembling Truchet tiles is a much better follow up to “Hello, World.”

The only way to really appreciate the wonder of what you can do with RND() is to write some code. Immerse yourself in it. Play with it. It’s programming as play, rather than programming as work. And it’s more fun to play with something when it’s easy — when there are virtually no barriers to entry. The one line BASIC program was my E-ticket to this world of wonder. Useless one line BASIC programs are a kind of activity that used to be called “recreational programming”. In addition to the C64 magazines discussed in the book, there used to be a wonderful recreational programming column in Scientific American by A. K. Dewdney (I was a little late for Martin Gardner); half my career owes its existence to these publications, and especially Dewdney’s column – it was my principle reference.

This same activity today tends to be called “creative coding”, and we’re no longer using BASIC, but a different set of tools: Processing, Cinder, Open Frameworks, Javascript, Node, whatever floats your boat. And some of the tools, most notably Processing, have a low enough barrier to entry that we can almost (but not quite) recreate the experience of 10 PRINT.

Another feature of unicorns is that they don’t mind using programming techniques that are no longer on the list of officially approved methodologies by the software engineering orthodoxy. Incantations are only a means to an end. We are not in the business of making incantations, we are in the business of making universes, using incantations as a tool. 10 PRINT, for example, contains a GOTO command. GOTO, of course, has been the bane of readable code almost since the second edition of “The Elements of Style”, and the BASIC language itself sits on a lowly plain of derision slightly above COBOL. The book also addresses the unfortunate gulf between recreational coders and the computer science establishment.

Ultimately, it is the love of RND() that separates this particular creative coder from your dyed-in-the-wool computer science nerd. At this late stage in my creative programming career, I no longer make as much use of RND() – I’ve discovered new ways to achieve the same important thing it gave me: complex and beautiful behavior with very little effort. The holy grail of the unicorn is the perfect one-line program. The one-line program that succeeds in recreating the universe, and making its own DNA, and breeding with itself so that a new sub-universe is born. This is our philosopher’s stone.

What the book helped me to remember is that joyful process of trying to create the universe with a line of code. Each time, I would get something interesting, like a labyrinth or a kaleidoscope; but I wouldn’t quite get that ultimate spark. So I would try again, never quite thinking that I had succeeded in creating the universe I sought. The book shows that the universe was already there — like the grains in a Mandelbrot filament, each of those little programs already contains a little universe, you just need to pay attention. Zoom in the right direction, and you’ll see it.

Unfortunately, one line programs, like unicorns, have become an endangered species. Those of us who remember one line BASIC despair at the new hurdles that have been raised, which prevent young people from discovering the joys of the random number generator. When we expunged GOTOs from the reserved words of all the new programming languages, when we made our code structured, object-oriented and useable for large complex software engineering projects, we also made it much harder for kids and teens to use those same technologies to explore the imaginary landscape. If the first programming language I had been exposed to was Java, I think I might have ended up in a different profession entirely.

The proceeds of this book go to PLAYPOWER – a charity which aims to give disadvantaged kids access to extremely cheap computers that have a one line BASIC. This seems like a wonderful thing. Damn, I want one of those computers too!

I miss my VIC 20.

Share and Enjoy:
  • Digg
  • del.icio.us
  • Facebook
  • Google
  • Design Float
  • E-mail this story to a friend!
  • HackerNews
  • MySpace
  • Reddit
  • Slashdot
  • StumbleUpon
  • Suggest to Techmeme via Twitter
  • Twitter

2 Responses to “The mark of the unicorn”

  1. Damon Says:

    I think we used to call you Unicorns “Pirates”.
    Personally, I still do.
    I’m doing WordPress production at a Medical Marketing Agency over by LAX..
    Boob Bob before-and-after images et al & PHP.
    Low stress so I can focus on other intellectual pursuits for a change.
    And yeah..I’m enamored with you crazy auto-didact types that sat up till all hours in your childhood manipulating pixels and found an entire universe in it.
    And you, Sir, are a river to your people.
    Like Clint says in “Outlaw Josie Wells”
    “I rode with ya..I got no complaints.”

  2. Eduard Schwan Says:

    What a delight to bump via a random walk into another unicorn… I too loved the elegant simplicity of bresenham line interference patterns, fractals, and simple programs that did complex things… Looks like I have quite a bit more perusing to do on your site and blog… Some great software here… And yes, dewdney and Gardner were much discussed in my house growing up (I just rediscovered hexaflexagons and made a bunch as gifts this year). Consider yourself bookmarked! :)
    Ttfn,
    Eduard