' Program TreeX.bas

'-------------------------------- fractal tree ----------------------

BackColor 30

CLS

DIM a(4),b(4),c(4),d(4),e(4),f(4)

a(1)=0:a(2)=.42:a(3)=.42:a(4)=.1

b(1)=0:b(2)=-.42:b(3)=.42:b(4)=0

c(1)=0:c(2)=.42:c(3)=-.42:c(4)=0

d(1)=.5:d(2)=.42:d(3)=.42:d(4)=.1

e(1)=0:e(2)=0:e(3)=0:e(4)=0

f(1)=0:f(2)=.2:f(3)=.2:f(4)=.5

x=0: y=0: numits = 20000

FOR n=1 TO numits

k = INT(4*RND-.0001)+1

xx=a(k)*x+b(k)*y+e(k)

yy=c(k)*x+d(k)*y+f(k)

x=xx: y=yy

IF n > 10 THEN

ForeColor 2*n+1

PSET(300+500*x,350-500*y)

END IF

NEXT n

FOR k=1 TO 10^6

NEXT k