Example of Turtle Graphics

Draw polygons

You can change the parameter values appropriately.

Sub DrawPolygon()
' Get device context handle
    monhdc = GetForegroundWindow()
    myhdc = GetDC(monhdc)
    If myhdc = 0 Then Exit Sub

Dim i, j
Dim c
Const side = 0.2
Const x0 = 0.4
Const y0 = 0.1

    InitializeGraphics
    
    SetViewPort 10, 10, 489, 489
    SetGraphicsWindow 0, 1, 1, 0
    c = QBColor(0)
    
    For i = 3 To 9
        TGSetPoint x0, y0
        TGSetAngle 0
        For j = 1 To i
            TGMoveL side, c
            TGTurn 360 / i
        Next j
    Next i

End Sub

polygon

Download source program   tg-polygon-gdi32.bas