'''lecture_05_triangle_heading.py Oliver W. Layton CS 151 Fall 2020 Lecture 05 Demonstrate the effects of changing the turtle's heading direction Things to try: - Draw a few triangles, turn the turtle in between, print heading. - Replace turn with a fixed heading to relationship between absolute heading and relative turns - Reset the heading to 0 to avoid unintended subsequent tilted shapes ''' import turtle def goto(x, y): '''Send turtle to new position (x,y) without drawing anything. ''' turtle.penup() turtle.goto(x, y) turtle.pendown() def triangle(x, y, edgeSize): ''' Draws a triangle''' goto(x, y) turtle.forward(edgeSize) turtle.left(120) turtle.forward(edgeSize) turtle.left(120) turtle.forward(edgeSize) turtle.left(120) # Main code setup # Speed up drawing turtle.speed(0) print('turtle current heading is:', turtle.heading()) triangle(0, 0, 100) turtle.left(45) triangle(100, 0, 100) print('turtle current heading is:', turtle.heading()) turtle.left(45) triangle(200, 0, 100) print('turtle current heading is:', turtle.heading()) # Keep the hexagon up until the user clicks on the window turtle.exitonclick()