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


10 LET level=12: LET LONG=45
20 LET x=127: LET y=0
30 LET rotation=PI/2
40 LET a1=PI/9: LET a2=PI/9
50 LET c1=0.75: LET c2=0.75
60 DIM x(level): DIM y(level)
70 BORDER 0: PAPER 0: INK 4: CLS 
80 GO SUB 100
90 STOP 
100 REM Tree
110 LET x(level)=x: LET y(level)=y
120 GO SUB 1000
130 IF level=1 THEN GO TO 240
140 LET level=level-1
150 LET LONG=LONG*c1
160 LET rotation=rotation-a1
170 GO SUB 100
180 LET LONG=LONG/c1*c2
190 LET rotation=rotation+a1+a2
200 GO SUB 100
210 LET rotation=rotation-a2
220 LET LONG=LONG/c2
230 LET level=level+1
240 LET x=x(level): LET y=y(level)
250 RETURN 
1000 REM Draw
1010 LET yn=-SIN rotation*LONG+y
1020 LET xn=COS rotation*LONG+x
1030 PLOT x,y: DRAW xn-x,y-yn
1040 LET x=xn: LET y=yn
1050 RETURN 