misc

Unnamed repository; edit this file 'description' to name the repository.
git clone git://git.alexwennerberg.com/misc
Log | Files | Refs | README | LICENSE

commit c58d76e3a5986ea8204cb2afc9ed567bac80d124
parent 11889f710259047050c63799a7183240f2b4e680
Author: alex wennerberg <alex@alexwennerberg.com>
Date:   Sun, 30 Oct 2022 13:48:17 -0700

poke type script

Diffstat:
Apoketype.py | 77+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 77 insertions(+), 0 deletions(-)

diff --git a/poketype.py b/poketype.py @@ -0,0 +1,77 @@ +import random + +# a tool to help me remember gen 3 types +# I dont write much python so this is not very idomatic + +generation = 3 + +chart = { + "Normal": [1,1,1,1,1,1,1,1,1,1,1,1,0.5,0,1,1,0.5,1], + "Fire": [1,0.5,0.5,1,2,2,1,1,1,1,1,2,0.5,1,0.5,1,2,1], + "Water": [1,2,0.5,1,0.5,1,1,1,2,1,1,1,2,1,0.5,1,1,1], + "Electric": [1,1,2,0.5,0.5,1,1,1,0,2,1,1,1,1,0.5,1,1,1], + "Grass": [1,0.5,2,1,0.5,1,1,0.5,2,0.5,1,0.5,2,1,0.5,1,0.5,1], + "Ice": [1,0.5,0.5,1,2,0.5,1,1,2,2,1,1,1,1,2,1,0.5,1], + "Fighting": [2,1,1,1,1,2,1,0.5,1,0.5,0.5,0.5,2,0,1,2,2,0.5], + "Poison": [1,1,1,1,2,1,1,0.5,0.5,1,1,1,0.5,0.5,1,1,0,2], + "Ground": [1,2,1,2,0.5,1,1,2,1,0,1,0.5,2,1,1,1,2,1], + "Flying": [1,1,1,0.5,2,1,2,1,1,1,1,2,0.5,1,1,1,0.5,1], + "Psychic": [1,1,1,1,1,1,2,2,1,1,0.5,1,1,1,1,0,0.5,1], + "Bug": [1,0.5,1,1,2,1,0.5,0.5,1,0.5,2,1,1,0.5,1,2,0.5,0.5], + "Rock": [1,2,1,1,1,2,0.5,1,0.5,2,1,2,1,1,1,1,0.5,1], + "Ghost": [0,1,1,1,1,1,1,1,1,1,2,1,1,2,1,0.5,1,1], + "Dragon": [1,1,1,1,1,1,1,1,1,1,1,1,1,1,2,1,0.5,0], + "Dark": [1,1,1,1,1,1,0.5,1,1,1,2,1,1,2,1,0.5,1,0.5], + "Steel": [1,0.5,0.5,0.5,1,2,1,1,1,1,1,1,2,1,1,1,0.5,2], + # "Fairy": [1,0.5,1,1,1,1,2,0.5,1,1,1,1,1,1,2,2,0.5,1] +} + +# build index +index = {} + +n = 0 +for k,v in chart.items(): + index[k] = n + n += 1 + +combos = [] + +for k in chart.keys(): + for k2 in chart.keys(): + combos.append((k, k2)) + +random.shuffle(combos) + +print("""Usage: + 1: super effective + 2: standard effective + 3: not very effective + 4: no effect + 5: info + """) + + +wrong = [] + +correct = "" +while len(combos) > 0: + print(str(len(combos)) + " remain") + for n, combo in enumerate(combos): + inp = input(combo[0] + " x " + combo[1] + "\n") + effectiveness = chart[combo[0]][index[combo[1]]] + if inp == "5": + print("wrong: {}, correct: {}, remaining: {}".format(len(wrong), n-len(wrong), len(combos)-n)) + inp = input(combo[0] + " x " + combo[1] + "\n") + correct = (inp == "4" and effectiveness == 0 + or inp == "1" and effectiveness == 2 + or inp == "2" and effectiveness == 1 + or inp == "3" and effectiveness == 0.5) + if correct: + print("That's right!") + else: + print("Wrong. Effectiveness is " + str(effectiveness)) + wrong.append(combo) + print("") + print("Lets retry the ones you got wrong.") + combos = wrong + wrong = []