/* 20080424 preset.de new kind of science like cellular automaton */ int numpixels; int[] pixelrow; int[] newrow; int row = 0; int temp; int sample; float mp; int tresh; void setup(){ size(650, 100); numpixels = width; pixelrow = new int[numpixels]; newrow = new int[numpixels]; foo(); } void draw(){ row++; if(row < height){ for(int x=0; x < width; x++){ temp = 0; sample = x - 1; if(sample < 0){ sample = 0; } temp += pixelrow[sample] * mp; temp += pixelrow[x]; sample = x + 1; if(sample > width - 1){ sample = width - 1; } temp += pixelrow[sample] * mp; temp = int(temp % 255); if(temp > tresh){ temp = (255); } //temp = int(temp / 3 * (255 / 3)); newrow[x] = int(temp); stroke(temp); point(x, row); } stroke(0); line(0, row + 1, width, row + 1); }else{ row = -1; } pixelrow = newrow; } void mousePressed(){ foo(); } void foo(){ background(255); for(int x=0; x < width; x++){ pixelrow[x] = int(random(255)); stroke(pixelrow[x]); point(x, 0); } mp = random(1); row = 0; tresh = int(random(255)); }