Ejemplo n.º 1
0
    def opponent_protect_goal(self, env, goal_point):

        for h in shortcuts.opponent_field_hockeyists(env):
            distance = geometry.ray_point_distance(
                env.world.puck,
                geometry.diff(env.world.puck, goal_point),
                h
            )
            if distance <= h.radius:
                return True
        return False
Ejemplo n.º 2
0
def puck_is_heading_to_unit(env, unit):
    if shortcuts.hockeyist_with_puck(env) is not None:
        return False
    speed_abs = geometry.vector_abs(env.world.puck.speed_x, env.world.puck.speed_y)
    if speed_abs < 10:
        return False
    return geometry.ray_point_distance(
        env.world.puck,
        geometry.Point(
            env.world.puck.speed_x,
            env.world.puck.speed_y
        ),
        unit) < 60