def factorDistancia(self): nummoves = 0 distancia = 0.0 for line in self.lines: d, n = line.distancia_moves() nummoves += n distancia += d base_dist = Position.distancia("a1", "a4") return (distancia / nummoves) / base_dist
def distancia_moves(self): dt = sum(Position.distancia(pv[:2], pv[2:4]) for pv in self.limoves) return dt, len(self.limoves)
def distancia(self): return Position.distancia(self.from_sq, self.to_sq)