fd - forward - as in fd 40 - fd space bar 40 - which will cause the turtle move 40 turtle steps.
rt or lt - right or left - as in lt 90 - lt space bar 90 - which will cause the turtle to turn 90 degrees
REPEAT - repeats a function - as in REPEAT 12 [fd 60 lt 36] - repeats 12 times the process in the square brackets - next to the p on the keyboard
Programming in Logo
All programs start with TO and end with END. The word following the TO is the name of the program. Logo programming allows for the embedding of previous defined procedures within more complex programs.
A simple program
TO SQUARE
REPEAT 4 [FD 40 LT 90]
END
would design a square.
A more complex program (for class projects)
TO HEXAGON
REPEAT 5 [FD 50 RT 60]
END
TO FLOWERS
REPEAT 18 [SQUARE LT 20]
REPEAT 18 [HEXAGON LT 20]
END
would design a flower with two shapes of petals.
A very complex program (consider for extra credit projects)
:N, where N is a number, allows for the introduction of a variable to the program. In the program below, :f stands for the first number of sides that will be drawn, :l stands for the last number of sides. A recursive program is a program that calls on itself using the variables defined within the program.
Demonstrates that the more sides on an equilateral polygon, the more the polygon looks like a circle.Copy this program into the flipside of your LogoWriter page. One way to do that is to change this WWW pages into source - under View on the menu bar above. Then highlight and copy the following lines
to polygon :n :m
repeat :n [fd (:n * 3) lt 360 / :n]
if :n +1 > :m [stop]
setc :n + 11
polygon :n + 1 :m
end
An amusing book related to this idea is Flatland . Please see Seymour Paperts' Mindstorms for more information on the educational applications of LOGO in learning higher order thinking skills.