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.

10 PRINT · Open in new tab ↗ · Motion begins only when you press Run.

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);    // "/"
    }
  }
}

Open the demo source ↗

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

Lineage

Related
Cellular Automata, Truchet Tiles

Frequently combined with

Works using this algorithm (4)

D-D-Dots
tuplart
Gravity Grid
eliya-stein
ilumz
wolffia-inc-motus-art
Undercover
artplusbrad

References

Last updated 2026-07-16