Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion base/bhv_kick.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand All @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion base/generator_dribble.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 0 additions & 1 deletion base/generator_pass.py
Original file line number Diff line number Diff line change
Expand Up @@ -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())
Expand Down
3 changes: 3 additions & 0 deletions base/generator_shoot.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -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
Expand Down