RosettaCodeData/Task/Fractal-tree/BASIC/fractal-tree-4.basic

17 lines
492 B
Plaintext

VDU 23,22,SizeX%;SizeY%;8,16,16,128
PROCbranch(SizeX%, 0, SizeY%/2, 90, Depth%)
END
DEF PROCbranch(x1, y1, size, angle, depth%)
LOCAL x2, y2
x2 = x1 + size * COSRAD(angle)
y2 = y1 + size * SINRAD(angle)
VDU 23,23,depth%;0;0;0;
LINE x1, y1, x2, y2
IF depth% > 0 THEN
PROCbranch(x2, y2, size * Scale, angle - Spread, depth% - 1)
PROCbranch(x2, y2, size * Scale, angle + Spread, depth% - 1)
ENDIF
ENDPROC