Microsoft Small Basic

Program Listing: GMN498
'Make the tortoise move as fast as possible --#15
Tortoise.SetSpeed(10)
'Have the tortoise start at 10 pixels in on the X axis --#16
Tortoise.SetX(10)
'The current height is 50 --#1.1
height = 50
'DrawHouse (recipe below) --#14
DrawHouse()
'The current height is 120 --#18
height = 120
'DrawHouse (recipe below) --#17
DrawHouse()
'The current height is 20 --#19
height = 20
'DrawHouse (recipe below) --#19
DrawHouse()
'The current height is 60 --#20
height = 60
'DrawHouse (recipe below) --#20
DrawHouse()
'The current height is 40 --#21
height = 40
'DrawHouse (recipe below) --#21
DrawHouse()
'The current height is 80 --#22
height = 80
'DrawHouse (recipe below) --#22
DrawHouse()
'The current height is 20 --#23
height = 20
'DrawHouse (recipe below) --#23
DrawHouse()
'The current height is 105 --#24
height = 105
'DrawHouse (recipe below) --#24
DrawHouse()
'The current height is 70 --#25
height = 70
'DrawHouse (recipe below) --#25
DrawHouse()

'------------- Recipe for DrawHouse --#13
Sub DrawHouse
' Change the color of the line the tortoise draws to a random color--#2
Tortoise.SetPenColor(Colors.GetRandomColor())
' Move the tortoise the height of a house --#1
Tortoise.Move(height)
' If the current height is greater than 55, then --#33
If height> 55 Then
' DrawFlatRoof (recipe below) --#7
DrawFlatRoof()
' Otherwise --#33
Else
' DrawPointyRoof (recipe below) --#32 (comment out DrawFlatRoof as fake)
DrawPointyRoof()
EndIf
' Move the tortoise the height of a house --#8
Tortoise.Move(height)
' Turn the tortoise 90 degrees to the left --#9
Tortoise.TurnLeft()
' Change the color of the line the tortoise draws to green --#10
Tortoise.SetPenColor(Colors.Green)
' Move the tortoise 20 pixels --#11
Tortoise.Move(20)
' Turn the tortoise 90 degrees to the left --#12
Tortoise.TurnLeft()
'------------- End of DrawHouse recipe --#13
EndSub


'------------- Recipe for DrawFlatRoof --#6
Sub DrawFlatRoof
' Turn the tortoise 90 degrees to the right --#3
Tortoise.TurnRight()
' Move the tortoise 30 pixels --#4
Tortoise.Move(30)
' Turn the tortoise 90 degrees to the right --#5
Tortoise.TurnRight()
'------------- End of DrawFlatRoof recipe --#6
EndSub

'------------- Recipe for DrawPointyRoof --#31
Sub DrawPointyRoof
' Turn the tortoise 45 degrees to the right --#26
Tortoise.Turn(45)
' Move the tortoise 20 pixels --#27
Tortoise.Move(20)
' Turn the tortoise 90 degrees to the right --#28
Tortoise.Turn(90)
' Move the tortoise 20 pixels --#29
Tortoise.Move(20)
' Turn the tortoise 45 degrees to the right --#30
Tortoise.Turn(45)
'------------- End of DrawPointyRoof recipe --#31
EndSub