10 PRINT: the one-line maze every Commodore owner typed
by The RetroMake desk 26 October 2026
A single line of BASIC that fills the screen with an endless diagonal maze, and the reason it works on the C64 and nowhere else. Type it, run it, then change one number.
The whole program is one line. PRINT writes a character; CHR$ turns a number into that character; RND(1) returns a value between 0 and 1; adding it to 205.5 gives a number between 205.5 and 206.5, which CHR$ rounds down to 205 or 206. The semicolon stops PRINT from starting a new line, so the next character lands right after the last one, and GOTO 10 does it again forever. Forty characters later the screen scrolls, and the maze keeps growing until you press RUN/STOP.
Why 205 and 206
PETSCII, the C64's character set, puts two diagonal line graphics at codes 205 and 206: one runs from top left to bottom right, the other from bottom left to top right. Because both are drawn edge to edge inside the 8 by 8 character cell, adjacent cells join up. A random stream of the two characters reads as corridors and walls. On a machine whose character set has no diagonals, such as an IBM PC in code page 437, the same program prints box-drawing fragments and the effect collapses, which is why the line is so bound to Commodore hardware.
Things to change
Replace 205.5 with 77.5 and the program prints the same two glyphs in the shifted character set: on a C64 in its default uppercase mode you get the slash and backslash from the Commodore keyboard instead. Change the 1 in RND(1) to a negative number and the sequence becomes fixed, because a negative argument reseeds the generator; the same maze will appear every run. Add a POKE 53280,0 in front of the PRINT to turn the border black. Each of these is a one-character edit, which is the point of a one-liner: it rewards experiment.
Where it came from
Nick Montfort and nine co-authors spent a book on this program. The earliest printed version they traced is in Commodore's own 1982 user manual, where it appears as a demonstration of random numbers; variants had circulated on PET machines before that. Nobody has claimed authorship. The book argues that the line is a small piece of culture rather than a trick, and the argument is easier to accept after watching it run for a minute.
The listing
10 print chr$(205.5+rnd(1)); : goto 10