Monthly Archives: July 2011

Bricolage programming example

I wrote this for the PPIG newsletter last year, but as there has been a hold-up in publishing the newsletter, I’ve put it here:

My paper for PPIG 2010 was about bricolage programmers, in
particular artists who write software without any clear plan, but just
reacting to the results of each edit. From feedback it is clear that
the paper could have done with a decent case study, so I thought I’d
contribute the following example to this newsletter. This is not
meant to illustrate great art, or indeed great programming, but just
to act as a talking point when discussing alternative approaches of
programming. Full versions of the examples are available
on sketchpatch.

Imagine a visual artist, programming their work using the Processing
environment, a language based on Java. They begin with an urge to
draw superimposed curved lines, and come up with the following
program, shown with its output:

  1. float rx() { return(random(width)); }
  2. float ry() { return(random(height)); }
  3.  
  4. void draw() {
  5.   background(255);
  6.   for (int i = 0; i < 20; ++i) {
  7.     bezier(rx(), ry(), rx(), ry(), rx(), ry(), rx(), ry());
  8.   }
  9. }

On seeing the output, they are struck first by how hairy it looks,
but then by the suggestion of a scribble. They decide that they are
interested in the latter, and change their program to join the curves
together, removing the hairiness and accentuating the scribble:

  1. void draw() {
  2.   background(255);
  3.   float x = rx(); float y = ry();
  4.   for (int i = 0; i < 5; ++i) {
  5.     float x1 = rx(); float y1 = ry();
  6.     bezier(x, y, rx(), ry(), rx(), ry(), x1, y1);
  7.     x = x1; y = y1;
  8.   }
  9. }

The artist reflects upon the letter-like quality of the scribble
forms, and decides to try writing letters across the page, grouped
into word-like forms:

  1. float letterSpace = 30;
  2.  
  3. float rx() { return(random(letterSpace + 10)); }
  4. float ry() { return(random(height - 10)); }
  5. int rWordlen() { return(3 + int(random(4))); }
  6.  
  7. void draw() {
  8.   background(255);
  9.   int letters = (int) (width / letterSpace) - 4;
  10.   int wordLen = rWordlen();
  11.   int word = 0;
  12.   float x = rx(); float y = ry();
  13.   for (int letter = 0; letter < letters; ++letter) {
  14.     float ox = letter * letterSpace + word * letterSpace;
  15.     if (wordLen == 0) {
  16.       wordLen = rWordlen();
  17.       word++;
  18.     }
  19.     for (int i = 0; i < 3; ++i) {
  20.       float x1 = rx() + ox; float y1 = ry();
  21.       bezier(x, y, rx() + ox, ry(), rx() + ox, ry(), x1, y1);
  22.       x = x1; y = y1;
  23.     }
  24.   }
  25. }

The output has a handwritten quality, almost appearing to be readable,
a quality of `automatic writing’ used by mystics to supposedly channel
the spirit world. This may bring further conceptual development in
our artist’s mind, but at this point we leave will them pondering.

Programming of the Art Computer

After getting frustrated with trying to have a discussion about programming languages within the confines of twitter, I made a mailing list, mentioned it to a few people and suddenly 100 people appeared.  It’s called potac, Programming of the Art Computer, with the topic being the design of (rather than the use of) programming languages for the arts.  It’s unmoderated, but it’s well worth browsing the archives to get a feel for the topic before diving in.