# Tut­o­r­i­a­l week 5

face

• Show Sketch
``````/** @peep sketchcode */

size(200, 200);
smooth();
fill(0);
face(40,random(160),random(52));

void face(int x, int y, int gap) {
line(x, 0, x, y);               // Nose Bridge
line(x, y, x+gap, y);           // Nose
line(x+gap, y, x+gap, height);
int mouthY = (height+y)/2;
line(x, mouthY, x+gap, mouthY); // Mouth
ellipse(x-gap/2, y/2, 5, 5);    // Left eye
ellipse(x+gap, y/2, 5, 5);      // Right eye
}``````

coloured boxes

• Show Code
``````/** @peep sketch */
size(500, 500);
squareRecursion(0, 0, width, height);

void squareRecursion(float x, float y, float w, float h) {
// Draw a rectangle
fill(random(0,255), random(0,255), 245);
stroke(0);
rect(x, y, w, h);

// Test to see if we should recurse...
if ((random(100) < 80) && (w > 10 || h > 10)) {
// Set a border to go around sub-rectangles
float bx = 3;
float by = 3;
// Calculatue the width and height of sub-rectangles
w = (w - 3*bx) / 2;
h = (h - 3*by) / 2;
// Call the same function to draw the sub-rectangles
squareRecursion(x + bx, y + by, w, h);
squareRecursion(x + bx + w + bx, y + by, w, h);
squareRecursion(x + bx, y + by + h + by, w, h);
squareRecursion(x + bx + w + bx, y + by + h + by, w, h);
}
}``````