Advertisement
Guest User

Untitled

a guest
Apr 29th, 2016
57
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.33 KB | None | 0 0
  1. class GPS_Location:
  2. def __init__(self, x, y): # makes x and y into x and y attributes respectivly
  3. self.x = x
  4. self.y = y
  5.  
  6. def __str__(self):
  7. return '(%s","%s )' % (self.x, self.y) # returns the coordinates as a string
  8.  
  9. def __repr__(self):
  10. thing = 'GPS_Location(%s,%s)' % (self.x, self.y)
  11. return thing
  12.  
  13. def __eq__(self, other):
  14. if other.x == self.x and other.y == self.y:
  15. return True
  16. else:
  17. return False
  18.  
  19. def dist(self, other):
  20. def dist(self, other):
  21. return abs(self.x - other.x) + abs(self.y - other.y)
  22.  
  23. class GPS_POI:
  24. def __init__(self, location, name, kind):
  25. self.location = location
  26. self.name = name
  27. self.kind = kind
  28.  
  29. def __str__(self):
  30. '%s: %s, %s' % (self.location, self.name, self.kind)
  31.  
  32. def __repr__(self):
  33. return 'GPS_POI(%s,%s,%s)' % (thing, self.name, self.food)
  34.  
  35. class GPS:
  36. def __init(self, current, map = None):
  37. self.current = current
  38. if map == None:
  39. self.map = []
  40. else:
  41. self.map = map
  42. self.route = route
  43.  
  44. def relocate(self, location):
  45. self.location = current
  46.  
  47. def add_dest(self, location):
  48. self.location = location
  49. current.append(route)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement