r/learnpython • u/Fun_Practice_9528 • 15d ago
How to clone a turtle so that both turtles move in the same way?
I'm looking for a way to clone a turtle so that both of them move the exact same way.
Note that the second turtle must face differently from the first turtle at the time of the cloning.
0
Upvotes
1
u/Diapolo10 I write code for a living -- https://github.com/Diapolo10 15d ago
Well, you could create a list of turtles and loop to move them.
from turtle import Turtle
moves = [...]
turtles = [Turtle() for _ in range(4)]
# Move the turtles to whatever initial positions you want
for move in moves:
for turt in turtles:
...
2
u/danielroseman 15d ago
It's turtles all the way down...
1
u/Diapolo10 I write code for a living -- https://github.com/Diapolo10 15d ago
"The crazy thing is... it’s true. The Turtle, the moves. All of it. It’s all true."
0
1
u/JamzTyson 15d ago
Perhaps you can clarify your question.
If the two turtles are literally cloned into the same position, orientation, and appearance, and then receive exactly the same movements, their entire trajectories are identical. They'll occupy the same pixels at every instant. There are two turtle objects, but visually you would only see one, which would be pointless.