size(600,400); float brickHeight = 15; fill(178,34,34); // brick red stroke(205,205,193); // mortar color strokeWeight(3); int row = 0; while (row*brickHeight < height) { // draw one more row float offset = -1.5 * brickHeight * (row % 2); int count = 0; while (3*brickHeight*count + offset < width) { // draw one more brick in current row rect(offset+3*brickHeight*count, row*brickHeight, 3*brickHeight, brickHeight); count++; } row++; }