REM The SUB Tree uses the initial parameters (x,y,l,a,ang,lim%,m,c) REM x is the start x REM y is the start y REM l is the initial branch length REM a is the initial angle REM ang is the angle of rotation for each successive branch REM lim% is the branch length lower limit REM m is the denominator for successive branch length REM c is the colour SUB tree (x, y, l, a, ang, lim%, m, c) IF l > lim% THEN LINE (x, y)-(x + l * COS(a), y + l * SIN(a)), c LINE (x, y)-(x + l * COS(a), y + l * SIN(a)), c CALL tree(x + l * COS(a), y + l * SIN(a), l / m, a + ang, ang, lim%, m, c) CALL tree(x + l * COS(a), y + l * SIN(a), l / m, a - ang, ang, lim%, m, c) END IF END SUB DECLARE SUB tree (x!, y!, l!, a!, ang!, lim%, m!, c!) REM A simple tree fractal by Ali Afshar SCREEN 13 CONST pi = 3.141593 WINDOW (-200, 0)-(200, 400) REM This example draws a big white tree CALL tree(0, 0, 50, pi / 2, pi / 6, 5, 1.3, 15) REM This example draws 4 trees all at a pi/3 angle in random colours FOR a = -100 TO 100 STEP 50 CALL tree(a, 0, 20, pi / 3, pi / 12, 5, 1.4, RND * 15) NEXT a END