TO SQUAREIf 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.
FORWARD 100
RIGHT 90
SQUARE
END
TO SQUARE :DISTANCEIf 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:
FORWARD :DISTANCE
RIGHT 90
SQUARE :DISTANCE
END
TO SQUARE.MAZE :DISTANCE :CHANGEIf 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 ?):
FORWARD :DISTANCE
RIGHT 90
SQUARE.MAZE (:DISTANCE :CHANGE) :CHANGE
END
TO POLYSPI :DISTANCE :ANGLE :CHANGEIf 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):
FORWARD :DISTANCE
RIGHT :ANGLE
POLYSPI (:DISTANCE + :CHANGE) :ANGLE :CHANGE
END
TO INSPI :DISTANCE :ANGLE :CHANGEIf 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.
FORWARD :DISTANCE
RIGHT :ANGLE
INSPI :DISTANCE (:ANGLE + :CHANGE) :CHANGE
END
Publication notes: