def _async_create_description( permalink: Permalink, status_update: Callable[[str], None], attempts: int, ) -> LayoutDescription: """ :param permalink: :param status_update: :return: """ rng = Random(permalink.as_bytes) presets = { i: permalink.get_preset(i) for i in range(permalink.player_count) } retrying = tenacity.Retrying( stop=tenacity.stop_after_attempt(attempts), retry=tenacity.retry_if_exception_type(UnableToGenerate), reraise=True) filler_results = retrying(_create_pools_and_fill, rng, presets, status_update) all_patches = _distribute_remaining_items(rng, filler_results.player_results) return LayoutDescription( permalink=permalink, version=VERSION, all_patches=all_patches, item_order=filler_results.action_log, )
def _async_create_description( permalink: Permalink, status_update: Callable[[str], None], ) -> LayoutDescription: """ :param permalink: :param status_update: :return: """ rng = Random(permalink.as_str) presets = { i: permalink.get_preset(i) for i in range(permalink.player_count) } filler_results = _retryable_create_patches(rng, presets, status_update) all_patches = _distribute_remaining_items(rng, filler_results.player_results) return LayoutDescription( permalink=permalink, version=VERSION, all_patches=all_patches, item_order=filler_results.action_log, )
def _test_data(default_preset): data = default_data.decode_default_prime2() game = data_reader.decode_data(data) permalink = Permalink( seed_number=15000, spoiler=True, presets={0: default_preset}, ) configuration = permalink.get_preset(0).layout_configuration patches = game.create_game_patches() patches = patches.assign_gate_assignment( base_patches_factory.gate_assignment_for_configuration( configuration, game.resource_database, Random(15000))) game, state = logic_bootstrap(configuration, game, patches) return game, state, permalink