Truchet Tiles
First appeared 1704 · Sébastien Truchet — Sébastien Truchet, "Mémoire sur les combinaisons" (1704). · timeline ↗
third-party / eponym Name — An eponym: Truchet described the tiles in his 1704 memoir but did not name them after himself. The "Truchet tiles" name was carried into the modern literature by Cyril Stanley Smith, who popularized them in his 1987 Leonardo paper "The Tiling Patterns of Sebastian Truchet and the Topology of Structural Hierarchy" (which included a translation of Truchet's text). The exact coiner of the eponym is not established here.
In one line A classic technique that tiles a grid with one simple, asymmetric square placed in random orientations, so the tile edges connect into complex global patterns. Variants use diagonal splits or quarter-circle arcs (Smith tiles).
The code
The actual sketch behind the demo above — sandboxed and reproducible. This is the whole thing.
truchet-tiles/index.html
const SEED = Math.floor(Math.random()*1e9);
function setup() {
randomSeed(SEED);
const s = Math.min(windowWidth, windowHeight);
createCanvas(s, s);
background(15);
noFill();
strokeCap(SQUARE);
// Curved Truchet: each cell randomly orients two quarter-arcs
// connecting opposite midpoints.
const N = 14;
const cs = width / N;
strokeWeight(cs * 0.25);
stroke(240);
for (let i = 0; i < N; i++) {
for (let j = 0; j < N; j++) {
const x = i * cs;
const y = j * cs;
if (random() < 0.5) {
// Arcs connecting (top↔right) and (bottom↔left)
arc(x + cs, y, cs, cs, PI/2, PI);
arc(x, y + cs, cs, cs, -PI/2, 0);
} else {
// Arcs connecting (top↔left) and (bottom↔right)
arc(x, y, cs, cs, 0, PI/2);
arc(x + cs, y + cs, cs, cs, PI, -PI/2);
}
}
}
}How it works
Take a single square tile whose design meets its edges at fixed connection points — e.g. a diagonal line corner-to-corner, or two quarter-circle arcs joining adjacent edge-midpoints. Then: 1. For each cell of a grid, pick one of the tile's rotations (and/or reflections) at random — for the diagonal tile, 2 states; for the arc tile, 2 rotations. 2. Draw the tile in that orientation. Because every variant aligns at the same edge points, adjacent tiles always connect, so the local randomness assembles into continuous mazes, contours and looping curves. Weighting the random choice, or driving it from noise, biases the texture.
Parameters
tileSet: string — The set of tile motifs used (e.g. quarter-arcs, diagonals).gridSize: number — Number of tiles per side.rotationSet: array — Allowed orientations each tile may be placed in (e.g. 0/90/180/270°).
Lineage
Frequently combined with
- Multi-color Modular Truchet · 3 works
- Geometric / Hexagonal Tiling · 3 works
- Perlin / Simplex Noise · 2 works
- Bezier / Catmull-Rom Splines · 1 work
- Polygon Mosaic · 1 work
- Quadtree / Recursive Quad Split · 1 work
- Cellular Automata · 1 work
- Wave Function Collapse · 1 work
- Modular Assembly / Parametric Character · 1 work
- Generative Typography · 1 work
- 10 PRINT · 1 work
- HSL / Hue Cycle · 1 work
Works using this algorithm (11)
Last updated 2026-07-16