Beach Image - Kevan, 01/10/03

Each pixel of beach is assigned a target colour, to match a specific target image. Working in a random order, forever, each pixel compares its current pebble to that of a randomly-chosen neighbour; if the neighbouring pebble's colour is closer to the pixel's target colour, it swaps it for its own pebble.

(Pebbles are also given a slight tendency to move the same direction as last time, when comparing, to help large blocks of colour sort themselves out more quickly.)

Press 'z' to flip between the two target images, and 'x' to change the pebble colours (the fourth set of pebbles starts as a copy of the other target image). Click the applet to stamp footprints into the pebbles.

Source code - Built with Processing