Spirograph™ is a geometric drawing device that produces mathematical roulettes.

★★★

In 1827, Peter Desvignes developed the "Speiragraph", a device to create elaborate spiral drawings. In the 20th Century this became a popular children's toy, the Spirograph™. In addition to creating drawings, practical uses include creating patterns on banknotes that make it much more difficult to accurately create forgeries.


Make

Write a program that draws a roulette using the number of turns in the circle, the number of sides and length of a side in the shape.

Success Criteria

Remember to add a comment before a subprogram, condition or iteration to explain its purpose.

Complete the subprogram called draw_shape that:

  1. Takes two parameters: size and sides.
    • size is the size in pixels of one side of the shape.
    • sides is the number of sides the shape has. E.g. a pentagon has 5 sides, a hexagon has 6 sides.
  2. Draws one shape using the parameters.

Complete the subprogram called spiro that:

  1. Takes three parameters: turns, size and sides.
    • turns is the number of turns to make to complete the circle.
    • size is the size of one side of one shape.
    • sides is the number of sides of one shape.
  2. Draws a number of shapes equal to turns to complete a circle.

Complete the main program so that:

  1. The spiro subprogram is called.
  2. The turtle is hidden once the roulette is finished.

Typical outputs from the program would be:

spiro(20, 50, 6)

spiro(20, 50, 6)

spiro(8, 50, 3)

spiro(20, 50, 6)

spiro(3, 50, 5)

spiro(20, 50, 6)