summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFlorian Jung <flo@windfisch.org>2015-08-25 00:49:34 +0200
committerFlorian Jung <flo@windfisch.org>2015-08-25 00:49:34 +0200
commit8a1591c08f7e55ba6d22d5b78a4cb48d8bc0c8d8 (patch)
treeba9c712fe3562ec4e996a7b8b3ec315eb7ed779a
parent066b391e0e3b644353e6bafe10656ea902e06780 (diff)
fix crash when no runaway interval is available
-rw-r--r--strategy.py7
1 files changed, 6 insertions, 1 deletions
diff --git a/strategy.py b/strategy.py
index dbe7cd1..c570d2d 100644
--- a/strategy.py
+++ b/strategy.py
@@ -219,8 +219,13 @@ class Strategy:
forbidden_intervals = merge_intervals(forbidden_intervals)
allowed_intervals = invert_angle_intervals(forbidden_intervals)
+
+ try:
+ (a,b) = find_largest_angle_interval(allowed_intervals)
+ except:
+ print("TODO FIXME: need to handle no runaway direction being available!")
+ (a,b) = (0,0)
- (a,b) = find_largest_angle_interval(allowed_intervals)
runaway_angle = (a+b)/2
runaway_x, runaway_y = (self.c.player.center[0]+int(100*math.cos(runaway_angle))), (self.c.player.center[1]+int(100*math.sin(runaway_angle)))