Here is b+ mod of Cantor's Dust, a Binary Tree I did some time ago for fun, now we could call it Cantor's Tree:
Code: (Select All)
_Title "Binary Tree AKA Cantor Tree" 'b+ 2022-05-19 trans from
' binary tree.bas SmallBASIC 0.12.6 [B+=MGA] 2016-05-20
' line method added and posted with that mod 2016-05-22
xmax = 800: ymax = 600
Screen _NewImage(xmax, ymax, 32)
_ScreenMove 250, 60
For i = 0 To ymax
Line (0, i)-(xmax, i), _RGB32(0, 0, 120 + 100 * i / ymax)
Next
xlength = xmax
p2 = 2
ystart = ymax
Do
xstart = xmax / p2
yheight = (ymax - 150) / p2
xlength = xlength / 2
th = .2 * yheight
For x = xstart To xmax - .5 Step 2 * xlength
cc = 180 - ((yheight / ymax) * 255)
brown~& = _RGB32(cc, cc * .5, cc * .25)
Line (x, ystart - yheight)-Step(th, yheight), brown~&, BF
Next
ystart = ystart - (ymax - 150) / p2
xhozstart = xstart / 2
For x = xhozstart To xmax - .5 Step 2 * xlength
cc = Rnd * 140: brown = _RGB32(cc, cc * .5, cc * .25)
Line (x, ystart)-(x + xlength, ystart), brown~&
Line (x, ystart - th)-Step(xlength + .5 * th, th + 2), brown~&, BF
Next
p2 = p2 * 2
Loop Until xlength / 2 < 1 Or yheight / 2 < 1
For i = 1 To 6000
Line (Rnd * xmax, 24 + Rnd * 123)-Step(Rnd * 5 + 1, Rnd * 5 + 1), _RGB32(Rnd * 45, 65 + Rnd * 190, Rnd * 15), BF
Next
Sleep
b = b + ...