Spirograph™

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.

Use this boilerplate code as a starting point:

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.
  2. size is the size in pixels of one side of the shape.
  3. sides is the number of sides the shape has. E.g. a pentagon has 5 sides, a hexagon has 6 sides.
  4. Draws one shape using the parameters.

Complete the subprogram called `spiro` that:

  1. Takes three parameters: turns, size and sides.
  2. turns is the number of turns to make to complete the circle.
  3. size is the size of one side of one shape.
  4. sides is the number of sides of one shape.
  5. 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)

Knowledge Organiser

Use these resources as a reference to help you meet the success criteria.

Programming guide:

Evaluate


Check that your program outputs the expected result and has met the success criteria.

spiro(20, 50, 6)

spiro(20, 50, 6)

spiro(8, 50, 3)

spiro(3, 50, 5)

Check that you have:

  • Used comments within the code to describe the purpose of subprograms, conditions and iterations.
  • Used meaningful identifier names. That means the names of subprograms and variables indicate what they are for.