diff --git a/base/bhv_kick.py b/base/bhv_kick.py index 22c6de4..d3293c8 100644 --- a/base/bhv_kick.py +++ b/base/bhv_kick.py @@ -17,6 +17,7 @@ from lib.player.world_model import WorldModel from lib.player.player_agent import PlayerAgent +from pyrusgeom.geom_2d import Vector2D class BhvKick: def __init__(self): @@ -40,12 +41,17 @@ def execute(self, agent: 'PlayerAgent'): if len(action_candidates) == 0: return self.no_candidate_action(agent) - + best_action: KickAction = max(action_candidates) target = best_action.target_ball_pos + if target.x() >= wm.offside_line_x(): + target = Vector2D(wm.offside_line_x() - 0.5, target.y()) + if len(wm.opponents()) == 0 and best_action.type is KickActionType.Pass: + best_action = max(action_candidates, key=lambda x: x.eval and x.type is not KickActionType.Pass) log.debug_client().set_target(target) log.debug_client().add_message(best_action.type.value + 'to ' + best_action.target_ball_pos.__str__() + ' ' + str(best_action.start_ball_speed)) + SmartKick(target, best_action.start_ball_speed, best_action.start_ball_speed - 1, 3).execute(agent) if best_action.type is KickActionType.Pass: diff --git a/base/generator_dribble.py b/base/generator_dribble.py index 7152781..ef993d5 100644 --- a/base/generator_dribble.py +++ b/base/generator_dribble.py @@ -50,7 +50,7 @@ def generate_simple_dribble(self, wm: 'WorldModel'): for a in range(angle_div): dash_angle = wm.self().body() + (angle_step * a) - if wm.self().pos().x() < 16.0 and dash_angle.abs() > 100.0: + if dash_angle.abs() > 100.0: if debug_dribble: log.sw_log().dribble().add_text( '#dash angle:{} cancel is not safe1'.format(dash_angle)) continue diff --git a/base/generator_pass.py b/base/generator_pass.py index ece617c..1f49753 100644 --- a/base/generator_pass.py +++ b/base/generator_pass.py @@ -180,7 +180,6 @@ def generate_lead_pass(self, wm: 'WorldModel', receiver): for a in range(abgle_divs + 1): angle = angle_from_ball + angle_step * a receive_point = receiver.inertia_point(1) + Vector2D.from_polar(player_move_dist, angle) - move_dist_penalty_step = 0 ball_move_line = Line2D(wm.ball().pos(), receive_point) player_line_dist = ball_move_line.dist(receiver.pos()) diff --git a/base/generator_shoot.py b/base/generator_shoot.py index 0424798..d09fae7 100644 --- a/base/generator_shoot.py +++ b/base/generator_shoot.py @@ -117,6 +117,9 @@ def check_shoot(self, wm: 'WorldModel', target_point: Vector2D, first_ball_speed for o in range(1, 12): opp = wm.their_player(o) + if opp is None: + log.sw_log().shoot().add_text( '## opp {} can not, none') + continue if opp.unum() < 1: log.sw_log().shoot().add_text( '## opp {} can not, unum') continue diff --git a/requirements.txt b/requirements.txt index 2e94d1a..cd4ac35 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,5 +1,6 @@ coloredlogs==15.0.1 humanfriendly==10.0 +setuptools==58.2.0 numpy==1.24.2 pyrusgeom==0.1.2 scipy==1.10.1