The "10 print"

by George Y. Kussumoto

It's crazy to think that after years working with Python, I've stumbled upon this line of code, in a different language and is absolutely stunning. (I mean, what are the odds, really?)

Without further ado:

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

A bash version, just in case you have terminal nearby =)

yes 'c=(╱ ╲);printf ${c[RANDOM%2]}'| bash

In fact, there's an entire book about this line of code. I didn't read it yet, but it certainly made its way to the queue.

My recent interest on generative art led me to this line of code, and it seems to summarize much of the main principles in this art form. The main idea is pretty simple: choose a "/" or "\" randomly (50% probability each), then print it and repeat indefinitely.

What is special about this line? The kind of this maze pattern that is unexpected if you only read the code. You can see a demo on youtube that might be close to the original Commodore 64 Basic version, or just stare at the image below:

10 print maze example

Amazing, right?

In my opinion, in generative art, the principles of randomness and emergence are the spark that makes it so appealing and special. It's unlikely to yield the same output twice from this program, and at the same time, we always keep its characteristics. It's random, but sort of "under control" type of chaos.

The emergence, it's the surprising effect that we get if we execute the program long enough for the "maze" to appear. You can't see the pattern if you draw something like /\\//\/, there's a magic number of iterations where the maze raise to our eyes. A type of arrangement that is never the same, but builds its own identity (sound familiar?).

Lastly, the thing that makes me coming back to generative art is how rewarding is the exploration. That's one of the reasons why this line of code is so beautiful, such a simple concept but endless combinations and results awaiting to be discovered. I highly suggest you to try if you get so slightly interested. Here's a place to start with

Here's an example of my own:

It's so addictive!

We can start with simple questions like "what if I change the probability?", "what if I draw something different?" - Suddenly, you'll start to recognize it everywhere, you'll think about the "applications" in your own designs. It's a rabbit hole and I hope you enjoy going after.

Was I the last programmer to find about this? Share your thoughts.

~ 🤘