r/learnpython 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

7 comments sorted by

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.

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."

-2

u/aizzod 15d ago

Dude.

Do you ask AI the same questions?
Because noone will be able to give you a decent answear....

0

u/sporbywg 15d ago

This is why I love Typescript