summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFlorian Jung <flo@windfisch.org>2015-09-01 18:14:37 +0200
committerFlorian Jung <flo@windfisch.org>2015-09-01 18:14:37 +0200
commit738d057c6da4aaca7516158db55f3553a03cf189 (patch)
treecc2cd7cb0fbfc8b7b79b364cf478d1dc4b75a5ad
parent4251e85c172f57c39bdfa244e945578eb450926d (diff)
better "can i safely feed" estimation
-rw-r--r--gui.py4
-rw-r--r--mechanics.py1
-rw-r--r--strategy.py9
3 files changed, 8 insertions, 6 deletions
diff --git a/gui.py b/gui.py
index 001fc80..2a8460c 100644
--- a/gui.py
+++ b/gui.py
@@ -209,8 +209,8 @@ def draw_cell(cell):
cx,cy = world_to_win_pt(cell.pos,c.player.center)
try:
mov_ang = cell.movement_angle
- p2 = cell.pos + Vec( math.cos(mov_ang + 26*math.pi/180), math.sin(mov_ang + 26*math.pi/180) ) * (cell.size+700)
- p3 = cell.pos + Vec( math.cos(mov_ang - 26*math.pi/180), math.sin(mov_ang - 26*math.pi/180) ) * (cell.size+700)
+ p2 = cell.pos + Vec( math.cos(mov_ang + mechanics.eject_delta*math.pi/180), math.sin(mov_ang + mechanics.eject_delta*math.pi/180) ) * (cell.size+700)
+ p3 = cell.pos + Vec( math.cos(mov_ang - mechanics.eject_delta*math.pi/180), math.sin(mov_ang - mechanics.eject_delta*math.pi/180) ) * (cell.size+700)
cx2,cy2 = world_to_win_pt(p2,c.player.center)
cx3,cy3 = world_to_win_pt(p3,c.player.center)
diff --git a/mechanics.py b/mechanics.py
index 1f9d5cc..5f2254b 100644
--- a/mechanics.py
+++ b/mechanics.py
@@ -4,3 +4,4 @@ def speed(size):
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)
diff --git a/strategy.py b/strategy.py
index 900cf8f..bbbe07d 100644
--- a/strategy.py
+++ b/strategy.py
@@ -2,6 +2,7 @@ import math
from interval_utils import *
import random
import nogui
+import mechanics
friendly_players=["Windfisch","windfisch","Cyanide","cyanide"] +\
["Midna","Nayru","Farore","Din","Ezelo","Navi","Zelda","Tetra","Link","Ciela","Linebeck","Salia","Epona","Shiek"] +\
@@ -181,12 +182,12 @@ class Strategy:
good_intervals += canonicalize_angle_interval( interval_occupied_by_cell(my_cell.pos, feedable) )
good_intervals = merge_intervals(good_intervals)
- 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))
+ area = interval_area( intersection(good_intervals, canonicalize_angle_interval((my_cell.movement_angle - mechanics.eject_delta*math.pi/180, my_cell.movement_angle + mechanics.eject_delta*math.pi/180))) )
+ success_rate += area / (2*mechanics.eject_delta*math.pi/180) / len(list(self.c.player.own_cells))
- self.gui.draw_bar(((100,40),(500,24)), success_rate, thresh=.98, color=(0,0,127))
- if success_rate >= 0.98:
+ self.gui.draw_bar(((100,40),(500,24)), success_rate, thresh=.80, color=(0,0,127))
+ if success_rate >= 0.80:
self.c.send_shoot()