void drawHouse() {
  
  //TODO for students *************
  //fix the locations of the house by changing the values for the rect and
  //triangle - make it match your handout
  //When you are done, ask for the secret to have a visitor come to your
  //house
  //*********************************
  stroke(255, 255, 255);
  //house
  fill(0, 102, 204);
  rect(0, 0, 200, 250);

  //roof
  fill(0, 0, 0);
  triangle(200, 400, 300, 300, 400, 400);

  //grass
  fill(0, 255, 0);
  rect(0, 250, 400, 50);

  //door
  fill(153, 76, 0);
  rect(300, 100, 50, 100);
}



void drawGrid() {
  //the horizontal lines
  stroke(0, 0, 255);
  line(0, 50, width, 50);
  line(0, 100, width, 100);
  line(0, 150, width, 150);
  line(0, 200, width, 200);
  line(0, 250, width, 250);
  line(0, 300, width, 300);
  line(0, 350, width, 350);
  //the vertical lines
  stroke(255, 0, 255);
  line(50, 0, 50, height);
  line(100, 0, 100, height);
  line(150, 0, 150, height);
  line(200, 0, 200, height);
  line(250, 0, 250, height);
  line(300, 0, 300, height);
  line(350, 0, 350, height);
}

void drawVisitor() {
 noStroke();
  fill(128, 128);
  beginShape();
    vertex(gx, 265);
    vertex(gx+20, 260);
    vertex(gx+25, 300);
    vertex(gx+15, 290);
    vertex(gx+5, 300);
    vertex(gx-5, 290);
    vertex(gx-15, 300);
    vertex(gx-25, 290);
    vertex(gx-20, 260);
  endShape(CLOSE);
  ellipse(gx, 250, 50, 50);
  stroke(255);
  fill(255);
  pushMatrix();
  translate(gx, 250);
  scale(0.75);
  translate(-gx, -250);
    beginShape();
   vertex(gx, 265);
    vertex(gx+20, 260);
    vertex(gx+25, 300);
    vertex(gx+15, 290);
    vertex(gx+5, 300);
    vertex(gx-5, 290);
    vertex(gx-15, 300);
    vertex(gx-25, 290);
    vertex(gx-20, 260);
  endShape(CLOSE);
  ellipse(gx, 250, 50, 50);
  popMatrix();
  fill(0, 200);
  ellipse(gx-5, 245, 8, 12);
  ellipse(gx+5, 245, 8, 12);
  gx= gx+1;
}

void setup() {
  size(400, 400);
  grid = true;
  gx = 0;
}

boolean grid;
boolean anim;
int gx;

void draw() {
  background(255);
  anim = false;
  if (grid) {
    drawGrid();
  }
  drawHouse();
  if (anim) {
    drawVisitor();
  }
}