Copyright © University of Cambridge. All rights reserved.
'LOGO Challenge 7 - More Stars and Squares' printed from https://nrich.maths.org/
The idea of a variable is a powerful one.
Spend some time trying to see what the variable does. Perhaps you
can introduce variables of your own to different procedures?
The procedure for a ring of squares might look something
like:
TO RINGSQ :N
REPEAT 8 [SQ :N FD :N RT 90 FD :N LT 45]
END
I think this could be more elegant with a procedure that dealt with
the relocation of the turtle before drawing the next square (the
messy bit inside the REPEAT brackets with FDs and turns)..
Part of the challenge is to produce elegant solutions to any
problems asked or any replications that you attempt. Where elegance
implies simplicity within the program(s) and procedures devised.
Alternatively you may like to explore the following procedure:
TO NESTSQ :SIDE
IF :SIDE < 2 [STOP]
REPEAT 4 [ NESTSQ :SIDE/3 FD :SIDE RT 90]
END
Perhaps instead of squares you might like to vary the number of
repeats and the angle turned through.