From 8a1591c08f7e55ba6d22d5b78a4cb48d8bc0c8d8 Mon Sep 17 00:00:00 2001 From: Florian Jung Date: Tue, 25 Aug 2015 00:49:34 +0200 Subject: fix crash when no runaway interval is available --- strategy.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) 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))) -- cgit v1.2.3