Play Home Contribute GitHub Join Us Discourse Staff Members GitHub Contribution Guides Team

Dance-Off please help [python]

friend = self.findNearest(self.findFriends())
    friendpos = friend.pos
    fx = friendpos.x
    fy = friendpos.y
    if < 6:
        self.move({'x': fx, 'y': 42})
    if < 14 and > 6:
        self.move({'x': fx, 'y': fy + 6})
    if > 14 and < 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


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.



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


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.


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.


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