parameters: (self)
docstring: The bot hivemind will stay in this loop for the whole game.
          This is where the initialize_hive and get_outputs functions are called.
docstring_summary: The bot hivemind will stay in this loop for the whole game.
          This is where the initialize_hive and get_outputs functions are called.
docstring_tokens: The bot hivemind will stay in this loop for the whole game . This is where the initialize_hive and get_outputs functions are called .
function: def __game_loop(self):
          """
          The bot hivemind will stay in this loop for the whole game.
          This is where the initialize_hive and get_outputs functions are called.
          """
  
          # Creating ball prediction and field info objects to later update in wrapper methods.
          self._ball_prediction = BallPrediction()
  
          # Create packet object.
          packet = GameTickPacket()
          # Uses one of the drone indices as a key.
          first_index = next(iter(self.drone_indices))
          self.game_interface.fresh_live_data_packet(packet, 20, first_index)
  
          # Get a rendering manager for the hivemind.
          self.team = packet.game_cars[first_index].team
          self.renderer = self.game_interface.renderer.get_rendering_manager(bot_index=first_index, bot_team=self.team)
  
          # Initialization step for your hivemind.
          self.initialize_hive(packet)
  
          while not self.quit_event.is_set():
              try:
                  # Updating the packet.
                  self.game_interface.fresh_live_data_packet(packet, 20, first_index)
  
                  # Get outputs from hivemind for each bot.
                  # Outputs are expected to be a Dict[int, PlayerInput]
                  outputs = self.get_outputs(packet)
  
                  if outputs is None:
                      self.logger.error("No outputs were returned.")
                      self.logger.error("  Try putting `return {i: PlayerInput() for i in self.drone_indices}`")
                      self.logger.error("  in `get_outputs()` to troubleshoot.")
                      continue
  
                  if len(outputs) < len(self.drone_indices):
                      self.logger.error("Not enough outputs were given.")
  
                  elif len(outputs) > len(self.drone_indices):
                      self.logger.error("Too many outputs were given.")
  
                  # Send the drone inputs to the drones.
                  for index in outputs:
                      if index not in self.drone_indices:
                          self.logger.error("Tried to send output to bot index not in drone_indices.")
                          continue
                      output = outputs[index]
                      self.game_interface.update_player_input(output, index)
  
              except Exception:
                  traceback.print_exc()
function_tokens: def __game_loop ( self ) : # Creating ball prediction and field info objects to later update in wrapper methods. self . _ball_prediction = BallPrediction ( ) # Create packet object. packet = GameTickPacket ( ) # Uses one of the drone indices as a key. first_index = next ( iter ( self . drone_indices ) ) self . game_interface . fresh_live_data_packet ( packet , 20 , first_index ) # Get a rendering manager for the hivemind. self . team = packet . game_cars [ first_index ] . team self . renderer = self . game_interface . renderer . get_rendering_manager ( bot_index = first_index , bot_team = self . team ) # Initialization step for your hivemind. self . initialize_hive ( packet ) while not self . quit_event . is_set ( ) : try : # Updating the packet. self . game_interface . fresh_live_data_packet ( packet , 20 , first_index ) # Get outputs from hivemind for each bot. # Outputs are expected to be a Dict[int, PlayerInput] outputs = self . get_outputs ( packet ) if outputs is None : self . logger . error ( "No outputs were returned." ) self . logger . error ( "  Try putting `return {i: PlayerInput() for i in self.drone_indices}`" ) self . logger . error ( "  in `get_outputs()` to troubleshoot." ) continue if len ( outputs ) < len ( self . drone_indices ) : self . logger . error ( "Not enough outputs were given." ) elif len ( outputs ) > len ( self . drone_indices ) : self . logger . error ( "Too many outputs were given." ) # Send the drone inputs to the drones. for index in outputs : if index not in self . drone_indices : self . logger . error ( "Tried to send output to bot index not in drone_indices." ) continue output = outputs [ index ] self . game_interface . update_player_input ( output , index ) except Exception : traceback . print_exc ( )