diff options
author | Florian Jung <flo@windfisch.org> | 2015-09-22 19:51:56 +0200 |
---|---|---|
committer | Florian Jung <flo@windfisch.org> | 2015-09-22 19:51:56 +0200 |
commit | 8184e7c9a463867e9be420558503b7a52c3e9e75 (patch) | |
tree | 2a49e2cc5fe468659dfc3bfb9f374d1836e1e869 /mechanics.py | |
parent | 7bfa215e4ce3850cfa2cc4812ad62d8725ba372b (diff) |
works a bit... sometimes...
Diffstat (limited to 'mechanics.py')
-rw-r--r-- | mechanics.py | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/mechanics.py b/mechanics.py index c290a5f..727a258 100644 --- a/mechanics.py +++ b/mechanics.py @@ -20,15 +20,18 @@ def get_my_smallest_cell(c): def get_my_largest_cell(c): return sorted(c.player.own_cells, key = lambda x: x.mass)[-1] +def random_own_cell(c): + return c.player.world.cells[next(iter(c.player.own_ids))] + def is_enemy(cell, c): - return (not cell.same_player(c.player.own_cells[0])) and cell.mass > 1.25 * get_my_smallest_cell(c).mass + return (not cell.same_player(random_own_cell(c))) and cell.mass > 1.25 * get_my_smallest_cell(c).mass def is_splitkiller(cell, c): - return (not cell.same_player(c.player.own_cells[0])) and cell.mass > 2.5 * get_my_smallest_cell(c).mass + return (not cell.same_player(random_own_cell(c))) and cell.mass > 2.5 * get_my_smallest_cell(c).mass def is_edible(cell, c): - return cell.is_food or cell.is_ejected_mass or ( (not cell.same_player(c.player.own_cells[0])) and not is_enemy(cell,c) and get_my_largest_cell(c).mass > 1.25 * cell.mass ) + return cell.is_food or cell.is_ejected_mass or ( (not cell.same_player(random_own_cell(c))) and not is_enemy(cell,c) and get_my_largest_cell(c).mass > 1.25 * cell.mass ) def is_dangerous_virus(cell, c): - return cell.is_virus and (cell.mass < self.get_my_largest().mass) + return cell.is_virus and (cell.mass < get_my_largest_cell(c).mass) |