One diagonal per cell, chosen by a coin flip, and a maze nobody drew.
A Truchet tiling with two tiles
Sébastien Truchet’s 1704 idea is a motif that is not rotationally symmetric, laid down at
random orientation so that motifs join across shared edges. This is the smallest possible
version of it: the motif is a diagonal, and there are exactly two orientations.
The one-liner
10 PRINT CHR$(205.5+RND(1)); : GOTO 10
That is the whole program, and on a Commodore 64 it fills the screen with a maze.
RND(1) returns a number in [0, 1), so 205.5 + RND(1) rounds to either 205 or
206 with equal probability, and those two PETSCII codes are the characters \ and
/. Print them forever and the screen scrolls a labyrinth.
This is that program with the terminal taken away: a grid of cells, one diagonal
per cell, a fair coin deciding which.
The substrate. Each cell is a square of Size pixels, and its two corner pairs are
all the geometry the piece will ever use.
Two lines and a coin
For a cell whose corners are A = (x·s, y·s) and B = ((x+1)·s, (y+1)·s):
r = random() uniform in [0, 1)
r > 0.5 → A ─────── B "\"
r <= 0.5 → (B.x, A.y) ─── (A.x, B.y) "/"
Swapping only the x coordinates reflects the segment across the cell’s vertical
midline. Both orientations keep their endpoints on the cell’s corners — which is
the single design decision the whole piece rests on.
Two rows of it. Read on its own, each stroke is just a diagonal in a box, and the
coin flips are visibly independent: there is no run, no rhythm, nothing to predict.
Why it becomes a maze
Because every segment ends on a corner, and every corner is shared by four cells, a
stroke can only ever meet another stroke end to end. There is no near-miss and no
crossing. What look like decisions — this path turns left, that one closes into a
loop — are just two independent coin flips that happened to land on the same point.
A quarter of the field. The joins have started, and the eye has already begun
reading paths rather than cells.
Two thirds. Long corridors, closed rings, dead ends. Nothing in the algorithm
knows what a corridor is.
The whole field
Finished. Every cell was decided in isolation, in one pass, with no look at its
neighbours and no second attempt — and the result is a weave with no seam in it.
Geometry
Width and Height count cells, not pixels, which is worth saying plainly
because their values look like a resolution. Each preset chooses a Size (cell
edge in pixels) such that Width × Size = 3840 and Height × Size = 2160: every
generated cell lands on the canvas and none are clipped.
The cell size is also a compositional choice. At 40 px each diagonal occupies a
large square and the eye reads bold geometry; at 10 px the field becomes a textile
where individual strokes are only visible up close; at 20 px — the default — the
maze reads clearly at screen distance.
The renderings
Only the palette, the stroke weight, and the seed differ. The geometry is identical
across all 20 px presets, which is why they read as the same texture in different
materials.
| Rendering | Size | Seed | Stroke | Ink |
|---|
| White on Green | 20 | 42 | 4 px | White on Dark Green |
| Crimson on Onyx | 20 | 101 | 1.5 px | #DC143C on #353535 |
| Ember | 20 | 77 | 4 px | #E8960F on #1A0800 |
| Slab | 40 | 23 | 8 px | #0D0D0D on #F2F0EB |
| Lattice | 10 | 61 | 1.5 px | #5BBBDE on #0A1628 |
The thin stroke is not a small change. At 1.5 pixels the weave reads as wireframe
and the background dominates; at 4 pixels the ink dominates and the gaps become the
figure. Same coin flips, opposite reading.
Museum mount
The mount variant presents the White on Green pattern within a warm cream
surround: 384 px margin left and right, 216 px top and bottom, leaving a
3072 × 1728 inner field at 16 px cells. The mat color and the artwork are separate
layers — the mat is painted first and the artwork is clipped and translated into
position — so the framing can be reused with any underlying configuration.
Determinism
The coin is SeededRandom, a PCG32 generator seeded from the preset’s Seed, so
the sequence of flips — and therefore the entire layout — is fixed by that one
integer. Each preset declares a distinct nonzero seed, which is the only reason
the renderings differ in pattern rather than only in colour.
The flips are assigned row by row but stored column by column, so the array is
drawn in a different order than it was generated. That has no effect on the image:
every stroke uses the same paint, and each cell’s tile was decided before any of
them were drawn.