Skip to content

Instantly share code, notes, and snippets.

@yohanes
Last active September 6, 2016 03:54
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 yohanes/f6694cdc8d3ef0259b7c161b299cfcd9 to your computer and use it in GitHub Desktop.
Save yohanes/f6694cdc8d3ef0259b7c161b299cfcd9 to your computer and use it in GitHub Desktop.
How many Pidgeys you need to reach an XP (assuming you always evolve after 12 candies and not using lucky egg)
import sys
if (len(sys.argv)<2):
print "Usage: python pidgey.py targetxp"
exit(0)
target_xp = int(sys.argv[1])
print "Target XP ", target_xp
total_pidgey = 0
current_pidgey = 0
current_pidgeotto = 0
current_candy = 0
current_xp = 0
while current_xp < target_xp:
#catch current_pidgey, assume 100 points
current_xp += 100
total_pidgey += 1
current_pidgey +=1
current_candy += 3
while (current_candy>12 and current_pidgey>0):
current_pidgey -= 1
current_pidgeotto += 1
current_candy -= 12
current_xp += 500 #assume not using lucky egg
while (current_pidgeotto>12):
current_pidgeotto -= 12 #exchange for candy
current_candy += 12
while (current_pidgey>12):
current_pidgey -= 12 #exchange for candy
current_candy += 12
print "Total pidgey needed ", total_pidgey
print "Current XP ", current_xp
print "Current pidgey ", current_pidgey
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment