Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import csv
- recipes = {}
- tolerance = 0
- def append_ignore_none(dictionary, key, value):
- if key in dictionary:
- dictionary[key].add(value)
- else:
- dictionary[key] = {value}
- with open('rec.csv') as csvfile:
- reader = csv.reader(csvfile)
- for row in reader:
- append_ignore_none(recipes, row[0], row[1])
- dependents = {}
- for kleft, vleft in recipes.items():
- for kright, vright in recipes.items():
- if kleft != kright and vleft.issuperset(vright):
- needed_items = vleft.symmetric_difference(vright)
- if len(needed_items) <= tolerance:
- if len(needed_items) != 0:
- print("Factory of {0} can also produce {1}, just add {2}".format(kleft, kright, ",".join(needed_items)))
- else:
- print("Factory of {0} can also produce {1}".format(kleft, kright))
- Factory of logistic-chest-storage can also produce logistic-chest-requester
- Factory of logistic-chest-storage can also produce logistic-chest-active-provider
- Factory of logistic-chest-storage can also produce logistic-chest-passive-provider
- Factory of empty-barrel can also produce steel-chest
- Factory of piercing-shotgun-shell can also produce big-electric-pole
- Factory of piercing-shotgun-shell can also produce piercing-bullet-magazine
- Factory of piercing-shotgun-shell can also produce heavy-armor
- Factory of piercing-shotgun-shell can also produce medium-electric-pole
- Factory of logistic-chest-requester can also produce logistic-chest-storage
- Factory of logistic-chest-requester can also produce logistic-chest-active-provider
- Factory of logistic-chest-requester can also produce logistic-chest-passive-provider
- Factory of productivity-module can also produce effectivity-module
- Factory of productivity-module can also produce speed-module
- Factory of iron-gear-wheel can also produce pipe
- Factory of iron-gear-wheel can also produce iron-chest
- Factory of iron-gear-wheel can also produce iron-stick
- Factory of iron-gear-wheel can also produce basic-bullet-magazine
- Factory of iron-gear-wheel can also produce steel-plate
- Factory of iron-gear-wheel can also produce basic-armor
- Factory of big-electric-pole can also produce piercing-shotgun-shell
- Factory of big-electric-pole can also produce piercing-bullet-magazine
- Factory of big-electric-pole can also produce heavy-armor
- Factory of big-electric-pole can also produce medium-electric-pole
- Factory of chemical-plant can also produce pumpjack
- Factory of player-port can also produce basic-inserter
- Factory of player-port can also produce rocket-launcher
- Factory of player-port can also produce radar
- Factory of player-port can also produce basic-mining-drill
- Factory of player-port can also produce assembling-machine-1
- Factory of pipe can also produce iron-gear-wheel
- Factory of pipe can also produce iron-chest
- Factory of pipe can also produce iron-stick
- Factory of pipe can also produce basic-bullet-magazine
- Factory of pipe can also produce steel-plate
- Factory of pipe can also produce basic-armor
- Factory of basic-inserter can also produce player-port
- Factory of basic-inserter can also produce rocket-launcher
- Factory of basic-inserter can also produce radar
- Factory of basic-inserter can also produce basic-mining-drill
- Factory of basic-inserter can also produce assembling-machine-1
- Factory of pistol can also produce shotgun-shell
- Factory of energy-shield-equipment can also produce night-vision-equipment
- Factory of basic-electric-discharge-defense-equipment can also produce basic-laser-defense-equipment
- Factory of lubricant can also produce solid-fuel-from-heavy-oil
- Factory of logistic-chest-active-provider can also produce logistic-chest-storage
- Factory of logistic-chest-active-provider can also produce logistic-chest-requester
- Factory of logistic-chest-active-provider can also produce logistic-chest-passive-provider
- Factory of blueprint can also produce deconstruction-planner
- Factory of iron-chest can also produce iron-gear-wheel
- Factory of iron-chest can also produce pipe
- Factory of iron-chest can also produce iron-stick
- Factory of iron-chest can also produce basic-bullet-magazine
- Factory of iron-chest can also produce steel-plate
- Factory of iron-chest can also produce basic-armor
- Factory of poison-capsule can also produce slowdown-capsule
- Factory of piercing-bullet-magazine can also produce piercing-shotgun-shell
- Factory of piercing-bullet-magazine can also produce big-electric-pole
- Factory of piercing-bullet-magazine can also produce heavy-armor
- Factory of piercing-bullet-magazine can also produce medium-electric-pole
- Factory of steel-chest can also produce empty-barrel
- Factory of stone-furnace can also produce stone-brick
- Factory of heavy-armor can also produce piercing-shotgun-shell
- Factory of heavy-armor can also produce big-electric-pole
- Factory of heavy-armor can also produce piercing-bullet-magazine
- Factory of heavy-armor can also produce medium-electric-pole
- Factory of rocket-launcher can also produce player-port
- Factory of rocket-launcher can also produce basic-inserter
- Factory of rocket-launcher can also produce radar
- Factory of rocket-launcher can also produce basic-mining-drill
- Factory of rocket-launcher can also produce assembling-machine-1
- Factory of pumpjack can also produce chemical-plant
- Factory of medium-electric-pole can also produce piercing-shotgun-shell
- Factory of medium-electric-pole can also produce big-electric-pole
- Factory of medium-electric-pole can also produce piercing-bullet-magazine
- Factory of medium-electric-pole can also produce heavy-armor
- Factory of curved-rail can also produce straight-rail
- Factory of iron-stick can also produce iron-gear-wheel
- Factory of iron-stick can also produce pipe
- Factory of iron-stick can also produce iron-chest
- Factory of iron-stick can also produce basic-bullet-magazine
- Factory of iron-stick can also produce steel-plate
- Factory of iron-stick can also produce basic-armor
- Factory of night-vision-equipment can also produce energy-shield-equipment
- Factory of radar can also produce player-port
- Factory of radar can also produce basic-inserter
- Factory of radar can also produce rocket-launcher
- Factory of radar can also produce basic-mining-drill
- Factory of radar can also produce assembling-machine-1
- Factory of gun-turret can also produce submachine-gun
- Factory of green-wire can also produce red-wire
- Factory of basic-bullet-magazine can also produce iron-gear-wheel
- Factory of basic-bullet-magazine can also produce pipe
- Factory of basic-bullet-magazine can also produce iron-chest
- Factory of basic-bullet-magazine can also produce iron-stick
- Factory of basic-bullet-magazine can also produce steel-plate
- Factory of basic-bullet-magazine can also produce basic-armor
- Factory of shotgun-shell can also produce pistol
- Factory of basic-mining-drill can also produce player-port
- Factory of basic-mining-drill can also produce basic-inserter
- Factory of basic-mining-drill can also produce rocket-launcher
- Factory of basic-mining-drill can also produce radar
- Factory of basic-mining-drill can also produce assembling-machine-1
- Factory of basic-transport-belt can also produce burner-inserter
- Factory of slowdown-capsule can also produce poison-capsule
- Factory of deconstruction-planner can also produce blueprint
- Factory of burner-inserter can also produce basic-transport-belt
- Factory of effectivity-module can also produce productivity-module
- Factory of effectivity-module can also produce speed-module
- Factory of steel-plate can also produce iron-gear-wheel
- Factory of steel-plate can also produce pipe
- Factory of steel-plate can also produce iron-chest
- Factory of steel-plate can also produce iron-stick
- Factory of steel-plate can also produce basic-bullet-magazine
- Factory of steel-plate can also produce basic-armor
- Factory of speed-module can also produce productivity-module
- Factory of speed-module can also produce effectivity-module
- Factory of stone-brick can also produce stone-furnace
- Factory of basic-laser-defense-equipment can also produce basic-electric-discharge-defense-equipment
- Factory of assembling-machine-1 can also produce player-port
- Factory of assembling-machine-1 can also produce basic-inserter
- Factory of assembling-machine-1 can also produce rocket-launcher
- Factory of assembling-machine-1 can also produce radar
- Factory of assembling-machine-1 can also produce basic-mining-drill
- Factory of submachine-gun can also produce gun-turret
- Factory of red-wire can also produce green-wire
- Factory of logistic-chest-passive-provider can also produce logistic-chest-storage
- Factory of logistic-chest-passive-provider can also produce logistic-chest-requester
- Factory of logistic-chest-passive-provider can also produce logistic-chest-active-provider
- Factory of basic-armor can also produce iron-gear-wheel
- Factory of basic-armor can also produce pipe
- Factory of basic-armor can also produce iron-chest
- Factory of basic-armor can also produce iron-stick
- Factory of basic-armor can also produce basic-bullet-magazine
- Factory of basic-armor can also produce steel-plate
- Factory of solid-fuel-from-heavy-oil can also produce lubricant
- Factory of straight-rail can also produce curved-rail
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement