Microsoft Small Basic

Program Listing: KTH055
'Infinite Closed Squares using the Turtle
'Rick Murphy AUS, 2012/12/31, 12:20AM

GraphicsWindow.Height = 580
GraphicsWindow.Width = 1165
GraphicsWindow.Left = 1
GraphicsWindow.Top = 1

x = 1165 / 2 '***NB the x and y variables can't equal a variable that is exceeded ***
y = 580 / 2 '** in the program**
Turtle.X = x
Turtle.Y = y

Turtle.Speed = 10

For i = 4 To i*2 Step 4
a = x + i '3rd & 4th coordinates
b = x - i '1st & 2nd
c = y + i '1st & 4th
d = y - i '2nd & 3rd
Turtle.PenUp()
Turtle.MoveTo(b, c)
Turtle.PenDown()
Turtle.MoveTo(b, d)
Turtle.MoveTo(a, d)
Turtle.MoveTo(a, c)
Turtle.MoveTo(b, c)
EndFor