Dance-Off please help [python]

friend = self.findNearest(self.findFriends())
loop:
    friendpos = friend.pos
    fx = friendpos.x
    fy = friendpos.y
    if self.now() < 6:
        self.move({'x': fx, 'y': 42})
    if self.now() < 14 and self.now() > 6:
        self.move({'x': fx, 'y': fy + 6})
    if self.now() > 14 and self.now() < 17:
        self.move({'x': fx, 'y': fy + 6})

i can seem to get this right can someone please help me? my hero stops right before the end

I think you need to line up your code more. What is it saying when you run your code? Basically what error is it producing?

this is what happens from bottom to top


I’m not sure about this. Ask @Bryukh

ok i will do that
thank you

1 Like

Have you read hints for this level? You are trying to use time as an argument. The logic should time independent. Watch for the nearest friend position only.

1 Like

@Bryukh i read the hints and i can’t seem to figure out the level do you know what im doing wrong?

1 Like

All. Only while is correct :slight_smile: Find the offset from the nearest friend by x and y. Then use move to that friend position with those offsets.

1 Like

was i supposed to beat it with a simple move code?

You can solve it many ways, however “move tactic” is the simplest one. You can solve it just with one line in while-loop.

1 Like

yes that is exactly what i did then i created a javascript account

1 Like

Well done for completing the level, but please could you not post working code. It ruins it for others.
So could you delete it (edit your post and delete the part with the code) and thank you for giving the advice, you can keep that part. It’s just that it’s better to help people understand without telling them the answer.
Thanks
Danny