We can draw regular polygons.
We can draw a square four sides, equal length, right angles
with a repeat that looks quite a lot like that description.
rpt 4 [ fd 5 rt 90 ]
To change the shape, we must change the angle that is turned at the corners (or vertices). It is the outside angle we are turning.
For a triangle, this is 120 degrees.
rpt 3 [ fd 5 rt 120 ]
rpt 4 [ fd 5 rt 90 ]
rpt 5 [ fd 5 rt 72 ]
What other regular polygons can you draw? How do you work out what angle to turn for each different number of sides?
It turns out there is a pattern. The angle to turn is 360 divided by the number of sides on the shape
. That makes sence because we are moving forward and turning all the way round to close the shape.
We can write that in logo like this:
make "sides 6
rpt :sides [ fd 5 rt 360/:sides ]
Change the number after "sides
and see what shapes you get. You might need to change the number after fd
to get them to fit on the screen.