Created
July 17, 2016 19:26
-
-
Save funkytaco/fb5414dbd160b749fd7dfc297c1d01ac to your computer and use it in GitHub Desktop.
Pokemon: GO Candy/Evolution Calculator
This file contains hidden or 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
def main(): | |
while True: | |
try: | |
pokemon = int(input("How many Pokemon do you have? ")) | |
if pokemon >= 0: | |
break | |
raise ValueError | |
except ValueError: | |
print("Invalid number") | |
while True: | |
try: | |
candy = int(input("How many candies do you have for that Pokemon? ")) | |
if candy >= 0: | |
break | |
raise ValueError | |
except ValueError: | |
print("Invalid number") | |
while True: | |
try: | |
cost = int(input("How much candy does it take to evolve the pokemon? ")) - 1 | |
if cost >= 0: | |
break | |
raise ValueError | |
except ValueError: | |
print("Invalid Number") | |
total_evolved = candy // cost | |
candy_remaining = candy % cost | |
pokemon_remaining = pokemon - total_evolved | |
transfer_max = pokemon_remaining // cost | |
transfer = (pokemon_remaining - transfer_max) // cost | |
transfer_mod = (pokemon_remaining - transfer_max) % cost | |
total_evolved += transfer | |
pokemon_remaining = transfer_mod | |
xp = total_evolved * 1000 | |
print("\nTransfer {0} pokemon first.\nYou can evolve {1} pokemon, with {2} candy and {3} pokemon reamining.\n" | |
"You will earn {4} EXP. for this pokemon." \ | |
.format(transfer, total_evolved, candy_remaining, pokemon_remaining, xp)) | |
return xp | |
if __name__ == '__main__': | |
run_again = "n" | |
tot_xp = 0 | |
while run_again != "": | |
current_xp = main() | |
tot_xp += current_xp | |
print("\nYou will receive" ,tot_xp, "total EXP for all the pokemon you have evolved so far") | |
run_again = input("\nAdd more pokemon? (y/n/ (leave blank to quit) ") | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment