rect(0, 0, width-1, height-1);
subDivide(5, 50, 50, width-100, height-100);
void subDivide(int n, float x, float y, float w, float h) {
boolean linesHoriz = random(1) > 0.5 ? true : false;
float limitW = random(w);
float limitH = random(h);
for (float j = y; j < (h+y); j+=5) {
drawLine(x, j, x + limitW, j, false);
for (float i = x; i < (w+x); i+=5) {
drawLine(i, y, i, y + limitH, false);
boolean horiz = random(1) > 0.5 ? true : false;
subDivide(n-1, x, y, w, h*t);
subDivide(n-1, x, y+h*t, w, h*(1-t));
subDivide(n-1, x, y, w*t, h);
subDivide(n-1, x+w*t, y, w*(1-t), h);
void drawLine(float strtx, float strty, float finx, float finy, boolean isShape) {
for (int j = 0; j <= int (numSegs); j++) {
float x = (randomGaussian()*.3)+x1 + (fraction * (finx-x1));
float y = (randomGaussian()*.3)+y1 + (fraction * (finy-y1));
void drawRect(float x, float y, float w, float h) {
drawLine(x, y, x+w, y, true);
drawLine(x+w, y, x+w, y+h, true);
drawLine( x+w, y+h, x, y+h, true);
drawLine( x, y+h, x, y, true);
for (int i = 0; i < width; i += 2) {
for (int j = 0; j < height; j += 2) {
fill(random(210, 235), 150);
for (int i = 0; i < 50; i++) {
fill(random(70, 110), 140);
ellipse(random(0, width), random(0, height), random(1, 3), random(1, 3));