Advertisement
Guest User

Untitled

a guest
Apr 18th, 2014
42
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.63 KB | None | 0 0
  1. class First:
  2. go_to = 1
  3.  
  4. def move(self, lu, rb, gate, index, side, balls, your_team, enemy_team):
  5. posx = your_team[index][0]
  6. posy = your_team[index][1]
  7.  
  8. point1 = (lu[0], (lu[1] + rb[1]) / 2.0)
  9. point2 = ((lu[0] + rb[0]) / 2.0, lu[1])
  10. point3 = (rb[0], (lu[1] + rb[1]) / 2.0)
  11.  
  12.  
  13. if (posx, posy) == point1:
  14. self.go_to = 2
  15. if (posx, posy) == point2:
  16. self.go_to = 3
  17. if (posx, posy) == point3:
  18. self.go_to = 1
  19.  
  20. if self.go_to == 1:
  21. return (point1[0] - posx, point1[1] - posy)
  22. if self.go_to == 2:
  23. return (point2[0] - posx, point2[1] - posy)
  24. return (point3[0] - posx, point3[1] - posy)
  25.  
  26. """
  27. if (posx, posy) == point1 and go_to == 1:
  28. go_to = 2
  29. sp = (point1[0] - posx, point1[1] - posy)
  30. if (posx, posy) == point2 and go_to == 2:
  31. go_to = 3
  32. sp = (point2[0] - posx, point2[1] - posy)
  33. if (posx, posy) == point3 and go_to == 3:
  34. go_to = 1
  35. sp = (point3[0] - posx, point3[1] - posy)
  36. return sp
  37. if (posx,posy) != point1:
  38. sp = (point1[0]-posx,point1[1]-posy)
  39. elif (posx,posy) != point1:
  40. self.go_to +=1
  41. elif (posx,posy) != point2:
  42. sp = (point2[0]-posx,point2[1]-posy)
  43. elif (posx,posy) != point3:
  44. sp = (point3[0]-posx,point3[1]-posy)
  45.  
  46. if (posx,posy) == point1 or (posx,posy) == point2:
  47. self.go_to +=1
  48. else:
  49. self.go_to = 1
  50. return sp
  51. """
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement