def configure_players(
    model: language_model.LanguageModel,
    sampled_settings: Any,
    time_and_place_params: types.ModuleType,
    rng: random.Random,
) -> tuple[
    list[formative_memories.AgentConfig],
    list[formative_memories.AgentConfig],
    formative_memories.AgentConfig,
    formative_memories.AgentConfig,
]:
  """Configure the players.

  Args:
    model: the language model to use
    sampled_settings: the environment configuration containing the time and
      place details.
    time_and_place_params: the module containing the time and place parameters
    rng: the random number generator to use.

  Returns:
    main_player_configs: configs for the main characters
    supporting_player_configs: configs for the supporting characters
    antagonist_config: config of the antagonist character
    organizer_config: config of the labor organizer character
  """
  num_main_players = time_and_place_params.NUM_MAIN_PLAYERS
  if time_and_place_params.NUM_MAIN_PLAYERS > len(sampled_settings.people):
    num_main_players = len(sampled_settings.people)
  main_player_names = sampled_settings.people[:num_main_players]

  joined_world_elements = '\n'.join(sampled_settings.world_elements)

  def get_agent_config(player_name: str, environment_cfg: Any):
    if environment_cfg.person_data[player_name]['gender'] == 'male':
      subject_pronoun = 'he'
      object_pronoun = 'him'
    elif environment_cfg.person_data[player_name]['gender'] == 'female':
      subject_pronoun = 'she'
      object_pronoun = 'her'
    else:
      subject_pronoun = 'they'
      object_pronoun = 'their'

    birth_year = environment_cfg.year - (30 + rng.randint(-8, 8))
    birth_month = rng.randint(1, 12)
    birth_day = rng.randint(1, 28)
    goal_str = (
        f'{player_name} hopes to be able to provide for their '
        'family and live a full life.'
    )
    traits_str = (
        f"{player_name}'s personality is like "
        + player_traits_and_styles.get_trait(flowery=True)
    )
    prompt = interactive_document.InteractiveDocument(
        model, rng=np.random.default_rng(sampled_settings.seed)
    )
    prompt.statement(
        'The following exercise is preparatory work for a role playing '
        'session. The purpose of the exercise is to fill in the backstory '
        f'for a character named {player_name}.'
    )
    prompt.statement(f'The year is {environment_cfg.year}.\n')
    prompt.statement(f'The location is {environment_cfg.location}.\n')
    prompt.statement(f'{player_name} was born in the year {birth_year}.\n')
    prompt.statement(f'Past events:\n{joined_world_elements}\n')
    prompt.statement(goal_str)
    prompt.statement(traits_str)
    player_backstory_answers = []
    for question in environment_cfg.formative_memory_prompts[player_name]:
      answer = prompt.open_question(question=question, max_tokens=500)
      player_backstory_answers.append(answer)
    public_face_prefix = (
        f'What casual acquaintances remember about {player_name} is that '
    )
    public_face = prompt.open_question(
        question=(
            f'What do most acquaintances know about {player_name}? How '
            f'does {subject_pronoun} present {object_pronoun}self to others? '
            f'Does {subject_pronoun} have any personality quirks, salient '
            'mannerisms, accents, or patterns of speech which casual '
            f'acquaintances may be aware of? Is {subject_pronoun} especially '
            'likely to bring up certain favorite conversation topics? '
            f'Is {subject_pronoun} known for having '
            'unusual beliefs or for uncommon fashion choices? Does '
            f'{subject_pronoun} often talk about memorable life experiences, '
            'past occupations, or hopes for the future which others would be '
            'likely to remember them for? Overall, how '
            f'would casual acquaintances describe {object_pronoun} if pressed?'
        ),
        answer_prefix=public_face_prefix,
        max_tokens=500,
    )
    player_backstory_answers.append(public_face_prefix + public_face)
    return formative_memories.AgentConfig(
        name=player_name,
        gender=environment_cfg.person_data[player_name].get('gender', None),
        date_of_birth=datetime.datetime(
            year=birth_year, month=birth_month, day=birth_day
        ),
        goal=goal_str,
        context=(
            ' '.join(environment_cfg.world_elements)
            + ' '
            + ' '.join(player_backstory_answers)
        ),
        traits=traits_str,
        extras={
            'player_specific_memories': player_backstory_answers + list(
                environment_cfg.person_data[player_name]['salient_beliefs']
            ),
            'main_character': True,
            'initial_endowment': {
                'coin': 5.0,
            },
            'public_face': public_face,
        },
    )

  # Embellish main player backstory prompts in parallel.
  player_configs = concurrency.map_parallel(
      functools.partial(get_agent_config, environment_cfg=sampled_settings),
      main_player_names,
  )

  public_faces = {
      config.name: config.extras['public_face'] for config in player_configs
  }
  for config in player_configs:
    for name, public_face in public_faces.items():
      if config.name != name:
        config.extras['player_specific_memories'].append(
            f'What {config.name} remembers about {name} is that ' + public_face
        )
  antagonist_knowledge_of_others = []
  for name, public_face in public_faces.items():
    antagonist_knowledge_of_others.append(
        f'What {sampled_settings.antagonist} remembers about {name} is that '
        + public_face
    )
  organizer_knowledge_of_others = []
  for name, public_face in public_faces.items():
    organizer_knowledge_of_others.append(
        f'What {sampled_settings.antagonist} remembers about {name} is that '
        + public_face
    )

  # Add supporting players: (1) the antagonist, and (2) the labor organizer.
  antagonist_params = sampled_settings.person_data[sampled_settings.antagonist]
  antagonist_config = formative_memories.AgentConfig(
      name=sampled_settings.antagonist,
      gender=sampled_settings.person_data[sampled_settings.antagonist].get(
          'gender', None
      ),
      date_of_birth=datetime.datetime(
          year=sampled_settings.year - (30 + rng.randint(10, 30)),
          month=rng.randint(1, 12),
          day=rng.randint(1, 28),
      ),
      goal=(
          f'{sampled_settings.antagonist} wants to make as much money '
          'as possible and does not care who gets hurt along the way.'
      ),
      context=(
          ' '.join(sampled_settings.world_elements)
          + ' '
          + ' '.join(antagonist_params['salient_beliefs'])
      ),
      traits=(
          f"{sampled_settings.antagonist}'s personality is "
          'supremely rational and ruthless.'
      ),
      extras={
          'player_specific_memories': (
              antagonist_params['salient_beliefs']
              + antagonist_knowledge_of_others
          ),
          'main_character': False,
          'initial_endowment': {
              'coin': 100.0,
          },
      },
  )
  player_configs = [*player_configs, antagonist_config]
  organizer_params = sampled_settings.person_data[sampled_settings.organizer]
  organizer_config = formative_memories.AgentConfig(
      name=sampled_settings.organizer,
      gender=sampled_settings.person_data[sampled_settings.organizer].get(
          'gender', None
      ),
      date_of_birth=datetime.datetime(
          year=sampled_settings.year - (30 + rng.randint(2, 10)),
          month=rng.randint(1, 12),
          day=rng.randint(1, 28),
      ),
      goal=(
          f'{sampled_settings.organizer} wants to prevent the '
          'boss from instituting their latest policy '
          'announcement which said they plan to reduce wages from '
          f'{time_and_place_params.ORIGINAL_DAILY_PAY} to '
          f'{time_and_place_params.LOW_DAILY_PAY} coins per day, and to '
          'become famous in the labor movement as a result.'
      ),
      context=(
          ' '.join(sampled_settings.world_elements)
          + ' '
          + ' '.join(organizer_params['salient_beliefs'])
      ),
      traits=(
          f"{sampled_settings.organizer}'s personality is impatient and "
          'ambitious, but also fundamentally kind.'
      ),
      extras={
          'player_specific_memories': (
              organizer_params['salient_beliefs']
              + organizer_knowledge_of_others
          ),
          'main_character': False,
          'initial_endowment': {
              'coin': 1.0,
          },
      },
  )
  player_configs.append(organizer_config)

  main_player_configs = [
      player for player in player_configs if player.extras['main_character']
  ]
  supporting_player_configs = [
      player for player in player_configs if not player.extras['main_character']
  ]

  return (
      main_player_configs,
      supporting_player_configs,
      antagonist_config,
      organizer_config,
  )
Configure the players.

  Args:
    model: the language model to use
    sampled_settings: the environment configuration containing the time and
      place details.
    time_and_place_params: the module containing the time and place parameters
    rng: the random number generator to use.

  Returns:
    main_player_configs: configs for the main characters
    supporting_player_configs: configs for the supporting characters
    antagonist_config: config of the antagonist character
    organizer_config: config of the labor organizer character
  
examples/deprecated/modular/environment/labor_collective_action.py