LOGO Challenge 7 - More Stars and Squares
Can you use LOGO to create a systematic reproduction of a basic
design? An introduction to variables in a familiar setting.
Problem
Taking squares as a theme, it would be remiss not to revisit a familiar idea :
Image
And a new idea:
TO SQ :N
REPEAT 4 [ FD :N RT 90]
END
Then type SQ 50 and see what happens. What about SQ 30?
Now can you write another procedure to produce this ring of
squares? It might start:
TO RINGSQ :N
REPEAT 8 [SQ :N ...
But why not REPEAT 6 and then turn a little?
Or, why not consider a systematic reduction of the basic design?
Image
Why not then put all the four designs together?
Image
Why not add others that are bigger?
BUT what has this got to do with the following numbers:
0.4142; 1.4142 and 2.4142?
Teachers' Resources
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.