Skip to content

Truchet Tiles

You'll fill a grid with tiles chosen at random from a tiny set, and watch a maze or a tangle of arcs appear out of a rule that fits in five lines.

About

In 1704 Sebastien Truchet noticed that a square tile split on the diagonal makes endless patterns when you drop it onto a grid at random, and the Commodore 64 one-liner 10 PRINT did the same thing with two characters. The idea is that a grid, a small tile set and a coin flip give you more variety than you could draw by hand. You'll build the diagonal version first, then the quarter-circle version where every arc meets its neighbor, and then weight the coin so the pattern gets a mood. The common mistake is drawing each tile from scratch instead of writing one tile function and rotating it, which is the whole trick.

At a glance

Per requirement
15 XP
Completion bonus
75 XP
Requirements
5
Takes
One evening
Skill level
Beginner (done it a few times)
Cost
Cheap (under $10)
Supplies
Nothing special
Where
Around town
Other people
On your own

Requirements

  1. 1
    Draw a grid of diagonal tiles picked by a coin flip. Divide an 800 by 800 canvas into 20 by 20 cells and in each one draw either a forward or a back diagonal, chosen with random(1) < 0.5. That is the whole of 10 PRINT. Take a screenshot of the result with the code beside it. Photo
  2. 2
    Swap in quarter-circle tiles so the arcs join up. Each tile gets two quarter-circle arcs on opposite corners and a random rotation of 0 or 90 degrees. If the arcs don't meet at the tile edges your radius is wrong, because it has to be exactly half the cell size. Post one output at 20 by 20 cells. Photo
  3. 3
    Weight the coin and show three different moods. Replace 0.5 with 0.2, 0.5 and 0.8 and render one grid of each from the same seed. A weighted choice is the first dial you get for steering randomness. Post the three side by side with the weight written under each. Photo
  4. 4
    Change the tile size across the canvas. Make the cells smaller toward one edge, or subdivide a cell into four smaller ones when a random check passes. This is where the piece stops looking like wallpaper and starts looking composed. Post the output next to the plain 20 by 20 version from the same seed. Photo
  5. 5
    Print one on paper and look at it from across the room. A home printer or a copy shop on plain A4 is fine. Generative work reads differently at arm's length than on a screen, and the print is how you find out whether the pattern holds up. Take a photo of the print on a wall or a table. Photo