Мартин обнови решението на 25.03.2014 17:18 (преди над 11 години)
+class Rank:
+    def __init__(self, symbol):
+        self.symbol = symbol
+
+    def __eq__(self, other):
+        return self.symbol == other.symbol
+
+    def __str__(self):
+        return self.__class__.__name__
+
+
+class Suit:
+    def __init__(self, colour):
+        self.color = colour
+
+    def __eq__(self, other):
+        return self.color == other.color
+
+    def __str__(self):
+        return self.__class__.__name__
+
+
+class Two(Rank):
+    def __init__(self):
+        super().__init__('2')
+
+
+class Three(Rank):
+    def __init__(self):
+        super().__init__('3')
+
+
+class Four(Rank):
+    def __init__(self):
+        super().__init__('4')
+
+
+class Five(Rank):
+    def __init__(self):
+        super().__init__('5')
+
+
+class Six(Rank):
+    def __init__(self):
+        super().__init__('6')
+
+
+class Seven(Rank):
+    def __init__(self):
+        super().__init__('7')
+
+
+class Eight(Rank):
+    def __init__(self):
+        super().__init__('8')
+
+
+class Nine(Rank):
+    def __init__(self):
+        super().__init__('9')
+
+
+class Ten(Rank):
+    def __init__(self):
+        super().__init__('10')
+
+
+class Jack(Rank):
+    def __init__(self):
+        super().__init__('11')
+
+
+class Queen(Rank):
+    def __init__(self):
+        super().__init__('12')
+
+
+class King(Rank):
+    def __init__(self):
+        super().__init__('13')
+
+
+class Ace(Rank):
+    def __init__(self):
+        super().__init__('1')
+
+
+RANKS = {
+    'Two': Two, 'Three': Three, 'Four': Four, 'Five': Five, 'Six': Six,
+    'Seven': Seven, 'Eight': Eight, 'Nine': Nine, 'Ten': Ten,
+    'Jack': Jack, 'Queen': Queen, 'King': King, 'Ace': Ace
+    }
+
+
+class Clubs(Suit):
+    def __init__(self):
+        super().__init__('Clubs')
+
+
+class Diamonds(Suit):
+    def __init__(self):
+        super().__init__('Diamonds')
+
+
+class Hearts(Suit):
+    def __init__(self):
+        super().__init__('Hearts')
+
+
+class Spades(Suit):
+    def __init__(self):
+        super().__init__('Spades')
+
+
+SUITS = {
+    'Clubs': Clubs, 'Diamonds': Diamonds, 'Hearts': Hearts, 'Spades': Spades
+    }
+
+
+class Card:
+    def __init__(self, rank, suit):
+        self.__rank = rank()
+        self.__suit = suit()
+
+    @property
+    def rank(self):
+        return self.__rank
+
+    @property
+    def suit(self):
+        return self.__suit
+
+    def __eq__(self, other):
+        return self.rank == other.rank and self.suit == other.suit
+
+    def __str__(self):
+        return "{} of {}".format(self.rank, self.suit)
+
+    def value(self):
+        if str(self.suit) == 'Clubs':
+            suit_value = 1
+        if str(self.suit) == 'Diamonds':
+            suit_value = 2
+        if str(self.suit) == 'Hearts':
+            suit_value = 3
+        if str(self.suit) == 'Spades':
+            suit_value = 4
+        return suit_value * 100 + int(self.rank.symbol)
+
+    def __lt__(self, other):
+        return self.value() < other.value()
+
+
+class CardCollection:
+    def __init__(self, collection):
+        collection.sort(reverse=True)
+        self.collection = collection
+
+    def draw(self, index):
+        tmp = self.collection[index]
+        del self.collection[index]
+        return tmp
+
+    def draw_from_top(self):
+        length = len(self.collection)
+        tmp = self.collection[length-1]
+        del self.collection[length-1]
+        return tmp
+
+    def draw_from_bottom(self):
+        tmp = self.collection[0]
+        del self.collection[0]
+        return tmp
+
+    def top_card(self):
+        return self.collection[len(self.collection)-1]
+
+    def bottom_card(self):
+        return self.collection[0]
+
+    def add(self, card):
+        cc.collection.append(card)
+
+    def __getitem__(self, index):
+        return self.collection[index]
+
+    def index(self, card):
+        return self.collection.index(card)
+
+
+def StandardDeck():
+    cards = [Card(x, y) for x in RANKS.values() for y in SUITS.values()]
+    return CardCollection(cards)
+
+
+def BeloteDeck():
+    used = [
+        Card(x, y)
+        for x in RANKS.values() if int(x().symbol) >= 7 or int(x().symbol) == 1
+        for y in SUITS.values()
+        ]
+    return CardCollection(used)
+
+
+def SixtySixDeck():
+    used = [
+        Card(x, y)
+        for x in RANKS.values() if int(x().symbol) >= 9 or int(x().symbol) == 1
+        for y in SUITS.values()
+        ]
+    return CardCollection(used)
