summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFlorian Jung <flo@windfisch.org>2015-09-02 00:51:08 +0200
committerFlorian Jung <flo@windfisch.org>2015-09-02 00:51:08 +0200
commitad947a0161c8c68ac2b6d4c2b32b2acc80ecad67 (patch)
tree7b89a21f96e77cc1ebda6227947b21b396d682ab
parent88ecf4dc97294eae017f7b10001480861177a9e8 (diff)
better paths, i think. still sloooow
-rw-r--r--pathfinding.py8
1 files 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