original_docstring: Executes a full trajectory of the agent interacting with the environment.
  
      Returns:
        The number of steps taken and the total reward.
      
docstring: Executes a full trajectory of the agent interacting with the environment.
docstring_tokens: Executes a full trajectory of the agent interacting with the environment .
code: def _run_one_episode(self):
      """Executes a full trajectory of the agent interacting with the environment.
  
      Returns:
        The number of steps taken and the total reward.
      """
      step_number = 0
      total_reward = 0.
  
      action = self._initialize_episode()
      is_terminal = False
  
      # Keep interacting until we reach a terminal state.
      while True:
        observation, reward, is_terminal = self._run_one_step(action)
  
        total_reward += reward
        step_number += 1
  
        # Perform reward clipping.
        reward = np.clip(reward, -1, 1)
  
        if (self._environment.game_over or
            step_number == self._max_steps_per_episode):
          # Stop the run loop once we reach the true end of episode.
          break
        elif is_terminal:
          # If we lose a life but the episode is not over, signal an artificial
          # end of episode to the agent.
          self._agent.end_episode(reward)
          action = self._agent.begin_episode(observation)
        else:
          action = self._agent.step(reward, observation)
  
      self._end_episode(reward)
  
      return step_number, total_reward
code_tokens: def _run_one_episode ( self ) : step_number = 0 total_reward = 0. action = self . _initialize_episode ( ) is_terminal = False while True : observation , reward , is_terminal = self . _run_one_step ( action ) total_reward += reward step_number += 1 reward = np . clip ( reward , - 1 , 1 ) if ( self . _environment . game_over or step_number == self . _max_steps_per_episode ) : break elif is_terminal : self . _agent . end_episode ( reward ) action = self . _agent . begin_episode ( observation ) else : action = self . _agent . step ( reward , observation ) self . _end_episode ( reward ) return step_number , total_reward
short_docstring: Executes a full trajectory of the agent interacting with the environment.
short_docstring_tokens: Executes a full trajectory of the agent interacting with the environment .
comment: """Executes a full trajectory of the agent interacting with the environment.
  
      Returns:
        The number of steps taken and the total reward.
      """$SEP$# Keep interacting until we reach a terminal state.$SEP$# Perform reward clipping.$SEP$# Stop the run loop once we reach the true end of episode.$SEP$# If we lose a life but the episode is not over, signal an artificial$SEP$# end of episode to the agent.