Add get_mains() method

Returns the list of chars used ordered by the number of time they were
used.
master
Lertsenem 2020-07-07 16:09:22 +02:00
parent f5350d506f
commit 290445a26d
1 changed files with 8 additions and 0 deletions

View File

@ -119,6 +119,14 @@ class Player():
except KeyError: except KeyError:
self.chars[character] = ( 1.01 if win else 1.00 ) self.chars[character] = ( 1.01 if win else 1.00 )
# -------------------------------------------------------------------------
def get_mains(self):
return [ cv[0] for cv in sorted(
self.chars.items(),
key = lambda cv: cv[1],
reverse = True,
) ]
# ------------------------------------------------------------------------- # -------------------------------------------------------------------------
def conf(self): def conf(self):