new recipe format
This commit is contained in:
parent
043629fe12
commit
f83c70c340
19
calc.py
19
calc.py
@ -1,7 +1,10 @@
|
|||||||
from dataclasses import dataclass
|
# fmt: off
|
||||||
import typing as tp
|
import typing as tp
|
||||||
|
from dataclasses import dataclass
|
||||||
|
|
||||||
import pdbp
|
import pdbp
|
||||||
|
|
||||||
|
|
||||||
@dataclass(frozen=True)
|
@dataclass(frozen=True)
|
||||||
class Resource:
|
class Resource:
|
||||||
name: str
|
name: str
|
||||||
@ -179,7 +182,7 @@ class Recipies:
|
|||||||
|
|
||||||
circuit_a = Recipe("Electronic Circuit", {RS.assembler: -0.5, RS.copper_cable: -3, RS.iron_plate: -1, RS.circuit_a: 1})
|
circuit_a = Recipe("Electronic Circuit", {RS.assembler: -0.5, RS.copper_cable: -3, RS.iron_plate: -1, RS.circuit_a: 1})
|
||||||
circuit_b = Recipe("Advanced Circuit", {RS.assembler: -6, RS.copper_cable: -4, RS.circuit_a: -2, RS.plastic: -2, RS.circuit_b: 1})
|
circuit_b = Recipe("Advanced Circuit", {RS.assembler: -6, RS.copper_cable: -4, RS.circuit_a: -2, RS.plastic: -2, RS.circuit_b: 1})
|
||||||
circuit_c = Recipe("Processing Unit", {RS.assembler: -10, RS.circuit_b: -2, RS.circuit_a: -20, RS.sulfuric_acid: -5, RS.circuit_c: 1})
|
circuit_c = Recipe("Processing Unit", {RS.assembler: -10, RS.circuit_a: -2, RS.circuit_b: -20, RS.sulfuric_acid: -5, RS.circuit_c: 1})
|
||||||
|
|
||||||
# logistics
|
# logistics
|
||||||
belt_y = Recipe("Transport Belt", {RS.assembler: -0.5, RS.iron_gear: -1, RS.iron_plate: -1, RS.belt_y: 2})
|
belt_y = Recipe("Transport Belt", {RS.assembler: -0.5, RS.iron_gear: -1, RS.iron_plate: -1, RS.belt_y: 2})
|
||||||
@ -243,7 +246,7 @@ class Recipies:
|
|||||||
science_blue = Recipe("Chemical Science Pack", {RS.assembler: -24, RS.sulfur: -1, RS.circuit_b: -3, RS.engine_unit: -2, RS.science_blue: 2})
|
science_blue = Recipe("Chemical Science Pack", {RS.assembler: -24, RS.sulfur: -1, RS.circuit_b: -3, RS.engine_unit: -2, RS.science_blue: 2})
|
||||||
science_purple = Recipe("Production Science Pack", {RS.assembler: -21, RS.rail: -30, RS.electric_furnace: -1, RS.module_productivity: -1, RS.science_purple: 3})
|
science_purple = Recipe("Production Science Pack", {RS.assembler: -21, RS.rail: -30, RS.electric_furnace: -1, RS.module_productivity: -1, RS.science_purple: 3})
|
||||||
science_yellow = Recipe("Utility Science Pack", {RS.assembler: -21, RS.circuit_c: -2, RS.flying_robot_frame: -1, RS.low_density_structure: -3, RS.science_yellow: 3})
|
science_yellow = Recipe("Utility Science Pack", {RS.assembler: -21, RS.circuit_c: -2, RS.flying_robot_frame: -1, RS.low_density_structure: -3, RS.science_yellow: 3})
|
||||||
science_white = Recipe("Space Science Pack", {RS.rocket_part: -100, RS.sattelite: -1, RS.science_white: 1})
|
science_white = Recipe("Space Science Pack", {RS.rocket_part: -100, RS.sattelite: -1, RS.science_white: 1000})
|
||||||
|
|
||||||
T = tp.TypeVar("T")
|
T = tp.TypeVar("T")
|
||||||
def props(cls: type, _t: type[T]) -> list[T]:
|
def props(cls: type, _t: type[T]) -> list[T]:
|
||||||
@ -255,4 +258,14 @@ for resource in props(RS, Resource):
|
|||||||
|
|
||||||
# TODO: draw recipe graph
|
# TODO: draw recipe graph
|
||||||
|
|
||||||
|
target = {
|
||||||
|
RS.science_red: 1,
|
||||||
|
RS.science_green: 1,
|
||||||
|
RS.science_gray: 1,
|
||||||
|
RS.science_blue: 1,
|
||||||
|
RS.science_purple: 1,
|
||||||
|
RS.science_yellow: 1,
|
||||||
|
}
|
||||||
|
|
||||||
breakpoint() # michael
|
breakpoint() # michael
|
||||||
|
# fmt: on
|
||||||
|
140
calc2.py
Normal file
140
calc2.py
Normal file
@ -0,0 +1,140 @@
|
|||||||
|
recipies: dict[str, dict[str, float]] = {
|
||||||
|
# mining
|
||||||
|
'iron-ore': {'mining-drill': -1, 'iron-ore': 0.5},
|
||||||
|
'copper-ore': {'mining-drill': -1, 'copper-ore': 0.5},
|
||||||
|
'stone': {'mining-drill': -1, 'stone': 0.5},
|
||||||
|
'coal': {'mining-drill': -1, 'coal': 0.5},
|
||||||
|
'uranium-ore': {'mining-drill': -1, 'sulfuric-acid': -0.25, 'uranium-ore': 0.5},
|
||||||
|
# oil
|
||||||
|
'basic-oil-processing': {'oil-refinery': -5, 'crude-oil': -100, 'petroleum-gas': 45},
|
||||||
|
'advanced-oil-processing': {
|
||||||
|
'oil-refinery': -5,
|
||||||
|
'crude-oil': -100,
|
||||||
|
'water': -50,
|
||||||
|
'petroleum-gas': 55,
|
||||||
|
'light-oil': 45,
|
||||||
|
'heavy-oil': 25,
|
||||||
|
},
|
||||||
|
'coal-liquefaction': {
|
||||||
|
'oil-refinery': -5,
|
||||||
|
'coal': -10,
|
||||||
|
'steam': -50,
|
||||||
|
'petroleum-gas': 10,
|
||||||
|
'light-oil': 20,
|
||||||
|
'heavy-oil': -25 + 90,
|
||||||
|
},
|
||||||
|
'heavy-oil-craking': {'chemical-plant': -2, 'heavy-oil': -40, 'water': -30, 'light-oil': 30},
|
||||||
|
'light-oil-craking': {'chemical-plant': -2, 'light-oil': -30, 'water': -30, 'petroleum-gas': 20},
|
||||||
|
# fuel
|
||||||
|
'solid-fuel-pg': {'chemical-plant': -2, 'petroleum-gas': -20, 'solid-fuel': 1},
|
||||||
|
'solid-fuel-lo': {'chemical-plant': -2, 'light-oil': -10, 'solid-fuel': 1},
|
||||||
|
'solid-fuel-ho': {'chemical-plant': -2, 'heavy-oil': -20, 'solid-fuel': 1},
|
||||||
|
'rocket-fuel': {'assembler': -30, 'light-oil': -10, 'solid-fuel': -10, 'rocket-fuel': 1},
|
||||||
|
# smelting
|
||||||
|
'iron-plate': {'furnace': -3.2, 'iron-ore': -1, 'iron-plate': 1},
|
||||||
|
'copper-plate': {'furnace': -3.2, 'copper-ore': -1, 'copper-plate': 1},
|
||||||
|
'stone-brick': {'furnace': -3.2, 'stone': -1, 'stone-brick': 1},
|
||||||
|
'steel': {'furnace': -16, 'iron-plate': -5, 'steel': 1},
|
||||||
|
# crafting basics
|
||||||
|
'iron-gear': {'assembler': -0.5, 'iron-plate': -2, 'iron-gear': 1},
|
||||||
|
'iron-stick': {'assembler': -0.5, 'iron-plate': -1, 'iron-stick': 2},
|
||||||
|
'pipe': {'assembler': -0.5, 'iron-plate': -1, 'pipe': 1},
|
||||||
|
'copper-cable': {'assembler': -0.5, 'copper-plate': -1, 'copper-cable': 2},
|
||||||
|
# circuits
|
||||||
|
'circuit-a': {'assembler': -0.5, 'copper-cable': -3, 'iron-plate': -1, 'circuit-a': 1},
|
||||||
|
'circuit-b': {'assembler': -6, 'copper-cable': -4, 'circuit-a': -2, 'plastic': -2, 'circuit-b': 1},
|
||||||
|
'circuit-c': {'assembler': -10, 'circuit-a': -2, 'circuit-b': -20, 'sulfuric-acid': -5, 'circuit-c': 1},
|
||||||
|
# logistics
|
||||||
|
'belt-y': {'assembler': -0.5, 'iron-gear': -1, 'iron-plate': -1, 'belt-y': 2},
|
||||||
|
'inserter-y': {'assembler': -0.5, 'circuit-a': -1, 'iron-gear': -1, 'iron-plate': -1, 'inserter-y': 1},
|
||||||
|
# transport
|
||||||
|
'concrete': {'assembler': -10, 'iron-ore': -1, 'stone-brick': -5, 'water': -100, 'concrete': 10},
|
||||||
|
'rail': {'assembler': -0.5, 'iron-stick': -1, 'steel': -1, 'stone': -1, 'rail': 1},
|
||||||
|
# chemicals
|
||||||
|
'sulfur': {'chemical-plant': -1, 'petroleum-gas': -30, 'water': -30, 'sulfur': 2},
|
||||||
|
'sulfuric-acid': {'chemical-plant': -1, 'iron-plate': -1, 'sulfur': -5, 'water': -100, 'sulfuric-acid': 50},
|
||||||
|
'plastic': {'chemical-plant': -1, 'coal': -1, 'petroleum-gas': -20, 'plastic': 2},
|
||||||
|
'explosives': {'chemical-plant': -4, 'coal': -1, 'sulfur': -1, 'water': -10, 'explosives': 2},
|
||||||
|
'battery': {'chemical-plant': -4, 'copper-plate': -1, 'iron-plate': -20, 'sulfuric-acid': -20, 'battery': 1},
|
||||||
|
# military
|
||||||
|
'magazine-y': {'assembler': -1, 'iron-plate': -4, 'magazine-y': 1},
|
||||||
|
'magazine-r': {'assembler': -1, 'copper-plate': -5, 'magazine-y': -1, 'steel': -1, 'magazine-r': 1},
|
||||||
|
'grenade': {'assembler': -8, 'coal': -10, 'iron-plate': -5, 'grenade': 1},
|
||||||
|
'wall': {'assembler': -0.5, 'stone-brick': -5, 'wall': 1},
|
||||||
|
'rocket-y': {'assembler': -8, 'circuit-a': -1, 'explosives': -1, 'iron-plate': -2, 'rocket-y': 1},
|
||||||
|
'rocket-r': {'assembler': -8, 'explosives': -2, 'rocket-r': 1},
|
||||||
|
# intermediates
|
||||||
|
'engine-unit': {'assembler': -10, 'iron-gear': -1, 'pipe': -2, 'steel': -1, 'engine-unit': 1},
|
||||||
|
'engine-unit-electric': {
|
||||||
|
'assembler': -10,
|
||||||
|
'circuit-a': -2,
|
||||||
|
'engine-unit': -1,
|
||||||
|
'lubricant': -15,
|
||||||
|
'engine-unit-electric': 1,
|
||||||
|
},
|
||||||
|
'accumulator': {'assembler': -10, 'battery': -5, 'iron-plate': -2, 'accumulator': 1},
|
||||||
|
'solar-panel': {'assembler': -10, 'copper-plate': -5, 'circuit-a': -15, 'steel': -5, 'solar-panel': 1},
|
||||||
|
'electric-furnace': {'assembler': -5, 'circuit-b': -5, 'steel': -10, 'stone-brick': -10, 'electric-furnace': 1},
|
||||||
|
'flying-robot-frame': {
|
||||||
|
'assembler': -20,
|
||||||
|
'battery': -2,
|
||||||
|
'engine-unit-electric': -1,
|
||||||
|
'circuit-a': -3,
|
||||||
|
'steel': -1,
|
||||||
|
'flying-robot-frame': 1,
|
||||||
|
},
|
||||||
|
'low-density-structure': {
|
||||||
|
'assembler': -20,
|
||||||
|
'copper-plate': -20,
|
||||||
|
'plastic': -5,
|
||||||
|
'steel': -2,
|
||||||
|
'low-density-structure': 1,
|
||||||
|
},
|
||||||
|
# modules
|
||||||
|
'module-productivity': {'assembler': -15, 'circuit-b': -5, 'circuit-a': -5, 'module-productivity': 1},
|
||||||
|
'module-speed': {'assembler': -15, 'circuit-b': -5, 'circuit-a': -5, 'module-speed': 1},
|
||||||
|
# end-game
|
||||||
|
'rocket-control-unit': {'assembler': -30, 'circuit-c': -1, 'module-speed': -1, 'rocket-control-unit': 1},
|
||||||
|
'rocket-part': {
|
||||||
|
'rocket-silo': -3,
|
||||||
|
'low-density-structure': -10,
|
||||||
|
'rocket-control-unit': -10,
|
||||||
|
'rocket-fuel': -10,
|
||||||
|
'rocket-part': 1,
|
||||||
|
},
|
||||||
|
'sattelite': {
|
||||||
|
'assembler': -5,
|
||||||
|
'accumulator': -100,
|
||||||
|
'low-density-structure': -100,
|
||||||
|
'circuit-c': -100,
|
||||||
|
'radar': -5,
|
||||||
|
'rocket-fuel': -50,
|
||||||
|
'solar-panel': -100,
|
||||||
|
'sattelite': 1,
|
||||||
|
},
|
||||||
|
# science packs
|
||||||
|
'science-red': {'assembler': -5, 'copper-plate': -1, 'iron-gear': -1, 'science-red': 1},
|
||||||
|
'science-green': {'assembler': -6, 'belt-y': -1, 'inserter-y': -1, 'science-green': 1},
|
||||||
|
'science-gray': {'assembler': -10, 'magazine-r': -1, 'grenade': -1, 'wall': -2, 'science-gray': 2},
|
||||||
|
'science-blue': {'assembler': -24, 'sulfur': -1, 'circuit-b': -3, 'engine-unit': -2, 'science-blue': 2},
|
||||||
|
'science-purple': {
|
||||||
|
'assembler': -21,
|
||||||
|
'rail': -30,
|
||||||
|
'electric-furnace': -1,
|
||||||
|
'module-productivity': -1,
|
||||||
|
'science-purple': 3,
|
||||||
|
},
|
||||||
|
'science-yellow': {
|
||||||
|
'assembler': -21,
|
||||||
|
'circuit-c': -2,
|
||||||
|
'flying-robot-frame': -1,
|
||||||
|
'low-density-structure': -3,
|
||||||
|
'science-yellow': 3,
|
||||||
|
},
|
||||||
|
'science-white': {'rocket-part': -100, 'sattelite': -1, 'science-white': 1000},
|
||||||
|
}
|
||||||
|
|
||||||
|
resources = {resource for _, resources in recipies.items() for resource, quantity in resources.items() if quantity > 0}
|
||||||
|
|
||||||
|
print(f'{resources=}')
|
||||||
|
breakpoint() # michael
|
5
pyproject.toml
Normal file
5
pyproject.toml
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
[tool.ruff]
|
||||||
|
line-length = 120
|
||||||
|
|
||||||
|
[tool.ruff.format]
|
||||||
|
quote-style = 'single'
|
Loading…
Reference in New Issue
Block a user