Microsoft Small Basic

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

GraphicsWindow.Title = "Turtle Flower 2"
Init()

' drawing
GraphicsWindow.PenColor = "MediumVioletRed"
s = 10
For petal = 1 To 6
For a = s To 360 Step s
Turtle.Move(s * (1 + LDMath.Sin(2*a)))
Turtle.Turn(s)
EndFor
Turtle.Turn(360 / 6)
EndFor

' painting
LDShapes.RasteriseTurtleLines()
s = 360 / 12
GraphicsWindow.BrushColor = "Black"
For a = s To 360 Step s
If Math.Remainder(a / s, 2) = 0 Then
r = 30
color = "Pink"
Else
r = 10
color = "Yellow"
EndIf
x = gw / 2 + r * LDMath.Sin(a)
y = gh / 2 + r * LDMath.Cos(a)
LDGraphicsWindow.FloodFill(x, y, color)
EndFor

LDGraphicsWindow.FloodFill(10, 10, "YellowGreen")
Turtle.Hide()

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