Microsoft Small Basic

Program Listing: MGR577
'Make the tortoise go as fast as possible - # 10
Tortoise.SetSpeed(10)
'Change the width of the line the tortoise draws to 1 pixel - # 11
Tortoise.SetPenWidth(1)
'Change the color of the line the tortoise draws to silver - # 12
Tortoise.SetPenColor(Colors.Silver)
'The current length of a line is 10 pixels -- # 1.0
length = 10
'The current zoom is 1 -- # 6.1
zoom = 1
'Do the following 10 times -- # 13.0
For i = 1 To 10
' WeaveOneLayer (recipe below) -- # 8.2
WeaveOneLayer()
' Change the zoom so it is multiplied by 1.3 -- # 9.0
zoom = zoom * 1.3
'Repeat -- # 13.1
EndFor

'------------- Recipe for WeaveOneLayer -- # 8.0
Sub WeaveOneLayer
'Do the following 6 times -- # 7.0
For j = 1 To 6
' DrawTriangle (recipe below) -- # 4.2
DrawTriangle()
' Turn the tortoise 1/6th of 360 degrees to the right -- # 5.0
Tortoise.Turn(360/6)
' Increase the length of the line by the current zoom -- # 6.0
length = length + zoom
'Repeat -- # 7.1
EndFor
'------------- End of WeaveOneLayer recipe -- # 8.1
EndSub

'------------- Recipe for DrawTriangle -- # 4.0
Sub DrawTriangle
'Do the following 3 times -- # 3.0
For k = 1 To 3
' Move the tortoise the length of a line -- # 1.1
Tortoise.Move(length)
' Turn the tortoise 1/3rd of 360 degrees -- # 2.0
Tortoise.Turn(360/3)
'Repeat -- # 3.1
EndFor
'------------- End of DrawTriangle recipe -- # 4.1
EndSub