Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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
You can’t perform that action at this time.