1. Open Small Basic here.
2. Type the following code:
Turtle.Move(100)
Turtle.Turn(90)
Turtle.Move(100)
3. Click Run to see what your program does.
4. Now add more code so that it draws a square, like the animation to the right shows.
5. Save your program in your Small Basic folder and call it Square.
1. Create a new Small Basic file.
2. Use the following Turtle commands to create a triangle changing x for the size and y for the angle.
Turtle.Move(x)
Turtle.Turn(y)
HINT: If all the internal angles are 60°, you will need to turn the turtle the difference between the internal angle (60°) and 180°.
1. Create a new Small Basic file.
2. Use the following Turtle commands to create a hexagon changing x for the size and y for the angle.
Turtle.Move(x)
Turtle.Turn(y)
HINT: If all the internal angles are 120°, you will need to turn the turtle the difference between the internal angle (120°) and 180°.
1. Create a new Small Basic file.
2. Use a for loop to draw a square. Identify the repeating code for a square (see right) and work our how many times it repeats. A for loop is laid out like this:
For x = ? to ?
CODE TO REPEAT
EndFor
Extensions:
Use a loop to draw a triangle
Use a loop to draw a hexagon
Can you create a program that creates multiple squares that grow each time?
Some of the code you need can be found below, but there are bits missing. Copy and paste this into Small Basic and replace the ?? and the comment on line 2 with the correct code.
distance = 50
'replace this with a loop to repeat 4 times
For x = 1 To 4
Turtle.Move(??)
Turtle.Turn(??)
EndFor
distance = distance + ??