int scalefactor; int[][] rArray = new int[8][8]; int[][] gArray = new int[8][8]; int[][] bArray = new int[8][8]; int[] rPoint = new int[2]; int[] gPoint = new int[2]; int[] bPoint = new int[2]; void setup() { rPoint[0] = round(random(0,7)); rPoint[1] = round(random(0,7)); gPoint[0] = round(random(0,7)); gPoint[1] = round(random(0,7)); bPoint[0] = round(random(0,7)); bPoint[1] = round(random(0,7)); scalefactor = 256/16; size(400, 400); framerate(15); background(0); } int[] transthing(int[] input) { int rando = (int) round(random(0,3)); if (rando == 0) input[0]++; else if (rando == 1) input[0]--; else if (rando == 2) input[1]++; else if (rando == 3) input[1]--; if (input[0] < 0) input[0] = 7; else if (input[0] > 7) input[0] = 0; if (input[1] < 0) input[1] = 7; else if (input[1] > 7) input[1] = 0; return input; } void draw() { rPoint = transthing(rPoint); gPoint = transthing(gPoint); bPoint = transthing(bPoint); rArray[rPoint[0]][rPoint[1]] = 16; gArray[gPoint[0]][gPoint[1]] = 16; bArray[bPoint[0]][bPoint[1]] = 16; for(int i = 0; i < 8 ; i++) { for(int j = 0; j < 8 ; j++) { rArray[i][j]--; gArray[i][j]--; bArray[i][j]--; if (rArray[i][j] < 0) rArray[i][j] = 0; if (gArray[i][j] < 0) gArray[i][j] = 0; if (bArray[i][j] < 0) bArray[i][j] = 0; } } rArray[rPoint[0]][rPoint[1]] = 16; gArray[gPoint[0]][gPoint[1]] = 16; bArray[bPoint[0]][bPoint[1]] = 16; for(int i = 0; i < 8 ; i++) { for(int j = 0; j < 8 ; j++) { //fill((random(0,16)*scalefactor)-1,(random(0,16)*scalefactor)-1,(random(0,16)*scalefactor)-1); fill(colorDo(rArray[i][j]),colorDo(gArray[i][j]),colorDo(bArray[i][j])); noStroke(); rect(i*width/8, j*height/8, width/8, height/8); } } } int colorDo(int col) { col = col * 16; return col; }