diff options
author | Florian Jung <flo@windfisch.org> | 2015-08-25 00:04:28 +0200 |
---|---|---|
committer | Florian Jung <flo@windfisch.org> | 2015-08-25 00:04:28 +0200 |
commit | dc0af643b64619a6898fd0c74be1407e73c0fb76 (patch) | |
tree | e04192427d3f4a24badaf84e1747096e6a5a94d0 /strategy.py | |
parent | 9a00624c68cc0606cdd2be5eaf4f5c5658edb02a (diff) |
sexy graphics
Diffstat (limited to 'strategy.py')
-rw-r--r-- | strategy.py | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/strategy.py b/strategy.py index a7e553e..d0f8583 100644 --- a/strategy.py +++ b/strategy.py @@ -132,12 +132,14 @@ class Strategy: friend_to_feed = None if friend_to_feed: gui.hilight_cell(friend_to_feed, (255,255,255),(255,127,127),30) - for c in self.c.player.own_cells: - gui.hilight_cell(c, (255,255,255), (255,127,127), 20) self.target_cell = friend_to_feed self.has_target = True + if self.do_approach_friends: + for c in self.c.player.own_cells: + gui.hilight_cell(c, (255,255,255), (255,127,127), 20) + # can this cell feed that cell? # "False" means "No, definitely not" # "True" means "Maybe" @@ -176,8 +178,9 @@ class Strategy: area = interval_area( intersection(good_intervals, canonicalize_angle_interval((my_cell.movement_angle - 10*math.pi/180, my_cell.movement_angle + 10*math.pi/180))) ) success_rate += area / (2*10*math.pi/180) / len(list(self.c.player.own_cells)) - if success_rate >= 0.5: - print("EJECT") + + gui.draw_bar(((100,40),(500,24)), success_rate, thresh=.98, color=(0,0,127)) + if success_rate >= 0.98: self.c.send_shoot() |