Dance-Off please help [python]


#1
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


#2

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?


#3

this is what happens from bottom to top



#4

I’m not sure about this. Ask @Bryukh


#5

ok i will do that
thank you


#6

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.


#7


#8

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


#9

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.


#10

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


#11

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


#12

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