diff options
author | Florian Jung <flo@windfisch.org> | 2015-09-01 20:47:11 +0200 |
---|---|---|
committer | Florian Jung <flo@windfisch.org> | 2015-09-01 20:48:03 +0200 |
commit | 7a836f4a0a68188a1486b669c4cd437b5f592a5d (patch) | |
tree | 666d7867967e8d6fdc04aca6b18d8a95a077f33c /mechanics.py | |
parent | f99e10cff97afdc3e6ef07db22cf5f7fd442e067 (diff) | |
parent | 7c1180a7b58e7b8c17c8dab297058d0c001386c6 (diff) |
Merge branch 'master' into pathfinding
Diffstat (limited to 'mechanics.py')
-rw-r--r-- | mechanics.py | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/mechanics.py b/mechanics.py new file mode 100644 index 0000000..3aaa405 --- /dev/null +++ b/mechanics.py @@ -0,0 +1,15 @@ +from agarnet.agarnet.world import Cell + +def speed(size_or_cell): + if isinstance(size_or_cell, Cell): + if size_or_cell.is_virus or size_or_cell.is_ejected_mass or size_or_cell.is_food: + return 0 + else: + return speed(size_or_cell.size) + else: + return 86 / (size_or_cell**0.45) + +def viewport_diag(sizesum): + return 370 * max(sizesum,70)**0.431776 + +eject_delta = 22 # how many degrees do ejects deviate from the original direction (maximum) |