Microsoft Small Basic

Program Listing: NHJ324
' Starfish
' Copyright © 2018 Nonki Takahashi. The MIT License.
' Challenge 2018-09

GraphicsWindow.Title = "Starfish"
Init()
GraphicsWindow.BrushColor = "Crimson"
color = GraphicsWindow.BrushColor
For a = 0 To 288 Step 72
_a = Math.GetRadians(a)
For i = 0 To 5
r = i * 20
s = (7 - i) * 10
x = ox + r * Math.Sin(_a)
y = oy - r * Math.Cos(_a)
GraphicsWindow.FillEllipse(x - s / 2, y - s / 2, s, s)
EndFor
EndFor
For i = 1 To 2
GraphicsWindow.BrushColor = bc[i]
For j = 1 To 1000
a = Math.GetRandomNumber(359)
_a = Math.GetRadians(a)
r = Math.GetRandomNumber(100) + 10
x = ox + r * Math.Sin(_a)
y = oy - r * Math.Cos(_a)
If GraphicsWindow.GetPixel(x, y) = color Then
GraphicsWindow.FillEllipse(x - 2, y - 2, 4, 4)
EndIf
EndFor
EndFor
GraphicsWindow.BrushColor = "White"
For a = 0 To 288 Step 72
_a = Math.GetRadians(a)
s = 10
For i = 0 To 10
r = i * 10
x = ox + r * Math.Sin(_a)
y = oy - r * Math.Cos(_a)
GraphicsWindow.FillEllipse(x - s / 2, y - s / 2, s, s)
s = s * 0.9
EndFor
EndFor

Sub Init
gw = 598
gh = 428
GraphicsWindow.Width = gw
GraphicsWindow.Height = gh
GraphicsWindow.BackgroundColor = "Tan"
ox = gw / 2
oy = gh / 2
bc = "1=#CC0000;2=#FF6666;"
EndSub