| Learning and Computing | Education | Computing | Psychology | Artificial Intelligence |

Do Something a Little Different

One of the basic procedures most people work out when starting Logo is a procedure to make a square. If you're willing to stop the turtle with "control G", this procedure will do quite nicely:
TO SQUARE
FORWARD 100
RIGHT 90
SQUARE
END
If you want to do something a little different, you might pick out a command operand, such as 100 and turn it into a variable. Doing so would permit you to makes squares of any size.
TO SQUARE :DISTANCE
FORWARD :DISTANCE
RIGHT 90
SQUARE :DISTANCE
END
If you want to do something a little different, you might consider changing the value of distance in every invocation of SQUARE. You would have a SQUARE.MAZE procedure:
TO SQUARE.MAZE :DISTANCE :CHANGE
FORWARD :DISTANCE
RIGHT 90
SQUARE.MAZE (:DISTANCE :CHANGE) :CHANGE
END
If you want to do something a little different, you might look at the operand of the second command in the procedure and turn that '90' into a variable. You would then have what's become known as a POLYSPI procedure (can you find some of the many good number for angle ?):
TO POLYSPI :DISTANCE :ANGLE :CHANGE
FORWARD :DISTANCE
RIGHT :ANGLE
POLYSPI (:DISTANCE + :CHANGE) :ANGLE :CHANGE
END
If you want to do something a little different, you might think of applying the change value to the variable "ANGLE" instead of to "DISTANCE". You would then have the INSPI procedure (be certain to try INSPI 5 0 7):
TO INSPI :DISTANCE :ANGLE :CHANGE
FORWARD :DISTANCE
RIGHT :ANGLE
INSPI :DISTANCE (:ANGLE + :CHANGE) :CHANGE
END
If you want to do something a little different, you might ask yourself about symmetrical versions of the POLYSPI and INSPI procedure. Or ask yourself why the procedures generate the attractive designs they make. Or ask if you can apply in other places the idea of isolating some single element of a procedure and changing it to create new things and to understand them.

Publication notes:


| Learning and Computing | Education | Computing | Psychology | Artificial Intelligence |