// Horseys I (single horsey, monochrome exposure mode) // Jo Wilson, May 2010 // http://www.pixelbrain.me.uk // written in Processing 1.1 // Exposure method based on code by Jared Tarbell - see www.complexification.net int dim = 400; // screen dimensions (square) int jumps = 2; // no. of jumps per iteration - roughly, 'speed'. int x, y; int t = 0; // 2D array to hold exposure values int[] exposure = new int[dim*dim]; int maxexposure; // maximum exposure value // MAIN ------------------------------------------------------------------ void setup() { size(dim,dim,P3D); background(0); frameRate(1000); //choose starting point x = int(random(dim/4, 3*dim/4)); y = int(random(dim/4, 3*dim/4)); } void draw() { moveHorsey(); findMaxExposure(); renderHorseys(); } void moveHorsey() { for (int n=0;n 0) && (x < dim) && (y > 0) && (y < dim)) { float r = random(0,200); if (r < 25) { x = x + 1; y = y + 2; } else if (r < 50) { x = x + 1; y = y - 2; } else if (r < 75) { x = x + 2; y = y + 1; } else if (r < 100) { x = x + 2; y = y - 1; } else if (r < 125) { x = x - 1; y = y + 2; } else if (r < 150) { x = x - 1; y = y - 2; } else if (r < 175) { x = x - 2; y = y + 1; } else if (r < 200) { x = x - 2; y = y - 1; } if ((x > 0) && (x < dim) && (y > 0) && (y < dim)) { exposure[x*dim+y]++; } } // If horsey has escaped, save picture and exit //else { // save("Horseys1bw_"+dim+".png"); // exit(); //} } } void renderHorseys() { // draw to screen for (int i=0;i 1) { ramp = 1; } color c = color(int(ramp*255), int(ramp*255), int(ramp*255)); set(j,i,c); } } } void findMaxExposure() { // assume no exposure maxexposure=0; // find the largest density value for (int i=0;i