summaryrefslogtreecommitdiff
path: root/strategy.py
diff options
context:
space:
mode:
authorFlorian Jung <flo@windfisch.org>2015-08-28 14:19:22 +0200
committerFlorian Jung <flo@windfisch.org>2015-08-28 14:19:22 +0200
commit403058ba1e31330689f9b36a10384ee0b2e8ebde (patch)
tree8ef4130d4ee05daff881f1825ba3b90c8684bb83 /strategy.py
parentf13b8a44441206a4f761002ed3adabd129601ba1 (diff)
hopefully fixed "enemy in our midpoint" issue
Diffstat (limited to 'strategy.py')
-rw-r--r--strategy.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/strategy.py b/strategy.py
index 2ea84e2..1a57897 100644
--- a/strategy.py
+++ b/strategy.py
@@ -196,11 +196,12 @@ class Strategy:
if ( (not cell.is_virus and dist < ((500+2*cell.size) if cell.mass > 1.25*my_smallest.mass*2 else (300+cell.size)) and cell.mass > 1.25 * my_smallest.mass) or (cell.is_virus and dist < my_largest.mass and cell.mass < my_largest.mass) ) and not (cell in friendly_cells) or (cell in friendly_cells) and dist < cell.size+10:
try:
angle = math.atan2(relpos[1],relpos[0])
- corridor_halfwidth = math.asin(cell.size / dist)
+ corridor_halfwidth = math.asin(min(1, cell.size / dist))
forbidden_intervals += canonicalize_angle_interval((angle-corridor_halfwidth, angle+corridor_halfwidth))
runaway = True
except:
print("TODO FIXME: need to handle enemy cell which is in our centerpoint!")
+ raise
# wall avoidance
if self.c.player.center[0] < self.c.world.top_left[1]+(self.c.player.total_size*2):