Last active
August 5, 2018 16:44
-
-
Save gbartz/b2a2a091700ea86178113f243137f353 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
import sys | |
def main(): | |
"""Calculate the resources required to craft SINGULARITIES for Minecraft Awakening""" | |
f_help = "Usage: python singularity.py blocks_required block_value singularities" | |
if len(sys.argv) >= 3: | |
num_of_blocks = int(sys.argv[1]) | |
block_value = int(sys.argv[2]) | |
try: | |
gain = int(sys.argv[3]) | |
except: | |
gain = 1 | |
else: | |
print(f_help) | |
sys.exit() | |
cost = num_of_blocks * block_value * gain | |
currency = {'red_matter_furnace': 6299656, | |
'red_matter_block': 1204224, | |
'nether_star': 139264} | |
if cost > currency['red_matter_furnace']: | |
num_red_matter_furnace = cost // currency['red_matter_furnace'] | |
cost = cost % currency['red_matter_furnace'] | |
if num_red_matter_furnace > 64: | |
stacks = num_red_matter_furnace // 64 | |
plus = num_red_matter_furnace % 64 | |
print("Red Matter Furnaces: {} x 64 + {}".format(stacks, plus)) | |
else: | |
print("Red Matter Furnaces: {}".format(str(num_red_matter_furnace))) | |
if cost > currency['red_matter_block']: | |
num_red_matter_block = cost // currency['red_matter_block'] | |
cost = cost % currency['red_matter_block'] | |
if num_red_matter_block > 64: | |
stacks = num_red_matter_block // 64 | |
plus = num_red_matter_block % 64 | |
print("Red Matter Blocks: {} x 64 + {}".format(stacks, plus)) | |
else: | |
print("Red Matter Blocks: {}".format(str(num_red_matter_block))) | |
if cost > currency['nether_star']: | |
num_nether_star = cost // currency['nether_star'] | |
cost = cost % currency['nether_star'] | |
if num_nether_star > 64: | |
stacks = num_nether_star // 64 | |
plus = num_nether_star % 64 | |
print("Nether Stars: {} x 64 + {}".format(stacks, plus)) | |
else: | |
print("Nether Stars: {}".format(str(num_nether_star))) | |
remaining_blocks = cost // block_value | |
print("Blocks: {}".format(str(remaining_blocks))) | |
print("-"*30) | |
print("Singularities: {}".format(gain)) | |
if __name__ == '__main__': | |
main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment