# Path: mau_mau/concepts.py
# class _CardCollection:
#     """A sequence of cards, used for all groups of cards used in the game."""
# 
#     def __init__(self, seed=None):
#         """Can be initialized with different seed kinds"""
#         if not seed:
#             self.cards = []
#         elif isinstance(seed, _CardCollection):
#             self.cards = seed.cards
#         elif isinstance(seed, Iterable):
#             self.cards = seed
#         else:
#             self.cards = [seed]
# 
#     def __repr__(self):
#         """Nice automatic representation for all inheriting objects.
# 
#         >>> from mau_mau.objects import Stock
#         >>> s = Stock([1, 2, 3])
#         >>> repr(s)
#         'Stock([1, 2, 3])'
#         """
#         name = self.__class__.__name__
#         return f"{name}({self.cards})"
# 
#     def __len__(self):
#         """Object has a length that is the number of cards contained in it.
# 
#         >>> c = _CardCollection([1, 2, 3])
#         >>> len(c)
#         3
# 
#         >>> c = _CardCollection()
#         >>> not c
#         True
#         """
#         return len(self.cards)
# 
#     def __iter__(self):
#         """Let's me use the object like a genuine Python sequence
# 
#         >>> [e for e in _CardCollection([1, 2, 3])]
#         [1, 2, 3]
#         """
#         for card in self.cards:
#             yield card
# 
#     def shuffle(self) -> None:
#         """Does not return anything: `random.shuffle` changes list in place"""
#         random.shuffle(self.cards)
# 
#     def put(self, card):
#         self.cards.append(card)
# 
#     def fetch(self, criterion=None):
#         """Fetch one or several cards from the collection.
# 
#         * Given (None, 0, 1): fetch first card from the collection
#         * Given a specific card: fetch that specific card
#         * Given a number > 1: return a list of cards
#         :rtype: Card or list of Card
#         """
#         if not self.cards:
#             raise exceptions.NoCardsLeft()
# 
#         try:
#             if not criterion or criterion == 1:
#                 return self.cards.pop(0)
# 
#             if isinstance(criterion, int):
#                 return [self.cards.pop(i) for i in range(criterion)]
# 
#             return self.cards.pop(self.cards.index(criterion))
#         except (IndexError, ValueError):
#             raise exceptions.CardNotFound()


import logging
from mau_mau.concepts import _CardCollection
        """
        self.players = players
        for idx, player in enumerate(self.players):
            try:
                player.nextPlayer = players[idx + 1]
            except IndexError:
                player.nextPlayer = players[0]

    @staticmethod
    def transfer_punishments(sourceRule, destinationRule):
        destinationRule.punishments.extend(sourceRule.punishments)

    def replenish_stock(self):
        self.stock = Stock(self.waste)
        self.waste = Waste()
        self.stock.shuffle()

    @property
    def winner(self):
        try:
            return [p for p in self.players if self.rules.wins(p.hand)][0]

        except IndexError:
            return None


class Stock(_CardCollection):
    """technically not necessary but then it's clear what this represents"""



# Path: mau_mau/concepts.py
# class _CardCollection:
#     """A sequence of cards, used for all groups of cards used in the game."""
# 
#     def __init__(self, seed=None):
#         """Can be initialized with different seed kinds"""
#         if not seed:
#             self.cards = []
#         elif isinstance(seed, _CardCollection):
#             self.cards = seed.cards
#         elif isinstance(seed, Iterable):
#             self.cards = seed
#         else:
#             self.cards = [seed]
# 
#     def __repr__(self):
#         """Nice automatic representation for all inheriting objects.
# 
#         >>> from mau_mau.objects import Stock
#         >>> s = Stock([1, 2, 3])
#         >>> repr(s)
#         'Stock([1, 2, 3])'
#         """
#         name = self.__class__.__name__
#         return f"{name}({self.cards})"
# 
#     def __len__(self):
#         """Object has a length that is the number of cards contained in it.
# 
#         >>> c = _CardCollection([1, 2, 3])
#         >>> len(c)
#         3
# 
#         >>> c = _CardCollection()
#         >>> not c
#         True
#         """
#         return len(self.cards)
# 
#     def __iter__(self):
#         """Let's me use the object like a genuine Python sequence
# 
#         >>> [e for e in _CardCollection([1, 2, 3])]
#         [1, 2, 3]
#         """
#         for card in self.cards:
#             yield card
# 
#     def shuffle(self) -> None:
#         """Does not return anything: `random.shuffle` changes list in place"""
#         random.shuffle(self.cards)
# 
#     def put(self, card):
#         self.cards.append(card)
# 
#     def fetch(self, criterion=None):
#         """Fetch one or several cards from the collection.
# 
#         * Given (None, 0, 1): fetch first card from the collection
#         * Given a specific card: fetch that specific card
#         * Given a number > 1: return a list of cards
#         :rtype: Card or list of Card
#         """
#         if not self.cards:
#             raise exceptions.NoCardsLeft()
# 
#         try:
#             if not criterion or criterion == 1:
#                 return self.cards.pop(0)
# 
#             if isinstance(criterion, int):
#                 return [self.cards.pop(i) for i in range(criterion)]
# 
#             return self.cards.pop(self.cards.index(criterion))
#         except (IndexError, ValueError):
#             raise exceptions.CardNotFound()


# Path: mau_mau/objects.py
import logging
from mau_mau.concepts import _CardCollection

        """
        self.players = players
        for idx, player in enumerate(self.players):
            try:
                player.nextPlayer = players[idx + 1]
            except IndexError:
                player.nextPlayer = players[0]

    @staticmethod
    def transfer_punishments(sourceRule, destinationRule):
        destinationRule.punishments.extend(sourceRule.punishments)

    def replenish_stock(self):
        self.stock = Stock(self.waste)
        self.waste = Waste()
        self.stock.shuffle()

    @property
    def winner(self):
        try:
            return [p for p in self.players if self.rules.wins(p.hand)][0]

        except IndexError:
            return None


class Stock(_CardCollection):
    """technically not necessary but then it's clear what this represents"""



class Waste(_CardCollection):