10 generative art ideas to code this weekend (number 1 is a 40-year-old one-liner)
Ten classic generative art ideas for beginners, from the 10 PRINT maze and Truchet tiles to flow fields, recursive trees and Lissajous curves, with starter code in p5.js.

Key takeaways
- Generative art uses rules, repetition and chance to make images that can surprise even their maker.
- Most classic ideas need only a few lines of code.
- Pick one idea and make ten variations by changing one number at a time.
The fastest way to learn creative coding is to make things. These ten ideas are classics because they’re simple to start and endlessly variable. Try them in the free p5.js Web Editor; new to code? Start with our beginner’s plan.
1.The 10 PRINT maze
In the early 1980s, a one-line program for the Commodore 64 home computer drew an endless random maze from just two characters, a forward slash and a backslash. It became so celebrated that a group of scholars wrote a whole book about it in 2012. Here it is in p5.js: each cell randomly gets one diagonal or the other.
let x = 0, y = 0;
const s = 20;
function setup() {
createCanvas(600, 600);
background(243, 242, 238);
strokeWeight(2);
}
function draw() {
if (random() < 0.5) line(x, y, x + s, y + s);
else line(x, y + s, x + s, y);
x += s;
if (x >= width) { x = 0; y += s; }
if (y >= height) noLoop();
}
Try changing s, the cell size, or the 0.5 probability.
2.Truchet tiles
In 1704 the French priest and scientist Sébastien Truchet studied the patterns made by rotating a single square tile split diagonally into two colours. Truchet tiles are a perfect next step from the maze. A later variation uses quarter circles instead of diagonals, producing flowing, river-like curves.
3.From order to disorder
Draw a neat grid of squares, then add a little random offset to each, increasing as you move across the page. Vera Molnár explored this tension between order and chaos for decades, including in her 1974 series (Dés)Ordres.
4.Random walkers
Start a point in the centre and move it one step in a random direction every frame, leaving a trail. Then add a hundred walkers in different colours. Simple rules, rich results.
5.Flow fields
Use Perlin noise to give every point on the canvas a direction, then release thousands of particles that follow it. The result looks like hair, smoke or wind.
6.Recursive trees
Draw a branch, then from its tip draw two smaller branches at an angle, and repeat. This is recursion, and it’s how many plants actually grow. In 1968 the biologist Aristid Lindenmayer developed L-systems, a way of describing plant growth with rules.

7.Circle packing
Place circles at random and grow each one until it touches another. The page fills with a satisfying, cellular texture. Try limiting the colours to two or three.
8.Lissajous curves
Combine two simple waves at right angles and you get elegant looping figures. The French physicist Jules Antoine Lissajous used them in 1857 to make sound vibrations visible. Lissajous curves are a few lines of code, and changing the ratio between the two waves transforms the shape.
9.Noise landscapes
Draw rows of horizontal lines and push each point up or down with noise. Stack them and you get mountain ridges, sound waves or topographic maps.

10.Instruction drawings, no computer needed
Write a set of rules, such as “draw ten straight lines, each starting where the last one ended, never crossing”, and give it to a friend to draw by hand. Compare the results. Sol LeWitt made whole wall drawings this way, and it’s the clearest way to understand that generative art is about the system, not the tool.
How to turn an idea into a series
- Change one number at a time and save every version you like.
- Limit your colours. Two or three good colours beat twenty.
- Use
randomSeed()so you can recreate a favourite result. - Export at high resolution and print. Work changes when it leaves the screen.
References and further reading
Keep reading
Creative codingWant to learn creative coding? Here’s the plan nobody gives beginners
An artist-first path into creative coding: the six ideas to learn first, a four-week plan, the best free resources, and where to learn in Melbourne.
3 minute read
Creative codingRobots that draw: the strange, beautiful world of pen plotter art
What pen plotter art is, a short history of drawing machines from the harmonograph to today, and how to make your first plotter drawing.
3 minute read