Truchet Tiles: Generative Pattern Art for Pen Plotters
Truchet tiles turn a simple square tile and a coin flip into mesmerizing mazes and weaves. Learn the rules, the variations, and how to plot your own tiled patterns.
Few generative techniques deliver as much visual payoff for as little code as Truchet tiles. A single repeated tile, randomly rotated across a grid, produces sprawling mazes and woven patterns that look like they took hours of careful design. They took a coin flip per square. Here’s how they work and how to plot your own.
The original idea
The technique is named after Sébastien Truchet, an 18th-century French mathematician who studied the patterns produced by tiling a square divided diagonally into two triangles of different colours, placed in random rotations. Centuries later, the same principle — one asymmetric tile, randomly rotated, repeated across a grid — became a staple of generative art because it’s so simple and so visually rich.
The classic arc version
The most popular Truchet variant for plotter art uses a tile with two quarter-circle arcs drawn corner to corner. There are exactly two distinct rotations of this tile (the other two rotations are identical to these by symmetry). For each cell in your grid:
- Flip a coin
- Draw arc orientation A, or arc orientation B
That’s the entire algorithm. When you tile a grid with random choices between these two states, the individual quarter-circles connect across cell boundaries into long, continuous, maze-like curves that wind across the whole canvas.
Coding it in p5.js
function setup() {
createCanvas(600, 600);
noFill();
stroke(0);
let tileSize = 30;
for (let x = 0; x < width; x += tileSize) {
for (let y = 0; y < height; y += tileSize) {
if (random(1) < 0.5) {
arc(x, y, tileSize, tileSize, 0, HALF_PI);
arc(x + tileSize, y + tileSize, tileSize, tileSize, PI, PI + HALF_PI);
} else {
arc(x + tileSize, y, tileSize, tileSize, HALF_PI, PI);
arc(x, y + tileSize, tileSize, tileSize, PI + HALF_PI, TWO_PI);
}
}
}
}
This is the entire pattern generator. Swap random(1) < 0.5 for a noise-based or weighted choice and the character of the maze changes — biased toward one direction, it reads more like flowing water; perfectly 50/50, it reads as a balanced labyrinth.
Variations worth trying
Line tiles — replace the arcs with a single diagonal line per tile (two rotation states again). The result is angular and architectural rather than flowing — think circuit boards or origami creases.
Weighted randomness — instead of a 50/50 coin flip, bias the probability based on position (e.g. more of one rotation near the edges, more of the other near the centre). This introduces large-scale structure on top of the local randomness.
Multi-tile sets — add a third or fourth tile type (straight lines, empty cells, double arcs) to the random pool. More tile variety means richer, less repetitive-looking output, at the cost of a busier final image.
Variable tile size — instead of a uniform grid, use a quad-tree or varying cell sizes so some areas of the canvas have fine detail and others are coarse. This is a more advanced variation but produces striking results.
Exporting and plotting
Use the SVG renderer (createCanvas(600, 600, SVG) with the p5.svg library) to export vector paths instead of pixels — essential for plotting. As with most generative SVGs, the arcs are drawn in grid order, not travel-optimized order, so run the output through vpype before plotting:
vpype read truchet.svg linesort write truchet_optimized.svg
Pen and paper choice
Truchet patterns plot cleanly with any fineliner — the curves are smooth and the line density is moderate. Pigma Micron at 0.3–0.5 mm gives a confident, legible line. On smooth paper like Hahnemühle Bristol, the arc joins read as seamless continuous curves rather than a grid of separate tiles — which is exactly the illusion that makes Truchet art compelling.
Why it’s worth learning
Truchet tiles are the rare generative technique that’s both genuinely simple to implement and immediately impressive plotted. If you’re newer to generative coding, it’s one of the best second projects after a basic grid sketch — the algorithm is trivial, but tuning the tile design, probability weighting, and grid scale gives you endless room to develop a personal style.
Frequently asked questions
What is a Truchet tile?
A Truchet tile is a square tile with a simple asymmetric pattern — typically a quarter-circle arc or a diagonal line — that can be placed in one of several rotations. Tiling a grid with randomly rotated copies produces continuous, maze-like patterns from a single repeated element.
Do Truchet tiles need complex code?
No — the classic version is one of the simplest generative art techniques to implement. Draw a grid, and for each cell randomly choose one of two tile rotations (a quarter-circle arc flipped one way or the other). A basic version is under 20 lines in p5.js.
What's the difference between arc Truchet tiles and line Truchet tiles?
Arc tiles (two quarter-circles per tile) produce smooth, flowing maze patterns. Line tiles (a single diagonal) produce angular, geometric weaves. Both use the same random-rotation principle but read very differently when plotted — arcs feel organic, lines feel architectural.
Gear mentioned in this post
Antoine Beyeler vpype (Free)
4.9 (480)The command-line Swiss-army knife for pen plotter SVGs — optimizes, reorders, merges, crops and prepares vector files for cleaner, faster plots.
Best for: Everyone — mandatory step between generative art and plotting
Sakura Pigma Micron Fineliner Set
4.8 (5,400)Archival pigment fineliners that are the de facto default for pen plotting — consistent line width, fade-proof ink and almost no skipping.
Best for: Clean, consistent line art on most papers
Hahnemühle Bristol Board Pad
4.8 (410)A heavyweight, ultra-smooth German bristol that takes fineliner ink with glass-like crispness — a premium surface for finished, frame-worthy plots.
Best for: Premium finished plots and fine detail