Wednesday, April 16, 2014

Day 11

Played around with changing some code instructions and seeing how it affects the outcome. Completed all 6 puzzles on Stage 19 and finished up the rest of the tutorials. In total I have completed over 1000 lines of code. This was the last lines of code I wrote today.

var depth;
var branches;

function draw_a_tree(depth, branches) {
  if (depth > 0) {
    penColour(colour_random());
    penDown();
    moveForward(7 * depth);
    turnLeft(130);
    for (var count = 0; count < branches; count++) {
      turnRight(180 / branches);
      draw_a_tree(depth - 1, branches);
    }
    turnLeft(50);
    penUp();
    moveBackward(7 * depth);
  }

No comments:

Post a Comment