From 40e1693809b788470cd3daf62d13d21b1353667e Mon Sep 17 00:00:00 2001 From: Florian Jung Date: Wed, 23 Sep 2015 23:42:24 +0200 Subject: gui fixes --- gui.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/gui.py b/gui.py index 2a8460c..33f0a08 100644 --- a/gui.py +++ b/gui.py @@ -80,13 +80,21 @@ def draw_box(rect, color, filled=False, global_coords=True): world_to_win_pt(rect[0][0], c.player.center), world_to_win_pt(rect[0][1], c.player.center) ) - rect = (t, rect[1]) + w = ( + world_to_win_length(rect[1][0]), + world_to_win_length(rect[1][1]) + ) + rect = (t, w) if filled: screen.fill(color, rect) else: gfxdraw.rectangle(screen, rect, color) + +def draw_square(pos, r, color, filled=False, global_coords=True): + draw_box(((pos[0]-r, pos[1]-r),(pos[0]+r,pos[1]+r)), color, filled, global_coords) + def draw_circle(pos, r, color, filled=False, global_coords=True): if global_coords: pos = world_to_win_pt(pos, c.player.center) -- cgit v1.2.3 From b12734d412869ebd85320cc171723e6b9686336c Mon Sep 17 00:00:00 2001 From: Florian Jung Date: Wed, 23 Sep 2015 23:42:39 +0200 Subject: mechanic fix (plus more) --- mechanics.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mechanics.py b/mechanics.py index c290a5f..d15df83 100644 --- a/mechanics.py +++ b/mechanics.py @@ -21,10 +21,10 @@ def get_my_largest_cell(c): return sorted(c.player.own_cells, key = lambda x: x.mass)[-1] 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.is_virus and not cell.is_food and not cell.is_ejected_mass and (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.is_virus and not cell.is_food and not cell.is_ejected_mass and(not cell.same_player(random_own_cell(c))) and cell.mass > 2.5 * get_my_smallest_cell(c).mass and cell.mass < 10 * 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 ) -- cgit v1.2.3 From b6730116365c37a7dd6e822dc46896f81d8e56ee Mon Sep 17 00:00:00 2001 From: Florian Jung Date: Mon, 28 Sep 2015 01:00:23 +0200 Subject: fix party mode --- main.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main.py b/main.py index ab92ce3..b8eb746 100644 --- a/main.py +++ b/main.py @@ -87,7 +87,7 @@ for i in range(1,10): # 10 connection attempts # find out server and token to connect try: token = sys.argv[1] - addr, *_ = utils.get_party_address(token) + addr = utils.get_party_address(token) print("using party token") except: -- cgit v1.2.3 From 4638ab90d947db216c87c6bb07681088220511b3 Mon Sep 17 00:00:00 2001 From: Florian Jung Date: Thu, 15 Oct 2015 11:53:18 +0200 Subject: update to newer agarnet --- agarnet | 2 +- subscriber.py | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/agarnet b/agarnet index fcb201a..5eea687 160000 --- a/agarnet +++ b/agarnet @@ -1 +1 @@ -Subproject commit fcb201a3dc6bd867caacf94bb1e31a8c9f3b43fe +Subproject commit 5eea6879d9c020237342c2f3e0361fc859c2bd13 diff --git a/subscriber.py b/subscriber.py index 54c03cc..27cdfd3 100644 --- a/subscriber.py +++ b/subscriber.py @@ -13,6 +13,9 @@ class DummySubscriber: def on_sock_closed(self): log("on sock closed") + def on_server_version(self, number, text): + pass + def on_message_error(self,s): log("on msg err "+s) -- cgit v1.2.3