def sample_parameters(
    minigame_name: str = DEFAULT_MINIGAME,
    num_players: int | None = None,
    seed: int | None = None,
) -> reality_show.WorldConfig:
  """Sample parameters of the setting and the backstory for each player."""
  seed = seed if seed is not None else random.getrandbits(63)
  rng = random.Random(seed)
  shuffled_male_names = list(rng.sample(MALE_NAMES, len(MALE_NAMES)))
  shuffled_female_names = list(rng.sample(FEMALE_NAMES, len(FEMALE_NAMES)))
  if num_players is None:
    num_players = rng.choice(DEFAULT_POSSIBLE_NUM_PLAYERS)

  minigames = {
      'prisoners_dilemma': reality_show.MiniGameSpec(
          name='Carpooling',
          public_premise=MINIGAME_INTRO_PREMISE
          + get_prisoners_dilemma_host_speech(num_players),
          schelling_diagram=prisoners_dilemma_schelling_diagram,
          map_external_actions_to_schelling_diagram=dict(
              cooperation='try to carpool with others',
              defection='drive individually',
          ),
          action_spec=agent_lib.choice_action_spec(
              call_to_action=(
                  'Which action would {name} choose in the minigame?'
              ),
              options=('try to carpool with others', 'drive individually'),
              tag='minigame_action',
          ),
      ),
      'chicken': reality_show.MiniGameSpec(
          name='Home Appliance Sharing',
          public_premise=MINIGAME_INTRO_PREMISE + get_chicken_host_speech(
              num_players),
          schelling_diagram=chicken_schelling_diagram,
          map_external_actions_to_schelling_diagram=dict(
              cooperation='maintain the appliance',
              defection='let others handle upkeep of the appliance',
          ),
          action_spec=agent_lib.choice_action_spec(
              call_to_action=(
                  'Which action would {name} choose in the minigame?'
              ),
              options=(
                  'maintain the appliance',
                  'let others handle upkeep of the appliance',
              ),
              tag='minigame_action',
          ),
      ),
      'stag_hunt': reality_show.MiniGameSpec(
          name='Boat Race',
          public_premise=MINIGAME_INTRO_PREMISE + get_stag_hunt_host_speech(
              num_players),
          schelling_diagram=stag_hunt_schelling_diagram,
          map_external_actions_to_schelling_diagram=dict(
              cooperation='row vigorously',
              defection='row less vigorously',
          ),
          action_spec=agent_lib.choice_action_spec(
              call_to_action=(
                  'Which action would {name} choose in the minigame?'
              ),
              options=('row vigorously', 'row less vigorously'),
              tag='minigame_action',
          ),
      ),
  }

  contestants = {}
  for _ in range(num_players):
    gender = rng.choice(GENDERS)
    if gender == 'male':
      player_name = shuffled_male_names.pop()
      stereotype = rng.choice(EARLY_2000_MALE_TYPE_CASTS)
    else:
      player_name = shuffled_female_names.pop()
      stereotype = rng.choice(EARLY_2000_FEMALE_TYPE_CASTS)
    interview_questions = rng.sample(
        EARLY_2000_STEREOTYPED_CHARACTERS[stereotype]['interview_questions'],
        NUM_INTERVIEW_QUESTIONS,
    )
    contestants[player_name] = {
        'gender': gender,
        'traits': EARLY_2000_STEREOTYPED_CHARACTERS[stereotype]['traits'],
        'catchphrase': rng.choice(
            EARLY_2000_STEREOTYPED_CHARACTERS[stereotype]['catchphrases']
        ),
        'interview_questions': interview_questions,
        'subject_pronoun': HE_OR_SHE[gender],
        'object_pronoun': HIM_OR_HER[gender],
    }
  num_additional_minigame_scenes = rng.randint(0, MAX_EXTRA_MINIGAMES + 1)
  min_reps_per_extra_scene = np.min(NUM_MINIGAME_REPS_PER_SCENE)
  max_reps_per_extra_scene = np.max(NUM_MINIGAME_REPS_PER_SCENE)
  num_minigame_reps_per_extra_scene = tuple(
      [rng.randint(min_reps_per_extra_scene, max_reps_per_extra_scene + 1)
       for _ in range(num_additional_minigame_scenes)])
  return reality_show.WorldConfig(
      minigame_name=minigame_name,
      minigame=minigames[minigame_name],
      year=YEAR,
      month=MONTH,
      day=DAY,
      num_players=num_players,
      num_additional_minigame_scenes=num_additional_minigame_scenes,
      contestants=contestants,
      num_minigame_reps_per_scene=NUM_MINIGAME_REPS_PER_SCENE,
      num_minigame_reps_per_extra_scene=num_minigame_reps_per_extra_scene,
      seed=seed,
  )
Sample parameters of the setting and the backstory for each player.
examples/deprecated/modular/environment/modules/circa_2003_american_reality_show.py