Microsoft Small Basic

Program Listing: MDB491
net = "2=1;5=2;6=3;7=5;8=4;10=6;"
pattern[1] = " . "
pattern[2] = ". ."
pattern[3] = " . . . "
pattern[4] = ". . . ."
pattern[5] = ". . . . ."
pattern[6] = ". .. .. ."
x0 = 70
y0 = 40
size = 120
GraphicsWindow.PenColor = "LightGray"
For i = 1 To 10
n = net[i]
If n <> "" Then
x = x0 + Math.Remainder(i - 1, 4) * size
y = y0 + Math.Floor((i - 1) / 4) * size
GraphicsWindow.DrawRectangle(x, y, size, size)
For j = 1 To 9
If Text.GetSubText(pattern[n], j, 1) = "." Then
If n = 1 Then
GraphicsWindow.BrushColor = "Red"
d = size / 3
p = 0.35
Else
GraphicsWindow.BrushColor = "Black"
d = size / 5
p = 0.6
EndIf
x1 = x + (Math.Remainder(j - 1, 3) + p) * size / 4
y1 = y + (Math.Floor((j - 1) / 3) + p) * size / 4
GraphicsWindow.FillEllipse(x1, y1, d, d)
EndIf
EndFor
EndIf
EndFor