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

  Args:
    model: the language model to use
    show_title: the name of the reality show.
    sampled_settings: the environment configuration containing the time and
      place details.
      rng: the random number generator to use.

  Returns:
    main_player_configs: configs for the main characters
    supporting_player_configs: configs for the supporting characters
  """

  def get_agent_config(player_name: str, sampled_settings: Any):
    birth_year = sampled_settings.year - (25 + rng.randint(-3, 3))
    birth_month = rng.randint(1, 12)
    birth_day = rng.randint(1, 28)
    traits_str = sampled_settings.contestants[player_name]['traits']
    catchphrase = sampled_settings.contestants[player_name]['catchphrase']
    subject_pronoun = sampled_settings.contestants[player_name][
        'subject_pronoun'
    ]
    object_pronoun = sampled_settings.contestants[player_name][
        'subject_pronoun'
    ]
    prompt = interactive_document.InteractiveDocument(model)
    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 {sampled_settings.year}.\n')
    age = sampled_settings.year - birth_year
    prompt.statement(
        f'{player_name} was born in the year {birth_year} so '
        f'{subject_pronoun} is currently {age} years old.\n'
    )
    prompt.statement(
        f'{player_name} is currently a contestant on a reality show called '
        f'{show_title}.\n'
    )
    prompt.statement(f'{player_name} is {traits_str}')
    prompt.statement(f"{player_name}'s catchphrase is: {catchphrase}")
    prompt.statement(
        'The following is the transcript of a '
        'confessional-style introductory interview '
        "conversation between the show's host and "
        f'{player_name}.'
    )
    interview = []
    for interview_question in sampled_settings.contestants[player_name][
        'interview_questions'
    ]:
      answer = prompt.open_question(question=interview_question, max_tokens=500)
      combined = f'Host -- "{interview_question}"\n{player_name} -- "{answer}"'
      interview.append(combined)
    hometown_question = 'Where are you from?'
    hometown = prompt.open_question(question=hometown_question, max_tokens=100)
    interview.append(
        f'Host -- "{hometown_question}"\n{player_name} -- "{hometown}"'
    )
    interview_str = '\n'.join(interview)
    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,
    )
    print(interview_str)
    return formative_memories.AgentConfig(
        name=player_name,
        gender=sampled_settings.contestants[player_name]['gender'],
        date_of_birth=datetime.datetime(
            year=birth_year, month=birth_month, day=birth_day
        ),
        goal='make as much money as possible by winning the reality show',
        context=(
            f'{player_name} is a contestant on a reality TV show, '
            f'and hopes to win it since {subject_pronoun} needs the prize '
            f'money. {subject_pronoun} gave the following confessional-style '
            f'interview at the start of the show:\n{interview_str}\n'
            f'What casual acquaintances remember about {player_name} is that '
            f'{public_face}'
        ),
        traits=f'{player_name} is {traits_str}',
        extras={
            'player_specific_memories': [
                f'{player_name} is a contestant on {show_title}.',
                (
                    f'{player_name} gave the following confessional-style '
                    f'interview at the start of the show:\n{interview_str}'
                ),
                (
                    f'Some memorable things about {player_name} are that '
                    f'{public_face}'
                ),
            ],
            'main_character': True,
            'initial_endowment': {'money': 0.0},
            'public_face': public_face,
        },
    )

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

  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
        )

  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
Configure the players.

  Args:
    model: the language model to use
    show_title: the name of the reality show.
    sampled_settings: the environment configuration containing the time and
      place details.
      rng: the random number generator to use.

  Returns:
    main_player_configs: configs for the main characters
    supporting_player_configs: configs for the supporting characters
  
examples/deprecated/modular/environment/reality_show.py