def which_game_masters(
      self,
      configurator: entity_lib.Entity,
      game_master_prefabs: Mapping[str, prefab_lib.Prefab],
      verbose: bool = False,
  ) -> prefab_lib.InstanceConfig:
    """Select which game master to use for the simulation."""
    game_masters_by_name = {
        name: prefab.description for name, prefab in game_master_prefabs.items()
    }

    # removing the game masters with _initializer_ in their name
    game_masters_by_name = {
        name: game_master
        for name, game_master in game_masters_by_name.items()
        if '_initializer_' not in name and 'dramaturgic' not in name
    }

    # make an observation of game masters and their descriptions
    configurator.observe(
        f'Game masters and their descriptions:\n{str(game_masters_by_name)}'
    )

    game_master_name = configurator.act(
        action_spec=entity_lib.ActionSpec(
            call_to_action=self._call_to_which_game_masters,
            output_type=entity_lib.OutputType.CHOICE,
            options=tuple(game_masters_by_name.keys()),
        )
    )
    if verbose:
      print(termcolor.colored(f'Game master: {game_master_name}', _PRINT_COLOR))
    if game_master_name not in game_masters_by_name:
      raise ValueError(
          f'Selected game master "{game_master_name}" not found in:'
          f' {game_masters_by_name.keys()}'
      )

    instance_config = prefab_lib.InstanceConfig(
        prefab=game_master_name,
        role=prefab_lib.Role.GAME_MASTER,
        params={'name': 'default rules'},
    )

    if 'locations' in game_master_prefabs[game_master_name].params:
      locations = configurator.act(
          action_spec=entity_lib.ActionSpec(
              call_to_action='What is the location of the simulation?',
              output_type=entity_lib.OutputType.FREE,
          )
      )
      instance_config = prefab_lib.InstanceConfig(
          prefab=game_master_name,
          role=prefab_lib.Role.GAME_MASTER,
          params={
              'name': 'default rules',
              'locations': locations,
          },
      )

    return instance_config
Select which game master to use for the simulation.
concordia/environment/engines/configuration.py