Created
June 16, 2019 14:35
-
-
Save Sigafoos/0ad607978a4f8a04c2beada9525d4503 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 json | |
import sys | |
floors = { | |
'good': 1, | |
'great': 2, | |
'ultra': 3, | |
'weather': 4, | |
'best': 5, | |
'hatch': 10, | |
'raid': 10, | |
'research': 10, | |
'lucky': 12, | |
} | |
if len(sys.argv) < 3: | |
print("need to pass both pokemon and floor") | |
sys.exit(1) | |
try: | |
floor = floors[sys.argv[2]] | |
except KeyError: | |
print("'{}' is not a valid floor".format(sys.argv[2])) | |
sys.exit(1) | |
try: | |
with open("data/{}.json".format(sys.argv[1])) as fp: | |
pokemon = json.load(fp) | |
except FileNotFoundError: | |
print("'{}' is not a valid Pokemon".format(sys.argv[1])) | |
sys.exit(1) | |
best = {} | |
for spread in pokemon.values(): | |
ivs = spread['ivs'].split('/') | |
if int(ivs[0]) < floor or int(ivs[1]) < floor or int(ivs[2]) < floor: | |
continue | |
if 'ranks' not in best or spread['ranks']['all'] < best['ranks']['all']: | |
best = spread | |
print('IVs: {}\nRank: {}'.format(best['ivs'], best['ranks']['all'])) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment