def configure_scenes(
    model: language_model.LanguageModel,
    game_master_memory: associative_memory.AssociativeMemory,
    players: Sequence[entity_agent_with_logging.EntityAgentWithLogging],
    clock: game_clock.MultiIntervalClock,
    main_player_configs: Sequence[formative_memories.AgentConfig],
    supporting_player_configs: Sequence[formative_memories.AgentConfig],
    start_time: datetime.datetime,
    sampled_settings: Any,
    rng: random.Random,
) -> tuple[
    Sequence[scene_lib.SceneSpec],
    Callable[[], Mapping[str, float]],
    list[game_master.GameMaster] | list[None],
]:
  """Configure the scene storyboard structure.

  Args:
    model: the language model to use.
    game_master_memory: the game master memory to use.
    players: the players to use.
    clock: the clock to use.
    main_player_configs: configs for the main characters
    supporting_player_configs: configs for the supporting characters
    start_time: the start time/date in the game world for the first scene
    sampled_settings: the sampled settings for the world configuration
    rng: the random number generator to use

  Returns:
    scenes: a sequence of scene specifications
  """

  player_configs = list(main_player_configs) + list(supporting_player_configs)

  coordination_payoffs = []
  scenes = []
  pubs = sampled_settings.venues

  pub_closed_probability = sampled_settings.pub_closed_probability

  secondary_environments = []

  for i in range(sampled_settings.num_games):
    closed_pub = None
    if rng.random() < pub_closed_probability:
      closed_pub = rng.choice(sampled_settings.venues)

    playing_tonight = rng.sample(sampled_settings.game_countries, 2)
    coordination_prompt = (
        f'Tonight is the night of the game between {playing_tonight[0]} and'
        f' {playing_tonight[1]}. Friends are going to watch the game at a pub,'
        ' but they are not sure which pub to go to.'
    )
    scene = rng.choice(sampled_settings.social_context)

    per_player_premise = {
        cfg.name: [
            scene.format(
                player_name=cfg.name,
                players=', '.join([player.name for player in players]),
            ),
            coordination_prompt,
        ]
        for cfg in player_configs
    }

    if closed_pub:
      if sampled_settings.player_who_knows_closed_pub:
        player_name = sampled_settings.player_who_knows_closed_pub
      else:
        player_name = rng.choice(player_configs).name

      per_player_premise[player_name].append(
          f'{player_name} have learnt that {closed_pub} is closed today. Going'
          ' there would be a bad idea.'
      )

    scene_specs = {
        'social': scene_lib.SceneTypeSpec(
            name='day',
            premise=per_player_premise,
        ),
    }

    option_multiplier = {pub: 1.0 for pub in pubs}
    if closed_pub:
      option_multiplier[closed_pub] = 0.0

    choice_scene_spec, this_coordination_payoff = add_choice_scene_spec(
        model=model,
        game_master_memory=game_master_memory,
        scene_name=f'Which pub? decision scene {i}',
        players=players,
        clock=clock,
        option_multiplier=option_multiplier,
        player_configs=player_configs,
        scene_type_name=DECISION_SCENE_TYPE,
        pubs=pubs,
        rng=rng,
        relationship_matrix=sampled_settings.relationship_matrix,
    )
    coordination_payoffs.append(this_coordination_payoff)
    scene_specs[DECISION_SCENE_TYPE] = choice_scene_spec
    secondary_environments.append(choice_scene_spec.override_game_master)
    scenes = scenes + [
        scene_lib.SceneSpec(
            scene_type=scene_specs['social'],
            start_time=start_time + i * TIME_INCREMENT_BETWEEN_SCENES,
            participant_configs=player_configs,
            num_rounds=1,
        ),
        scene_lib.SceneSpec(
            scene_type=scene_specs[DECISION_SCENE_TYPE],
            start_time=start_time
            + i * TIME_INCREMENT_BETWEEN_SCENES
            + datetime.timedelta(hours=8),
            participant_configs=player_configs,
            num_rounds=1,
        ),
    ]

  def return_payoffs_sum():
    result = collections.defaultdict(float)
    for payoff in coordination_payoffs:
      results_dict = payoff.get_scores()
      for name, score in results_dict.items():
        result[name] += score
    return result

  return (scenes, return_payoffs_sum, secondary_environments)
Configure the scene storyboard structure.

  Args:
    model: the language model to use.
    game_master_memory: the game master memory to use.
    players: the players to use.
    clock: the clock to use.
    main_player_configs: configs for the main characters
    supporting_player_configs: configs for the supporting characters
    start_time: the start time/date in the game world for the first scene
    sampled_settings: the sampled settings for the world configuration
    rng: the random number generator to use

  Returns:
    scenes: a sequence of scene specifications
  
examples/deprecated/modular/environment/pub_coordination.py