summaryrefslogtreecommitdiff
path: root/main.py
diff options
context:
space:
mode:
authorFlorian Jung <flo@windfisch.org>2015-08-11 02:29:11 +0200
committerFlorian Jung <flo@windfisch.org>2015-08-11 02:29:18 +0200
commit41a73fed9bf12763ae2462265b41c7a76ef5613d (patch)
tree709b24a24d3d866a5a8ce5e96cd50163e82c997f /main.py
parent673878da2e31cf4e84948a626b5113066f305f9a (diff)
avoid viruses when fleeing and when to fat
Diffstat (limited to 'main.py')
-rw-r--r--main.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/main.py b/main.py
index 6718b43..b9294fa 100644
--- a/main.py
+++ b/main.py
@@ -45,13 +45,14 @@ while True:
runaway=False
my_smallest = min(map(lambda cell : cell.mass, c.player.own_cells))
+ my_largest = max(map(lambda cell : cell.mass, c.player.own_cells))
forbidden_intervals = []
for cell in c.world.cells.values():
relpos = ((cell.pos[0]-c.player.center[0]),(cell.pos[1]-c.player.center[1]))
dist = math.sqrt(relpos[0]**2+relpos[1]**2)
- if dist < cell.size*4 and cell.mass > 1.25 * my_smallest:
+ if (not cell.is_virus and dist < 100+cell.size and cell.mass > 1.1 * my_smallest) or (cell.is_virus and dist < cell.size and cell.mass < my_largest):
angle = math.atan2(relpos[1],relpos[0])
corridor_width = 2 * math.asin(cell.size / dist)
forbidden_intervals += canonicalize_angle_interval((angle-corridor_width, angle+corridor_width))