Generate and draw a fractal tree.

 Draw the trunk
 At the end of the trunk, split by some angle and draw two branches
 Repeat at the end of each branch until a sufficient level of branching is reached


Related tasks
 Pythagoras Tree


fcn fractalTree(){
   scale:=0.76;
   sizeX:=400; sizeY:=300;
   bitmap:=PPM(sizeX*2,sizeY*2,0xFF|FF|FF);
   branch:='wrap(x1,y1,size,angle,depth){
      ar:=angle.toRad();
      x2:=x1 - size*ar.cos();
      y2:=y1 + size*ar.sin();
      color:=(0xff-depth*8).shiftLeft(16) + (depth*12+100).shiftLeft(8);
      bitmap.line(x1,y1, x2,y2, color);
      if(depth){
         self.fcn(x2,y2,scale*size,angle - 30,depth - 1,vm.pasteArgs(5));
	 self.fcn(x2,y2,scale*size,angle + 8, depth - 1,vm.pasteArgs(5));
      }
   };
   branch(sizeX,0,sizeY/2,90.0,10);
   bitmap.write(File("foo.ppm","wb"));
}();