Skip to content
Tech News
← Back to articles

Zero Lines Maze: What the 8-Bit Guy's One-Liner Can Still Teach Us

read original get 8-Bit Guy T-Shirt → more articles
Why This Matters

The article highlights the enduring relevance of the 8-Bit Guy's reinterpretation of the classic C64 BASIC maze program, emphasizing how simple, elegant code can teach valuable lessons in programming efficiency and creativity. This serves as a reminder for both industry professionals and consumers of the importance of understanding fundamental coding principles and the beauty of minimalistic design in technology. Such insights continue to inspire innovation and appreciation for retro computing within the modern tech landscape.

Key Takeaways

What can we learn from 8bitguy’s version of the famous C64 BASIC random maze …?

Say what you will about the 8-Bit Guy, but he just put out a fantastic take on the famous one-liner maze program. Even though I have typed that one-liner more times than I can remember, it still inspired me to write this post today, decades after I first learned it.

Yep, the 8-Bit Guy, controversial as he is, sent me down a proper several day rabbit hole. There are at least four genuinely useful tricks hiding in his final program, but his video does not have a written version from what I can tell, so let me take you through them here.

How the 10 PRINT Maze (Famous Version) Works

Here is the original:

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

Run that on a C64 and you get an endless, scrolling random maze. It looks like magic. It is actually one of the most elegant little hacks in 8-bit BASIC. Many people have “riffed” on it, which was probably best done by Robin.

The whole thing is based on this guy CHR$(205.5+RND(1)) .

RND(1) hands you a float between 0 and 0.999, so the result lands somewhere between 205.5 and 206.499. CHR$ ignores the fraction, so you get character 205 or character 206, at roughly 50/50 odds. Those two codes are the diagonal PETSCII graphics, the / and \ lines.

Print one or the other at random, let the screen scroll, and the diagonals join up into a maze. As 8 Bit Guy says, it looks a bit nicer on the Vic 20 font because it joins up better.

... continue reading