Satisfactory Resource Calculator (Supercomputer)
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
import math | |
# All available resource recipes | |
# Uncomment the ones that you want to resolve | |
recipes = { | |
# Computer components | |
"supercomputer": [[2, "ai limiter"], [3, "high speed connector"], [2, "computer"], [28, "plastic"]], | |
"ai limiter": [[20, "quickwire"], [5, "copper sheet"]], | |
"high speed connector": [[56, "quickwire"], [10, "cable"], [1, "circuit board"]], | |
"circuit board": [[2, "copper sheet"], [4, "plastic"]], | |
"computer": [[7, "circuit board"], [28, "quickwire"], [12, "rubber"]], | |
# Dumb metal components | |
#"quickwire": [[1/5, "caterium ingot"]], | |
#"cable": [[2, "wire"]], | |
#"wire": [[1/8, "caterium ingot"]], | |
#"copper sheet": [[2, "copper ingot"]], | |
# Oil products | |
#"rubber": [[3, "crude oil"]], | |
#"plastic": [[2/3, "crude oil"]] | |
# Ores | |
#"caterium ingot": [[1, "caterium ore"]], | |
#"copper ingot": [[1, "copper ore"]], | |
} | |
result = [1, "supercomputer", 0] | |
working_ingredients = [result] | |
def resolve(idx): | |
if idx < 0 or idx >= len(working_ingredients): | |
return | |
ingredient = working_ingredients[idx] | |
ingredient_count = ingredient[0] | |
ingredient_name = ingredient[1] | |
ingredient_lvl = ingredient[2] | |
recipe_optional = recipes.get(ingredient_name) | |
if recipe_optional: | |
add_recipe(idx, ingredient_count, recipe_optional, ingredient_lvl + 1) | |
resolve(idx + 1) | |
def add_recipe(idx, recipe_count, recipe, lvl): | |
for ingredient in recipe: | |
scaled_ingredient = [ingredient[0] * recipe_count, ingredient[1], lvl] | |
add_ingredient(idx, scaled_ingredient) | |
def add_ingredient(idx, ingredient): | |
ingredient_count = ingredient[0] | |
ingredient_name = ingredient[1] | |
working_ingredients.insert(idx+1, ingredient) | |
def filter_leafs(): | |
i = 0 | |
while i < len(working_ingredients): | |
if i < len(working_ingredients)-1 and working_ingredients[i][2] < working_ingredients[i+1][2]: | |
working_ingredients.pop(i) | |
continue | |
i += 1 | |
i = 0 | |
while i < len(working_ingredients): | |
for j in range(i+1, len(working_ingredients) - 1): | |
while j < len(working_ingredients) and working_ingredients[i][1] == working_ingredients[j][1] and not i == j: | |
working_ingredients[i][0] += working_ingredients[j][0] | |
working_ingredients.pop(j) | |
i += 1 | |
for j in range(len(working_ingredients)): | |
working_ingredients[j][2] = 1 | |
def ingredient_str(ingredient): | |
leading_whitespace = "" | |
lvl = ingredient[2] | |
for i in range(lvl): | |
leading_whitespace += "-" | |
if lvl > 0: | |
leading_whitespace += " " | |
return leading_whitespace + (str(ingredient[0]) + "x").ljust(5) + ingredient[1] | |
def ceil_ingredient(ingredient): | |
ingredient[0] = math.ceil(ingredient[0]) | |
return ingredient | |
def print_all(): | |
for ingredient in working_ingredients: | |
print(ingredient_str(ceil_ingredient(ingredient))) | |
def main(): | |
resolve(0) | |
print("\nRecipe tree for " + ingredient_str(result) + ":\n") | |
print_all() | |
filter_leafs() | |
print("\n\nOnly leaf resources:\n") | |
print_all() | |
if __name__ == "__main__": | |
main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This is a super quick and dirty Python script to calculate the resources required to build a super computer in Satisfactory.
Feel free to download it and adjust it for your needs. It's in no way cleaned up to be actually usable, just something I was toying around with.
For more practical purposes when playing Satisfactory, consider paying a visit to https://www.satisfactorytools.com/