Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class First:
- go_to = 1
- def move(self, lu, rb, gate, index, side, balls, your_team, enemy_team):
- posx = your_team[index][0]
- posy = your_team[index][1]
- point1 = (lu[0], (lu[1] + rb[1]) / 2.0)
- point2 = ((lu[0] + rb[0]) / 2.0, lu[1])
- point3 = (rb[0], (lu[1] + rb[1]) / 2.0)
- if (posx, posy) == point1:
- self.go_to = 2
- if (posx, posy) == point2:
- self.go_to = 3
- if (posx, posy) == point3:
- self.go_to = 1
- if self.go_to == 1:
- return (point1[0] - posx, point1[1] - posy)
- if self.go_to == 2:
- return (point2[0] - posx, point2[1] - posy)
- return (point3[0] - posx, point3[1] - posy)
- """
- if (posx, posy) == point1 and go_to == 1:
- go_to = 2
- sp = (point1[0] - posx, point1[1] - posy)
- if (posx, posy) == point2 and go_to == 2:
- go_to = 3
- sp = (point2[0] - posx, point2[1] - posy)
- if (posx, posy) == point3 and go_to == 3:
- go_to = 1
- sp = (point3[0] - posx, point3[1] - posy)
- return sp
- if (posx,posy) != point1:
- sp = (point1[0]-posx,point1[1]-posy)
- elif (posx,posy) != point1:
- self.go_to +=1
- elif (posx,posy) != point2:
- sp = (point2[0]-posx,point2[1]-posy)
- elif (posx,posy) != point3:
- sp = (point3[0]-posx,point3[1]-posy)
- if (posx,posy) == point1 or (posx,posy) == point2:
- self.go_to +=1
- else:
- self.go_to = 1
- return sp
- """
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement