10 PRINT
First appeared 1982 — The Commodore 64 one-liner "10 PRINT CHR$(205.5+RND(1));" (1982); see the book "10 PRINT", 2012. · timeline ↗
community / folk Name — A folk name taken directly from the Commodore 64 one-liner "10 PRINT CHR$(205.5+RND(1));" (1982); canonized as a proper name by the 2012 book "10 PRINT" (Montfort et al.).
In one line A minimal maze-like pattern from the one-line Commodore 64 program `10 PRINT CHR$(205.5+RND(1)); : GOTO 10`: it fills a grid by randomly choosing one of two diagonal characters per cell.
The code
The actual sketch behind the demo above — sandboxed and reproducible. This is the whole thing.
ten-print/index.html
const SEED = Math.floor(Math.random()*1e9);
function setup() {
randomSeed(SEED);
const s = Math.min(windowWidth, windowHeight);
createCanvas(s, s);
background(15);
// 10 PRINT CHR$(205.5+RND(1)); : GOTO 10
// Each grid cell draws one of two diagonals at 50/50. The maze-like
// structure is an emergent side effect of how adjacent diagonals connect.
const N = 22;
const cs = width / N;
stroke(240);
strokeWeight(cs * 0.18);
strokeCap(SQUARE);
for (let i = 0; i < N; i++) {
for (let j = 0; j < N; j++) {
const x = i * cs, y = j * cs;
if (random() < 0.5) line(x, y, x + cs, y + cs); // "\"
else line(x, y + cs, x + cs, y); // "/"
}
}
}How it works
Walk the grid cell by cell (left-to-right, top-to-bottom, wrapping). For each cell, flip a coin and draw one of two diagonal glyphs — "╱" or "╲". On the C64, CHR$(205.5+RND(1)) rounds 205.5 plus a random 0–1 to PETSCII code 205 or 206 (the two diagonal characters), and ": GOTO 10" loops forever. The interest is emergent: random diagonals connect into a continuous maze of corridors with no overall plan. The same idea generalises to any two complementary tiles and any bias between them.
Parameters
gridSize: number — Number of cells per side.cellSize: number — Pixel size of each cell.probability: number — Chance of drawing "/" vs "\\" in each cell (the 10 PRINT coin flip).charSet: array — The two glyphs alternated (classically the forward/back slash).
Lineage
Frequently combined with
- Perlin / Simplex Noise · 2 works
- HSL / Hue Cycle · 2 works
- Particle System · 1 work
- Quadtree / Recursive Quad Split · 1 work
- Flow Field / Vector Field · 1 work
- Bezier / Catmull-Rom Splines · 1 work
- Truchet Tiles · 1 work
Works using this algorithm (4)
References
Last updated 2026-07-16