initial commit

This commit is contained in:
Michael Peters 2024-02-11 12:52:21 -08:00
commit 87f4ac7d29
2 changed files with 108 additions and 0 deletions

1
.gitignore vendored Normal file
View File

@ -0,0 +1 @@
venv

107
calc.py Normal file
View File

@ -0,0 +1,107 @@
from dataclasses import dataclass
@dataclass(frozen=True)
class Resource:
name: str
# item definitions
class RS:
iron_ore = Resource("Iron Ore")
copper_ore = Resource("Copper Ore")
uranium_ore = Resource("Uranium Ore")
stone = Resource("Stone")
coal = Resource("Coal")
crude_oil = Resource("Crude Oil")
water = Resource("Water")
energy = Resource("Energy (kW)")
assembler = Resource("Assembler")
mining_drill = Resource("Mining Drill")
furnace = Resource("Furnace")
chemical_plant = Resource("Chemical Plant")
oil_refinery = Resource("Oil Refinery")
iron = Resource("Iron Plate")
copper = Resource("Copper Plate")
stone_brick = Resource("Stone Brick")
steel = Resource("Steel")
concrete = Resource("Concrete")
iron_gear = Resource("Iron Gear")
iron_stick = Resource("Iron Stick")
copper_cable = Resource("Copper Cable")
circuit_a = Resource("Electronic Circuit")
circuit_b = Resource("Advanced Circuit")
circuit_c = Resource("Processing Unit")
engine_unit = Resource("Engine Unit")
engine_unit_electric = Resource("Electric Engine Unit")
belt_y = Resource("Transport Belt")
belt_r = Resource("Fast Transport Belt")
belt_b = Resource("Express Transport Belt")
inserter_y = Resource("Inserter")
inserter_r = Resource("Long-Handed Inserter")
inserter_b = Resource("Fast Inserter")
magazine_y = Resource("Firearm Magazine")
magazine_r = Resource("Piercing Magazine")
grenade = Resource("Grenade")
rocket_y = Resource("Rocket")
rocket_r = Resource("Explosive Rocket")
petrolium_gas = Resource("Petrolium Gas")
light_oil = Resource("Light Oil")
heavy_oil = Resource("Heavy Oil")
steam = Resource("Steam")
lubricant = Resource("Lubricant")
sulfur = Resource("Sulfur")
sulfuric_acid = Resource("Sulfuric Acid")
battery = Resource("Battery")
explosives = Resource("Explosives")
flying_robot_frame = Resource("Flying Robot Frame")
low_density_structure = Resource("Low Density Structure")
rocket_part = Resource("Rocket Part")
rocket = Resource("Rocket")
science_red = Resource("Automation Science Pack")
science_green = Resource("Logistic Science Pack")
science_gray = Resource("Military Science Pack")
science_blue = Resource("Chemical Science Pack")
science_purple = Resource("Production Science Pack")
science_yellow = Resource("Utility Science Pack")
science_white = Resource("Space Science Pack")
@dataclass
class Recipe:
name: str
resources: dict[Resource, float]
class Recipies:
# mining
iron_ore = Recipe("Iron Ore", {RS.mining_drill: -1, RS.iron_ore: 0.5})
copper_ore = Recipe("Copper Ore", {RS.mining_drill: -1, RS.copper_ore: 0.5})
coal = Recipe("Coal", {RS.mining_drill: -1, RS.coal: 0.5})
uranium_ore = Recipe("Uranium Ore", {RS.mining_drill: -1, RS.sulfuric_acid: -0.25, RS.uranium_ore: 0.25})
# smelting
iron_plate = Recipe("Iron Plate", {RS.furnace: -3.2, RS.iron_ore: -1, RS.iron: 1})
copper_plate = Recipe("Copper Plate", {RS.furnace: -3.2, RS.copper_ore: -1, RS.copper: 1})
stone_brick = Recipe("Stone Brick", {RS.furnace: -3.2, RS.stone: -2, RS.stone_brick: 1})
# crafting
concrete = Recipe("Concrete", {RS.assembler: -10, RS.iron_ore: -1, RS.stone_brick: -5, RS.water: -100, RS.concrete: 10})
RECIPIES = {}