Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Recursion: 4 ways to get it working
#9
(02-15-2023, 02:10 AM)bplus Wrote:
(02-15-2023, 12:13 AM)TempodiBasic Wrote:
(02-14-2023, 11:54 PM)bplus Wrote: Fractals work great with recursion! I could do an art show!

Heart I hope you'll do as soon you can. It is very beautiful to see the facts over the teoretic moment.

Smile A quickie from Proggies:
Code: (Select All)
_Title "Flower Wheel" ' b+ 2022-04?
Screen 12
Do
    Cls
    o = o + _Pi / 180
    drawc _Width / 2, _Height / 2, _Width / 5, .25, 4, o
    _Display
    _Limit 30
Loop

Sub drawc (x, y, r, a, n, o)
    If n > 0 Then
        For t = 0 To _Pi(2) Step _Pi(1 / 3)
            xx = x + r * Cos(t + o)
            yy = y + r * Sin(t + o)
            Circle (xx, yy), r
            drawc xx, yy, a * r, a, n - 1, -o - n * _Pi / 180
        Next
    End If
End Sub

fine graphic, please post more or a collection of yours snippets when you can!


[Image: immagine-2023-02-17-105041253.png]



this is my first simple tribute to do graphic with recursion: a chesstable maker
Code: (Select All)
' recursive demo drawing a chesstable
Screen _NewImage(1000, 1000, 32)
_ScreenMove 1, 1
_Title "Chess table recursive way"

Cls , _RGB32(6, 6, 230)
cell 1, 1
End

Sub cell (x As Integer, y As Integer)
    'x is the counter of cells into the row
    ' y is the counter of rows into the table
    Dim c As Long
    If (x + y) Mod 2 = 0 Then
        c = _RGB32(255)
    Else
        c = _RGB32(0)
    End If

    Line (100 * x, 100 * y)-Step(100, 100), c, BF
    _Delay .05
    If (x + y) < 64 Then
        If x < 8 Then
            x = x + 1
        Else
            x = 1
            If y < 8 Then y = y + 1 Else Exit Sub
        End If
        cell x, y
    Else
        Exit Sub
    End If
End Sub
Reply


Messages In This Thread
RE: Recursion: 4 ways to get it working - by TempodiBasic - 02-17-2023, 09:52 AM



Users browsing this thread: 3 Guest(s)