def configure_scenes(
    config: config_dict.ConfigDict,
    main_player_configs: Sequence[formative_memories.AgentConfig],
    supporting_player_configs: Sequence[formative_memories.AgentConfig],
    player_configs_dict: dict[str, formative_memories.AgentConfig],
    no_conversation_game_master: game_master.GameMaster,
    negotiation_game_master: game_master.GameMaster,
) -> Sequence[scene_lib.SceneSpec]:
  """Configure the scene storyboard structure.

  Args:
    config: the time and place configuration to use
    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
    no_conversation_game_master: secondary game master that does not include
      conversations
    negotiation_game_master: secondary game master for the negotiation scene

  Returns:
    scenes: the scenes to use
  """
  main_player_configs = list(main_player_configs)
  supporting_player_configs = list(supporting_player_configs)

  year_increment = datetime.timedelta(days=365)

  main_player_names = [config.name for config in main_player_configs]
  supporting_player_names = [
      config.name for config in supporting_player_configs
  ]
  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'
  )

  home_scene_premises = {}
  for name in main_player_names:
    village_name = player_configs_dict[name].extras['home_village']
    if village_name == config.village_a_name:
      and_stakeholders = and_stakeholders_village_a
    elif village_name == config.village_b_name:
      and_stakeholders = and_stakeholders_village_b
    else:
      raise ValueError(f'Unknown village name: {village_name}')
    home_scene_premises[name] = (
        config.home_phase_premise.format(
            player_name=name,
            village_name=village_name,
            and_supporting_characters=and_stakeholders
        ),
    )
  for name in supporting_player_names:
    home_scene_premises[name] = (
        config.supporting_character_home_phase_premise.format(
            player_name=name,
            village_name=player_configs_dict[name].extras['home_village'],
        ),
    )

  negotiation_phase_premises = {}
  for name in main_player_names:
    negotiation_phase_premises[name] = (
        config.negotiation_phase_premise.format(
            player_name=name,
            village_name=player_configs_dict[name].extras['home_village'],
        ),
        config.negotiation_phase_extra_premise,
        config.negotiation_phase_premise_addendum,
    )

  scene_types = {}
  scene_types['home'] = scene_lib.SceneTypeSpec(
      name='home',
      premise=home_scene_premises,
  )
  scene_types[NEGOTIATION_SCENE_TYPE] = scene_lib.SceneTypeSpec(
      name=NEGOTIATION_SCENE_TYPE,
      premise=negotiation_phase_premises,
      override_game_master=negotiation_game_master,
  )
  scene_types[POST_NEGOTIATION_SCENE_TYPE] = scene_lib.SceneTypeSpec(
      name=POST_NEGOTIATION_SCENE_TYPE,
      premise={},
      action_spec=entity_lib.free_action_spec(
          call_to_action=(
              'In {name}\'s view, was there an agreement to pool '
              'agricultural products between villages such that a '
              'village with less food can be resupplied by a village '
              'with more food?'),
          tag='announcement',
      ),
      override_game_master=no_conversation_game_master,
  )
  activities_str = (', '.join(config.activities[:-1]) +
                    f', and {config.activities[-1]}')
  scene_types[RESOLUTION_SCENE_TYPE] = scene_lib.SceneTypeSpec(
      name=RESOLUTION_SCENE_TYPE,
      premise={},
      action_spec=entity_lib.free_action_spec(
          call_to_action=('How does {name} intend to spend the rest of the '
                          'year? What daily activities will they devote '
                          'their time to? Why? Respond by giving the '
                          'average proportion of their time that they '
                          'intend to spend on each of the '
                          f'following activities: {activities_str}. Note that '
                          'proportions of time should sum to 1. Sleep counts '
                          f'as {config.free_time_activity} and, '
                          'all else equal, '
                          'more leisure time is better.'),
          tag='announcement',
      ),
      override_game_master=no_conversation_game_master,
  )
  scene_types[DEBRIEF_SCENE_TYPE] = scene_lib.SceneTypeSpec(
      name=DEBRIEF_SCENE_TYPE,
      premise={},
      action_spec=entity_lib.free_action_spec(
          call_to_action=('How does {name} feel about how this year went? '
                          'What went well? What did not go well? What does '
                          '{name} feel could be improved for next year?'),
          tag='reflection',
      ),
      override_game_master=no_conversation_game_master,
  )

  scenes = [
      # Year 1
      scene_lib.SceneSpec(
          scene_type=scene_types['home'],
          start_time=config.times.start,
          participant_configs=main_player_configs,
          num_rounds=1,
      ),
      scene_lib.SceneSpec(
          scene_type=scene_types[NEGOTIATION_SCENE_TYPE],
          start_time=config.times.meeting,
          participant_configs=main_player_configs,
          num_rounds=3,
      ),
      scene_lib.SceneSpec(
          scene_type=scene_types[POST_NEGOTIATION_SCENE_TYPE],
          start_time=config.times.post_meeting,
          participant_configs=main_player_configs,
          num_rounds=1,
      ),
      scene_lib.SceneSpec(
          scene_type=scene_types['home'],
          start_time=config.times.return_home,
          participant_configs=main_player_configs,
          num_rounds=1,
      ),
      scene_lib.SceneSpec(
          scene_type=scene_types[RESOLUTION_SCENE_TYPE],
          start_time=config.times.decision,
          participant_configs=supporting_player_configs,
          num_rounds=1,
      ),
      scene_lib.SceneSpec(
          scene_type=scene_types[DEBRIEF_SCENE_TYPE],
          start_time=config.times.debrief,
          participant_configs=main_player_configs + supporting_player_configs,
          num_rounds=1,
      ),
  ]

  for i in range(1, config.num_years):
    year = i * year_increment
    scenes.append(
        scene_lib.SceneSpec(
            scene_type=scene_types[NEGOTIATION_SCENE_TYPE],
            start_time=config.times.meeting + year,
            participant_configs=main_player_configs,
            num_rounds=3,
        )
    )
    scenes.append(
        scene_lib.SceneSpec(
            scene_type=scene_types[POST_NEGOTIATION_SCENE_TYPE],
            start_time=config.times.post_meeting + year,
            participant_configs=main_player_configs,
            num_rounds=1,
        )
    )
    scenes.append(
        scene_lib.SceneSpec(
            scene_type=scene_types['home'],
            start_time=config.times.return_home + year,
            participant_configs=main_player_configs,
            num_rounds=1,
        )
    )
    scenes.append(
        scene_lib.SceneSpec(
            scene_type=scene_types[RESOLUTION_SCENE_TYPE],
            start_time=config.times.decision + year,
            participant_configs=supporting_player_configs,
            num_rounds=1,
        )
    )
    scenes.append(
        scene_lib.SceneSpec(
            scene_type=scene_types[DEBRIEF_SCENE_TYPE],
            start_time=config.times.debrief + year,
            participant_configs=[],
            num_rounds=1,
        )
    )

  return scenes
Configure the scene storyboard structure.

  Args:
    config: the time and place configuration to use
    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
    no_conversation_game_master: secondary game master that does not include
      conversations
    negotiation_game_master: secondary game master for the negotiation scene

  Returns:
    scenes: the scenes to use
  
examples/deprecated/modular/environment/state_formation.py