forked from ArchipelagoMW/Archipelago
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Factorio: flatten science pack curve (ArchipelagoMW#1660)
Co-authored-by: black-sliver <[email protected]>
- Loading branch information
1 parent
6628e8c
commit 8e7bbb4
Showing
5 changed files
with
87 additions
and
90 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,32 +1,30 @@ | ||
from typing import Dict, List | ||
|
||
from .Technologies import factorio_base_id, factorio_id | ||
from .Technologies import factorio_base_id | ||
from .Options import MaxSciencePack | ||
|
||
boundary: int = 0xff | ||
total_locations: int = 0xff | ||
|
||
assert total_locations <= boundary | ||
assert factorio_base_id != factorio_id | ||
|
||
|
||
def make_pools() -> Dict[str, List[str]]: | ||
pools: Dict[str, List[str]] = {} | ||
for i, pack in enumerate(MaxSciencePack.get_ordered_science_packs(), start=1): | ||
max_needed: int = sum(divmod(boundary, i)) | ||
scale: float = boundary / max_needed | ||
max_needed: int = 0xff | ||
prefix: str = f"AP-{i}-" | ||
pools[pack] = [prefix + hex(int(x * scale))[2:].upper().zfill(2) for x in range(1, max_needed + 1)] | ||
pools[pack] = [prefix + hex(x)[2:].upper().zfill(2) for x in range(1, max_needed + 1)] | ||
return pools | ||
|
||
|
||
location_pools: Dict[str, List[str]] = make_pools() | ||
|
||
location_table: Dict[str, int] = {} | ||
end_id: int = factorio_id | ||
end_id: int = factorio_base_id | ||
for pool in location_pools.values(): | ||
location_table.update({name: ap_id for ap_id, name in enumerate(pool, start=end_id)}) | ||
end_id += len(pool) | ||
|
||
assert end_id - len(location_table) == factorio_id | ||
assert end_id - len(location_table) == factorio_base_id | ||
del pool |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters