Skip to content

Instantly share code, notes, and snippets.

@soraphis
Last active January 7, 2018 22:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save soraphis/ee2336a29036bb5106ac726d13717dbc to your computer and use it in GitHub Desktop.
Save soraphis/ee2336a29036bb5106ac726d13717dbc to your computer and use it in GitHub Desktop.
python file that calculates base ressources needed to craft components.
Minecraft Mod: "Solar Flux"
Modpack: Project Ozone Lite
Calculating Cost Efficiency
3 x Chaotic Solar Panel -> 1572864.0 RF/t 100.00%
4 x Draconic Solar Panel -> 524288.0 RF/t 33.33%
8 x Solar Panel 8 -> 262144.0 RF/t 16.67%
16 x Solar Panel 7 -> 131072.0 RF/t 8.33%
32 x Solar Panel 6 -> 65536.0 RF/t 4.17%
64 x Solar Panel 5 -> 32768.0 RF/t 2.08%
128 x Solar Panel 4 -> 16384.0 RF/t 1.04%
256 x Solar Panel 3 -> 8192.0 RF/t 0.52%
512 x Solar Panel 2 -> 8192.0 RF/t 0.52%
4096 x Solar Panel 1 -> 32768.0 RF/t 2.08%
Costs of 3 x Chaotic Solar Panel:
Item Amount Stacks
Chaos Chard x 1.00 0.0
Draconic Hearth x 3.22 0.1
Dragon Egg x 8.00 0.1
Dragon Breath x 16.00 0.2
Redstone Lamp x 16.00 0.2
Emerald Block x 42.33 0.7
Clock x 64.00 1.0
Nether Star x 87.67 1.4
Diamond Block x 100.00 1.6
Draconium Block x 105.56 1.6
Block of Quarz x 168.00 2.6
Diamond x 213.67 3.3
Blaze Rod x 252.00 3.9
Obsidian x 360.00 5.6
Stone x 384.00 6.0
Glowstone Dust x 836.00 13.1
Draconium Ingot x 854.67 13.4
Clay x 1116.00 17.4
Gold Ingot x 1142.67 17.9
Cobblestone x 2048.00 32.0
Lapis Lazuli x 3384.00 52.9
Redstone x 5154.00 80.5
Log x 5536.00 86.5
Iron Ingot x 7340.00 114.7
Glass x 8545.50 133.5
print("""
Minecraft Mod: "Solar Flux"
Modpack: Project Ozone Lite
Calculating Cost Efficiency
""")
from math import ceil, floor, log
costs = {
'Planks': { 'Log': 0.25 },
'Piston': { 'Planks': 3, 'Cobblestone': 4, 'Redstone': 1, 'Iron Ingot': 1 },
'Glass Pane': {'Glass': 6/16},
'Mirror': { 'Glass Pane': 3/3, 'Iron Ingot': 1/3 },
'Stick': {'Planks': 2/4},
'Redstone Torch': { 'Stick': 1, 'Redstone': 1},
'Redstone Repeater': { 'Stone': 3, 'Redstone Torch': 2, 'Redstone': 1},
'Redstone Block': {'Redstone': 9},
'Gold Block': { 'Gold Ingot': 9 },
'Iron Block': { 'Iron Ingot': 9 },
'Glowstone Block': {'Glowstone Dust': 4},
'Photovoltaik Cell 1': {'Lapis Lazuli': 3, 'Glass': 3, 'Mirror': 3 },
'Photovoltaik Cell 2': {'Lapis Lazuli': 3, 'Clay': 3, 'Mirror': 2, 'Photovoltaik Cell 1': 1},
'Photovoltaik Cell 3': {'Glowstone Dust': 3, 'Glass': 3, 'Obsidian': 2, 'Photovoltaik Cell 2': 1},
'Photovoltaik Cell 4': {'Glowstone Dust': 2, 'Diamond Block': 1, 'Blaze Rod': 3, 'Block of Quarz': 2, 'Photovoltaik Cell 3': 1},
'Awakened Core': {'Wyvern Core': 5, 'Awakened Draconium Block': 4, 'Nether Star': 1},
'Wyvern Core': {'Draconic Core': 5, 'Draconium Block': 2, 'Emerald Block': 1, 'Nether Star': 2},
'Draconic Core': {'Gold Ingot': 4, 'Draconium Ingot': 4, 'Diamond': 1},
'Draconic Energy Core': {'Wyvern Energy Core': 1, 'Awakened Draconium Ingot': 4, 'Awakened Core': 1, 'Redstone Block': 5},
'Wyvern Energy Core': {'Draconic Core': 1, 'Draconium Block': 4, 'Redstone Block': 4},
'Awakened Draconium Ingot': {'Awakened Draconium Block': 1/9 },
'Awakened Draconium Block': {'Wyvern Core': 6/4, 'Draconic Hearth': 1/4, 'Draconium Block': 4/4},
'Solar Panel 1' : { 'Mirror': 3, 'Planks': 5, 'Redstone': 1 },
'Solar Panel 2' : { 'Solar Panel 1': 8, 'Piston': 1 },
'Solar Panel 3' :
{ 'Solar Panel 2': 4/2, 'Iron Block': 1/2, 'Redstone Repeater': 1/2, 'Photovoltaik Cell 1': 3/2 },
'Solar Panel 4' :
{ 'Solar Panel 3': 4/2, 'Iron Block': 1/2, 'Clock': 1/2, 'Photovoltaik Cell 2': 3/2 },
'Solar Panel 5' :
{ 'Solar Panel 4': 4/2, 'Gold Block': 1/2, 'Glowstone Block': 1/2, 'Photovoltaik Cell 3': 3/2 },
'Solar Panel 6' :
{ 'Solar Panel 5': 4/2, 'Diamond Block': 1/2, 'Redstone Lamp': 1/2, 'Photovoltaik Cell 4': 3/2 },
'Solar Panel 7' :
{ 'Solar Panel 6': 4/2, 'Dragon Breath': 2/2, 'Photovoltaik Cell 4': 3/2 },
'Solar Panel 8' :
{ 'Solar Panel 7': 4/2, 'Dragon Egg': 2/2, 'Photovoltaik Cell 4': 3/2 },
'Draconic Solar Panel' :
{ 'Solar Panel 8': 4/2, 'Wyvern Core': 4/2, 'Draconic Energy Core': 1/2 },
'Chaotic Solar Panel' :
{ 'Draconic Solar Panel': 4/3, 'Chaos Chard': 1/3, 'Awakened Core': 1/3 },
}
energy = {
'Solar Panel 1': 8,
'Solar Panel 2': 16,
'Solar Panel 3': 32,
'Solar Panel 4': 128,
'Solar Panel 5': 512,
'Solar Panel 6': 2048,
'Solar Panel 7': 8192,
'Solar Panel 8': 32768,
'Draconic Solar Panel': 131072,
'Chaotic Solar Panel': 524288,
}
SI_Prefix = ['', 'k', 'M', 'G', 'T', 'P', 'E', 'Z', 'Y']
def large_number(num):
ex = floor(log(num, 1000))
b = num / 1000 ** ex
if ex < len(SI_Prefix):
return "%d %s" % (b, SI_Prefix[ex])
return "%d * 10^(3*%d)" % (b, ex)
def getIndexOfTuple(l, index, value):
for pos,t in enumerate(l):
if t[index] == value:
return pos
raise ValueError("list.index(x): x not in list")
def stash(chest, items):
global last_item, iron_log
for item, amount in items:
if item == "Mirror":
iron_log += "%s: %15d \n" % (last_item, amount)
try:
i = getIndexOfTuple(chest, 0, item)
chest[i] = (chest[i][0], chest[i][1] + amount)
except ValueError:
chest += [(item, amount)]
return chest
def equivalence_calculation(type : str, amount: int, vgl = None):
assert type in costs
# Calculate energy production
en = energy[type] * amount
print("%4d x" % amount, "%20s" % type, " -> %9.1f" % (en), "RF/t", "\t 100.00%" if vgl is None else "\t %6.2f%%" % (en/vgl * 100))
eq = costs[type].copy()
for r in eq:
eq[r] *= amount
if r in energy:
equivalence_calculation(r, eq[r], en if vgl is None else vgl)
if vgl is not None: return
# Talk about SI Prefixes
# print("\n")
# for i in range(1, len(SI_Prefix)): print("%s = 1000^%d" % (SI_Prefix[i], i), end=" ")
print("\n")
# What does it cost?
TABS = ["%20s", "%12s", "%8s"]
print("Costs of %d x %s:" % (amount, type))
print("\t", TABS[0] % "Item", "\t ", TABS[1] % "Amount", " ", TABS[2] % "Stacks\n")
stuff = [(r, eq[r]) for r in eq]
i = 0
while i < len(stuff):
if stuff[i][0] not in costs:
i += 1
continue
item, number = stuff.pop(i)
global last_item
last_item = "%21d x %s" % (number, item)
stuff = stash(stuff, [(r, number * costs[item][r]) for r in costs[item] ])
# stuff += [(r, number * costs[item][r]) for r in costs[item] ]
stuff = sorted(stuff, key=lambda x: x[1])
for c in stuff:
amount = ("%.2f" % c[1]) if c[1] < 100000 else large_number(c[1])
amount_stacks = ("%.1f" % (c[1]/64)) if c[1]/64 < 100000 else large_number(c[1]/64)
print("\t",TABS[0] % c[0], "\t x", TABS[1] % amount, " ", TABS[2] % amount_stacks)
last_item = ""
iron_log = ""
equivalence_calculation('Chaotic Solar Panel', 3)
#print(iron_log)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment