def configure_players(
    rng: random.Random,
    config: config_dict.ConfigDict,
) -> tuple[
    list[formative_memories.AgentConfig],
    list[formative_memories.AgentConfig],
    dict[str, formative_memories.AgentConfig],
]:
  """Configure the players.

  Args:
    rng: the random number generator to use.
    config: the time and place configuration to use.

  Returns:
    main_player_configs: configs for the main characters
    supporting_player_configs: configs for the supporting characters
    player_configs_dict: dict mapping player name to corresponding config
  """
  supporting_player_names_village_a = [
      player[0] for player in config.supporting_characters.a
  ]
  supporting_player_names_village_b = [
      player[0] for player in config.supporting_characters.b
  ]
  and_stakeholders_village_a = _get_conjunction_of_names_string(
      supporting_player_names_village_a, and_or='and'
  )
  and_stakeholders_village_b = _get_conjunction_of_names_string(
      supporting_player_names_village_b, and_or='and'
  )
  if len(supporting_player_names_village_a) > 1:
    is_or_are = 'are'
  else:
    is_or_are = 'is'
  elder_village_a_stakeholder_knowledge = (
      f'{and_stakeholders_village_a} are respected and influential in '
      f'{config.village_a_name}. It is critical to gain their support for any '
      f'agreement to be made with {config.village_b_name}. '
      f'{and_stakeholders_village_a} {is_or_are} '
      "generally pretty reasonable. It's a good idea for "
      f'{config.main_characters.a.name} to try to represent '
      'their interests and concerns in the negotiation. There are no '
      f'other influential individuals in {config.village_a_name}.'
  )
  elder_village_b_stakeholder_knowledge = (
      f'{and_stakeholders_village_b} are respected and influential in '
      f'{config.village_b_name}. It is critical to gain their support for any '
      f'agreement to be made with {config.village_a_name}. '
      f'{and_stakeholders_village_b} {is_or_are} '
      "generally pretty reasonable. It's a good idea for "
      f'{config.main_characters.b.name} to try to represent '
      'their interests and concerns in the negotiation. There are no '
      f'other influential individuals in {config.village_b_name}.'
  )

  player_configs = [
      # Main characters:
      formative_memories.AgentConfig(
          name=config.main_characters.a.name,
          gender=config.main_characters.a.gender,
          date_of_birth=datetime.datetime(year=1700, month=9, day=13),
          goal=(
              f'{config.main_characters.a.name} wants to be a good leader and '
              f'do what is best for {config.village_a_name}.'
          ),
          context=' '.join(config.villages.a) + ' ' + config.basic_setting,
          traits=(
              f'Personality: {player_traits_and_styles.get_trait()} and '
              f'{player_traits_and_styles.get_trait()}'
          ),
          extras={
              'player_specific_memories': [
                  (
                      f'{config.main_characters.a.name} is an elder of '
                      f'{config.village_a_name}.'
                  ),
                  (
                      f'{config.main_characters.a.name} represents'
                      f' {config.village_a_name} at the diplomatic meeting at'
                      f' {config.meeting_location}.'
                  ),
                  (
                      f'The center of {config.village_a_name} is a good place'
                      ' to meet other villagers.'
                  ),
                  elder_village_a_stakeholder_knowledge,
                  config.negotiation_objective_thought,
                  *config.villages.a,
              ],
              'home_village': config.village_a_name,
              'main_character': True,
          },
      ),
      formative_memories.AgentConfig(
          name=config.main_characters.b.name,
          gender=config.main_characters.b.gender,
          date_of_birth=datetime.datetime(year=1700, month=2, day=12),
          goal=(
              f'{config.main_characters.b.name} wants to be a good leader and '
              f'do what is best for {config.village_b_name}.'
          ),
          context=' '.join(config.villages.b) + ' ' + config.basic_setting,
          traits=(
              f'Personality: {player_traits_and_styles.get_trait()} and '
              f'{player_traits_and_styles.get_trait()}'
          ),
          extras={
              'player_specific_memories': [
                  (
                      f'{config.main_characters.b.name} is an elder of '
                      f'{config.village_b_name}.'
                  ),
                  (
                      f'{config.main_characters.b.name} represents'
                      f' {config.village_b_name} at the diplomatic meeting at'
                      f' {config.meeting_location}.'
                  ),
                  (
                      f'The center of {config.village_b_name} is a good place'
                      ' to meet other villagers.'
                  ),
                  elder_village_b_stakeholder_knowledge,
                  config.negotiation_objective_thought,
                  *config.villages.b,
              ],
              'home_village': config.village_b_name,
              'main_character': True,
          },
      ),
  ]

  for idx in range(len(config.supporting_characters.a)):
    birth_month = rng.randint(1, 12)
    birth_day = rng.randint(1, 28)
    gender = config.supporting_characters.a[idx][1]
    him_or_her = 'her'
    his_or_her = 'her'
    if gender == 'male':
      him_or_her = 'him'
      his_or_her = 'his'
    supporting_player_config = formative_memories.AgentConfig(
        name=config.supporting_characters.a[idx][0],
        gender=gender,
        date_of_birth=datetime.datetime(
            year=1725, month=birth_month, day=birth_day
        ),
        goal=(
            f'{config.supporting_characters.a[0][0]} wants to secure '
            f'prosperity for {him_or_her}self and {his_or_her} family.'
        ),
        context=' '.join(config.villages.a) + ' ' + config.basic_setting,
        traits=(
            f'Personality: {player_traits_and_styles.get_trait()} and '
            f'{player_traits_and_styles.get_trait()}'
        ),
        extras={
            'player_specific_memories': [
                (
                    f'{config.supporting_characters.a[0][0]} is from '
                    f'{config.village_a_name}.'
                ),
                (
                    f'{config.supporting_characters.a[0][0]} knows that '
                    f'{config.main_characters.a.name} will represent '
                    f'{config.village_a_name} in the meeting at '
                    f'{config.meeting_location}.'
                ),
                *config.villages.a,
            ],
            'home_village': config.village_a_name,
            'main_character': False,
            'prior_year_activity_distribution': {
                config.farming_activity: 0.5,
                config.free_time_activity: 0.5,
                config.warrior_training_activity: 0.0,
            },
        },
    )
    player_configs.append(supporting_player_config)

  for idx in range(len(config.supporting_characters.b)):
    birth_month = rng.randint(1, 12)
    birth_day = rng.randint(1, 28)
    gender = config.supporting_characters.b[idx][1]
    him_or_her = 'her'
    his_or_her = 'her'
    if gender == 'male':
      him_or_her = 'him'
      his_or_her = 'his'
    supporting_player_config = formative_memories.AgentConfig(
        name=config.supporting_characters.b[idx][0],
        gender=gender,
        date_of_birth=datetime.datetime(
            year=1725, month=birth_month, day=birth_day
        ),
        goal=(
            f'{config.supporting_characters.a[0][0]} wants to secure '
            f'prosperity for {him_or_her}self and {his_or_her} family.'
        ),
        context=' '.join(config.villages.b) + ' ' + config.basic_setting,
        traits=(
            f'Personality: {player_traits_and_styles.get_trait()} and '
            f'{player_traits_and_styles.get_trait()}'
        ),
        extras={
            'player_specific_memories': [
                (
                    f'{config.supporting_characters.b[0][0]} is from '
                    f'{config.village_b_name}.'
                ),
                (
                    f'{config.supporting_characters.b[0][0]} knows that '
                    f'{config.main_characters.b.name} will represent '
                    f'{config.village_b_name} in the meeting at '
                    f'{config.meeting_location}.'
                ),
                *config.villages.b,
            ],
            'home_village': config.village_b_name,
            'main_character': False,
            'prior_year_activity_distribution': {
                config.farming_activity: 0.5,
                config.free_time_activity: 0.3,
                config.warrior_training_activity: 0.2,
            },
        },
    )
    player_configs.append(supporting_player_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']
  ]

  player_configs_dict = {player.name: player for player in player_configs}

  return main_player_configs, supporting_player_configs, player_configs_dict
Configure the players.

  Args:
    rng: the random number generator to use.
    config: the time and place configuration to use.

  Returns:
    main_player_configs: configs for the main characters
    supporting_player_configs: configs for the supporting characters
    player_configs_dict: dict mapping player name to corresponding config
  
examples/deprecated/modular/environment/state_formation.py