|
A turtle is a small robot that can move around the floor. The turtle can move forwards and backwards and rotate left and right. Attached to the turtle is a pen. If the pen is lowered then the turtle will draw on a piece of paper placed underneath it as it moves. If the pen is raised then the turtle will not draw as it moves.
To carry out a task the turtle must be given a sequence of instructions to follow. The sequence of instructions is known as a program. A special programming language is used to give these instructions. Each individual instruction is called a command . Most turtles can be programmed using a language called Logo. The most basic turtle control language will support these six commands :
Logo Control Commands | |
Command | Purpose |
PENDOWN | Lower the turtle's pen to start drawing. |
PENUP | Raise the turtle's pen to stop drawing. |
FORWARD 50 | Go forward 50 steps. |
BACK 100 | Go back 100 steps. |
LEFT 90 | Turn left 90 degrees. |
RIGHT 45 | Turn right 45 degrees. |
The number after a forward or backward command is how many steps the turtle should move. The number after a left or right command tells the turtle how many degrees to turn through.
If a robot turtle is not available then the operation of the robot can be simulated by using a picture of a turtle on the screen.
Here are some example programs which use the turtle to draw shapes.
GCSE ICT Companion 04 - (C) P Meakin 2004