def successors(self): (fu, fv) = self.face dist = lambda (u,v): math.sqrt((fu-u)*(fu-u) + (fv-v)*(fv-v)) succ = [ self.map.map_state(n) for n in grid.neighbours2(self.face) if self.map.valid_face(n) ] return [ (s, self.map.cost(s.face) * dist(s.face)) for s in succ ]