Hi Eros,
There is still another problem with recursion.
It seems that Mathematics in Thinbasic is a little bit differently.
This recursion tree only shows one branch.
You can compare with oxygenbasic tree, to see the difference.
OxygenBasic code:Code:Uses "ui", "math"
#INCLUDE "abc.inc"
OpenWindow 600, 500
SetHandleDC hdc, hwnd
Canvas_Clear &HFFFFFF
Dim x2, y2, depth As Long
depth = 9
Sub MainDraw(x1, y1 As Long, angle As Single, d As Long)
If d >0 Then
x2 = x1 + Cos(DegToRad(angle)) * d * 10
y2 = y1 + Sin(DegToRad(angle)) * d * 10
DrawLine x1, y1, x2, y2, d, Rgb(255-d*10, 100-d, 70)
MainDraw(x2, y2, angle - 20, d-1)
MainDraw(x2, y2, angle + 20, d-1)
End If
End Sub
MainDraw(300, 460, -90, depth)
Canvas_Redraw
Canvas_WaitKey
Canvas_Window End hwnd
Code:#include "sw.inc"
Window 600,500,1
sys depth=9
Sub Draw(sys x1, y1, single angle, sys depth)
iF depth > 0
x2 = x1 + cos(rad(angle)) * depth * 10
y2 = y1 + sin(rad(angle)) * depth * 10
Line x1, y1, x2, y2, depth, RGB(255-depth*10, 100-depth, 70)
Draw(x2, y2, angle - 20, depth - 1)
Draw(x2, y2, angle + 20, depth - 1)
End iF
End Sub
Draw(300, 460, -90, depth)
WaitKey
CloseWindow