original_docstring: Reset the game if necessary. This can be because:
              - we reach the end of an episode (we restart the game)
              - because the agent is dead (we make it respawn)
          
docstring: Reset the game if necessary. This can be because:
  we reach the end of an episode (we restart the game)
  because the agent is dead (we make it respawn)
docstring_tokens: Reset the game if necessary . This can be because : we reach the end of an episode ( we restart the game ) because the agent is dead ( we make it respawn )
code: def reset(self):
          """Reset the game if necessary. This can be because:
              - we reach the end of an episode (we restart the game)
              - because the agent is dead (we make it respawn)
          """
          self.count_non_forward_actions = 0
          # if the player is dead
          if self.is_player_dead():
              # respawn it (deathmatch mode)
              if self.episode_time is None:
                  self.respawn_player()
              # or reset the episode (episode ends when the agent dies)
              else:
                  self.new_episode()
  
          # start a new episode if it is finished
          if self.is_episode_finished():
              self.new_episode()
  
          # deal with a ViZDoom issue
          while self.is_player_dead():
              logger.warning('Player %i is still dead after respawn.' %
                             self.params.player_rank)
              self.respawn_player()
code_tokens: def reset ( self ) : self . count_non_forward_actions = 0 if self . is_player_dead ( ) : if self . episode_time is None : self . respawn_player ( ) else : self . new_episode ( ) if self . is_episode_finished ( ) : self . new_episode ( ) while self . is_player_dead ( ) : logger . warning ( 'Player %i is still dead after respawn.' % self . params . player_rank ) self . respawn_player ( )
short_docstring: Reset the game if necessary.
short_docstring_tokens: Reset the game if necessary .
comment: """Reset the game if necessary. This can be because:
              - we reach the end of an episode (we restart the game)
              - because the agent is dead (we make it respawn)
          """$SEP$# if the player is dead$SEP$# respawn it (deathmatch mode)$SEP$# or reset the episode (episode ends when the agent dies)$SEP$# start a new episode if it is finished$SEP$# deal with a ViZDoom issue