Microsoft Small Basic

Program Listing: ZBB149
'Show the tortoise --#1
Tortoise.Show()
'Make the tortoise go as fast as possible --#7
Tortoise.SetSpeed(10)
'The current length of a side is 1 pixel --#4.1
length = 1
'Do the following 60 times --#8
For j = 1 To 60
' Change the color of the line the tortoise draws to a random color --#10
Tortoise.SetPenColor(Colors.GetRandomColor())
' Increase the current length of the side by 4 pixels --#9
length = length + 4
' DrawTriangle (recipe below) --#6
DrowTriangle()
' Turn the tortoise 1/60th of 360 degrees to the right --#11
Tortoise.Turn(360/60)
'Repeat --#8
EndFor


'------------- Recipe for DrawTriangle --#5
Sub DrowTriangle
' Do the following 3 times --#3
For i = 1 To 3
' Move the tortoise the current length of a side --#4
Tortoise.Move(length)
' Turn the tortoise 1/3rd of 360 degrees --#2
Tortoise.Turn(360/3)
' Repeat --#3
EndFor
'------------- End of DrawTriangle recipe --#5
EndSub