dev/hack/make/play


Equilibrium

Equilibrium is a generative art piece made in a form of a device and a web page. It was made for Radiona's Drawing Machines exhibition.

Equilibrium represents a machine trying to draw an image with exactly the same number of black and white pixels. In each step it checks if the equilibrium is accomplished and if not it generates a random shape in the color with lower pixel count:

Web page is available at https://eq.hglt.ch

After the equilibrium is found the app will wait 15 seconds and start the process again with randomly selected seed.

For generating random numbers it uses random number generator seeded with specified value so starting the process with same seed on any computer will always generate the same image – due to the slight difference in rendering, different browser engines will not generate completely the same image (in the same number of steps) but this will hold true when all used browsers use the same engine (exhibited device uses Chromium).

Device

Device is based on a raspberry pi 3 with a 7" touch screen display and small thermal printer. At any point viewer can restart the process or print out the current image on the printer by pressing one of two buttons on the screen. The printed image also contains a QR code which will lead to the online version of the same process (with same seed value).

Analysis

Even though the whole set of rules for drawing is very arbitrary (the limitations were set to get some more aesthetic result), I was wondering what is the distribution of the number of steps required to find equilibrium on a bigger sample size. I've recorded step counts for 973 runs. This is the histogram of the number of required steps:

We'll get some more information if we separately check the distributions for lower number of steps (up to 4716) and the distribution of the 173 samples with largest number of steps:

We see that, although it's leaning towards smaller number of steps, it's almost ("almost" in a very wide sense :)) uniformly distributed for lower values with decreasing trend towards higher values while it significantly drops for values above around 15000 steps. That was expected as I tweaked the rules a bit towards getting smaller shapes (especially the case with the group of pixels) which help the process to converge to equilibrium faster.

The dataset (list of seeds together with number of required steps to accomplish equilibrium (on Chromium) is here: eq_sorted.txt

Source code

The whole web app is around 290 lines of javascript. It uses David Bau's seedrandom.js for seeded RNG and Box-Muller transform for getting the gaussian distribution (for pixel groups) taken from https://jsfiddle.net/ssell/qzzvruc4/.

Project contains index.html (web site available at https://eq.hglt.ch) and local.html for displaying on a exhibited device. The backend (used for printing the image on a thermal printer) is written in PHP (simply because there was an existing, easy to use library for printing on a thermal printer).

Repository with source code is available at https://bitbucket.org/igor_b/equilibrium

Comments