From 6046deff4568ca9b2888eb9f7c36908c94170989 Mon Sep 17 00:00:00 2001 From: mez Date: Wed, 23 Apr 2025 21:29:47 +0100 Subject: [PATCH] Add statistics function --- tools.py | 48 +++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 47 insertions(+), 1 deletion(-) diff --git a/tools.py b/tools.py index a898b5f..8051b11 100644 --- a/tools.py +++ b/tools.py @@ -1608,12 +1608,56 @@ def artshop(): shoplog += "}" print(shoplog) +def stats(): + print("\nCollection size: " + str(len(colors.cardlist)) + " cards") + tradesize = 0 + for card in colors.cardlist: + if card["priority"] == 4: + tradesize += 1 + print("Tradepile: " + str(tradesize) + " cards") + masteredsize = 0 + for deck in colors.decklist: + if deck["mastered"]: + masteredsize += 1 + print("Wantlist: " + str(len(colors.wantedlist)) + " cards") + print("Mastered: " + str(masteredsize) + " decks") + print("Mass collection progress:") + masslist = sorted(list(variables.masscollect.keys())) + seriesdict = {} + for series in masslist: + seriesdict[series] = 0 + for card in colors.cardlist: + if not card["dupe"]: + for series in card["mass"]: + for theseries in masslist: + if series == theseries: + seriesdict[series] += 1 + totaldict = {} + for key,value in variables.masscollect.items(): + thenumber = 0 + try: + thenumber += 20 * len(value["decks"]) + except: + pass + try: + thenumber += len(value["singles"]) + except: + pass + totaldict[key] = thenumber + totaldict = dict(sorted(totaldict.items())) + for key in seriesdict: + if totaldict[key] > seriesdict[key]: + print(" " + key + ": " + str(seriesdict[key]) + "/" + str(totaldict[key]) + " (" + str(int((float(seriesdict[key])/float(totaldict[key])) * 100)) + "%)") + else: + print(" " + key + ": complete") + + if __name__ == "__main__": while True: index = 0 # adapted from https://stackoverflow.com/a/64536882 indexValidList = [] print("Choose from the list:") - options = ["Get a list of potential cards to trade in for Riku’s Favors","Generate next palette portfolio","Generate next monochrome portfolio","Generate Switch It Up request","Generate Go Fish comment","Generate art shop request","Generate art studio request","Get a list of random cards from tradepile (excluding specials)","Get a list of random cards from tradepile (including specials)"] + options = ["Get a list of potential cards to trade in for Riku’s Favors","Generate next palette portfolio","Generate next monochrome portfolio","Generate Switch It Up request","Generate Go Fish comment","Generate art shop request","Generate art studio request","Get a list of random cards from tradepile (excluding specials)","Get a list of random cards from tradepile (including specials)","See some statistics about the collection"] for optionName in options: index = index + 1 indexValidList.extend([options.index(optionName)]) @@ -1647,5 +1691,7 @@ if __name__ == "__main__": randoms(True) elif chosen == "Generate art shop request": artshop() + elif chosen == "See some statistics about the collection": + stats() print("\n") input("Press Enter to continue or Ctrl-C to exit")