Drawing functions should work regardless of context

Make sure that your functions work regardless of context. For example, be sure to set the heading of the turtle explicitly in the triangle function. Recall we always want the left edge to be vertical. Don’t rely on the state of the turtle always being maintained as vertical outside the function. If the invariant is not maintained then your triangle function will not do the “right thing”. Similarly, don’t assume that the pen will be up at the beginning of a drawing function. In general we want to make sure our functions work regardless of what has happened before. And so we should set the position and orientation inside the function to be exactly what we need without relying on any assumptions.