China DOS Union

-- Unite DOS · Advance DOS · Grow DOS --

Union site: www.cn-dos.net Forum site: www.cn-dos.net/forum
DOS stands for freedom, openness and progress. Let us work hard, learn from the openness and GNU spirit of FreeDOS and Linux, and together build and grow a free GNU GPL world!

中国DOS联盟论坛
The time now is 2026-08-01 02:20
中国DOS联盟论坛 » DOS开发编程 & 发展交流 (开发室) » An Example Source Program Using the Recursive Method (repost) View 621 Replies 0
Original Poster Posted 2003-10-10 00:00 ·  中国 湖北 武汉 联通
高级用户
★★
Credits 677
Posts 194
Joined 2003-09-13 00:00
22-year member
UID 9778
Gender Male
Status Offline
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
Forum Jump: