Skip to main content

Section 17.7 Total Turtle Trip Theorem

That last piece of code is actually a pattern for a wide variety of geometric shapes. Hereโ€™s the code to draw a triangle. It may not be obvious why we turn 120 in this program, but it will be soon.

Activity 17.7.1.

Run the code to see what it draws.
And hereโ€™s the code to draw a pentagon.

Activity 17.7.2.

Run the code to see what it draws.
The Total Turtle Trip Theorem states that the turtle will draw a closed figure with n sides when the sum of the angles turned is a multiple of 360. In the triangle example, 3 \times 120 = 360 and in the pentagon example, 5 \times 72 = 360.
Change the ?? in line 7 below to the amount to turn each time to draw a 12-sided polygon, which is called a dodecagon. If you get it right the turtle will draw a 12-sided closed polygon.

Activity 17.7.3.

You will need to replace the โ€™??โ€™ on line 7 to have the code correctly draw a dodecagon (a polygon with 12 sides).

Activity 17.7.4.

How much does mia need to turn in the program above to create a closed dodecagon (12-sided figure)? Only one of these works.
  • 15
  • This one will not close
  • 30
  • Exactly! 12 * 30 = 360
  • 12
  • No, 12 * 12 is 144, which is not a multiple of 360
  • 90
  • This one will generate a square, three times. 12 * 90 = 1080 = 360 * 3

Activity 17.7.5.

Write a function polygon which takes in a turtle object and the number of sides as parameters to draw a polygon. Call the function to test it.
You have attempted of activities on this page.