Skip to content

RetroMake / type-ins

10 PRINT: the one-line maze from the Commodore 64 manual

by Captain Gosub 26 October 2026

A single line of BASIC that fills the screen with an endless diagonal maze, and why it needs a Commodore character set to work. Type it, run it, then change one number.

verified 29 Oct 2026. 450 words.

Commodore 64

10 PRINT: the one-line maze from the Commodore 64 manual

[Download]

Running loads floooh's chips emulator from floooh.github.io in a sandboxed frame. Click inside it once to enable sound.

10 PRINT: the one-line maze from the Commodore 64 manual: A single line of BASIC that fills the screen with an endless diagonal maze, and why it needs a Commodore character set to work. 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. Once the screen is full it scrolls up two lines at a time, 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 205.25 and one diagonal turns up three times as often as the other, so the maze stretches into long corridors running its way; Commodore's 1982 manual suggests the same experiment, adding or subtracting a couple of tenths to give either character a greater chance. Change the 1 in RND(1) to a negative number and the maze disappears: every call reseeds the generator with the same value, so one diagonal repeats across the screen. For the same maze on every run, call RND with a negative number once before the loop instead, as in 5 X=RND(-1), and keep RND(1) in line 10. Add a POKE 53280,0 in front of the PRINT to turn the border black. Each of these is a small 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, and the manual does not say who wrote it. The line runs unchanged on a PET or a VIC-20, the book notes; what ties it to the 64 is where it was printed, in that manual and, as a one-liner, in RUN magazine in July 1984. 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

1 lines. Lower case is what the C64 shows as capitals in its default character set; braces mark control characters: {clr} clears the screen, {wht} selects white.

10 print chr$(205.5+rnd(1)); : goto 10

Original program by Unknown; the earliest printed appearance found by Montfort and colleagues is in Commodore's 1982 manual for the C64, from 10 PRINT CHR$(205.5+RND(1)); : GOTO 10 (Montfort et al., MIT Press, 2013) (2013).