def configure_player(
    name: str,
    gender: str,
    favorite_pub: str,
    is_main: bool,
    all_player_names_str: str,
    friend_names_str: str,
    pub_preferences: dict[str, Sequence[str]],
    year: int,
    rng: random.Random,
) -> formative_memories.AgentConfig:
  """Configure a player.

  Args:
    name: the name of the player
    gender: the gender of the player
    favorite_pub: the favorite pub of the player
    is_main: whether the player is a main character or not
    all_player_names_str: the names of all the players in one comma-separated
       string
    friend_names_str: the names of the friends in one comma-separated string
    pub_preferences: the preferences of all the pubs
    year: the year of the simulation to sample the age of the players
    rng: the random number generator to use

  Returns:
    config: the player config
  """
  social_classes = ['working', 'middle', 'upper']

  social_class = rng.choice(social_classes)
  reasons = rng.choice(pub_preferences[favorite_pub])
  pubs = list(pub_preferences.keys())
  extras = {
      'player_specific_memories': [
          f'{name} is a member of the {social_class} class.',
      ],
      'main_character': is_main,
      'preference': {pub: 1.0 if pub == favorite_pub else 0.8 for pub in pubs},
  }

  if not is_main:
    extras['fixed_response_by_call_to_action'] = {
        _CALL_TO_ACTION.format(name=name): favorite_pub
    }
    extras['favourite_pub'] = favorite_pub
  goal = (
      f'Have a good time. To have a good time, {name} would like to'
      f' watch the game in the same pub as {friend_names_str}.'
      f' {name} would prefer everyone went to {favorite_pub}.'
  )
  config = 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),
      ),
      formative_ages=[16, 20],
      goal=goal,
      context=(
          f"{all_player_names_str}' are close friends. {name} has"
          f' a favorite pub which is {favorite_pub}. They love that pub for the'
          f' following reasons: {reasons}'
      ),
      traits=(
          f"{name}'s personality is like "
          + player_traits_and_styles.get_trait(flowery=True)
      ),
      extras=extras,
      specific_memories=f'[goal] {goal}',
  )
  return config
Configure a player.

  Args:
    name: the name of the player
    gender: the gender of the player
    favorite_pub: the favorite pub of the player
    is_main: whether the player is a main character or not
    all_player_names_str: the names of all the players in one comma-separated
       string
    friend_names_str: the names of the friends in one comma-separated string
    pub_preferences: the preferences of all the pubs
    year: the year of the simulation to sample the age of the players
    rng: the random number generator to use

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