comparison gamelib/misc.py @ 107:672cc5598e77

Fix dist metric
author Neil Muller <drnlmuller@gmail.com>
date Wed, 02 Sep 2009 18:26:15 +0000
parents e90068d1f374
children 1a7000c8211c
comparison
equal deleted inserted replaced
106:6115d89e3ca9 107:672cc5598e77
11 return self.x, self.y 11 return self.x, self.y
12 12
13 def dist(self, b): 13 def dist(self, b):
14 """Gives the distance to another position""" 14 """Gives the distance to another position"""
15 15
16 return abs(self.x - b.x) + abs(self.y - b.y) 16 return max(abs(self.x - b.x), abs(self.y - b.y))
17 17
18 def __sub__(self, b): 18 def __sub__(self, b):
19 return Position(self.x - b.x, self.y - b.y) 19 return Position(self.x - b.x, self.y - b.y)
20 20
21 def __add__(self, b): 21 def __add__(self, b):