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) WorksHere is the original: 10 PRINT CHR$(205.5+RND(1)); : GOTO 10Run 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.There’s no logic so it fits on one line. It’s a bigger deal than you would think, even today it is worth eliminating IF statements. This code shows you can fold a random binary choice into a single expression with zero branches, and combined with the C64’s habit of truncating floats, and a coin-toss is done for you.It’s famous now but it was originally straight out of the manuals shipped with the C64 and the VIC-20 back in 1980s, which is where a lot of us grey beards first met it.You can now follow the tutorials and edit the code right in your web browser with the Online Retro IDE– No downloads, configuration, etc necess...
First seen: 2026-05-28 04:01
Last seen: 2026-05-28 12:10