Microsoft Small Basic

Program Listing: HRT413
' Turtle Flower
' Copyright © 2020 Nonki Takahashi. The MIT License.

GraphicsWindow.Title = "Turtle Flower"
Init()

' drawing
GraphicsWindow.PenColor = "MediumVioletRed"
For j = 1 To 8
For i = 1 To 360 / 4
Turtle.Move(4)
Turtle.Turn(4)
If i = 45 Then
x1[j] = (gw / 2) * 0.4 + Turtle.X * 0.6
y1[j] = (gh / 2) * 0.4 + Turtle.Y * 0.6
x3[j] = (gw / 2) * 0.2 + Turtle.X * 0.8
y3[j] = (gh / 2) * 0.2 + Turtle.Y * 0.8
EndIf
EndFor
Turtle.Turn(360 / 8)
EndFor

' painting
LDShapes.RasteriseTurtleLines()
For j = 1 To 8
LDGraphicsWindow.FloodFill(x1[j], y1[j], "Pink")
LDGraphicsWindow.FloodFill(x3[j], y3[j], "DeepPink")
k = j + 1
If 8 < k Then
k = 1
EndIf
x2 = (x1[j] + x1[k]) / 2
y2 = (y1[j] + y1[k]) / 2
LDGraphicsWindow.FloodFill(x2, y2, "HotPink")
EndFor

Turtle.Hide()

Sub Init
gw = 400
gh = 400
GraphicsWindow.Width = gw
GraphicsWindow.Height = gh
Turtle.X = gw / 2
Turtle.Y = gh / 2
Turtle.Speed = 9
EndSub