From ad947a0161c8c68ac2b6d4c2b32b2acc80ecad67 Mon Sep 17 00:00:00 2001 From: Florian Jung Date: Wed, 2 Sep 2015 00:51:08 +0200 Subject: better paths, i think. still sloooow --- pathfinding.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/pathfinding.py b/pathfinding.py index 7476766..c126559 100644 --- a/pathfinding.py +++ b/pathfinding.py @@ -63,11 +63,13 @@ class Node: self.near_wormholes = list(filter(lambda blob : (self.point - blob.point).len() < radius, self.graph.blobs)) def move_cost(self,other): - if not (self.is_in_wormhole_plane and other.is_in_wormhole_plane): + dist = distance(self, other) + if not (self.is_in_wormhole_plane or other.is_in_wormhole_plane): # assert other in siblings(self,grid). otherwise this makes no sense - return 2*(distance(self, other) + (self.value + other.value)/2) + #return 5*(distance(self, other) + (self.value + other.value)/2) + return 5*dist else: - return distance(self, other) + return max(dist, 5*dist - 500) def siblings(self): x,y = self.point_in_grid -- cgit v1.2.1