rkondrup_enwandu_Final_Project

For the final project we created a code which draws four floor plans designed by Mies Van Der Rohe. Using keys, the program draws the farnsworth house (f), crown hall (c), brick country house (b), or barcelona pavilion (p). By pressing the mouse, the canvas is reset and the new selected building plan is drawn with white lines in a soothing animation. The program uses if statements and turtle graphics to animate the lines.

sketch

// ryu kondrup
//emmanuel nwandu
// rkondrup@andrew.cmu.edu
//enwandu@andrew.cmu.edu
// sectionD
// Final_Project

function turtleLeft(d) {
    this.angle -= d;
}


function turtleRight(d) {
    this.angle += d;
}


function turtleForward(p) {
    var rad = radians(this.angle);
    var newx = this.x + cos(rad) * p;
    var newy = this.y + sin(rad) * p;
    this.goto(newx, newy);
}


function turtleBack(p) {
    this.forward(-p);
}


function turtlePenDown() {
    this.penIsDown = true;
}


function turtlePenUp() {
    this.penIsDown = false;
}


function turtleGoTo(x, y) {
    if (this.penIsDown) {
      stroke(this.color);
      strokeWeight(this.weight);
      line(this.x, this.y, x, y);
    }
    this.x = x;
    this.y = y;
}


function turtleDistTo(x, y) {
    return sqrt(sq(this.x - x) + sq(this.y - y));
}


function turtleAngleTo(x, y) {
    var absAngle = degrees(atan2(y - this.y, x - this.x));
    var angle = ((absAngle - this.angle) + 360) % 360.0;
    return angle;
}


function turtleTurnToward(x, y, d) {
    var angle = this.angleTo(x, y);
    if (angle < 180) {
        this.angle += d;
    } else {
        this.angle -= d;
    }
}


function turtleSetColor(c) {
    this.color = c;
}


function turtleSetWeight(w) {
    this.weight = w;
}


function turtleFace(angle) {
    this.angle = angle;
}


function makeTurtle(tx, ty) {
    var turtle = {x: tx, y: ty,
                  angle: 0.0,
                  penIsDown: true,
                  color: color(128),
                  weight: 1,
                  left: turtleLeft, right: turtleRight,
                  forward: turtleForward, back: turtleBack,
                  penDown: turtlePenDown, penUp: turtlePenUp,
                  goto: turtleGoTo, angleto: turtleAngleTo,
                  turnToward: turtleTurnToward,
                  distanceTo: turtleDistTo, angleTo: turtleAngleTo,
                  setColor: turtleSetColor, setWeight: turtleSetWeight,
                  face: turtleFace};
    return turtle;
}









var bdis = 1;
//distance line travels per frame, barcelona pavilion
var fdis = 1;
//distance line travels per frame, farnsworth house
var BrVd = 1;
var BrHd = 1;

var CVd = 1;
var CHd = 1;


function setup() {
    createCanvas(480, 400);
    background(77, 125, 135);


    //vertical lines from left to right
    bv = makeTurtle(28, 83);
    //bv = barcelona pavilion vertical lines
    bh = makeTurtle(28, 83);
    //bh = barcelona pavilion horizontal lines
    // bgv = makeTurtle(width/2, height/2);
    // //bgv = barcelona pavilion grid vertical
    // bgh = makeTurtle(0, 0);
    // //bgh = barcelona pavilion grid horizontal

    fv = makeTurtle(31, 197);
    //fv = farnsworth house vertical lines
    fh = makeTurtle(122, 75);
    //fh = farnsworth house horizontal lines


    //formatting color and weight for barcelona pavilion lines
    bv.setColor(255);
    bv.setWeight(3);

    bh.setColor(255);
    bh.setWeight(3);

    fv.setColor(255);
    fv.setWeight(2);

    fh.setColor(255);
    fh.setWeight(2);
    // bgv.setColor(255);
    // bgv.setWeight(1);
    //
    // bgh.setColor(255);
    // bgh.setWeight(1);

    CV = makeTurtle(185, 94);
    CV.setWeight(3);
    CV.setColor(255);
    // Controls Building geometry oriented along the x-axis of the canvas
    CH = makeTurtle(185, 110);
    CH.setWeight(3);
    CH.setColor(255);

    // Building Geometry
    // Controls Building Geometry oriented along the y-axis of the canvas for Brick Country House
    BrV = makeTurtle(199, 148);
    BrV.setColor(255);
    BrV.setWeight(1);
    BrH = makeTurtle(199, 210);
    BrH.setColor(255);
    BrH.setWeight(1);


}


// function draw() {
//     // if (mouseIsPressed() & mouseX < width/2 && mouseY < height/2) {
//       if (mouseX < width/2 && mouseY < height/2) {
//           drawBarcelonaPavilion();
//       }
//       if (mouseX > width/2 & mouseY < height/2) {
//           drawCrownHall();
//       }
//       if (mouseX < width/2 & mouseY > height/2) {
//           drawBrickCountryHouse();
//
//       }
//       if (mouseX > width/2 & mouseY > height/2) {
//           drawFarnsworthHouse();
//       }
//       if (mouseIsPressed) {
//           background(77, 125, 135);
//       }
//
// }

function draw() {
    // if (mouseIsPressed() & mouseX < width/2 && mouseY < height/2) {
      if (key == 'P') {
          var bdis = 1;
          //distance line travels per frame, barcelona pavilion
          drawBarcelonaPavilion();
      }
      if (key == 'C') {
          CVd = 1;
          CHd = 1;
          drawCrownHall();
      }
      if (key =='B') {
          BrVd = 1;
          BrHd = 1;
          drawBrickCountryHouse();
      }
      if (key == 'F') {
          fdis = 1;
          drawFarnsworthHouse();
      }
      if (mouseIsPressed) {
          bdis = 0;
          //distance line travels per frame, barcelona pavilion
          fdis = 0;
          //distance line travels per frame, farnsworth house
          BrVd = 0;
          BrHd = 0;
          CVd = 0;
          CHd = 0;
          background(77, 125, 135);


      }

}


// function draw() {
//     function keyPressed() {
//         if (keyCode === 66) {
//             drawBarcelonaPavilion();
//         }
//         if (keyCode === 13) {
//             drawFarnsworthHouse();
//         }
//         if (key === 27) {
//             drawCrownHall();
//         }
//         if (key === 42) {
//             drawBrickCountryHouse()
//         }
//     }
// }


function drawBarcelonaPavilion() {

//TO DRAW ALL VERTICAL LINES LEFT TO RIGHT

    //to turn right at starting point
    if (bv.x == 28 & bv.y == 83) {
        bv.right(90);
    }
    // FIRST LINE (left wall)

    //move to line before first vertical door
    if (bv.x == 28 & bv.y == 260) {
        bv.penUp()
        bv.goto(63, 83);
        bv.penDown();
        bv.setWeight(2);

    }
    //SECOND LINE

    //move to after first door from left
    if (bv.x == 63 & bv.y == 101) {
        bv.penUp();
        bv.goto(63, 108);
        bv.penDown();
    }
    //THIRD LINE

    //move to top of second vertical door)
    if (bv.x == 63 & bv.y == 127) {
        bv.penUp();
        bv.goto(80, 83);
        bv.penDown();

    }
    //FOURTH LINE

    //move to bottom of vertical door
    if (bv.x == 80 & bv.y == 85) {
        bv.penUp();
        bv.goto(80, 93);
        bv.penDown();

    }
    //FIFTH LINE

    //move to top of third vertical wall
    if (bv.x == 80 & bv.y == 96) {
        bv.penUp();
        bv.goto(98, 83);
        bv.penDown();
        bv.setWeight(3);


    }
    //SIXTH LINE

    //move to bottom segment of third vertical wall
    if (bv.x == 98 & bv.y == 98) {
        bv.penUp();
        bv.goto(98, 113);
        bv.penDown();
    }
    //SEVENTH LINE

    //move to first of 2 parallel lines in middle
    if (bv.x == 98 & bv.y == 129) {
        bv.penUp();
        bv.goto(282, 155);
        bv.penDown();
        bv.setWeight(2);


    }
    //EIGHT LINE

    //move to second of 2 parallel lines in middle
    if (bv.x == 282 & bv.y == 208) {
        bv.penUp();
        bv.goto(292, 155);
        bv.penDown();
    }
    //NINTH LINE

    //move to second to last line from right
    if (bv.x == 292 & bv.y == 208) {
        bv.penUp();
        bv.goto(398, 150);
        bv.penDown();
    }
    //TENTH LINE

    //move to last line from right (RIGHT WALL)
    if (bv.x == 398 & bv.y == 213) {
        bv.penUp();
        bv.goto(453, 135);
        bv.penDown();
        bv.setWeight(3);

    }
    //ELEVENTH LINES

    //complete final right line
    if (bv.x == 453 & bv.y == 229) {
        bv.left(90);
        bv.penUp();
        bv.goto(28, 83);
        bv.right(90);
        bv.penDown();


    }


//TO DRAW ALL HORIZONTAL LINES TOP TO BOTTOM

    //FIRST LINE

    //go to the first tiny line before the first horizontal door
    if (bh.x == 63 & bh.y == 83) {
        bh.penUp();
        bh.goto(63, 96);
        bh.penDown();
        bh.setWeight(2);

    }
    //SECOND LINE

    //go to the tiny line after the first horizontal door
    if (bh.x == 71 & bh.y == 96) {
        bh.penUp();
        bh.goto(80, 96);
        bh.penDown();
    }
    //THIRD LINE

    //go to the tiny line after the first horizontal door
    if (bh.x == 98 & bh.y == 96) {
        bh.penUp();
        bh.goto(28, 127);
        bh.penDown();
    }
    //FOURTH LINE

    //go to the double room width horizontal line before the door on the left
    if (bh.x == 80 & bh.y == 127) {
        bh.penUp();
        bh.goto(88, 127);
        bh.penDown();
    }
    //FIFTH LINE

    //go to the far right exterior horizontal wall
    if (bh.x == 98 & bh.y == 127) {
        bh.penUp();
        bh.goto(340, 135);
        bh.penDown();
        bh.setWeight(3);

    }
    //SIXTH LINE

    //go to the loooong north wall line in the middle
    if (bh.x == 453 & bh.y == 135) {
        bh.penUp();
        bh.goto(83, 143);
        bh.penDown();
    }
    //SEVENTH LINE

    //go to the line conntecting to two parallel lines
    if (bh.x == 245 & bh.y == 143) {
        bh.penUp();
        bh.goto(275, 155);
        bh.penDown();

    }
    //EIGHTH LINE

    //go to the standalone horizontal wall on the right
    if (bh.x == 359 & bh.y == 155) {
        bh.penUp();
        bh.goto(334, 175);
        bh.penDown();

    }
    //NINTH LINE

    //go to the bottom horizontal line connecting to parallel lines
    if (bh.x == 380 & bh.y == 175) {
        bh.penUp();
        bh.goto(234, 208);
        bh.penDown();
        bh.setWeight(3);

    }
    //TENTH LINE

    //go to the bottom horizontal wall on right
    if (bh.x == 307 & bh.y == 208) {
        bh.penUp();
        bh.goto(274, 229);
        bh.penDown();
        bh.setWeight(3);

    }
    //TENTH LINE

    //to change lineweight on bottom right horizontal wall
    if (bh.x == 370 & bh.y == 208) {
        bh.penUp();
        bh.goto(370, 229);
        bh.penDown();
    }
    //ELEVENTH LINE

    //go to the bottom left exterior wall
    if (bh.x == 453 & bh.y == 229) {
        bh.penUp();
        bh.goto(28, 261);
        bh.penDown();
    }
    //TWELFTH LINE

    //go to the bottom left exterior wall
    if (bh.x == 88 & bh.y == 261) {
        bh.penUp();
        bh.goto(28, 83);
        bh.penDown();

    }






    //TO MOVE THE TURTLES FORWARD
    bv.forward(bdis);
    bh.forward(bdis);


}

function drawFarnsworthHouse() {


    //VERTICAL LINES
    if (fv.x == 31 & fv.y == 197) {
        fv.right(90);
    }
    //FIRST LINE on left

    if (fv.x == 31 & fv.y == 291) {
        fv.penUp();
        fv.goto(122, 75);
        fv.penDown();
    }
    //SECOND LINE FROM LEFT (left edge of building mass porch)

    if (fv.x == 122 & fv.y == 193) {
        fv.penUp();
        fv.goto(166, 193);
        fv.penDown();
    }
    //THIRD LINE (top set of stairs left edge)

    if (fv.x == 166 & fv.y == 224) {
        fv.penUp();
        fv.goto(166, 291);
        fv.penDown();
    }
    //FOURTH LINE (bottom set of stairs left edge)

    if (fv.x == 166 & fv.y == 311) {
        fv.setWeight(3);
        fv.penUp();
        fv.goto(214, 75);
        fv.penDown();
    }

    //FIFTH LINE (top of double doors wall)

    if (fv.x == 214 & fv.y == 121) {
        fv.penUp();
        fv.goto(214, 150);
        fv.penDown();
    }
    //SIXTH LINE (bottom of double doors wall)

    if (fv.x == 214 & fv.y == 193) {
        fv.setWeight(2);
        fv.penUp();
        fv.goto(216, 193);
        fv.penDown();
    }

    //SEVENTH LINE (right edge of top stair)

    if (fv.x == 216 & fv.y == 224) {
        fv.penUp();
        fv.goto(216, 291);
        fv.penDown();
    }
    //EIGHTH LINE (right edge of bottom stair)

    if (fv.x == 216 & fv.y == 311) {
        fv.penUp();
        fv.goto(260, 197);
        fv.penDown();
        }
    //NINTH LINE (rightmost edge of patio)

    if (fv.x == 260 & fv.y == 291) {
        fv.penUp();
        fv.goto(289, 92);
        fv.penDown();
        }
    //TENTH LINE (leftmost edge of wood core above first door)

    if (fv.x == 289 & fv.y == 117) {
        fv.penUp();
        fv.goto(289, 128);
        fv.penDown();
        }
    //ELEVENTH LINE (leftmost edge of wood core below first door)
    if (fv.x == 289 & fv.y == 143) {
        fv.penUp();
        fv.goto(322, 103);
        fv.penDown();
    }
    //TWELFTH LINE (left middle divider of wood core above door)
    if (fv.x == 322 & fv.y == 117) {
        fv.penUp();
        fv.goto(322, 127);
        fv.penDown();
    }
    //THIRTEENTH LINE (left middle divider of wood core below door)
    if (fv.x == 322 & fv.y == 138) {
        fv.penUp();
        fv.goto(356, 103);
        fv.penDown();
    }
    //FOURTEENTH LINE (right middle divider of wood core)

    if (fv.x == 356 & fv.y == 138) {
        fv.penUp();
        fv.goto(390, 92);
        fv.penDown();
    }
    //FIFTEENTH LINE (right  divider of wood core above door)
    if (fv.x == 390 & fv.y == 117) {
        fv.penUp();
        fv.goto(390, 128);
        fv.penDown();
    }
    //SIXTEENTH LINE (right  divider of wood core below door)
    if (fv.x == 390 & fv.y == 143) {
        fv.penUp();
        fv.goto(404, 134);
        fv.penDown();
    }
    //SEVENTEENTH LINE (left side of standalone right side wall)
    if (fv.x == 404 & fv.y == 183) {
        fv.penUp();
        fv.goto(413, 134);
        fv.penDown();
    }
    //EIGHTEENTH LINE (right side of standalone right side wall)
    if (fv.x == 413 & fv.y == 183) {
        fv.setWeight(3);
        fv.penUp();
        fv.goto(443, 75);
        fv.penDown();
    }
    //NINTEENTH LINE (right wall of building)
    if (fv.x == 443 & fv.y == 193) {
        fv.penUp();
        fv.setWeight(2);
        fv.goto(31, 197);
        fv.penDown();

    }



    //HORIZONTALS
    //FIRST 0.5 LINE (top edge of building (Thin))
    if (fh.x == 443 & fh.y == 75) {
        fh.penUp();
        fh.goto(289, 103);
        fh.penDown();
    }
    //FIRST 0.5 LINE (top edge of building (Thin))
    if (fh.x == 443 & fh.y == 75) {
        fh.penUp();
        fh.goto(289, 103);
        fh.penDown();
    }

    //SECOND LINE (top edge of wood core)
    if (fh.x == 443 & fh.y == 103) {
        fh.penUp();
        fh.goto(289, 103);
        fh.penDown();
    }
    //THIRD LINE (top edge of standalone wall)
    if (fh.x == 390 & fh.y == 103) {
        fh.penUp();
        fh.goto(404, 134);
        fh.penDown();
    }
    //FOURTH LINE (bottom edge of wood core)
    if (fh.x == 413 & fh.y == 134) {
        fh.penUp();
        fh.goto(289, 138);
        fh.penDown();
    }
    //FIFTH LINE (bottom edge of standalone wall)
    if (fh.x == 390 & fh.y == 138) {
        fh.penUp();
        fh.goto(404, 183);
        fh.penDown();
    }
    //SIXTH LINE (bottom wall of building)
    if (fh.x == 413 & fh.y == 183) {
        fh.penUp();
        fh.goto(122, 193);
        fh.penDown();
    }
    //SEVENTH LINE (top edge of top patio left of stair)
    if (fh.x == 443 & fh.y == 193) {
        fh.penUp();
        fh.goto(31, 197);
        fh.penDown();
    }
    //EIGHTH LINE (top edge of top patio right of stair)
    if (fh.x == 166 & fh.y == 197) {
        fh.penUp();
        fh.goto(216, 197);
        fh.penDown();
    }
    //NINTH LINE (first step top stair)
    if (fh.x == 259 & fh.y == 197) {
        fh.penUp();
        fh.goto(166, 204);
        fh.penDown();
    }
    //TENTH LINE (second step top stair)
    if (fh.x == 216 & fh.y == 204) {
        fh.penUp();
        fh.goto(166, 209);
        fh.penDown();
    }
    //ELEVENTH LINE (third step top stair)
    if (fh.x == 216 & fh.y == 209) {
        fh.penUp();
        fh.goto(166, 214);
        fh.penDown();
    }
    //TWELFTH LINE (fourth step top stair)
    if (fh.x == 216 & fh.y == 214) {
        fh.penUp();
        fh.goto(166, 219);
        fh.penDown();
    }
    //THIRTEENTH LINE (fifth step top stair)
    if (fh.x == 216 & fh.y == 219) {
        fh.penUp();
        fh.goto(166, 224);
        fh.penDown();
    }
    //FOURTEENTH LINE (bottom edge of patio)
    if (fh.x == 216 & fh.y == 224) {
        fh.penUp();
        fh.goto(31, 291);
        fh.penDown();
    }
    //FIFTEENTH LINE (first step bottom stair)
    if (fh.x == 259 & fh.y == 291) {
        fh.penUp();
        fh.goto(166, 296);
        fh.penDown();
    }
    //SIXTEENTH LINE (second step bottom stair)
    if (fh.x == 216 & fh.y == 296) {
        fh.penUp();
        fh.goto(166, 301);
        fh.penDown();
    }
    //SEVENTEENTH LINE (third step bottom stair)
    if (fh.x == 216 & fh.y == 301) {
        fh.penUp();
        fh.goto(166, 306);
        fh.penDown();
    }
    //EIGHTEENTH LINE (fourth step bottom stair)
    if (fh.x == 216 & fh.y == 306) {
        fh.penUp();
        fh.goto(166, 311);
        fh.penDown();
    }
    //NINTEENTH LINE (to make it stop)
    if (fh.x == 216 & fh.y == 311) {
        fh.penUp();
        fh.goto(122, 75);
        fh.penDown();

    }


    fv.forward(fdis);
    fh.forward(fdis);

    // fh.forward(fdis);
}


function drawCrownHall() {
    // Turns right at first point to draws first vertical line
    if(CV.x == 185 & CV.y == 94){
        CV.right(90);
    }
    // Moves to second point and draws vertical line
    if(CV.x == 185 & CV.y == 160){
        CV.penUp();
        CV.goto(280, 94);
        CV.penDown();
    }
    // Moves to third point and draws vertical line
    if(CV.x == 280 & CV.y == 160){
        CV.penUp();
        CV.goto(230, 110);
        CV.penDown();
    }
    // Moves to fourth point and draws vertical line
    if(CV.x == 230 & CV.y == 136){
        CV.setWeight(1.5);
        CV.penUp();
        CV.goto(197, 174);
        CV.penDown();
    }
    // Moves to fifth point and draws vertical line
    if(CV.x == 197 & CV.y == 250){
        CV.penUp();
        CV.goto(265, 174)
        CV.penDown();
    }
    // Moves to sixth point an draws vertical line
    if(CV.x == 265 & CV.y == 250){
        CV.setWeight(1);
        CV.penUp();
        CV.goto(175, 185);
        CV.penDown();
    }
    // Draws the seventh vertical line and moves to the eighth
    if(CV.x == 175 & CV.y == 220){
        CV.penUp();
        CV.goto(185, 195);
        CV.penDown();
    }
    // Draws the eight vertical line and moves to the ninth
    if(CV.x == 185 & CV.y == 215){
        CV.penUp();
        CV.goto(195, 185);
        CV.penDown();
    }
    // Draws the ninth vertical line and moves to the tenth
    if(CV.x == 195 & CV.y == 220){
        CV.penUp();
        CV.goto(268, 185);
        CV.penDown();
    }
    // Draws the tenth vertical line and moves eleventh
    if(CV.x == 268 & CV.y == 220){
        CV.penUp();
        CV.goto(278, 195);
        CV.penDown();
    }
    // Draws the eleventh vertical line and moves to the twelfth
    if(CV.x == 278 & CV.y == 215){
        CV.penUp();
        CV.goto(288, 185);
        CV.penDown();
    }
    // Draws the twelfth vertical and moves to the thirteenth
    if(CV.x == 288 & CV.y == 220){
        CV.penUp();
        CV.goto(205, 295);
        CV.penDown();
    }
    // Draws the thirteenth vertical line and moves to the fourteenth
    if(CV.x == 205 & CV.y == 315){
        CV.penUp();
        CV.goto(255, 295);
        CV.penDown();
    }
    // Draws fourteenth vertical line and moves to the fifteenth
    if(CV.x == 255 & CV.y == 315){
        CV.penUp();
        CV.goto(185, 57);
        CV.penDown();
    }
    // Draws fifteenth vertical line and moves to the sixteenth
    if(CV.x == 185 & CV.y == 70){
        CV.penUp();
        CV.goto(190, 57);
        CV.penDown();
    }
    // Draws sixteenth vertical line and moves to the seventeenth
    if(CV.x == 190 & CV.y == 70){
        CV.penUp();
        CV.goto(195, 57);
        CV.penDown();
    }
    // Draws seventeenth vertical line and moves to the eighteenth
    if(CV.x == 195 & CV.y == 70){
        CV.penUp();
        CV.goto(265, 57);
        CV.penDown();
    }
    // Draws the eighteenth vertical line and moves to the nineteenth
    if(CV.x == 265 & CV.y == 70){
        CV.penUp();
        CV.goto(270, 57);
        CV.penDown();
    }
    // Draws nineteenth vertical line and moves to the twentieth
    if(CV.x == 270 & CV.y == 70){
        CV.penUp();
        CV.goto(275, 57);
        CV.penDown();
    }
    // Draws twentieth vertical line and moves to the twenty-first
    if(CV.x == 275 & CV.y == 70){
        CV.setWeight(1.5);
        CV.penUp();
        CV.goto(160, 154);
        CV.penDown();
    }
    // Draws twenty-first vertical line and moves to the twenty-second
    if(CV.x == 160 & CV.y == 175){
        CV.setWeight(1.5);
        CV.penUp();
        CV.goto(165, 154);
        CV.penDown();
    }
    // Draws twenty-second vertical line and moves to the twenty-third
    if(CV.x == 165 & CV.y == 175){
        CV.penUp();
        CV.goto(297, 154);
        CV.penDown();
    }
    // Draws twenty-third vertical line and moves to the twenty-fourth
    if(CV.x == 297 & CV.y == 175){
        CV.penUp();
        CV.goto(303, 154);
        CV.penDown();
    }
    // Draws twenty-fourth vertical line and moves to twenty fifth
    if(CV.x == 303 & CV.y == 175){
        CV.setWeight(1);
        CV.penUp();
        CV.goto(212, 154);
        CV.penDown();
    }
    // Draws twenty-fifth vertical line and moves to the twenty sixth
    if(CV.x == 212 & CV.y == 157){
        CV.penUp();
        CV.goto(250, 154);
        CV.penDown();
    }
    // Draws twenty-sixth vertical line and moves to the twenty-seventh (Entry Stairs)
    if(CV.x == 250 & CV.y == 157){
        CV.setWeight(3);
        CV.penUp();
        CV.goto(205, 345);
        CV.penDown();
    }
    // Draws twenty-seventh vertical line and moves to the twenty-eighth (Entry Stairs)
    if(CV.x == 205 & CV.y == 355){
        CV.penUp();
        CV.goto(255, 345);
        CV.penDown();
    }
    // Draws twenty-eighth vertical line and moves to the twenty ninth (Platform)
    if(CV.x == 255 & CV.y == 355){
        CV.penUp();
        CV.goto(180, 295);
        CV.penDown();
    }
    // Draws twenty-ninth vertical line and moves to the thirtieth (Platform)
    if(CV.x == 180 & CV.y == 345){
        CV.penUp();
        CV.goto(285, 295);
        CV.penDown();

    }
    // Draws thirtieth vertical line and moves to the thirty-first(Exterior Building Wall)
    if(CV.x == 285 & CV.y == 345){
        CV.penUp();
        CV.goto(30, 71);
        CV.penDown();

    }
    // Draws thirty-first vertical line and moves to the thirty-second(Exterior Building Wall)
    if(CV.x == 30 & CV.y == 295){
        CV.penUp();
        CV.goto(430, 71);
        CV.penDown();

    }
    // Draws thirty-second vertical (Exterior Building Wall) line and stops
    if(CV.x == 430 & CV.y == 295){
        // CVd = 0;
        CV.penUp();
        CV.goto(185, 94);
        CV.penDown();
    }

    // Draws first Horizontal line
    if(CH.x == 185 & CH.y == 110){

    }
    // Draws second horizontal line  and moves ot the third
    if(CH.x == 280 && CH.y == 110){
        CH.penUp();
        CH.goto(203, 136);
        CH.penDown();
    }
    // Draws third Horizontal line and moves to the fourth
    if(CH.x == 203 & CH.y == 136){
        CH.setWeight(1);
        CH.penUp();
        CH.goto(186, 153);
        CH.penDown();
    }
    // Draws fourth horizontal line and moves to the fifth
    if(CH.x == 212 & CH.y == 153){
        CH.penUp();
        CH.goto(186, 157)
        CH.penDown();
    }
    // Draws fifth horizontal line and moves to the sixth
    if(CH.x == 212 & CH.y == 157){
        CH.penUp();
        CH.goto(250, 153);
        CH.penDown();
    }
    // Draws sixth horizontal line and moves to the seventh
    if(CH.x == 280 & CH.y == 153){
        CH.penUp();
        CH.goto(250, 157);
        CH.penDown();
    }
    // Draws seventh horizontal line and moves to the eighth
    if(CH.x == 280 & CH.y == 157){
        CH.setWeight(2);
        CH.penUp();
        CH.goto(160, 154);
        CH.penDown();
    }
    // Draws eighth horizontal line and moves to the ninth
    if(CH.x == 165 & CH.y == 154){
        CH.penUp();
        CH.goto(297, 154);
        CH.penDown();
    }
    // Draws ninth horizontal line and moves to the tenth
    if(CH.x == 303 & CH.y == 154){
        CH.penUp();
        CH.goto(160, 175);
        CH.penDown();
    }
    // Draws tenth horizontal line an moves to the eleventh
    if(CH.x == 165 & CH.y == 175){
        CH.penUp();
        CH.goto(297, 175);
        CH.penDown();
    }
    // Draws eleventh horizontal line and moves to the twelfth
    if(CH.x == 303 & CH.y == 175){
        CH.setWeight(1);
        CH.penUp();
        CH.goto(175, 185);
        CH.penDown();
    }
    // Draws twelfth horizontal line and moves to the thirteenth (Stairs)
    if(CH.x == 195 & CH.y == 185){
        CH.penUp();
        CH.goto(268, 185);
        CH.penDown();
    }
    // Draws thirteenth horizontal line and moves the fourteenth (Stairs)
    if(CH.x == 288 & CH.y == 185){
        CH.penUp();
        CH.goto(175, 195);
        CH.penDown();
    }
    // Draws fourteenth horizontal line and moves to the fifteenth (Stairs)
    if(CH.x == 195 & CH.y ==195){
        CH.penUp();
        CH.goto(268, 195);
        CH.penDown();
    }
    // Draws fifteenth horizontal line and moves to the sixteenth (Stairs)
    if(CH.x == 288 & CH.y == 195){
        CH.penUp();
        CH.goto(175, 200);
        CH.penDown();
    }
    // Draws sixteenth horizontal line and moves to the seventeenth (Stairs)
    if(CH.x == 195 & CH.y == 200){
        CH.penUp();
        CH.goto(268, 200);
        CH.penDown();
    }
    // Draws seventeenth horizontal line and moves to the eighteenth (Stairs)
    if(CH.x == 288 & CH.y == 200){
        CH.penUp();
        CH.goto(175, 205);
        CH.penDown();
    }
    // Draws eighteenth horizontal line and moves to the nineteenth (Stairs)
    if(CH.x == 195 & CH.y == 205){
        CH.penUp();
        CH.goto(268, 205);
        CH.penDown();
    }
    // Draws nineteenth horizontal line and moves to the twentieth (Stairs)
    if(CH.x == 288 & CH.y == 205){
        CH.penUp();
        CH.goto(175, 210);
        CH.penDown();
    }
    // Draws twentieth horizontal line and moves to the twenty-first (Stairs)
    if(CH.x == 195 & CH.y == 210){
        CH.penUp();
        CH.goto(268, 210);
        CH.penDown();
    }
    // Draws twenty-first horizontal line and moves to the twenty-second (Stairs)
    if(CH.x == 288 & CH.y == 210){
        CH.penUp();
        CH.goto(175, 215);
        CH.penDown();
    }
    // Draws twenty-second horizontal line and moves to the twenty-third (Stairs)
    if(CH.x == 195 & CH.y == 215){
        CH.penUp();
        CH.goto(268, 215);
        CH.penDown();
    }
    // Draws twenty-third horizontal line and moves to the twenty-fourth (Stairs)
    if(CH.x == 288 & CH.y == 215){
        CH.penUp();
        CH.goto(175, 220);
        CH.penDown();
    }
    // Draws twenty-fourth horizontal line and moves to the twenty-fifth (Stairs)
    if(CH.x == 195 & CH.y == 220){
        CH.penUp();
        CH.goto(268, 220);
        CH.penDown();
    }
    // Draws twenty-fifth horizontal line and moves to the twenty-sixth (Entry Stair)
    if(CH.x == 288 & CH.y == 220){
        CH.penUp();
        CH.goto(205, 305);
        CH.penDown();
    }
    // Draws twenty-sixth horizontal line and moves to the twenty-seventh (Entry Stairs)
    if(CH.x == 255 & CH.y == 305){
        CH.penUp();
        CH.goto(205, 310);
        CH.penDown();
    }
    // Draws twenty-seventh horizontal line and moves to the twenty-eighth (Entry Stairs)
    if(CH.x == 255 & CH.y == 310){
        CH.penUp();
        CH.goto(205, 315);
        CH.penDown();
    }
    // Draws twenty-eighth horizontal line and moves to the twenty-ninth (Entry Stairs)
    if(CH.x == 255 & CH.y == 315){
        CH.penUp();
        CH.goto(185, 57);
        CH.penDown();
    }
    // Draws twenty-ninth horizontal line and moves to the thirtieth (Back Stairs)
    if(CH.x == 275 & CH.y == 57){
        CH.penUp();
        CH.goto(185, 70);
        CH.penDown();
    }
    // Draws thirtieth horizontal line and moves to the thirty-first (Entry Stairs)
    if(CH.x == 275 & CH.y == 70){
        CH.penUp();
        CH.goto(205, 350);
        CH.penDown();
    }
    // Draws thirty-first horizontal line and moves to the thirty-second (Entry Stairs)
    if(CH.x == 255 & CH.y == 350){
        CH.penUp();
        CH.goto(205, 355);
        CH.penDown();
    }
    // Draws thirty-second horizontal line and moves to the thirty-third (Platform)
    if(CH.x == 255 & CH.y == 355){
        CH.setWeight(3);
        CH.penUp();
        CH.goto(180, 345);
        CH.penDown();
    }
    // Draws thirty-third horizontal line and moves to the thirty-fourth (Exterior Building Wall)
    if(CH.x == 285 & CH.y == 345){
        CH.penUp();
        CH.goto(30, 71);
        CH.penDown();
    }
    // Draws thirty-fourth horizontal line and moves to the thirty-fifth (Exterior Building Wall)
    if(CH.x == 430 & CH.y == 71){
        CH.penUp();
        CH.goto(30, 295);
        CH.penDown();
    }
    // Draws thrity-fifth horizontal line (Exterior Wall) and stops
    if(CH.x == 430 & CH.y == 295){
        CH.penUp();
        CH.goto(185, 110);
        CH.penDown();
    }


    // Draws
    // if(t1.x == 30 & t1.y == 70){
    // }
    // if(t1.x == 430 && t1.y == 70){
    //     t1.penUp();
    //     t1.goto(30, 80);
    //     t1.penDown();
    // }
    // if(t1.x == 430 & t1.y == 80){
    //     t1.penUp();
    //     t1.goto(30, 90);
    //     t1.penDown();
    // }
    // if(t1.x == 430 & t1.y == 90){
    //     t1.penUp();
    //     t1.goto(30, 100);
    //     t1.penDown();
    // }
    // if(t1.x == 430 & t1.y == 100){
    //     t1.penUp();
    //     t1.goto(30, 110);
    //     t1.penDown();
    // }
    // if(t1.x == 430 & t1.y == 110){
    //     t1.penUp();
    //     t1.goto(30, 120);
    //     t1.penDown();
    // }
    // if(t1.x == 430 & t1.y == 110){
    //     t1.penUp();
    //     t1.goto(30, 120);
    //     t1.penDown();
    // }
    // t1.forward(d);
    CV.forward(CVd);
    CH.forward(CHd);

}




function drawBrickCountryHouse() {
    // Turns right at forst point to draw verticall lines, draws first vertical line
    if(BrV.x == 199 & BrV.y == 148){
        BrV.right(90);
    }
    // Moves to second point and draws vertical line
    if(BrV.x == 199 & BrV.y == 210){
        BrV.penUp();
        BrV.goto(225, 148);
        BrV.penDown();
    }
    // Moves to third point and draws vertical line
    if(BrV.x == 225 & BrV.y == 210){
        BrV.penUp();
        BrV.goto(245, 220);
        BrV.penDown();
    }
    // Moves to fourth point and draws vertical line
    if(BrV.x == 245 & BrV.y == 280){
        BrV.penUp();
        BrV.goto(292, 100);
        BrV.penDown();
    }
    // Moves to fifth point and draws vertical line
    if(BrV.x == 292 & BrV.y == 118){
        BrV.penUp();
        BrV.goto(296, 98);
        BrV.penDown();
    }
    // Moves to sixth point and draws vertical line
    if(BrV.x == 296 & BrV.y == 115){
        BrV.penUp();
        BrV.goto(320, 120);
        BrV.penDown();
    }
    // Moves to seventh point and draws vertical line
    if(BrV.x == 320 & BrV.y == 132){
        BrV.penUp();
        BrV.goto(334, 115);
        BrV.penDown();
    }
    // Moves to eight point and draws vertical lines
    if(BrV.x == 334 & BrV.y == 167){
        BrV.penUp();
        BrV.goto(414, 153);
        BrV.penDown();
    }
    // Moves to ninth point and draws vertical lines
    if(BrV.x == 414 & BrV.y == 167){
        BrV.penUp();
        BrV.goto(416, 156);
        BrV.penDown();
    }
    // Moves to tenth point and draws vertical lines
    if(BrV.x == 416 & BrV.y == 170){
        BrV.penUp();
        BrV.goto(343, 207);
        BrV.penDown();
    }
    // Moves to eleventh point and draws vertical lines
    if(BrV.x == 343 & BrV.y == 240){
        BrV.penUp();
        BrV.goto(360, 212);
        BrV.penDown();
    }
    // Moves to twelfth point and draws vertical lines
    if(BrV.x == 360 & BrV.y == 280){
        BrV.penUp();
        BrV.goto(470, 180);
        BrV.penDown();
    }
    // Moves to thirteenth point and draws vertical lines
    if(BrV.x == 470 & BrV.y == 186){
        BrV.setWeight(3);
        BrV.penUp();
        BrV.goto(249, 242);
        BrV.penDown();
    }
    // Moves to fourteenth point and draws vertical lines
    if(BrV.x == 249 & BrV.y == 275){
        BrV.penUp();
        BrV.goto(251, 0);
        BrV.penDown();
    }
    // Moves to fifteenth point and draws vertical lines
    if(BrV.x == 251 & BrV.y == 120){
        BrV.penUp();
        BrV.goto(270, 114);
        BrV.penDown();
    }
    // Moves to sixteenth point and draws vertical lines
    if(BrV.x == 270 & BrV.y == 150){
        BrV.penUp();
        BrV.goto(298, 175);
        BrV.penDown();
    }
    // Moves to seventeenth point and draws vertical lines
    if(BrV.x == 298 & BrV.y == 243){
        BrV.penUp();
        BrV.goto(320, 132);
        BrV.penDown();
    }
    // Moves to eighteenth point and draws vertical lines
    if(BrV.x == 320 & BrV.y == 177){
        BrV.penUp();
        BrV.goto(343, 240);
        BrV.penDown();
    }
    // Moves to nineteenth point and draws vertical lines
    if(BrV.x == 343 & BrV.y == 399){
        BrV.penUp();
        BrV.goto(447, 159);
        BrV.penDown();
    }
    // Moves to twentieth point and draws vertical lines
    if(BrV.x == 447 & BrV.y == 187){
        BrV.penUp();
        BrV.goto(461, 185);
        BrV.penDown();
    }
    // Moves to twenty-first point and draws vertical lines
    if(BrV.x == 461 & BrV.y == 213){
        BrV.penUp();
        BrV.goto(476, 187);
        BrV.penDown();
    }
    // Moves to twenty-second point and draws vertical lines
    if(BrV.x == 476 & BrV.y == 195){
        BrV.setWeight(6)
        BrV.penUp();
        BrV.goto(389, 170);
        BrV.penDown();
    }
    // Moves to twenty-third point and draws vertical lines
    if(BrV.x == 389 & BrV.y == 198){
        BrV.setWeight(2)
        BrV.penUp();
        BrV.goto(420, 192);
        BrV.penDown();
    }
    // Moves to twenty-fourth point and draws vertical lines
    if(BrV.x == 420 & BrV.y == 227){
        BrV.penUp();
        BrV.goto(422, 192);
        BrV.penDown();
    }
    // Moves to twenty-fifth point and draws vertical lines
    if(BrV.x == 422 & BrV.y == 227){
        BrV.penUp();
        BrV.goto(424, 192);
        BrV.penDown();
    }
    // Moves to twenty-sixth point and draws vertical lines
    if(BrV.x == 424 & BrV.y == 227){
        BrV.penUp();
        BrV.goto(426, 192);
        BrV.penDown();
    }
    // Moves to twenty-seventh point and draws vertical lines
    if(BrV.x == 426 & BrV.y == 227){
        BrV.penUp();
        BrV.goto(428, 192);
        BrV.penDown();
    }
    // Moves to twenty-eighth point and draws vertical lines
    if(BrV.x == 428 & BrV.y == 227){
        BrV.penUp();
        BrV.goto(430, 192);
        BrV.penDown();
    }
    // Moves to twenty-ninth point and draws vertical lines
    if(BrV.x == 430 & BrV.y == 227){
        BrV.penUp();
        BrV.goto(199, 148);
        BrV.penDown();
        // BrV.penUp();
        // BrV.goto(430, 192);
        // BrV.penDown();
    }

    // Draws first horizontal line for Brick country House
    if(BrH.x == 199 & BrH.y == 210){
    }
    // Moves to second point and draws horizontal line
    if(BrH.x == 217 && BrH.y == 210){
        BrH.penUp();
        BrH.goto(253, 98);
        BrH.penDown();
    }
    // Moves to third point and draws horizontal line
    if(BrH.x == 296 & BrH.y == 98){
        BrH.penUp();
        BrH.goto(253, 101);
        BrH.penDown();
    }
    // Moves to third point and draws horizontal line
    if(BrH.x == 263 & BrH.y == 101){
        BrH.penUp();
        BrH.goto(245, 280);
        BrH.penDown();
    }
    // Moves to fourth point and draws horizontal line
    if(BrH.x == 360 & BrH.y == 280){
        BrH.penUp();
        BrH.goto(296, 115);
        BrH.penDown();
    }
    // Moves to fifth point and draws horizontal line
    if(BrH.x == 334 & BrH.y == 115){
        BrH.penUp();
        BrH.goto(334, 167);
        BrH.penDown();
    }
    // Moves to sixth point and draws horizontal line
    if(BrH.x == 414 & BrH.y == 167){
        BrH.penUp();
        BrH.goto(332, 170);
        BrH.penDown();
    }
    // Moves to seventh point and draws horizontal line
    if(BrH.x == 365 & BrH.y == 170){
        BrH.penUp();
        BrH.goto(360, 212);
        BrH.penDown();
    }
    // Moves to eighth point and draws horizontal line
    if(BrH.x == 420 & BrH.y == 212){
        BrH.penUp();
        BrH.goto(407, 206)
        BrH.penDown();
    }
    // Moves to ninth point and draws horizontal line
    if(BrH.x == 420 & BrH.y == 206){
        BrH.penUp();
        BrH.goto(414, 153)
        BrH.penDown();
    }
    // Moves to tenth point and draws horizontal line
    if(BrH.x == 479 & BrH.y == 153){
        BrH.penUp();
        BrH.goto(416, 155)
        BrH.penDown();
    }
    // Moves to eleventh point and draws horizontal line
    if(BrH.x == 430 & BrH.y == 155){
        BrH.penUp();
        BrH.goto(430, 221)
        BrH.penDown();
    }
    // Moves to twelfth point and draws horizontal line
    if(BrH.x == 447 & BrH.y == 221){
        BrH.penUp();
        BrH.goto(430, 225)
        BrH.penDown();
    }
    // Moves to thirteenth point and draws horizontal line
    if(BrH.x == 479 & BrH.y == 225){
        BrH.setWeight(3)
        BrH.penUp();
        BrH.goto(236, 159)
        BrH.penDown();
    }
    // Moves to fourteenth point and draws horizontal line
    if(BrH.x == 303 & BrH.y == 159){
        BrH.penUp();
        BrH.goto(264, 101)
        BrH.penDown();
    }
    // Moves to fifteenth point and draws horizontal line
    if(BrH.x == 290 & BrH.y == 101){
        BrH.penUp();
        BrH.goto(285, 120)
        BrH.penDown();
    }
    // Moves to sixteenth point and draws horizontal line
    if(BrH.x == 330 & BrH.y == 120){
        BrH.penUp();
        BrH.goto(300, 187)
        BrH.penDown();
    }
    // Moves to seventeenth point and draws horizontal line
    if(BrH.x == 330 & BrH.y == 187){
        BrH.penUp();
        BrH.goto(315, 206)
        BrH.penDown();
    }
    // Moves to eighteenth point and draws horizontal line
    if(BrH.x == 406 & BrH.y == 206){
        BrH.penUp();
        BrH.goto(366, 170)
        BrH.penDown();
    }
    // Moves to nineteenth point and draws horizontal line
    if(BrH.x == 416 & BrH.y == 170){
        BrH.penUp();
        BrH.goto(430, 158)
        BrH.penDown();
    }
    // Moves to twentieth point and draws horizontal line
    if(BrH.x == 454 & BrH.y == 158){
        BrH.penUp();
        BrH.goto(430, 197)
        BrH.penDown();
    }
    // Moves to twenty-first point and draws horizontal line
    if(BrH.x == 454 & BrH.y == 197){
        BrH.penUp();
        BrH.goto(448, 177)
        BrH.penDown();
    }
    // Moves to twenty-second point and draws horizontal line
    if(BrH.x == 464 & BrH.y == 177){
        BrH.penUp();
        BrH.goto(464, 205)
        BrH.penDown();
    }
    // Moves to twenty-third point and draws horizontal line
    if(BrH.x == 477 & BrH.y == 205){
        BrH.penUp();
        BrH.goto(447, 221)
        BrH.penDown();
    }
    // Moves to twenty-fourth point and draws horizontal line
    if(BrH.x == 479 & BrH.y == 221){
        BrH.penUp();
        BrH.goto(250, 275)
        BrH.penDown();
    }
    // Moves to twenty-fifth point and draws horizontal line
    if(BrH.x == 306 & BrH.y == 275){
        BrH.setWeight(2);
        BrH.penUp();
        BrH.goto(266, 237)
        BrH.penDown();
    }
    // Moves to twenty-sixth point and draws horizontal line
    if(BrH.x == 280 & BrH.y == 237){
        BrH.setWeight(2);
        BrH.penUp();
        BrH.goto(266, 239)
        BrH.penDown();
    }
    // Moves to twenty-seventh point and draws horizontal line
    if(BrH.x == 280 & BrH.y == 239){
        BrH.penUp();
        BrH.goto(266, 241)
        BrH.penDown();
    }
    // Moves to twenty-eigth point and draws horizontal line
    if(BrH.x == 280 & BrH.y == 241){
        BrH.penUp();
        BrH.goto(216, 207)
        BrH.penDown();
    }
    // Moves to twenty-ninth point and draws horizontal line
    if(BrH.x == 270 & BrH.y == 207){
        BrH.penUp();
        BrH.goto(216, 209)
        BrH.penDown();
    }
    // Moves to thirtieth point and draws horizontal line
    if(BrH.x == 270 & BrH.y == 209){
        BrH.penUp();
        BrH.goto(216, 211)
        BrH.penDown();
    }
    // Moves to thirty-first point and draws horizontal line
    if(BrH.x == 270 & BrH.y == 211){
        BrH.penUp();
        BrH.goto(216, 213)
        BrH.penDown();
    }
    // Moves to thirty-second point and draws horizontal line
    if(BrH.x == 270 & BrH.y == 213){
        BrH.penUp();
        BrH.goto(216, 215)
        BrH.penDown();
    }
    // Moves to thirty-third point and draws horizontal line
    if(BrH.x == 270 & BrH.y == 215){
        BrH.penUp();
        BrH.goto(216, 217)
        BrH.penDown();
    }
    // Moves to thirty-fourth point and draws horizontal line
    if(BrH.x == 270 & BrH.y == 217){
        BrH.penUp();
        BrH.goto(216, 219)
        BrH.penDown();
    }
    // Moves to thirty-fifth point and draws horizontal line
    if(BrH.x == 270 & BrH.y == 219){
        BrH.setWeight(4)
        BrH.penUp();
        BrH.goto(0, 150)
        BrH.penDown();
    }
    // Moves to thirty-fifth point and draws horizontal line
    if(BrH.x == 270 & BrH.y == 150){
        BrH.penUp();
        BrH.goto(199, 210);
        BrH.setWeight(1);
        BrH.penDown();
        // BrH.penUp();
        // BrH.goto(0, 147)
        // BrH.penDown();
    }


    BrV.forward(BrVd);
    BrH.forward(BrHd);
}

Leave a Reply