code: def human():
      """Run a host which expects one player to connect remotely."""
      run_config = run_configs.get()
  
      map_inst = maps.get(FLAGS.map)
  
      if not FLAGS.rgb_screen_size or not FLAGS.rgb_minimap_size:
          logging.info(
              "Use --rgb_screen_size and --rgb_minimap_size if you want rgb "
              "observations."
          )
  
      ports = portspicker.pick_contiguous_unused_ports(
          4
      )  # 2 * num_players
      host_proc = run_config.start(
          extra_ports=ports,
          host=FLAGS.host,
          timeout_seconds=FLAGS.timeout_seconds,
          window_loc=(50, 50),
      )
      client_proc = run_config.start(
          extra_ports=ports,
          host=FLAGS.host,
          connect=False,
          window_loc=(700, 50),
      )
  
      create = sc_pb.RequestCreateGame(
          realtime=FLAGS.realtime,
          local_map=sc_pb.LocalMap(map_path=map_inst.path),
      )
      create.player_setup.add(type=sc_pb.Participant)
      create.player_setup.add(type=sc_pb.Participant)
  
      controller = host_proc.controller
      controller.save_map(map_inst.path, map_inst.data(run_config))
      controller.create_game(create)
  
      print("-" * 80)
      print(
          "Join host: agent_remote --map %s --host %s --host_port %s "
          "--lan_port %s"
          % (FLAGS.map, FLAGS.host, client_proc.port, ports[0])
      )
      print("-" * 80)
      sys.stdout.flush()
  
      join = sc_pb.RequestJoinGame()
      join.shared_port = 0  # unused
      join.server_ports.game_port = ports.pop(0)
      join.server_ports.base_port = ports.pop(0)
      join.client_ports.add(
          game_port=ports.pop(0), base_port=ports.pop(0)
      )
  
      join.race = sc2_env.Race[FLAGS.user_race]
      join.player_name = FLAGS.user_name
      if FLAGS.render:
          join.options.raw = True
          join.options.score = True
          if FLAGS.feature_screen_size and FLAGS.feature_minimap_size:
              fl = join.options.feature_layer
              fl.width = 24
              FLAGS.feature_screen_size.assign_to(fl.resolution)
              FLAGS.feature_minimap_size.assign_to(
                  fl.minimap_resolution
              )
          if FLAGS.rgb_screen_size and FLAGS.rgb_minimap_size:
              FLAGS.rgb_screen_size.assign_to(
                  join.options.render.resolution
              )
              FLAGS.rgb_minimap_size.assign_to(
                  join.options.render.minimap_resolution
              )
      controller.join_game(join)
  
      if FLAGS.render:
          renderer = renderer_human.RendererHuman(
              fps=FLAGS.fps, render_feature_grid=False
          )
          renderer.run(run_configs.get(), controller, max_episodes=1)
      else:  # Still step forward so the Mac/Windows renderer works.
          try:
              while True:
                  frame_start_time = time.time()
                  if not FLAGS.realtime:
                      controller.step()
                  obs = controller.observe()
  
                  if obs.player_result:
                      break
                  time.sleep(
                      max(
                          0,
                          frame_start_time
                          - time.time()
                          + 1 / FLAGS.fps,
                      )
                  )
          except KeyboardInterrupt:
              pass
  
      for p in [host_proc, client_proc]:
          p.close()
  
      portspicker.return_ports(ports)
  
imports: import getpass
  import importlib
  import platform
  import sys
  import time
  from absl import app
  from absl import flags
  from absl import logging
  from pysc2 import maps
  from pysc2 import run_configs
  from pysc2.env import remote_sc2_env
  from pysc2.env import run_loop
  from pysc2.env import sc2_env
  from pysc2.lib import point_flag
  from pysc2.lib import portspicker
  from pysc2.lib import renderer_human
  from s2clientprotocol import sc2api_pb2
label_desc: Use image node_id 3 for calling a global function with example usage: human() without return types