diff --git a/wiz_game.py b/wiz_game.py index 4fb59ec..16a4639 100644 --- a/wiz_game.py +++ b/wiz_game.py @@ -1,5 +1,6 @@ import random +from operator import attrgetter def chunks(lst, n): """Yield successive n-sized chunks from lst.""" @@ -28,7 +29,7 @@ class Player: self.cards = [] def set_cards(self, cards): - self.cards = cards + self.cards = sorted(cards, key=attrgetter('color', 'value')) def show_cards(self): print(self.cards) @@ -45,9 +46,9 @@ class WizGame: for val in range(1, 14): self.card_deck.append(Card(color, val)) for _ in range(1, 5): - self.card_deck.append(Card(None, 'Z')) + self.card_deck.append(Card('-', 'Z')) for _ in range(1, 5): - self.card_deck.append(Card(None, 'N')) + self.card_deck.append(Card('-', 'N')) print("carddeck:") print(self.card_deck)