Add statistics function
This commit is contained in:
parent
221837ee04
commit
6046deff45
1 changed files with 47 additions and 1 deletions
48
tools.py
48
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")
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue