中国DOS联盟论坛

China DOS Union

-- Unite DOS · Advance DOS · Grow DOS --
Union site: www.cn-dos.net Forum site: www.cn-dos.net/forum
Guest | Log in | Register | Members | Search | China DOS Union
中国DOS联盟论坛
The time now is 2026-09-15 05:30
47,812 topics / 349,917 posts / today 0 new / 48,268 members
DOS开发编程 & 发展交流 (开发室) » An Example Source Program Using the Recursive Method (repost)
Printable Version  712 / 0
Floor1 qb45 Posted 2003-10-10 00:00
高级用户 Posts 194 Credits 677
SCREEN 12
DIM SHARED J
DRAW "BM320,460": CALL tree(440)
END
SUB JIAO (JAO) 'This program is used to rotate the pen by a certain angle.
J = J + JAO
IF J > 360 THEN J = J - 360
IF J < -360 THEN J = J + 360
DRAW "TA=" + VARPTR$(J)
PLAY "T255P64" 'This line is only to slow down the speed.
END SUB
SUB tree (C) 'Tree-drawing subroutine.
IF C < 18 THEN DRAW "C2NU=" + VARPTR$(C): EXIT SUB'After drawing the leaves, return.
C3 = C / 3
DRAW "C4U=" + VARPTR$(C3)
CALL JIAO(45): CALL tree(C / 2)'Turn 45 degrees counterclockwise, then draw the left subtree.
CALL JIAO(-45): CALL tree(2 * C / 3)'Turn 45 degrees clockwise, then draw the middle subtree.
CALL JIAO(-45): CALL tree(C / 2)'Turn 45 degrees clockwise, then draw the right subtree.
CALL JIAO(45) 'Turn 45 degrees counterclockwise, then return to the original direction.
DRAW "C7D=" + VARPTR$(C3)
END SUB
[ Contact the Union admin team - 中国DOS联盟 - Standard version ]
Sponsored by ifanr Inc | © 2001–2023