diff options
author | Florian Jung <flo@windfisch.org> | 2015-08-27 01:28:30 +0200 |
---|---|---|
committer | Florian Jung <flo@windfisch.org> | 2015-08-27 01:28:30 +0200 |
commit | a973a8986191a7a492a18a8f52d33bce9b821292 (patch) | |
tree | 985d97fbd160d18f9c61520338a302963e35f33c | |
parent | 52a1e369c35eed27841f21aa4efc5bc70f421d3a (diff) |
s/99999/float(inf)/g
-rw-r--r-- | strategy.py | 2 | ||||
-rw-r--r-- | subscriber.py | 6 |
2 files changed, 4 insertions, 4 deletions
diff --git a/strategy.py b/strategy.py index c570d2d..2ea84e2 100644 --- a/strategy.py +++ b/strategy.py @@ -118,7 +118,7 @@ class Strategy: if friendly_cells: dist_to_friend = min(map(lambda c : (self.c.player.center-c.pos).len() - max(my_largest.size, c.size), friendly_cells)) else: - dist_to_friend = 99999999 + dist_to_friend = float('inf') if dist_to_friend < 20 or my_largest.mass < 60: if self.do_approach_friends: print("not approaching friends") diff --git a/subscriber.py b/subscriber.py index 8fba726..03a36b0 100644 --- a/subscriber.py +++ b/subscriber.py @@ -161,7 +161,7 @@ class EnhancingSubscriber(DummySubscriber): if is_split: history_len = len(cell.poslog) - cell.parent = min(cell.player.cells, key=lambda c : (c.poslog[-history_len] - cell.poslog[-history_len]).len() if c != cell and len(c.poslog) >= history_len else 999999) + cell.parent = min(cell.player.cells, key=lambda c : (c.poslog[-history_len] - cell.poslog[-history_len]).len() if c != cell and len(c.poslog) >= history_len else float('inf')) elif cell.is_virus: is_split = False @@ -173,7 +173,7 @@ class EnhancingSubscriber(DummySubscriber): pass if is_split: - cell.parent = min(cell.player.cells, key=lambda c : (c.pos - cell.poslog[0]).len() if c != cell else 999999) + cell.parent = min(cell.player.cells, key=lambda c : (c.pos - cell.poslog[0]).len() if c != cell else float('inf')) elif cell.is_ejected_mass: is_split = False @@ -187,7 +187,7 @@ class EnhancingSubscriber(DummySubscriber): if is_split: history_len = len(cell.poslog) try: - cell.parent = min(filter(lambda c : not c.is_ejected_mass and not c.is_food and not c.is_virus and c.color == cell.color, self.c.world.cells.values()), key=lambda c : (c.poslog[-history_len] - cell.poslog[-history_len]).len() if len(c.poslog) >= history_len else 999999) + cell.parent = min(filter(lambda c : not c.is_ejected_mass and not c.is_food and not c.is_virus and c.color == cell.color, self.c.world.cells.values()), key=lambda c : (c.poslog[-history_len] - cell.poslog[-history_len]).len() if len(c.poslog) >= history_len else float('inf')) except ValueError: # if no possible parents are found, min wil raise a ValueError. ignore that. pass |