sort_card_list moved to utils and refactored
This commit is contained in:
@@ -1,3 +1,5 @@
|
||||
from bridzik import Card_colors
|
||||
|
||||
def get_points_sums(standings: []):
|
||||
sums = [0] * 4
|
||||
for series in standings:
|
||||
@@ -5,3 +7,17 @@ def get_points_sums(standings: []):
|
||||
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
|
||||
|
||||
Reference in New Issue
Block a user