From 290445a26d08e9c44dd1dbe49533828096533bba Mon Sep 17 00:00:00 2001 From: Lertsenem Date: Tue, 7 Jul 2020 16:09:22 +0200 Subject: [PATCH] Add get_mains() method Returns the list of chars used ordered by the number of time they were used. --- lokrez/smashgg.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/lokrez/smashgg.py b/lokrez/smashgg.py index 6efd3ae..6f1dbe5 100644 --- a/lokrez/smashgg.py +++ b/lokrez/smashgg.py @@ -119,6 +119,14 @@ class Player(): except KeyError: 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):