Мария обнови решението на 26.03.2014 16:25 (преди над 11 години)
+ORDERED_RANKS = ["King", "Queen", "Jack", "Ten", "Nine", "Eight", "Seven",
+                 "Six", "Five", "Four", "Three", "Two", "Ace"]
+ORDERED_SUITS = ["Diamonds", "Clubs", "Hearts", "Spades"]
+
+
+class Rank:
+    def __init__(self, symbol):
+        self.symbol = symbol
+
+    def __eq__(self, other):
+        return self.symbol == other.symbol
+
+    def __str__(self):
+        return self.rank
+
+
+class Suit:
+    def __init__(self, color):
+        self.color = color
+
+    def __eq__(self, other):
+        return self.color == other.color
+
+    def __str__(self):
+        return self.suit
+
+
+class Ace(Rank):
+    def __init__(self):
+        Rank.__init__(self, "A")
+
+    def __str__(self):
+        return "Ace"
+
+
+class Two(Rank):
+    def __init__(self):
+        Rank.__init__(self, "2")
+
+    def __str__(self):
+        return "Two"
+
+
+class Three(Rank):
+    def __init__(self):
+        Rank.__init__(self, "3")
+
+    def __str__(self):
+        return "Three"
+
+
+class Four(Rank):
+    def __init__(self):
+        Rank.__init__(self, "4")
+
+    def __str__(self):
+        return "Four"
+
+
+class Five(Rank):
+    def __init__(self):
+        Rank.__init__(self, "5")
+
+    def __str__(self):
+        return "Five"
+
+
+class Six(Rank):
+    def __init__(self):
+        Rank.__init__(self, "6")
+
+    def __str__(self):
+        return "Six"
+
+
+class Seven(Rank):
+    def __init__(self):
+        Rank.__init__(self, "7")
+
+    def __str__(self):
+        return "Seven"
+
+
+class Eight(Rank):
+    def __init__(self):
+        Rank.__init__(self, "8")
+
+    def __str__(self):
+        return "Eight"
+
+
+class Nine(Rank):
+    def __init__(self):
+        Rank.__init__(self, "9")
+
+    def __str__(self):
+        return "Nine"
+
+
+class Ten(Rank):
+    def __init__(self):
+        Rank.__init__(self, "10")
+
+    def __str__(self):
+        return "Ten"
+
+
+class Jack(Rank):
+    def __init__(self):
+        Rank.__init__(self, "J")
+
+    def __str__(self):
+        return "Jack"
+
+
+class Queen(Rank):
+    def __init__(self):
+        Rank.__init__(self, "Q")
+
+    def __str__(self):
+        return "Queen"
+
+
+class King(Rank):
+    def __init__(self):
+        Rank.__init__(self, "K")
+
+    def __str__(self):
+        return "King"
+
+
+class Hearts(Suit):
+    def __init__(self):
+        Suit.__init__(self, "red")
+
+    def __str__(self):
+        return "Hearts"
+
+
+class Clubs(Suit):
+    def __init__(self):
+        Suit.__init__(self, "black")
+
+    def __str__(self):
+        return "Clubs"
+
+
+class Diamonds(Suit):
+    def __init__(self):
+        Suit.__init__(self, "red")
+
+    def __str__(self):
+        return "Diamonds"
+
+
+class Spades(Suit):
+    def __init__(self):
+        Suit.__init__(self, "black")
+
+    def __str__(self):
+        return "Spades"
+
+RANKS = {
+    "Ace": Ace().__class__,
+    "Two": Two().__class__,
+    "Three": Three().__class__,
+    "Four": Four().__class__,
+    "Five": Five().__class__,
+    "Six": Six().__class__,
+    "Seven": Seven().__class__,
+    "Eight": Eight().__class__,
+    "Nine": Nine().__class__,
+    "Ten": Ten().__class__,
+    "Jack": Jack().__class__,
+    "Queen": Queen().__class__,
+    "King": King().__class__
+}
+
+SUITS = {
+    "Hearts": Hearts().__class__,
+    "Clubs": Clubs().__class__,
+    "Spades": Spades().__class__,
+    "Diamonds": Diamonds().__class__
+}
+
+
+class Card:
+    def __init__(self, rank, suit):
+        self.rank = rank()
+        self.suit = suit()
+
+    def __str__(self):
+        return "{} of {}".format(self.rank, self.suit)
+
+    def __eq__(self, other):
+        return self.rank == other.rank and self.suit == other.suit
+
+
+class CardCollection(Card):
+    def __init__(self, collection=[]):
+        self.collection = collection
+
+    def draw(self, index):
+        return self.collection.pop(index)
+
+    def draw_from_top(self):
+        return self.collection.pop()
+
+    def draw_from_bottom(self):
+        return self.collection.pop(0)
+
+    def top_card(self):
+        return self.collection[len(self.collection) - 1]
+
+    def bottom_card(self):
+        return self.collection[0]
+
+    def add(self, card):
+        self.collection.append(card)
+
+    def index(self, card):
+        return self.collection.index(card)
+
+    def __getitem__(self, index):
+        return self.collection[index]
+
+    def __len__(self):
+        return len(self.collection)
+
+
+def StandardDeck():
+    result = []
+    for suit in ORDERED_SUITS:
+        for rank in ORDERED_RANKS:
+            current_card = "Card " + str(Card(RANKS[rank], SUITS[suit]))
+            result.append(current_card)
+    return result
+
+
+def BeloteDeck():
+    result = []
+    for suit in ORDERED_SUITS:
+        for rank in ORDERED_RANKS[:7]+ORDERED_RANKS[12:]:
+            result.append("Card " + str(Card(RANKS[rank], SUITS[suit])))
+    return result
+
+
+def SixtySixDeck():
+    result = []
+    for suit in ORDERED_SUITS:
+        for rank in ORDERED_RANKS[:5]+ORDERED_RANKS[12:]:
+            result.append("Card " + str(Card(RANKS[rank], SUITS[suit])))
+    return result
