Excercise 6-8

Code


int sqWidth = 20; // dims of the square

// row stuff
int y = 0; // row

// colors
float R = 0;
float G = 0;
float B = 0;

//SETUP
void setup() {
size(400,400);
}

void draw() {
for (int rowNum=0; rowNum < height; rowNum+=sqWidth) { y=rowNum; for (int sqStart=0; sqStart < width; sqStart+=sqWidth) { noStroke(); // pick some random colors R = random(0,255); G = random(0,255); B = random(0,255); fill(R,G,B); rect(sqStart,y,sqWidth,y+sqWidth); } } }