Exemplo n.º 1
0
 def get_next_ball_hit(self, ball):
     if ball.velocity.y == 0:
         return Prediction(False, 1e307)
     dist = rlmath.sign(self.wall_y) * (abs(self.wall_y - ball.location.y) -
                                        datalibs.BALL_RADIUS)
     t = dist / ball.velocity.y
     return Prediction(t >= 0, t)
Exemplo n.º 2
0
def stop_moving(data: Data):
    if not data.car.wheel_contact:
        return fix_orientation(data)

    controller_state = SimpleControllerState()

    # We are on the ground. Now negate all velocity
    vel_f = data.car.velocity.proj_onto_size(data.car.orientation.front)
    if abs(vel_f) > 200:
        controller_state.throttle = -rlmath.sign(vel_f)

    return controller_state
Exemplo n.º 3
0
    def utility(self, data):
        team_sign = datalibs.team_sign(data.car.team)

        ball_to_goal = datalibs.get_goal_location(data.car.team) - data.ball.location
        ball_vel_g = data.ball.velocity.proj_onto_size(ball_to_goal)
        if ball_vel_g > 0:
            vel_g_01 = easing.fix(ball_vel_g / 700 + 0.36)
        else:
            vel_g_01 = 0

        too_close = ball_to_goal.length2() < 900*900

        hits_goal_prediction = predict.will_ball_hit_goal(data.ball)
        hits_goal = hits_goal_prediction.happens and rlmath.sign(data.ball.velocity.y) == team_sign and hits_goal_prediction.time < 6

        return easing.fix(vel_g_01) or hits_goal or too_close
Exemplo n.º 4
0
 def __init__(self, y):
     self.wall_y = y
     self.normal = Vec3(y=rlmath.sign(y))
Exemplo n.º 5
0
 def __init__(self, x):
     self.wall_x = x
     self.normal = Vec3(x=rlmath.sign(x))