Other Turtle Functions
And the undo buffer size can be set by changing
.setundobuffer() to the value you want. So if you feel you need more entries to undo, setting this to a larger number will save the day. You’ve already seen how to use
00:51 This will clear the turtle’s current drawing, but note that all variables will still be present and the turtle in question will stay where it was. Also note that if you have more than one turtle onscreen, only the turtle that you clear will be reset.
Now I’m back on our original turtle,
t. We can clear that using
t.clear(). Notice that
v is unaffected by this. Resetting the environment. It’s possible to go further than the
.clear() command by using the
.reset() command, which will return the turtle in question to the home location of
Cloning a turtle. It’s possible to clone a turtle from an existing turtle using the
.clone() method. The new turtle will be a clone of the original, down not only to its appearance and current position but even its history.
03:32 Now that you’re approaching mastery of the behavior of your turtle, in the next section you’ll take a look at some programming techniques that will allow you to create shorter programs that will be easier to understand, avoid repetition, and allow your code to make decisions.
Become a Member to join the conversation.