Advertisement
Guest User

Untitled

a guest
Jul 30th, 2015
209
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 8.95 KB | None | 0 0
  1. import csv
  2.  
  3. recipes = {}
  4. tolerance = 0
  5.  
  6. def append_ignore_none(dictionary, key, value):
  7. if key in dictionary:
  8. dictionary[key].add(value)
  9. else:
  10. dictionary[key] = {value}
  11.  
  12. with open('rec.csv') as csvfile:
  13. reader = csv.reader(csvfile)
  14. for row in reader:
  15. append_ignore_none(recipes, row[0], row[1])
  16.  
  17. dependents = {}
  18.  
  19. for kleft, vleft in recipes.items():
  20. for kright, vright in recipes.items():
  21. if kleft != kright and vleft.issuperset(vright):
  22. needed_items = vleft.symmetric_difference(vright)
  23. if len(needed_items) <= tolerance:
  24. if len(needed_items) != 0:
  25. print("Factory of {0} can also produce {1}, just add {2}".format(kleft, kright, ",".join(needed_items)))
  26. else:
  27. print("Factory of {0} can also produce {1}".format(kleft, kright))
  28.  
  29. Factory of logistic-chest-storage can also produce logistic-chest-requester
  30. Factory of logistic-chest-storage can also produce logistic-chest-active-provider
  31. Factory of logistic-chest-storage can also produce logistic-chest-passive-provider
  32. Factory of empty-barrel can also produce steel-chest
  33. Factory of piercing-shotgun-shell can also produce big-electric-pole
  34. Factory of piercing-shotgun-shell can also produce piercing-bullet-magazine
  35. Factory of piercing-shotgun-shell can also produce heavy-armor
  36. Factory of piercing-shotgun-shell can also produce medium-electric-pole
  37. Factory of logistic-chest-requester can also produce logistic-chest-storage
  38. Factory of logistic-chest-requester can also produce logistic-chest-active-provider
  39. Factory of logistic-chest-requester can also produce logistic-chest-passive-provider
  40. Factory of productivity-module can also produce effectivity-module
  41. Factory of productivity-module can also produce speed-module
  42. Factory of iron-gear-wheel can also produce pipe
  43. Factory of iron-gear-wheel can also produce iron-chest
  44. Factory of iron-gear-wheel can also produce iron-stick
  45. Factory of iron-gear-wheel can also produce basic-bullet-magazine
  46. Factory of iron-gear-wheel can also produce steel-plate
  47. Factory of iron-gear-wheel can also produce basic-armor
  48. Factory of big-electric-pole can also produce piercing-shotgun-shell
  49. Factory of big-electric-pole can also produce piercing-bullet-magazine
  50. Factory of big-electric-pole can also produce heavy-armor
  51. Factory of big-electric-pole can also produce medium-electric-pole
  52. Factory of chemical-plant can also produce pumpjack
  53. Factory of player-port can also produce basic-inserter
  54. Factory of player-port can also produce rocket-launcher
  55. Factory of player-port can also produce radar
  56. Factory of player-port can also produce basic-mining-drill
  57. Factory of player-port can also produce assembling-machine-1
  58. Factory of pipe can also produce iron-gear-wheel
  59. Factory of pipe can also produce iron-chest
  60. Factory of pipe can also produce iron-stick
  61. Factory of pipe can also produce basic-bullet-magazine
  62. Factory of pipe can also produce steel-plate
  63. Factory of pipe can also produce basic-armor
  64. Factory of basic-inserter can also produce player-port
  65. Factory of basic-inserter can also produce rocket-launcher
  66. Factory of basic-inserter can also produce radar
  67. Factory of basic-inserter can also produce basic-mining-drill
  68. Factory of basic-inserter can also produce assembling-machine-1
  69. Factory of pistol can also produce shotgun-shell
  70. Factory of energy-shield-equipment can also produce night-vision-equipment
  71. Factory of basic-electric-discharge-defense-equipment can also produce basic-laser-defense-equipment
  72. Factory of lubricant can also produce solid-fuel-from-heavy-oil
  73. Factory of logistic-chest-active-provider can also produce logistic-chest-storage
  74. Factory of logistic-chest-active-provider can also produce logistic-chest-requester
  75. Factory of logistic-chest-active-provider can also produce logistic-chest-passive-provider
  76. Factory of blueprint can also produce deconstruction-planner
  77. Factory of iron-chest can also produce iron-gear-wheel
  78. Factory of iron-chest can also produce pipe
  79. Factory of iron-chest can also produce iron-stick
  80. Factory of iron-chest can also produce basic-bullet-magazine
  81. Factory of iron-chest can also produce steel-plate
  82. Factory of iron-chest can also produce basic-armor
  83. Factory of poison-capsule can also produce slowdown-capsule
  84. Factory of piercing-bullet-magazine can also produce piercing-shotgun-shell
  85. Factory of piercing-bullet-magazine can also produce big-electric-pole
  86. Factory of piercing-bullet-magazine can also produce heavy-armor
  87. Factory of piercing-bullet-magazine can also produce medium-electric-pole
  88. Factory of steel-chest can also produce empty-barrel
  89. Factory of stone-furnace can also produce stone-brick
  90. Factory of heavy-armor can also produce piercing-shotgun-shell
  91. Factory of heavy-armor can also produce big-electric-pole
  92. Factory of heavy-armor can also produce piercing-bullet-magazine
  93. Factory of heavy-armor can also produce medium-electric-pole
  94. Factory of rocket-launcher can also produce player-port
  95. Factory of rocket-launcher can also produce basic-inserter
  96. Factory of rocket-launcher can also produce radar
  97. Factory of rocket-launcher can also produce basic-mining-drill
  98. Factory of rocket-launcher can also produce assembling-machine-1
  99. Factory of pumpjack can also produce chemical-plant
  100. Factory of medium-electric-pole can also produce piercing-shotgun-shell
  101. Factory of medium-electric-pole can also produce big-electric-pole
  102. Factory of medium-electric-pole can also produce piercing-bullet-magazine
  103. Factory of medium-electric-pole can also produce heavy-armor
  104. Factory of curved-rail can also produce straight-rail
  105. Factory of iron-stick can also produce iron-gear-wheel
  106. Factory of iron-stick can also produce pipe
  107. Factory of iron-stick can also produce iron-chest
  108. Factory of iron-stick can also produce basic-bullet-magazine
  109. Factory of iron-stick can also produce steel-plate
  110. Factory of iron-stick can also produce basic-armor
  111. Factory of night-vision-equipment can also produce energy-shield-equipment
  112. Factory of radar can also produce player-port
  113. Factory of radar can also produce basic-inserter
  114. Factory of radar can also produce rocket-launcher
  115. Factory of radar can also produce basic-mining-drill
  116. Factory of radar can also produce assembling-machine-1
  117. Factory of gun-turret can also produce submachine-gun
  118. Factory of green-wire can also produce red-wire
  119. Factory of basic-bullet-magazine can also produce iron-gear-wheel
  120. Factory of basic-bullet-magazine can also produce pipe
  121. Factory of basic-bullet-magazine can also produce iron-chest
  122. Factory of basic-bullet-magazine can also produce iron-stick
  123. Factory of basic-bullet-magazine can also produce steel-plate
  124. Factory of basic-bullet-magazine can also produce basic-armor
  125. Factory of shotgun-shell can also produce pistol
  126. Factory of basic-mining-drill can also produce player-port
  127. Factory of basic-mining-drill can also produce basic-inserter
  128. Factory of basic-mining-drill can also produce rocket-launcher
  129. Factory of basic-mining-drill can also produce radar
  130. Factory of basic-mining-drill can also produce assembling-machine-1
  131. Factory of basic-transport-belt can also produce burner-inserter
  132. Factory of slowdown-capsule can also produce poison-capsule
  133. Factory of deconstruction-planner can also produce blueprint
  134. Factory of burner-inserter can also produce basic-transport-belt
  135. Factory of effectivity-module can also produce productivity-module
  136. Factory of effectivity-module can also produce speed-module
  137. Factory of steel-plate can also produce iron-gear-wheel
  138. Factory of steel-plate can also produce pipe
  139. Factory of steel-plate can also produce iron-chest
  140. Factory of steel-plate can also produce iron-stick
  141. Factory of steel-plate can also produce basic-bullet-magazine
  142. Factory of steel-plate can also produce basic-armor
  143. Factory of speed-module can also produce productivity-module
  144. Factory of speed-module can also produce effectivity-module
  145. Factory of stone-brick can also produce stone-furnace
  146. Factory of basic-laser-defense-equipment can also produce basic-electric-discharge-defense-equipment
  147. Factory of assembling-machine-1 can also produce player-port
  148. Factory of assembling-machine-1 can also produce basic-inserter
  149. Factory of assembling-machine-1 can also produce rocket-launcher
  150. Factory of assembling-machine-1 can also produce radar
  151. Factory of assembling-machine-1 can also produce basic-mining-drill
  152. Factory of submachine-gun can also produce gun-turret
  153. Factory of red-wire can also produce green-wire
  154. Factory of logistic-chest-passive-provider can also produce logistic-chest-storage
  155. Factory of logistic-chest-passive-provider can also produce logistic-chest-requester
  156. Factory of logistic-chest-passive-provider can also produce logistic-chest-active-provider
  157. Factory of basic-armor can also produce iron-gear-wheel
  158. Factory of basic-armor can also produce pipe
  159. Factory of basic-armor can also produce iron-chest
  160. Factory of basic-armor can also produce iron-stick
  161. Factory of basic-armor can also produce basic-bullet-magazine
  162. Factory of basic-armor can also produce steel-plate
  163. Factory of solid-fuel-from-heavy-oil can also produce lubricant
  164. Factory of straight-rail can also produce curved-rail
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement