Last active
January 31, 2019 07:08
-
-
Save gandalfx/e1dbf41b75ad445f331d to your computer and use it in GitHub Desktop.
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
#!/usr/bin/env python | |
# | |
# Calculates the total number of Science Packs needed for research | |
# in the game Factorio (www.factorio.com). | |
# | |
# Created by Gandalfx | |
# https://gandalfx.github.com | |
sciences = { | |
# basic & misc | |
"Electronics" : (1, 0, 0, 0, 30), | |
"Advanced electronics" : (1, 1, 0, 0, 40), | |
"Advanced electronics 2" : (1, 1, 0, 0, 100), | |
"Optics" : (1, 0, 0, 0, 10), | |
"Toolbelt" : (1, 1, 0, 0, 50), | |
"Flight" : (1, 1, 0, 0, 200), | |
"Robotics" : (1, 1, 0, 0, 100), | |
"Construction robotics" : (1, 1, 0, 0, 50), | |
"Automated construction" : (1, 1, 0, 0, 75), | |
"Alien technology" : (1, 1, 0, 0, 300), | |
"Lab efficiency 1" : (1, 1, 0, 0, 100), | |
"Lab efficiency 2" : (1, 1, 0, 0, 150), | |
"Lab efficiency 3" : (1, 1, 1, 0, 250), | |
"Lab efficiency 4" : (1, 1, 1, 0, 500), | |
"Modules" : (1, 1, 0, 0, 50), | |
"Effect transmission" : (1, 1, 1, 1, 75), | |
"Speed module" : (1, 1, 0, 0, 50), | |
"Speed module 1" : (1, 1, 1, 0, 75), | |
"Speed module 2" : (1, 1, 1, 1, 300), | |
"Efficiency module" : (1, 1, 0, 0, 50), | |
"Efficiency module 1" : (1, 1, 1, 0, 75), | |
"Efficiency module 2" : (1, 1, 1, 1, 300), | |
"Productivity module" : (1, 1, 0, 0, 50), | |
"Productivity module 1" : (1, 1, 1, 0, 75), | |
"Productivity module 2" : (1, 1, 1, 1, 300), | |
"Rocket defense" : (1, 1, 1, 1, 1000), | |
# logistics | |
"Automation" : (1, 0, 0, 0, 10), | |
"Automation 2" : (2, 0, 0, 0, 40), | |
"Automation 3" : (1, 1, 1, 0, 100), | |
"Logistics" : (1, 0, 0, 0, 20), | |
"Logistics 2" : (1, 1, 0, 0, 40), | |
"Logistics 3" : (1, 1, 1, 0, 100), | |
"Electric energy distribution 1" : (1, 1, 0, 0, 50), | |
"Electric energy distribution 2" : (1, 1, 1, 0, 100), | |
"Solar energy" : (1, 1, 0, 0, 100), | |
"Electric energy accumulators 1" : (1, 1, 0, 0, 60), | |
"Logistic robotics" : (1, 1, 0, 0, 50), | |
"Logistic system" : (1, 1, 1, 0, 150), | |
"Inserter item stack size bonus 1" : (1, 1, 0, 0, 50), | |
"Inserter item stack size bonus 2" : (1, 1, 0, 0, 60), | |
"Inserter item stack size bonus 3" : (1, 1, 1, 0, 200), | |
"Inserter item stack size bonus 4" : (1, 1, 1, 1, 300), | |
"Logistic robot speed 1" : (1, 1, 1, 0, 50), | |
"Logistic robot speed 2" : (1, 1, 1, 0, 100), | |
"Logistic robot speed 3" : (1, 1, 1, 1, 150), | |
"Logistic robot speed 4" : (1, 1, 1, 1, 250), | |
"Logistic robot speed 5" : (1, 1, 1, 1, 500), | |
"Logistic robot cargo size 1" : (1, 1, 1, 0, 200), | |
"Logistic robot cargo size 2" : (1, 1, 1, 1, 300), | |
"Logistic robot cargo size 3" : (1, 1, 1, 1, 450), | |
"Character logistic slots 1" : (1, 1, 0, 0, 100), | |
"Character logistic slots 2" : (1, 1, 0, 0, 150), | |
"Character logistic slots 3" : (1, 1, 1, 0, 150), | |
"Character logistic slots 4" : (1, 1, 1, 1, 150), | |
# vehicles | |
"Engine" : (1, 1, 0, 0, 50), | |
"Electric engine" : (1, 1, 0, 0, 50), | |
"Automobilism" : (2, 1, 0, 0, 100), | |
"Tanks" : (1, 1, 1, 0, 20), | |
"Automated rail transportation" : (2, 1, 0, 0, 70), | |
"Rail signals" : (2, 1, 0, 0, 150), | |
# processing | |
"Steel processing" : (1, 0, 0, 0, 20), | |
"Advanced material processing" : (1, 1, 0, 0, 50), | |
"Advanced material processing 2" : (1, 1, 0, 0, 100), | |
"Oil processing" : (1, 1, 0, 0, 50), | |
"Fluid handling" : (1, 1, 0, 0, 75), | |
"Advanced oil processing" : (1, 1, 1, 0, 75), | |
"Sulfur processing" : (1, 1, 0, 0, 100), | |
"Plastics" : (1, 1, 0, 0, 100), | |
"Battery" : (1, 1, 0, 0, 50), | |
# weapons | |
"Military" : (1, 0, 0, 0, 10), | |
"Military 2" : (1, 1, 0, 0, 20), | |
"Military 3" : (1, 1, 1, 0, 50), | |
"Military 4" : (1, 1, 1, 1, 150), | |
"Explosives" : (1, 1, 0, 0, 60), | |
"Flammables" : (1, 1, 0, 0, 60), | |
"Flame thrower" : (1, 1, 0, 0, 20), | |
"Land mines" : (1, 1, 0, 0, 20), | |
"Rocketry" : (1, 1, 0, 0, 80), | |
"Explosive rocketry" : (1, 1, 1, 0, 100), | |
"Bullet damage 1" : (1, 0, 0, 0, 50), | |
"Bullet damage 2" : (1, 1, 0, 0, 100), | |
"Bullet damage 3" : (1, 1, 0, 0, 200), | |
"Bullet damage 4" : (1, 1, 1, 0, 100), | |
"Bullet damage 5" : (1, 1, 1, 1, 200), | |
"Bullet damage 6" : (1, 1, 1, 1, 300), | |
"Bullet shooting speed 1" : (1, 0, 0, 0, 50), | |
"Bullet shooting speed 2" : (1, 0, 0, 0, 100), | |
"Bullet shooting speed 3" : (1, 1, 0, 0, 100), | |
"Bullet shooting speed 4" : (1, 1, 1, 0, 200), | |
"Bullet shooting speed 5" : (1, 1, 1, 1, 200), | |
"Bullet shooting speed 6" : (1, 1, 1, 1, 300), | |
"Shotgun shell damage 1" : (1, 0, 0, 0, 50), | |
"Shotgun shell damage 2" : (1, 1, 0, 0, 100), | |
"Shotgun shell damage 3" : (1, 1, 0, 0, 200), | |
"Shotgun shell damage 4" : (1, 1, 1, 0, 100), | |
"Shotgun shell damage 5" : (1, 1, 1, 1, 200), | |
"Shotgun shell damage 6" : (1, 1, 1, 1, 300), | |
"Shotgun shell shooting speed 1" : (1, 0, 0, 0, 50), | |
"Shotgun shell shooting speed 2" : (1, 0, 0, 0, 100), | |
"Shotgun shell shooting speed 3" : (1, 1, 0, 0, 100), | |
"Shotgun shell shooting speed 4" : (1, 1, 1, 0, 200), | |
"Shotgun shell shooting speed 5" : (1, 1, 1, 1, 200), | |
"Shotgun shell shooting speed 6" : (1, 1, 1, 1, 300), | |
"Rocket damage 1" : (1, 1, 0, 1, 200), | |
"Rocket damage 2" : (1, 1, 0, 1, 250), | |
"Rocket damage 3" : (1, 1, 1, 0, 100), | |
"Rocket damage 4" : (1, 1, 1, 0, 150), | |
"Rocket damage 5" : (1, 1, 1, 0, 300), | |
"Rocket shooting speed 1" : (1, 1, 0, 1, 200), | |
"Rocket shooting speed 2" : (1, 1, 0, 1, 250), | |
"Rocket shooting speed 3" : (1, 1, 1, 0, 100), | |
"Rocket shooting speed 4" : (1, 1, 1, 0, 150), | |
"Rocket shooting speed 5" : (1, 1, 1, 0, 300), | |
# armor | |
"Armor crafting 1" : (1, 0, 0, 0, 10), | |
"Armor crafting 2" : (1, 0, 0, 0, 30), | |
"Armor crafting 3" : (1, 1, 0, 0, 100), | |
"Power armor" : (1, 1, 1, 0, 100), | |
"Power armor 2" : (1, 1, 1, 3, 150), | |
"Portable solar panel" : (1, 1, 0, 0, 50), | |
"Portable fusion reactor" : (1, 1, 1, 0, 200), | |
"Battery equipment" : (1, 1, 0, 0, 50), | |
"Battery equipment MK2" : (1, 1, 1, 0, 100), | |
"Energy shield equipment" : (1, 1, 0, 0, 50), | |
"Energy shield equipment MK2" : (1, 1, 1, 0, 100), | |
"Basic exoskeleton equipment" : (1, 1, 1, 0, 50), | |
"Personal laser defense" : (1, 1, 1, 0, 100), | |
"Night vision" : (1, 1, 0, 0, 50), | |
"Discharge defense" : (1, 1, 1, 1, 100), | |
# turrets & walls, combat robots | |
"Turrets" : (1, 0, 0, 0, 10), | |
"Stone walls" : (1, 0, 0, 0, 10), | |
"Gates" : (1, 1, 0, 0, 100), | |
"Laser" : (1, 1, 0, 0, 50), | |
"Laser turrets" : (1, 1, 0, 0, 50), | |
"Combat robotics" : (1, 1, 0, 0, 150), | |
"Combat robotics 2" : (1, 1, 1, 0, 200), | |
"Combat robotics 3" : (1, 1, 1, 1, 300), | |
"Gun turret damage upgrade 1" : (1, 1, 0, 0, 50), | |
"Gun turret damage upgrade 2" : (1, 1, 0, 0, 100), | |
"Gun turret damage upgrade 3" : (1, 1, 0, 0, 200), | |
"Gun turret damage upgrade 4" : (1, 1, 1, 0, 100), | |
"Gun turret damage upgrade 5" : (1, 1, 1, 1, 200), | |
"Gun turret damage upgrade 6" : (1, 1, 1, 1, 300), | |
"Laser turret damage upgrade 1" : (1, 1, 0, 0, 50), | |
"Laser turret damage upgrade 2" : (1, 1, 0, 0, 100), | |
"Laser turret damage upgrade 3" : (1, 1, 0, 0, 200), | |
"Laser turret damage upgrade 4" : (1, 1, 1, 0, 100), | |
"Laser turret damage upgrade 5" : (1, 1, 1, 1, 200), | |
"Laser turret damage upgrade 6" : (1, 1, 1, 1, 300), | |
"Laser turret shooting speed 1" : (1, 0, 0, 0, 50), | |
"Laser turret shooting speed 2" : (1, 1, 0, 0, 100), | |
"Laser turret shooting speed 3" : (1, 1, 0, 0, 200), | |
"Laser turret shooting speed 4" : (1, 1, 1, 0, 200), | |
"Laser turret shooting speed 5" : (1, 1, 1, 1, 200), | |
"Laser turret shooting speed 6" : (1, 1, 1, 1, 300), | |
"Combat robot damage 1" : (1, 1, 0, 0, 100), | |
"Combat robot damage 2" : (1, 1, 0, 0, 200), | |
"Combat robot damage 3" : (1, 1, 1, 0, 100), | |
"Combat robot damage 4" : (1, 1, 1, 1, 100), | |
"Combat robot damage 5" : (1, 1, 1, 1, 200), | |
"Follower robot count 1" : (1, 1, 0, 0, 50), | |
"Follower robot count 2" : (1, 1, 0, 0, 100), | |
"Follower robot count 3" : (1, 1, 1, 0, 150), | |
"Follower robot count 4" : (1, 1, 1, 0, 200), | |
"Follower robot count 5" : (1, 1, 1, 0, 250), | |
"Follower robot count 6" : (1, 1, 1, 1, 200), | |
"Follower robot count 7" : (1, 1, 1, 1, 300), | |
"Follower robot count 8" : (1, 1, 1, 1, 400), | |
"Follower robot count 9" : (1, 1, 1, 1, 500), | |
"Follower robot count 10" : (1, 1, 1, 1, 600), | |
"Follower robot count 11" : (1, 1, 1, 1, 800), | |
"Follower robot count 12" : (1, 1, 1, 1, 1000), | |
"Follower robot count 13" : (1, 1, 1, 1, 1200), | |
"Follower robot count 14" : (1, 1, 1, 1, 1400), | |
"Follower robot count 15" : (1, 1, 1, 1, 1600), | |
"Follower robot count 16" : (1, 1, 1, 1, 1800), | |
"Follower robot count 17" : (1, 1, 1, 1, 2000), | |
"Follower robot count 18" : (1, 1, 1, 1, 2200), | |
"Follower robot count 19" : (1, 1, 1, 1, 2400), | |
"Follower robot count 20" : (1, 1, 1, 1, 2600), | |
} | |
science_pack_costs = ( # copper, iron, petrol, coal, alien artifacts | |
( 1, 2, 0, 0, 0), | |
( 1.5, 5.5, 0, 0, 0), | |
(16.5, 21.4, 6, 1, 0), | |
( 0, 0, 0, 0, 0.1) | |
) | |
total_packs = [0, 0, 0, 0] | |
for science, packs in sciences.items(): | |
for i in (0, 1, 2, 3): | |
total_packs[i] += packs[i] * packs[4] | |
total_costs = [0, 0, 0, 0, 0] | |
for raw in (0, 1, 2, 3, 4): | |
for pack in (0, 1, 2, 3): | |
total_costs[raw] += total_packs[pack] * science_pack_costs[pack][raw] | |
print( "Red science packs: " + str(total_packs[0]) | |
+ "\nGreen science packs: " + str(total_packs[1]) | |
+ "\nBlue science packs: " + str(total_packs[2]) | |
+ "\nAlien science packs: " + str(total_packs[3]) | |
) | |
print("\nTotal raw:" | |
+ "\nCopper: " + str(total_costs[0]) | |
+ "\nIron: " + str(total_costs[1]) | |
+ "\nPetrol: " + str(total_costs[2]) | |
+ "\nCoal: " + str(total_costs[3]) | |
+ "\nAlien Artifacts: " + str(total_costs[4]) | |
) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment