Герасим обнови решението на 26.03.2014 01:12 (преди над 10 години)
+import collections
+class Rank:
+ def __init__(self):
+ symbol = ('A', 'K', 'Q', 'J', '10', '9', '8',
+ '7', '6', '5', '4', '3', '2')
+ return symbol
+ def __eq__(self, rank):
+ return self.rank == rank
+
+class Suit:
+ def __init__(self):
+ color = ('red', 'black')
+
+class Two(Rank):
+ def __init__(self):
+ self.rank = '2'
+
+class Three(Rank):
+ def __init__(self):
+ self.rank = '3'
+
+class Four(Rank):
+ def __init__(self):
+ self.rank = '4'
+
+class Five(Rank):
+ def __init__(self):
+ self.rank = '5'
+
+class Six(Rank):
+ def __init__(self):
+ self.rank = '6'
+
+class Seven(Rank):
+ def __init__(self):
+ self.rank = '7'
+
+class Eight(Rank):
+ def __init__(self):
+ self.rank = '8'
+
+class Nine(Rank):
+ def __init__(self):
+ self.rank = '9'
+
+class Ten(Rank):
+ def __init__(self):
+ self.rank = '10'
+
+class Jack(Rank):
+ def __init__(self):
+ self.rank = 'J'
+
+class Queen(Rank):
+ def __init__(self):
+ self.rank = 'Q'
+
+class King(Rank):
+ def __init__(self):
+ self.rank = 'K'
+
+class Ace(Rank):
+ def __init__(self):
+ self.rank = 'A'
+
+class RANKS:
+ RANKS = {}
+ for derived in Rank.__subclasses__():
+ RANKS[str(derived.__name__)] = derived
+ def __init__(self, rank):
+ self.rank = rank
+
+class Spades(Suit):
+ def __init__(self):
+ self.suit = 'black'
+ self.name = 'Spades'
+
+class Hearts(Suit):
+ def __init__(self):
+ self.suit = 'red'
+ self.name = 'Hearts'
+
+class Diamonds(Suit):
+ def __init__(self):
+ self.suit = 'red'
+ self.name = 'Diamonds'
+
+class Clubs(Suit):
+ def __init__(self):
+ self.suit = 'black'
+ self.name = 'Clubs'
+
+class SUITS:
+ classes_in_suit = {}
+ for suit in Suit.__subclasses__():
+ classes_in_suit[suit.__name__] = suit
+
+class Card:
+ rank
+ def __init__(self, rank):
+ self.rank = Rank(rank)