Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def reset(self):
"""Resets game data after each genome"""
ball_state = BallState(Physics(velocity=Vector3(0, 0, 0), location=Vector3(self.pos, 5000, 3000),
angular_velocity=Vector3(0, 0, 0)))
car_state = CarState(jumped=False, double_jumped=False, boost_amount=33,
physics=Physics(velocity=Vector3(0, 0, 0), rotation=Rotator(45, 90, 0),
location=Vector3(0.0, -4608, 500), angular_velocity=Vector3(0, 0, 0)))
game_info_state = GameInfoState(game_speed=1)
game_state = GameState(ball=ball_state, cars={self.index: car_state}, game_info=game_info_state)
self.set_game_state(game_state)
def make_game_state(self, rng: SeededRandomNumberGenerator):
self.rng = rng
ball = Ball()
car = Car()
self.set_car_ball_state(car, ball)
return GameState(
ball=BallState(
physics=Physics(
location=vec3_to_Vector3(ball.position),
velocity=vec3_to_Vector3(ball.velocity),
angular_velocity=vec3_to_Vector3(ball.angular_velocity)
)
),
cars={
0: CarState(
physics=Physics(
location=vec3_to_Vector3(car.position),
velocity=vec3_to_Vector3(car.velocity),
angular_velocity=vec3_to_Vector3(car.angular_velocity),
rotation=mat3_to_Rotator(car.orientation)
),
boost_amount=car.boost
)