Skip to content
Math Background Studioby GordonKit
Open Studio

Truchet

Square tiles flipped at random between two orientations; quarter arcs always connect, forming a continuous maze of curves.

Open Truchet in Studio

Truchet background example

Each square tile has two quarter circles joining the midpoints of neighboring edges. Turn tiles by 90° at random and lay them out: the arcs always connect, forming one continuous, winding maze.

How the maths works

Left: the same tile in its two orientations. Right: the two placed at random. Every edge midpoint has exactly one arc end, so however they are arranged, the curves join up (one is highlighted).
Formula
Chance each tile takes the second orientation
P(flip) = mix
Number of arrangements of m × n tiles
2^(m · n)

Each tile has only two orientations, and every edge midpoint carries exactly one end of an arc. Neighboring tiles share an edge, so their ends meet: no arrangement ever breaks a line.

An m × n grid has 2^(m·n) arrangements; a 10 × 10 grid already has more than 10³⁰. Flip chance is the probability that a tile takes the second orientation: 0 or 1 gives a tidy repeat, and 0.5 is the most random.

The curves never cross or break: each is either a closed loop or runs to the edge of the canvas. On large grids, the distribution of curve lengths connects to loop models in statistical physics.

Parameters

Tile
Tile face: arcs (continuous curves), diagonals (a zigzag maze) or quarter discs (solid shapes).
Arcs · Diagonals · Quarter discs
Tiles per short edge
How many tiles across the short side.
3 to 40
Flip chance
Chance that a tile takes the second orientation. 0.5 is the most random.
Ratio, 0 to 1
Colours
How many colours to use for the tiles or curves.
1 to 8
Line width
Line width, relative to the short side; applies to arcs and diagonals only.
0.002 to 0.04

Examples

Each example opens in the studio with these settings.

Using it as a background

Thick arcs in one or two colours look like a classic maze; quarter discs in many colours look like modern tiles.

A flip chance of 0.1 or 0.9, mostly repeating with the occasional change, is often more pleasing than fully random.