leaderboard/leaderboard/autoagents/human_agent.py
def _parse_vehicle_keys(self, keys, milliseconds):
        """
        Calculate new vehicle controls based on input keys
        """

        for event in pygame.event.get():
            if event.type == pygame.QUIT:
                return 
            elif event.type == pygame.KEYUP:
                if event.key == K_q:
                    self._control.gear = 1 if self._control.reverse else -1
                    self._control.reverse = self._control.gear < 0

        if keys[K_UP] or keys[K_w]:
            self._control.throttle = 0.6
        else:
            self._control.throttle = 0.0

        steer_increment = 3e-4 * milliseconds
        if keys[K_LEFT] or keys[K_a]:
            self._steer_cache -= steer_increment
        elif keys[K_RIGHT] or keys[K_d]:
            self._steer_cache += steer_increment
        else:
            self._steer_cache = 0.0

        steer_cache = min(0.95, max(-0.95, self._steer_cache))
        self._control.steer = round(self._steer_cache, 1)
        self._control.brake = 1.0 if keys[K_DOWN] or keys[K_s] else 0.0
        self._control.hand_brake = keys[K_SPACE]

        Calculate new vehicle controls based on input keys
        
Calculate new vehicle controls based on input keys
Calculate new vehicle controls based on input keys
def _parse_vehicle_keys(self, keys, milliseconds):
        for event in pygame.event.get():
            if event.type == pygame.QUIT:
                return 
            elif event.type == pygame.KEYUP:
                if event.key == K_q:
                    self._control.gear = 1 if self._control.reverse else -1
                    self._control.reverse = self._control.gear < 0
        if keys[K_UP] or keys[K_w]:
            self._control.throttle = 0.6
        else:
            self._control.throttle = 0.0
        steer_increment = 3e-4 * milliseconds
        if keys[K_LEFT] or keys[K_a]:
            self._steer_cache -= steer_increment
        elif keys[K_RIGHT] or keys[K_d]:
            self._steer_cache += steer_increment
        else:
            self._steer_cache = 0.0
        steer_cache = min(0.95, max(-0.95, self._steer_cache))
        self._control.steer = round(self._steer_cache, 1)
        self._control.brake = 1.0 if keys[K_DOWN] or keys[K_s] else 0.0
        self._control.hand_brake = keys[K_SPACE]
def _parse_vehicle_keys ( self , keys , milliseconds ) : for event in pygame . event . get ( ) : if event . type == pygame . QUIT : return elif event . type == pygame . KEYUP : if event . key == K_q : self . _control . gear = 1 if self . _control . reverse else - 1 self . _control . reverse = self . _control . gear < 0 if keys [ K_UP ] or keys [ K_w ] : self . _control . throttle = 0.6 else : self . _control . throttle = 0.0 steer_increment = 3e-4 * milliseconds if keys [ K_LEFT ] or keys [ K_a ] : self . _steer_cache -= steer_increment elif keys [ K_RIGHT ] or keys [ K_d ] : self . _steer_cache += steer_increment else : self . _steer_cache = 0.0 steer_cache = min ( 0.95 , max ( - 0.95 , self . _steer_cache ) ) self . _control . steer = round ( self . _steer_cache , 1 ) self . _control . brake = 1.0 if keys [ K_DOWN ] or keys [ K_s ] else 0.0 self . _control . hand_brake = keys [ K_SPACE ]
Calculate new vehicle controls based on input keys
Calculate new vehicle controls based on input keys
"""
        Calculate new vehicle controls based on input keys
        """
self
keys
milliseconds