def configure_player(
    name: str,
    gender: str,
    year: int,
    is_main: bool,
    rng: random.Random,
    supporting_player_parameters: dict[str, Any] | None = None,
):
  """Configure a player.

  Args:
    name: the name of the player
    gender: the gender of the player
    year: the year of the simulation to sample the age of the players
    is_main: whether the player is a main character or not
    rng: the random number generator to use
    supporting_player_parameters: the parameters for the supporting player

  Returns:
    config: the config for the player
  """
  extras = {
      'player_specific_memories': [f'{name} always drives a hard bargain.'],
      'main_character': is_main,
  }
  if not is_main and supporting_player_parameters:

    fixed_response = {
        key: value.format(name=name)
        for key, value in supporting_player_parameters[
            'fixed_response_by_call_to_action'
        ].items()
    }
    specific_memories = []

    for memory in supporting_player_parameters['specific_memories']:
      specific_memories.append(memory.format(name=name))

    extras['fixed_response_by_call_to_action'] = fixed_response
    extras['specific_memories'] = specific_memories

  return formative_memories.AgentConfig(
      name=name,
      gender=gender,
      date_of_birth=datetime.datetime(
          year=year - rng.randint(25, 54),
          month=rng.randint(1, 12),
          day=rng.randint(1, 28),
      ),
      context=(
          f'{name} is a travelling merchant. Her business is buying and'
          ' selling fruit.'
      ),
      traits=(
          f"{name}'s personality is like "
          + player_traits_and_styles.get_trait(flowery=True)
      ),
      goal=f'{name} wants to make as much money as possible.',
      extras=extras,
  )
Configure a player.

  Args:
    name: the name of the player
    gender: the gender of the player
    year: the year of the simulation to sample the age of the players
    is_main: whether the player is a main character or not
    rng: the random number generator to use
    supporting_player_parameters: the parameters for the supporting player

  Returns:
    config: the config for the player
  
examples/deprecated/modular/environment/haggling.py