Microsoft Small Basic

Program Listing: PCP610
' Symetric 55-card
' Copyright (c) 2014 Nonki Takahashi.
'
' Lisence:
' The MIT Lisence (MIT)
' http://en.wikipedia.org/wiki/MIT_License
'
gw = 598
gh = 428
GraphicsWindow.Width = gw
GraphicsWindow.Height = gh
r = 200
x[0] = gw / 2
y[0] = gh / 2
cmax = 55
DrawVertices()
GraphicsWindow.PenWidth = 2
GraphicsWindow.BrushColor = "White"
ec = "23=Orange;24=Gray;25=Red;26=Green;27=Blue;"
While "True"
For delta = 1 To 54
Program.Delay(1000)
GraphicsWindow.FillRectangle(0, 0, gw, gh)
GraphicsWindow.Title = "delta=" + delta
If ec[delta] <> "" Then
GraphicsWindow.PenColor = ec[delta]
Else
GraphicsWindow.PenColor = GraphicsWindow.GetRandomColor()
EndIf
continue = "True"
c1 = 1
DrawEdges()
EndFor
EndWhile
Sub DrawEdges
While continue
c2 = c1 + delta
If cmax < c2 Then
c2 = c2 - cmax
EndIf
GraphicsWindow.DrawLine(x[c1], y[c1], x[c2], y[c2])
c1 = c2
If c2 = 1 Then
continue = "False"
EndIf
EndWhile
EndSub
Sub DrawVertices
GraphicsWindow.PenWidth = 0
GraphicsWindow.BrushColor = "Black"
For c = 1 To cmax
a = 2 * Math.Pi * (c - 1) / cmax
x[c] = x[0] - r * Math.Sin(a)
y[c] = y[0] - r * Math.Cos(a)
DrawVertex()
EndFor
EndSub
Sub DrawVertex
' param x[c], y[c] - vertex
ew = 4
eh = 4
ex = x[c] - ew / 2
ey = y[c] - eh / 2
v[c] = Shapes.AddEllipse(ew, eh)
Shapes.Animate(v[c], ex, ey, 1000)
EndSub