Exemple #1
0
class Player:
    """
    Represents computer player.
    """
    def __init__(self, name='Computer'):
        self.__name = name
        self.__card = Card()
        self.is_playing = True

    @property
    def card(self):
        return self.__card

    def get_card_for_print(self):
        """
        Gets player's lotto card for printed format.
        :return: card for printed format
        """

        return f'{self.__name.center(22, "-")}\n{self.__card}{"-" * 22}'

    def analyse_current_number(self, item, action=1):
        """
        Analyses if given number is in the player's lotto card.
        :param item: given number
        :param action: will be used in child classes
        """

        if item in self.__card:
            self.__card.cross_out(item)

    def __str__(self):
        return self.__name