Files
bridzik/api/utils.py
T
2021-04-18 17:40:38 +02:00

24 lines
791 B
Python

from bridzik import Card_colors
def get_points_sums(standings: []):
sums = [0] * 4
for series in standings:
for round in series:
for player, points in enumerate(round):
sums[player] += points
return sums
def sort_card_list(input_card_set: []) -> []:
color_paritions = [
[c for c in input_card_set if c.color == Card_colors['HEARTS']],
[c for c in input_card_set if c.color == Card_colors['LEAVES']],
[c for c in input_card_set if c.color == Card_colors['ACORNS']],
[c for c in input_card_set if c.color == Card_colors['BELLS']]
]
output_list = []
for color_list in color_paritions:
color_list.sort(key=lambda a : a.value)
output_list.extend(color_list)
return output_list